[WIN32KNT_APITEST] Tabs To Spaces (#1326)

Converts Tabs to Spaces.
This commit is contained in:
Katayama Hirofumi MZ 2019-01-30 22:55:10 +09:00 committed by GitHub
parent e7846c0c67
commit 62f6e3b397
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 2715 additions and 2715 deletions

View file

@ -9,15 +9,15 @@
START_TEST(NtGdiDdCreateDirectDrawObject) START_TEST(NtGdiDdCreateDirectDrawObject)
{ {
HANDLE hDirectDraw; HANDLE hDirectDraw;
HDC hdc = CreateDCW(L"DISPLAY",NULL,NULL,NULL); HDC hdc = CreateDCW(L"DISPLAY",NULL,NULL,NULL);
ok(hdc != NULL, "\n"); ok(hdc != NULL, "\n");
/* Test ReactX */ /* Test ReactX */
ok(NtGdiDdCreateDirectDrawObject(NULL) == NULL, "\n"); ok(NtGdiDdCreateDirectDrawObject(NULL) == NULL, "\n");
ok((hDirectDraw = NtGdiDdCreateDirectDrawObject(hdc)) != NULL, "\n"); ok((hDirectDraw = NtGdiDdCreateDirectDrawObject(hdc)) != NULL, "\n");
/* Cleanup ReactX setup */ /* Cleanup ReactX setup */
DeleteDC(hdc); DeleteDC(hdc);
NtGdiDdDeleteDirectDrawObject(hDirectDraw); NtGdiDdDeleteDirectDrawObject(hDirectDraw);
} }

View file

@ -9,16 +9,16 @@
START_TEST(NtGdiDdDeleteDirectDrawObject) START_TEST(NtGdiDdDeleteDirectDrawObject)
{ {
HANDLE hDirectDraw; HANDLE hDirectDraw;
HDC hdc = CreateDCW(L"DISPLAY",NULL,NULL,NULL); HDC hdc = CreateDCW(L"DISPLAY",NULL,NULL,NULL);
ok(hdc != NULL, "\n"); ok(hdc != NULL, "\n");
/* Test ReactX */ /* Test ReactX */
ok(NtGdiDdDeleteDirectDrawObject(NULL) == FALSE, "\n"); ok(NtGdiDdDeleteDirectDrawObject(NULL) == FALSE, "\n");
ok((hDirectDraw=NtGdiDdCreateDirectDrawObject(hdc)) != NULL, "\n"); ok((hDirectDraw=NtGdiDdCreateDirectDrawObject(hdc)) != NULL, "\n");
ok(NtGdiDdDeleteDirectDrawObject(hDirectDraw) == TRUE, "\n"); ok(NtGdiDdDeleteDirectDrawObject(hDirectDraw) == TRUE, "\n");
/* Cleanup ReactX setup */ /* Cleanup ReactX setup */
DeleteDC(hdc); DeleteDC(hdc);
NtGdiDdDeleteDirectDrawObject(hDirectDraw); NtGdiDdDeleteDirectDrawObject(hDirectDraw);
} }

View file

@ -9,33 +9,33 @@
START_TEST(NtGdiArcInternal) START_TEST(NtGdiArcInternal)
{ {
HDC hDC = CreateDCW(L"Display",NULL,NULL,NULL); HDC hDC = CreateDCW(L"Display",NULL,NULL,NULL);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_int(NtGdiArcInternal(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), FALSE); ok_int(NtGdiArcInternal(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), FALSE);
ok_long(GetLastError(), ERROR_INVALID_HANDLE); ok_long(GetLastError(), ERROR_INVALID_HANDLE);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_int(NtGdiArcInternal(0, hDC, 0, 0, 0, 0, 0, 0, 0, 0), TRUE); ok_int(NtGdiArcInternal(0, hDC, 0, 0, 0, 0, 0, 0, 0, 0), TRUE);
ok_int(NtGdiArcInternal(1, hDC, 0, 0, 0, 0, 0, 0, 0, 0), TRUE); ok_int(NtGdiArcInternal(1, hDC, 0, 0, 0, 0, 0, 0, 0, 0), TRUE);
ok_int(NtGdiArcInternal(2, hDC, 0, 0, 0, 0, 0, 0, 0, 0), TRUE); ok_int(NtGdiArcInternal(2, hDC, 0, 0, 0, 0, 0, 0, 0, 0), TRUE);
ok_int(NtGdiArcInternal(3, hDC, 0, 0, 0, 0, 0, 0, 0, 0), TRUE); ok_int(NtGdiArcInternal(3, hDC, 0, 0, 0, 0, 0, 0, 0, 0), TRUE);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_int(NtGdiArcInternal(4, hDC, 0, 0, 0, 0, 0, 0, 0, 0), FALSE); ok_int(NtGdiArcInternal(4, hDC, 0, 0, 0, 0, 0, 0, 0, 0), FALSE);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER); ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_int(NtGdiArcInternal(4, (HDC)10, 0, 0, 0, 0, 0, 0, 0, 0), FALSE); ok_int(NtGdiArcInternal(4, (HDC)10, 0, 0, 0, 0, 0, 0, 0, 0), FALSE);
ok_long(GetLastError(), ERROR_INVALID_HANDLE); ok_long(GetLastError(), ERROR_INVALID_HANDLE);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_int(NtGdiArcInternal(0, hDC, 10, 10, 0, 0, 0, 0, 0, 0), TRUE); ok_int(NtGdiArcInternal(0, hDC, 10, 10, 0, 0, 0, 0, 0, 0), TRUE);
ok_int(NtGdiArcInternal(0, hDC, 10, 10, -10, -10, 0, 0, 0, 0), TRUE); ok_int(NtGdiArcInternal(0, hDC, 10, 10, -10, -10, 0, 0, 0, 0), TRUE);
ok_int(NtGdiArcInternal(0, hDC, 0, 0, 0, 0, 10, 0, -10, 0), TRUE); ok_int(NtGdiArcInternal(0, hDC, 0, 0, 0, 0, 10, 0, -10, 0), TRUE);
// was passiert, wenn left > right ? einfach tauschen? // was passiert, wenn left > right ? einfach tauschen?
DeleteDC(hDC); DeleteDC(hDC);
} }

View file

@ -9,106 +9,106 @@
START_TEST(NtGdiBitBlt) START_TEST(NtGdiBitBlt)
{ {
BOOL bRet; BOOL bRet;
HDC hdc1, hdc2; HDC hdc1, hdc2;
HBITMAP hbmp1, hOldBmp1, hbmp2, hOldBmp2; HBITMAP hbmp1, hOldBmp1, hbmp2, hOldBmp2;
DWORD bytes1[4] = {0x00ff0000, 0x0000ff00, 0x000000ff, 0x00ffffff}; DWORD bytes1[4] = {0x00ff0000, 0x0000ff00, 0x000000ff, 0x00ffffff};
DWORD bytes2[4] = {0x00000000, 0x0000000, 0x0000000, 0x00000000}; DWORD bytes2[4] = {0x00000000, 0x0000000, 0x0000000, 0x00000000};
/* Test NULL dc */ /* Test NULL dc */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
bRet = NtGdiBitBlt((HDC)0, 0, 0, 10, 10, (HDC)0, 10, 10, SRCCOPY, 0, 0); bRet = NtGdiBitBlt((HDC)0, 0, 0, 10, 10, (HDC)0, 10, 10, SRCCOPY, 0, 0);
ok_int(bRet, FALSE); ok_int(bRet, FALSE);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
/* Test invalid dc */ /* Test invalid dc */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
bRet = NtGdiBitBlt((HDC)0x123456, 0, 0, 10, 10, (HDC)0x123456, 10, 10, SRCCOPY, 0, 0); bRet = NtGdiBitBlt((HDC)0x123456, 0, 0, 10, 10, (HDC)0x123456, 10, 10, SRCCOPY, 0, 0);
ok_int(bRet, FALSE); ok_int(bRet, FALSE);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
hdc1 = NtGdiCreateCompatibleDC(0); hdc1 = NtGdiCreateCompatibleDC(0);
ok(hdc1 != NULL, "hdc1 was NULL.\n"); ok(hdc1 != NULL, "hdc1 was NULL.\n");
hdc2 = NtGdiCreateCompatibleDC(0); hdc2 = NtGdiCreateCompatibleDC(0);
ok(hdc2 != NULL, "hdc2 was NULL.\n"); ok(hdc2 != NULL, "hdc2 was NULL.\n");
hbmp1 = NtGdiCreateBitmap(2, 2, 1, 32, (LPBYTE)bytes1 ); hbmp1 = NtGdiCreateBitmap(2, 2, 1, 32, (LPBYTE)bytes1 );
ok(hbmp1 != NULL, "hbmp1 was NULL.\n"); ok(hbmp1 != NULL, "hbmp1 was NULL.\n");
hOldBmp1 = SelectObject(hdc1, hbmp1); hOldBmp1 = SelectObject(hdc1, hbmp1);
ok(NtGdiGetPixel(hdc1, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); ok(NtGdiGetPixel(hdc1, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0));
ok(NtGdiGetPixel(hdc1, 0, 1) == 0x00ff0000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); ok(NtGdiGetPixel(hdc1, 0, 1) == 0x00ff0000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1));
ok(NtGdiGetPixel(hdc1, 1, 0) == 0x0000ff00, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); ok(NtGdiGetPixel(hdc1, 1, 0) == 0x0000ff00, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0));
ok(NtGdiGetPixel(hdc1, 1, 1) == 0x00ffffff, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); ok(NtGdiGetPixel(hdc1, 1, 1) == 0x00ffffff, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1));
hbmp2 = NtGdiCreateBitmap(2, 2, 1, 32, (LPBYTE)bytes2 ); hbmp2 = NtGdiCreateBitmap(2, 2, 1, 32, (LPBYTE)bytes2 );
ok(hbmp2 != NULL, "hbmp2 was NULL.\n"); ok(hbmp2 != NULL, "hbmp2 was NULL.\n");
hOldBmp2 = SelectObject(hdc2, hbmp2); hOldBmp2 = SelectObject(hdc2, hbmp2);
bRet = NtGdiBitBlt(hdc2, 1, 1, -2, -2, hdc1, 0, 0, SRCCOPY, 0, 0); bRet = NtGdiBitBlt(hdc2, 1, 1, -2, -2, hdc1, 0, 0, SRCCOPY, 0, 0);
ok_int(bRet, TRUE); ok_int(bRet, TRUE);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
ok(NtGdiGetPixel(hdc2, 0, 0) == 0x00000000, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); ok(NtGdiGetPixel(hdc2, 0, 0) == 0x00000000, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0));
ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1));
ok(NtGdiGetPixel(hdc2, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); ok(NtGdiGetPixel(hdc2, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0));
ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1));
bRet = NtGdiBitBlt(hdc2, 1, 1, -2, -2, hdc1, 1, 1, SRCCOPY, 0, 0); bRet = NtGdiBitBlt(hdc2, 1, 1, -2, -2, hdc1, 1, 1, SRCCOPY, 0, 0);
ok_int(bRet, TRUE); ok_int(bRet, TRUE);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
ok(NtGdiGetPixel(hdc2, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); ok(NtGdiGetPixel(hdc2, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0));
ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1));
ok(NtGdiGetPixel(hdc2, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); ok(NtGdiGetPixel(hdc2, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0));
ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1));
NtGdiSetPixel(hdc2, 0, 0, 0x00000000); NtGdiSetPixel(hdc2, 0, 0, 0x00000000);
bRet = NtGdiBitBlt(hdc2, 1, 1, -2, -2, hdc1, 0, 0, SRCCOPY, 0, 0); bRet = NtGdiBitBlt(hdc2, 1, 1, -2, -2, hdc1, 0, 0, SRCCOPY, 0, 0);
ok_int(bRet, TRUE); ok_int(bRet, TRUE);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
ok(NtGdiGetPixel(hdc2, 0, 0) == 0x00000000, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); ok(NtGdiGetPixel(hdc2, 0, 0) == 0x00000000, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0));
ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1));
ok(NtGdiGetPixel(hdc2, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); ok(NtGdiGetPixel(hdc2, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0));
ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1));
bRet = NtGdiBitBlt(hdc2, 1, 1, -2, -2, hdc1, 2, 2, SRCCOPY, 0, 0); bRet = NtGdiBitBlt(hdc2, 1, 1, -2, -2, hdc1, 2, 2, SRCCOPY, 0, 0);
ok_int(bRet, TRUE); ok_int(bRet, TRUE);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
ok(NtGdiGetPixel(hdc2, 0, 0) == 0x00ffffff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); ok(NtGdiGetPixel(hdc2, 0, 0) == 0x00ffffff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0));
ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1));
ok(NtGdiGetPixel(hdc2, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); ok(NtGdiGetPixel(hdc2, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0));
ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1));
NtGdiSetPixel(hdc2, 0, 0, 0x00000000); NtGdiSetPixel(hdc2, 0, 0, 0x00000000);
bRet = NtGdiBitBlt(hdc2, 2, 2, -2, -2, hdc1, 2, 2, SRCCOPY, 0, 0); bRet = NtGdiBitBlt(hdc2, 2, 2, -2, -2, hdc1, 2, 2, SRCCOPY, 0, 0);
ok_int(bRet, TRUE); ok_int(bRet, TRUE);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
ok(NtGdiGetPixel(hdc2, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); ok(NtGdiGetPixel(hdc2, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0));
ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00ff0000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00ff0000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1));
ok(NtGdiGetPixel(hdc2, 1, 0) == 0x0000ff00, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); ok(NtGdiGetPixel(hdc2, 1, 0) == 0x0000ff00, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0));
ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00ffffff, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00ffffff, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1));
NtGdiSetPixel(hdc2, 0, 0, 0x00000000); NtGdiSetPixel(hdc2, 0, 0, 0x00000000);
NtGdiSetPixel(hdc2, 1, 0, 0x00000000); NtGdiSetPixel(hdc2, 1, 0, 0x00000000);
NtGdiSetPixel(hdc2, 0, 1, 0x00000000); NtGdiSetPixel(hdc2, 0, 1, 0x00000000);
NtGdiSetPixel(hdc2, 1, 1, 0x00000000); NtGdiSetPixel(hdc2, 1, 1, 0x00000000);
bRet = NtGdiBitBlt(hdc2, 0, 0, 2, 2, hdc1, 0, 0, SRCCOPY, 0, 0); bRet = NtGdiBitBlt(hdc2, 0, 0, 2, 2, hdc1, 0, 0, SRCCOPY, 0, 0);
ok_int(bRet, TRUE); ok_int(bRet, TRUE);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
ok(NtGdiGetPixel(hdc2, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); ok(NtGdiGetPixel(hdc2, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0));
ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00ff0000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00ff0000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1));
ok(NtGdiGetPixel(hdc2, 1, 0) == 0x0000ff00, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); ok(NtGdiGetPixel(hdc2, 1, 0) == 0x0000ff00, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0));
ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00ffffff, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00ffffff, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1));
SelectObject(hdc2, hOldBmp2); SelectObject(hdc2, hOldBmp2);
SelectObject(hdc1, hOldBmp1); SelectObject(hdc1, hOldBmp1);
DeleteObject(hbmp2); DeleteObject(hbmp2);
DeleteObject(hbmp1); DeleteObject(hbmp1);
DeleteDC(hdc1); DeleteDC(hdc1);
DeleteDC(hdc2); DeleteDC(hdc2);
} }

View file

@ -9,44 +9,44 @@
START_TEST(NtGdiCombineRgn) START_TEST(NtGdiCombineRgn)
{ {
HRGN hRgnDest, hRgn1, hRgn2; HRGN hRgnDest, hRgn1, hRgn2;
// test what params are accepted for what operations // test what params are accepted for what operations
// 0? invalid? are params maybe ignored in some cases? // 0? invalid? are params maybe ignored in some cases?
// LastError // LastError
/* Preparation */ /* Preparation */
hRgnDest = CreateRectRgn(0,0,1,1); hRgnDest = CreateRectRgn(0,0,1,1);
hRgn1 = CreateRectRgn(1,1,4,4); hRgn1 = CreateRectRgn(1,1,4,4);
hRgn2 = CreateRectRgn(2,2,6,3); hRgn2 = CreateRectRgn(2,2,6,3);
/* RGN_AND = 1, RGN_OR = 2, RGN_XOR = 3, RGN_DIFF = 4, RGN_COPY = 5 */ /* RGN_AND = 1, RGN_OR = 2, RGN_XOR = 3, RGN_DIFF = 4, RGN_COPY = 5 */
ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, 0), ERROR); ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, 0), ERROR);
ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, 6), ERROR); ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, 6), ERROR);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_int(NtGdiCombineRgn(hRgnDest, 0, 0, RGN_AND), ERROR); ok_int(NtGdiCombineRgn(hRgnDest, 0, 0, RGN_AND), ERROR);
ok_long(GetLastError(), ERROR_INVALID_HANDLE); ok_long(GetLastError(), ERROR_INVALID_HANDLE);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, 0, RGN_AND), ERROR); ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, 0, RGN_AND), ERROR);
ok_long(GetLastError(), ERROR_INVALID_HANDLE); ok_long(GetLastError(), ERROR_INVALID_HANDLE);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_int(NtGdiCombineRgn(hRgnDest, 0, hRgn1, RGN_AND), ERROR); ok_int(NtGdiCombineRgn(hRgnDest, 0, hRgn1, RGN_AND), ERROR);
ok_long(GetLastError(), ERROR_INVALID_HANDLE); ok_long(GetLastError(), ERROR_INVALID_HANDLE);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_int(NtGdiCombineRgn(0, hRgn1, hRgn2, RGN_AND), ERROR); ok_int(NtGdiCombineRgn(0, hRgn1, hRgn2, RGN_AND), ERROR);
ok_long(GetLastError(), ERROR_INVALID_HANDLE); ok_long(GetLastError(), ERROR_INVALID_HANDLE);
/* Create intersection */ /* Create intersection */
ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, RGN_AND), SIMPLEREGION); ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, RGN_AND), SIMPLEREGION);
SetRectRgn(hRgn1, 2, 2, 4, 3); SetRectRgn(hRgn1, 2, 2, 4, 3);
ok_int(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgn1, RGN_XOR), NULLREGION); ok_int(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgn1, RGN_XOR), NULLREGION);
/* Create intersection with itself */ /* Create intersection with itself */
SetRectRgn(hRgnDest, 2, 2, 4, 3); SetRectRgn(hRgnDest, 2, 2, 4, 3);
ok_int(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgnDest, RGN_AND), SIMPLEREGION); ok_int(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgnDest, RGN_AND), SIMPLEREGION);
SetRectRgn(hRgn1, 2, 2, 4, 3); SetRectRgn(hRgn1, 2, 2, 4, 3);
ok_int(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgn1, RGN_XOR), NULLREGION); ok_int(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgn1, RGN_XOR), NULLREGION);
/* What if 2 regions are the same */ /* What if 2 regions are the same */
} }

View file

@ -9,198 +9,198 @@
void Test_NtGdiCreateBitmap_Params(void) void Test_NtGdiCreateBitmap_Params(void)
{ {
HBITMAP hBmp; HBITMAP hBmp;
BITMAP bitmap; BITMAP bitmap;
BYTE BitmapData[10] = {0x11, 0x22, 0x33}; BYTE BitmapData[10] = {0x11, 0x22, 0x33};
/* Test simple params */ /* Test simple params */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 1, NULL)) != NULL, "hBmp was NULL.\n"); ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 1, NULL)) != NULL, "hBmp was NULL.\n");
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
DeleteObject(hBmp); DeleteObject(hBmp);
/* Test all zero */ /* Test all zero */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(0, 0, 0, 0, NULL), NULL); ok_ptr(NtGdiCreateBitmap(0, 0, 0, 0, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER); ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test cx == 0 */ /* Test cx == 0 */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(0, 1, 1, 1, NULL), NULL); ok_ptr(NtGdiCreateBitmap(0, 1, 1, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER); ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test negative cx */ /* Test negative cx */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(-10, 1, 1, 1, NULL), NULL); ok_ptr(NtGdiCreateBitmap(-10, 1, 1, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER); ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test cy == 0 */ /* Test cy == 0 */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(1, 0, 1, 1, NULL), NULL); ok_ptr(NtGdiCreateBitmap(1, 0, 1, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER); ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test negative cy */ /* Test negative cy */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(1, -2, 1, 1, NULL), NULL); ok_ptr(NtGdiCreateBitmap(1, -2, 1, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER); ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test negative cy and valid bits */ /* Test negative cy and valid bits */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(1, -2, 1, 1, BitmapData), NULL); ok_ptr(NtGdiCreateBitmap(1, -2, 1, 1, BitmapData), NULL);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
/* Test negative cy and invalid bits */ /* Test negative cy and invalid bits */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(1, -2, 1, 1, (BYTE*)0x80001234), NULL); ok_ptr(NtGdiCreateBitmap(1, -2, 1, 1, (BYTE*)0x80001234), NULL);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
/* Test huge size */ /* Test huge size */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(100000, 100000, 1, 1, NULL), NULL); ok_ptr(NtGdiCreateBitmap(100000, 100000, 1, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_NOT_ENOUGH_MEMORY); ok_long(GetLastError(), ERROR_NOT_ENOUGH_MEMORY);
/* Test huge size and valid bits */ /* Test huge size and valid bits */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
TEST(NtGdiCreateBitmap(1000, 1000, 1, 1, BitmapData) == NULL); TEST(NtGdiCreateBitmap(1000, 1000, 1, 1, BitmapData) == NULL);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
/* Test huge size and invalid bits */ /* Test huge size and invalid bits */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(100000, 100000, 1, 1, (BYTE*)0x80001234), NULL); ok_ptr(NtGdiCreateBitmap(100000, 100000, 1, 1, (BYTE*)0x80001234), NULL);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
/* Test cPlanes == 0 */ /* Test cPlanes == 0 */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok((hBmp = NtGdiCreateBitmap(1, 1, 0, 1, NULL)) != NULL, "hBmp was NULL.\n"); ok((hBmp = NtGdiCreateBitmap(1, 1, 0, 1, NULL)) != NULL, "hBmp was NULL.\n");
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP));
ok_int(bitmap.bmType, 0); ok_int(bitmap.bmType, 0);
ok_int(bitmap.bmWidth, 1); ok_int(bitmap.bmWidth, 1);
ok_int(bitmap.bmHeight, 1); ok_int(bitmap.bmHeight, 1);
ok_int(bitmap.bmWidthBytes, 2); ok_int(bitmap.bmWidthBytes, 2);
ok_int(bitmap.bmPlanes, 1); ok_int(bitmap.bmPlanes, 1);
ok_int(bitmap.bmBitsPixel, 1); ok_int(bitmap.bmBitsPixel, 1);
DeleteObject(hBmp); DeleteObject(hBmp);
/* Test big cPlanes */ /* Test big cPlanes */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok((hBmp = NtGdiCreateBitmap(1, 1, 32, 1, NULL)) != NULL, "hBmp was NULL.\n"); ok((hBmp = NtGdiCreateBitmap(1, 1, 32, 1, NULL)) != NULL, "hBmp was NULL.\n");
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
DeleteObject(hBmp); DeleteObject(hBmp);
ok_ptr(NtGdiCreateBitmap(1, 1, 33, 1, NULL), NULL); ok_ptr(NtGdiCreateBitmap(1, 1, 33, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER); ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test cBPP == 0 */ /* Test cBPP == 0 */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 0, NULL)) != NULL, "hBmp was NULL.\n"); ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 0, NULL)) != NULL, "hBmp was NULL.\n");
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP));
ok_int(bitmap.bmType, 0); ok_int(bitmap.bmType, 0);
ok_int(bitmap.bmWidth, 1); ok_int(bitmap.bmWidth, 1);
ok_int(bitmap.bmHeight, 1); ok_int(bitmap.bmHeight, 1);
ok_int(bitmap.bmWidthBytes, 2); ok_int(bitmap.bmWidthBytes, 2);
ok_int(bitmap.bmPlanes, 1); ok_int(bitmap.bmPlanes, 1);
ok_int(bitmap.bmBitsPixel, 1); ok_int(bitmap.bmBitsPixel, 1);
DeleteObject(hBmp); DeleteObject(hBmp);
/* Test negative cBPP */ /* Test negative cBPP */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(1, 1, 1, -1, NULL), NULL); ok_ptr(NtGdiCreateBitmap(1, 1, 1, -1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER); ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test bad cBPP */ /* Test bad cBPP */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 3, NULL)) != NULL, "hBmp was NULL.\n"); ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 3, NULL)) != NULL, "hBmp was NULL.\n");
ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP));
ok_int(bitmap.bmBitsPixel, 4); ok_int(bitmap.bmBitsPixel, 4);
DeleteObject(hBmp); DeleteObject(hBmp);
ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 6, NULL)) != NULL, "hBmp was NULL.\n"); ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 6, NULL)) != NULL, "hBmp was NULL.\n");
ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP));
ok_int(bitmap.bmBitsPixel, 8); ok_int(bitmap.bmBitsPixel, 8);
DeleteObject(hBmp); DeleteObject(hBmp);
ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 15, NULL)) != NULL, "hBmp was NULL.\n"); ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 15, NULL)) != NULL, "hBmp was NULL.\n");
ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP));
ok_int(bitmap.bmBitsPixel, 16); ok_int(bitmap.bmBitsPixel, 16);
DeleteObject(hBmp); DeleteObject(hBmp);
ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 17, NULL)) != NULL, "hBmp was NULL.\n"); ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 17, NULL)) != NULL, "hBmp was NULL.\n");
ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP));
ok_int(bitmap.bmBitsPixel, 24); ok_int(bitmap.bmBitsPixel, 24);
DeleteObject(hBmp); DeleteObject(hBmp);
ok((hBmp = NtGdiCreateBitmap(1, 1, 3, 7, NULL)) != NULL, "hBmp was NULL.\n"); ok((hBmp = NtGdiCreateBitmap(1, 1, 3, 7, NULL)) != NULL, "hBmp was NULL.\n");
ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP));
ok_int(bitmap.bmBitsPixel, 24); ok_int(bitmap.bmBitsPixel, 24);
DeleteObject(hBmp); DeleteObject(hBmp);
ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 25, NULL)) != NULL, "hBmp was NULL.\n"); ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 25, NULL)) != NULL, "hBmp was NULL.\n");
ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP));
ok_int(bitmap.bmBitsPixel, 32); ok_int(bitmap.bmBitsPixel, 32);
DeleteObject(hBmp); DeleteObject(hBmp);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(1, 1, 1, 33, NULL), NULL); ok_ptr(NtGdiCreateBitmap(1, 1, 1, 33, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER); ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test bad pointer */ /* Test bad pointer */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(1, 1, 1, 1, (BYTE*)0x80001234), NULL); ok_ptr(NtGdiCreateBitmap(1, 1, 1, 1, (BYTE*)0x80001234), NULL);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
/* Test pointer alignment */ /* Test pointer alignment */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 1, &BitmapData[1])) != NULL, "hBmp was NULL.\n"); ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 1, &BitmapData[1])) != NULL, "hBmp was NULL.\n");
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
DeleteObject(hBmp); DeleteObject(hBmp);
/* Test normal params */ /* Test normal params */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok((hBmp = NtGdiCreateBitmap(5, 7, 2, 4, NULL)) != NULL, "hBmp was NULL.\n"); ok((hBmp = NtGdiCreateBitmap(5, 7, 2, 4, NULL)) != NULL, "hBmp was NULL.\n");
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP));
ok_int(bitmap.bmType, 0); ok_int(bitmap.bmType, 0);
ok_int(bitmap.bmWidth, 5); ok_int(bitmap.bmWidth, 5);
ok_int(bitmap.bmHeight, 7); ok_int(bitmap.bmHeight, 7);
ok_int(bitmap.bmWidthBytes, 6); ok_int(bitmap.bmWidthBytes, 6);
ok_int(bitmap.bmPlanes, 1); ok_int(bitmap.bmPlanes, 1);
ok_int(bitmap.bmBitsPixel, 8); ok_int(bitmap.bmBitsPixel, 8);
DeleteObject(hBmp); DeleteObject(hBmp);
/* Test height 0 params */ /* Test height 0 params */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(1, 0, 1, 1, NULL), NULL); ok_ptr(NtGdiCreateBitmap(1, 0, 1, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER); ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test height -1 params */ /* Test height -1 params */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(1, -1, 1, 1, NULL), NULL); ok_ptr(NtGdiCreateBitmap(1, -1, 1, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER); ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test witdth 0 params */ /* Test witdth 0 params */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(0, 1, 1, 1, NULL), NULL); ok_ptr(NtGdiCreateBitmap(0, 1, 1, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER); ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test witdth -1 params */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(-1, 0, 1, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test witdth -1 params */ /* Test witdth -1 params */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(0, 0, 1, 1, NULL), NULL); ok_ptr(NtGdiCreateBitmap(-1, 0, 1, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER); ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test witdth -1 params */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(0, 0, 1, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
} }
START_TEST(NtGdiCreateBitmap) START_TEST(NtGdiCreateBitmap)
{ {
Test_NtGdiCreateBitmap_Params(); Test_NtGdiCreateBitmap_Params();
// Test_NtGdiCreateBitmap_Pixel(); // Test_NtGdiCreateBitmap_Pixel();
} }

View file

@ -9,25 +9,25 @@
START_TEST(NtGdiCreateCompatibleDC) START_TEST(NtGdiCreateCompatibleDC)
{ {
HDC hDC; HDC hDC;
HGDIOBJ hObj; HGDIOBJ hObj;
/* Test if aa NULL DC is accepted */ /* Test if aa NULL DC is accepted */
hDC = NtGdiCreateCompatibleDC(NULL); hDC = NtGdiCreateCompatibleDC(NULL);
ok(hDC != NULL, "hDC was NULL.\n"); ok(hDC != NULL, "hDC was NULL.\n");
/* We select a nwe palette. Note: SelectObject doesn't work with palettes! */ /* We select a nwe palette. Note: SelectObject doesn't work with palettes! */
hObj = SelectPalette(hDC, GetStockObject(DEFAULT_PALETTE), 0); hObj = SelectPalette(hDC, GetStockObject(DEFAULT_PALETTE), 0);
/* The old palette should be GetStockObject(DEFAULT_PALETTE) */ /* The old palette should be GetStockObject(DEFAULT_PALETTE) */
ok_ptr(hObj, GetStockObject(DEFAULT_PALETTE)); ok_ptr(hObj, GetStockObject(DEFAULT_PALETTE));
/* The default bitmap should be GetStockObject(21) */ /* The default bitmap should be GetStockObject(21) */
hObj = SelectObject(hDC, GetStockObject(21)); hObj = SelectObject(hDC, GetStockObject(21));
ok_ptr(hObj, GetStockObject(21)); ok_ptr(hObj, GetStockObject(21));
/* The default pen should be GetStockObject(BLACK_PEN) */ /* The default pen should be GetStockObject(BLACK_PEN) */
hObj = SelectObject(hDC, GetStockObject(WHITE_PEN)); hObj = SelectObject(hDC, GetStockObject(WHITE_PEN));
ok_ptr(hObj, GetStockObject(BLACK_PEN)); ok_ptr(hObj, GetStockObject(BLACK_PEN));
ok(NtGdiDeleteObjectApp(hDC) != 0, "NtGdiDeleteObjectApp(hDC) was zero.\n"); ok(NtGdiDeleteObjectApp(hDC) != 0, "NtGdiDeleteObjectApp(hDC) was zero.\n");
} }

View file

@ -10,186 +10,186 @@
HPALETTE HPALETTE
CreateTestPalette() CreateTestPalette()
{ {
struct struct
{ {
LOGPALETTE logpal; LOGPALETTE logpal;
PALETTEENTRY entry[5]; PALETTEENTRY entry[5];
} palstruct = } palstruct =
{ {0x300,5, { {0x300,5,
{ {1,2,3,0} }}, { {1,2,3,0} }},
{ {22,33,44,PC_RESERVED}, { {22,33,44,PC_RESERVED},
{11,55,77,PC_EXPLICIT}, {11,55,77,PC_EXPLICIT},
{00,77,66,PC_RESERVED | PC_NOCOLLAPSE}, {00,77,66,PC_RESERVED | PC_NOCOLLAPSE},
{12,34,56,78}} }; {12,34,56,78}} };
return CreatePalette((LOGPALETTE*)&palstruct); return CreatePalette((LOGPALETTE*)&palstruct);
} }
void void
Test_NtGdiDoPalette_GdiPalAnimate(void) Test_NtGdiDoPalette_GdiPalAnimate(void)
{ {
HPALETTE hPal; HPALETTE hPal;
PALETTEENTRY palEntries[5] = { PALETTEENTRY palEntries[5] = {
{0,0,0,0}, {0,0,0,0},
{0xff,0xff,0xff,0}, {0xff,0xff,0xff,0},
{0x33,0x66,0x99,0}, {0x33,0x66,0x99,0},
{0x25,0x84,0x14,0}, {0x25,0x84,0x14,0},
{0x12,0x34,0x56,0x11}}; {0x12,0x34,0x56,0x11}};
PALETTEENTRY palEntries2[5]; PALETTEENTRY palEntries2[5];
/* Test stock palette */ /* Test stock palette */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_long(NtGdiDoPalette(GetStockObject(DEFAULT_PALETTE), 0, 1, palEntries, GdiPalAnimate, FALSE), 0); ok_long(NtGdiDoPalette(GetStockObject(DEFAULT_PALETTE), 0, 1, palEntries, GdiPalAnimate, FALSE), 0);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
/* Test pEntries = NULL */ /* Test pEntries = NULL */
hPal = CreateTestPalette(); hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalAnimate, TRUE), 0); ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalAnimate, TRUE), 0);
ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalAnimate, FALSE), 0); ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalAnimate, FALSE), 0);
DeleteObject(hPal); DeleteObject(hPal);
/* Test PC_RESERVED */ /* Test PC_RESERVED */
hPal = CreateTestPalette(); hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, TRUE), 2); ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, TRUE), 2);
DeleteObject(hPal); DeleteObject(hPal);
hPal = CreateTestPalette(); hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 1, 5, palEntries, GdiPalAnimate, TRUE), 2); ok_long(NtGdiDoPalette(hPal, 1, 5, palEntries, GdiPalAnimate, TRUE), 2);
DeleteObject(hPal); DeleteObject(hPal);
hPal = CreateTestPalette(); hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 2, 5, palEntries, GdiPalAnimate, TRUE), 1); ok_long(NtGdiDoPalette(hPal, 2, 5, palEntries, GdiPalAnimate, TRUE), 1);
DeleteObject(hPal); DeleteObject(hPal);
hPal = CreateTestPalette(); hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 3, 5, palEntries, GdiPalAnimate, TRUE), 1); ok_long(NtGdiDoPalette(hPal, 3, 5, palEntries, GdiPalAnimate, TRUE), 1);
DeleteObject(hPal); DeleteObject(hPal);
hPal = CreateTestPalette(); hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 4, 5, palEntries, GdiPalAnimate, TRUE), 0); ok_long(NtGdiDoPalette(hPal, 4, 5, palEntries, GdiPalAnimate, TRUE), 0);
DeleteObject(hPal); DeleteObject(hPal);
hPal = CreateTestPalette(); hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 5, 5, palEntries, GdiPalAnimate, TRUE), 0); ok_long(NtGdiDoPalette(hPal, 5, 5, palEntries, GdiPalAnimate, TRUE), 0);
DeleteObject(hPal); DeleteObject(hPal);
hPal = CreateTestPalette(); hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, FALSE), 2); ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, FALSE), 2);
DeleteObject(hPal); DeleteObject(hPal);
hPal = CreateTestPalette(); hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 3, 5, palEntries, GdiPalAnimate, FALSE), 1); ok_long(NtGdiDoPalette(hPal, 3, 5, palEntries, GdiPalAnimate, FALSE), 1);
DeleteObject(hPal); DeleteObject(hPal);
/* Test if entries are set correctly */ /* Test if entries are set correctly */
hPal = CreateTestPalette(); hPal = CreateTestPalette();
NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, TRUE); NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, TRUE);
NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE); NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE);
ok_int(palEntries2[0].peRed, 1); ok_int(palEntries2[0].peRed, 1);
ok_int(palEntries2[0].peGreen, 2); ok_int(palEntries2[0].peGreen, 2);
ok_int(palEntries2[0].peBlue, 3); ok_int(palEntries2[0].peBlue, 3);
ok_int(palEntries2[0].peFlags, 0); ok_int(palEntries2[0].peFlags, 0);
ok_int(palEntries2[1].peRed, palEntries[1].peRed); ok_int(palEntries2[1].peRed, palEntries[1].peRed);
ok_int(palEntries2[1].peGreen, palEntries[1].peGreen); ok_int(palEntries2[1].peGreen, palEntries[1].peGreen);
ok_int(palEntries2[1].peBlue, palEntries[1].peBlue); ok_int(palEntries2[1].peBlue, palEntries[1].peBlue);
ok_int(palEntries2[1].peFlags, palEntries[1].peFlags); ok_int(palEntries2[1].peFlags, palEntries[1].peFlags);
ok_int(palEntries2[2].peRed, 11); ok_int(palEntries2[2].peRed, 11);
ok_int(palEntries2[2].peGreen, 55); ok_int(palEntries2[2].peGreen, 55);
ok_int(palEntries2[2].peBlue, 77); ok_int(palEntries2[2].peBlue, 77);
ok_int(palEntries2[2].peFlags, PC_EXPLICIT); ok_int(palEntries2[2].peFlags, PC_EXPLICIT);
ok_int(palEntries2[3].peRed, palEntries[3].peRed); ok_int(palEntries2[3].peRed, palEntries[3].peRed);
ok_int(palEntries2[3].peGreen, palEntries[3].peGreen); ok_int(palEntries2[3].peGreen, palEntries[3].peGreen);
ok_int(palEntries2[3].peBlue, palEntries[3].peBlue); ok_int(palEntries2[3].peBlue, palEntries[3].peBlue);
ok_int(palEntries2[3].peFlags, palEntries[3].peFlags); ok_int(palEntries2[3].peFlags, palEntries[3].peFlags);
DeleteObject(hPal); DeleteObject(hPal);
} }
void void
Test_NtGdiDoPalette_GdiPalSetEntries(void) Test_NtGdiDoPalette_GdiPalSetEntries(void)
{ {
HDC hDC; HDC hDC;
HPALETTE hPal, hOldPal; HPALETTE hPal, hOldPal;
PALETTEENTRY palEntries[5] = { PALETTEENTRY palEntries[5] = {
{0,0,0,0}, {0,0,0,0},
{0xff,0xff,0xff,0}, {0xff,0xff,0xff,0},
{0x33,0x66,0x99,0}, {0x33,0x66,0x99,0},
{0x25,0x84,0x14,0}, {0x25,0x84,0x14,0},
{0x12,0x34,0x56,0x11}}; {0x12,0x34,0x56,0x11}};
PALETTEENTRY palEntries2[5]; PALETTEENTRY palEntries2[5];
hPal = CreateTestPalette(); hPal = CreateTestPalette();
/* Test invalid handle */ /* Test invalid handle */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_long(NtGdiDoPalette((HPALETTE)23, 0, 1, palEntries, GdiPalSetEntries, TRUE), 0); ok_long(NtGdiDoPalette((HPALETTE)23, 0, 1, palEntries, GdiPalSetEntries, TRUE), 0);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
/* Test system palette */ /* Test system palette */
ok_long(NtGdiDoPalette(GetStockObject(DEFAULT_PALETTE), 0, 1, palEntries, GdiPalSetEntries, TRUE), 0); ok_long(NtGdiDoPalette(GetStockObject(DEFAULT_PALETTE), 0, 1, palEntries, GdiPalSetEntries, TRUE), 0);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
ok_long(NtGdiDoPalette(hPal, 0, 1, palEntries, GdiPalSetEntries, TRUE), 1); ok_long(NtGdiDoPalette(hPal, 0, 1, palEntries, GdiPalSetEntries, TRUE), 1);
ok_long(NtGdiDoPalette(hPal, 0, 2, palEntries, GdiPalSetEntries, TRUE), 2); ok_long(NtGdiDoPalette(hPal, 0, 2, palEntries, GdiPalSetEntries, TRUE), 2);
ok_long(NtGdiDoPalette(hPal, 0, 3, palEntries, GdiPalSetEntries, TRUE), 3); ok_long(NtGdiDoPalette(hPal, 0, 3, palEntries, GdiPalSetEntries, TRUE), 3);
ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE), 5); ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE), 5);
ok_long(NtGdiDoPalette(hPal, 0, 6, palEntries, GdiPalSetEntries, TRUE), 5); ok_long(NtGdiDoPalette(hPal, 0, 6, palEntries, GdiPalSetEntries, TRUE), 5);
ok_long(NtGdiDoPalette(hPal, 3, 6, palEntries, GdiPalSetEntries, TRUE), 2); ok_long(NtGdiDoPalette(hPal, 3, 6, palEntries, GdiPalSetEntries, TRUE), 2);
// TEST(NtGdiDoPalette(hPal, 4, 23247, palEntries, GdiPalSetEntries, TRUE), 0); // TEST(NtGdiDoPalette(hPal, 4, 23247, palEntries, GdiPalSetEntries, TRUE), 0);
/* Test bInbound, FALSE */ /* Test bInbound, FALSE */
NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE); NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE);
ZeroMemory(palEntries2, sizeof(palEntries2)); ZeroMemory(palEntries2, sizeof(palEntries2));
ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalSetEntries, FALSE), 5); ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalSetEntries, FALSE), 5);
/* we should get the old values returned in our buffer! */ /* we should get the old values returned in our buffer! */
ok_int(memcmp(palEntries2, palEntries, sizeof(palEntries)), 0); ok_int(memcmp(palEntries2, palEntries, sizeof(palEntries)), 0);
/* check what we have in our palette now */ /* check what we have in our palette now */
ZeroMemory(palEntries2, sizeof(palEntries2)); ZeroMemory(palEntries2, sizeof(palEntries2));
ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE), 5); ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE), 5);
ok_int(memcmp(palEntries2, palEntries, sizeof(palEntries)), 0); ok_int(memcmp(palEntries2, palEntries, sizeof(palEntries)), 0);
ok_long(NtGdiDoPalette(hPal, 0, 4, palEntries2, GdiPalSetEntries, TRUE), 4); ok_long(NtGdiDoPalette(hPal, 0, 4, palEntries2, GdiPalSetEntries, TRUE), 4);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
/* Test if entries are set correctly */ /* Test if entries are set correctly */
hPal = CreateTestPalette(); hPal = CreateTestPalette();
NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE); NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE);
NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE); NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE);
ok_int(palEntries2[0].peRed, 0); ok_int(palEntries2[0].peRed, 0);
ok_int(palEntries2[0].peGreen, 0); ok_int(palEntries2[0].peGreen, 0);
ok_int(palEntries2[0].peBlue, 0); ok_int(palEntries2[0].peBlue, 0);
ok_int(palEntries2[0].peFlags, 0); ok_int(palEntries2[0].peFlags, 0);
/* Test that the buffer was not changed */ /* Test that the buffer was not changed */
/* Test with palette selected into dc */ /* Test with palette selected into dc */
hDC = CreateCompatibleDC(NULL); hDC = CreateCompatibleDC(NULL);
hOldPal = SelectPalette(hDC, hPal, 0); hOldPal = SelectPalette(hDC, hPal, 0);
ok_long(NtGdiDoPalette(hPal, 0, 4, palEntries, GdiPalSetEntries, TRUE), 4); ok_long(NtGdiDoPalette(hPal, 0, 4, palEntries, GdiPalSetEntries, TRUE), 4);
SelectPalette(hDC, hOldPal, 0); SelectPalette(hDC, hOldPal, 0);
/* Test pEntries = NULL */ /* Test pEntries = NULL */
ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, TRUE), 0); ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, TRUE), 0);
} }
void void
Test_NtGdiDoPalette_GdiPalGetEntries(void) Test_NtGdiDoPalette_GdiPalGetEntries(void)
{ {
HPALETTE hPal; HPALETTE hPal;
hPal = CreateTestPalette(); hPal = CreateTestPalette();
/* Test pEntries = NULL */ /* Test pEntries = NULL */
ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, TRUE), 0); ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, TRUE), 0);
ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, FALSE), 5); ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, FALSE), 5);
ok_long(NtGdiDoPalette(hPal, 2, 1, NULL, GdiPalGetEntries, FALSE), 5); ok_long(NtGdiDoPalette(hPal, 2, 1, NULL, GdiPalGetEntries, FALSE), 5);
ok_long(NtGdiDoPalette(hPal, 20, 1, NULL, GdiPalGetEntries, FALSE), 5); ok_long(NtGdiDoPalette(hPal, 20, 1, NULL, GdiPalGetEntries, FALSE), 5);
ok_long(NtGdiDoPalette(hPal, -20, 1, NULL, GdiPalGetEntries, FALSE), 5); ok_long(NtGdiDoPalette(hPal, -20, 1, NULL, GdiPalGetEntries, FALSE), 5);
ok_long(NtGdiDoPalette(hPal, 2, 0, NULL, GdiPalGetEntries, FALSE), 5); ok_long(NtGdiDoPalette(hPal, 2, 0, NULL, GdiPalGetEntries, FALSE), 5);
// Test flags 0xf0 // Test flags 0xf0
@ -245,7 +245,7 @@ Test_NtGdiDoPalette_SetDIBColorTable(void)
bmi.bmiColors[7] = 0xE0E0E0; bmi.bmiColors[7] = 0xE0E0E0;
bmi.bmiColors[8] = 0xffffff; bmi.bmiColors[8] = 0xffffff;
hbmp = CreateDIBSection(hdc, (BITMAPINFO*)&bmi, DIB_PAL_COLORS, (PVOID*)&pjBits, NULL, 0); hbmp = CreateDIBSection(hdc, (BITMAPINFO*)&bmi, DIB_PAL_COLORS, (PVOID*)&pjBits, NULL, 0);
ok(hbmp != NULL, "hbmp was NULL.\n"); ok(hbmp != NULL, "hbmp was NULL.\n");
ok(pjBits != NULL, "pjBits was NULL.\n"); ok(pjBits != NULL, "pjBits was NULL.\n");
SelectObject(hdc, hbmp); SelectObject(hdc, hbmp);
@ -264,7 +264,7 @@ Test_NtGdiDoPalette_SetDIBColorTable(void)
bmi.bmiColors[2] = 0xC0C0C0; bmi.bmiColors[2] = 0xC0C0C0;
bmi.bmiColors[1] = 0xE0E0E0; bmi.bmiColors[1] = 0xE0E0E0;
bmi.bmiColors[0] = 0xffffff; bmi.bmiColors[0] = 0xffffff;
ok_long(NtGdiDoPalette(hdc, 0, 9, &bmi.bmiColors, GdiPalSetColorTable, FALSE), 9); ok_long(NtGdiDoPalette(hdc, 0, 9, &bmi.bmiColors, GdiPalSetColorTable, FALSE), 9);
SetDCPenColor(hdc, 0xE0E0E0); SetDCPenColor(hdc, 0xE0E0E0);
SetDCBrushColor(hdc, 0x202020); SetDCBrushColor(hdc, 0x202020);
@ -276,10 +276,10 @@ Test_NtGdiDoPalette_SetDIBColorTable(void)
START_TEST(NtGdiDoPalette) START_TEST(NtGdiDoPalette)
{ {
Test_NtGdiDoPalette_GdiPalAnimate(); Test_NtGdiDoPalette_GdiPalAnimate();
Test_NtGdiDoPalette_GdiPalSetEntries(); Test_NtGdiDoPalette_GdiPalSetEntries();
Test_NtGdiDoPalette_GdiPalGetEntries(); Test_NtGdiDoPalette_GdiPalGetEntries();
Test_NtGdiDoPalette_GetSystemPalette(); Test_NtGdiDoPalette_GetSystemPalette();
Test_NtGdiDoPalette_GetBIBColorTable(); Test_NtGdiDoPalette_GetBIBColorTable();
Test_NtGdiDoPalette_SetDIBColorTable(); Test_NtGdiDoPalette_SetDIBColorTable();
} }

View file

@ -9,17 +9,17 @@
START_TEST(NtGdiEngCreatePalette) START_TEST(NtGdiEngCreatePalette)
{ {
HPALETTE hPal; HPALETTE hPal;
ULONG Colors[3] = {1,2,3}; ULONG Colors[3] = {1,2,3};
PENTRY pEntry; PENTRY pEntry;
hPal = NtGdiEngCreatePalette(PAL_RGB, 3, Colors, 0xff000000, 0x00ff0000, 0x0000ff00); hPal = NtGdiEngCreatePalette(PAL_RGB, 3, Colors, 0xff000000, 0x00ff0000, 0x0000ff00);
ok(hPal != NULL, "hPal was NULL.\n"); ok(hPal != NULL, "hPal was NULL.\n");
ok_int((int)GDI_HANDLE_GET_TYPE(hPal), (int)GDI_OBJECT_TYPE_PALETTE); ok_int((int)GDI_HANDLE_GET_TYPE(hPal), (int)GDI_OBJECT_TYPE_PALETTE);
pEntry = &GdiHandleTable[GDI_HANDLE_GET_INDEX(hPal)]; pEntry = &GdiHandleTable[GDI_HANDLE_GET_INDEX(hPal)];
ok(pEntry->einfo.pobj != NULL, "pEntry->einfo.pobj was NULL.\n"); ok(pEntry->einfo.pobj != NULL, "pEntry->einfo.pobj was NULL.\n");
ok_long(pEntry->ObjectOwner.ulObj, GetCurrentProcessId()); ok_long(pEntry->ObjectOwner.ulObj, GetCurrentProcessId());
ok_ptr(pEntry->pUser, NULL); ok_ptr(pEntry->pUser, NULL);
//TEST(pEntry->Type == (((UINT)hPal >> 16) | GDI_OBJECT_TYPE_PALETTE)); //TEST(pEntry->Type == (((UINT)hPal >> 16) | GDI_OBJECT_TYPE_PALETTE));
} }

View file

@ -9,38 +9,38 @@
START_TEST(NtGdiEnumFontOpen) START_TEST(NtGdiEnumFontOpen)
{ {
HDC hDC; HDC hDC;
ULONG_PTR idEnum; ULONG_PTR idEnum;
ULONG ulCount; ULONG ulCount;
PENTRY pEntry; PENTRY pEntry;
hDC = CreateDCW(L"DISPLAY",NULL,NULL,NULL); hDC = CreateDCW(L"DISPLAY",NULL,NULL,NULL);
// FIXME: We should load the font first // FIXME: We should load the font first
idEnum = NtGdiEnumFontOpen(hDC, 2, 0, 32, L"Courier", ANSI_CHARSET, &ulCount); idEnum = NtGdiEnumFontOpen(hDC, 2, 0, 32, L"Courier", ANSI_CHARSET, &ulCount);
ok(idEnum != 0, "idEnum was 0.\n"); ok(idEnum != 0, "idEnum was 0.\n");
if (idEnum == 0) if (idEnum == 0)
{ {
skip("idEnum == 0"); skip("idEnum == 0");
return; return;
} }
/* we should have a gdi handle here */ /* we should have a gdi handle here */
ok_int((int)GDI_HANDLE_GET_TYPE(idEnum), (int)GDI_OBJECT_TYPE_ENUMFONT); ok_int((int)GDI_HANDLE_GET_TYPE(idEnum), (int)GDI_OBJECT_TYPE_ENUMFONT);
pEntry = &GdiHandleTable[GDI_HANDLE_GET_INDEX(idEnum)]; pEntry = &GdiHandleTable[GDI_HANDLE_GET_INDEX(idEnum)];
ok(pEntry->einfo.pobj != NULL, "pEntry->einfo.pobj was NULL.\n"); ok(pEntry->einfo.pobj != NULL, "pEntry->einfo.pobj was NULL.\n");
ok_long(pEntry->ObjectOwner.ulObj, GetCurrentProcessId()); ok_long(pEntry->ObjectOwner.ulObj, GetCurrentProcessId());
ok_ptr(pEntry->pUser, NULL); ok_ptr(pEntry->pUser, NULL);
ok_int(pEntry->FullUnique, (idEnum >> 16)); ok_int(pEntry->FullUnique, (idEnum >> 16));
ok_int(pEntry->Objt, GDI_OBJECT_TYPE_ENUMFONT >> 16); ok_int(pEntry->Objt, GDI_OBJECT_TYPE_ENUMFONT >> 16);
ok_int(pEntry->Flags, 0); ok_int(pEntry->Flags, 0);
/* We should not be able to use DeleteObject() on the handle */ /* We should not be able to use DeleteObject() on the handle */
ok_int(DeleteObject((HGDIOBJ)idEnum), FALSE); ok_int(DeleteObject((HGDIOBJ)idEnum), FALSE);
NtGdiEnumFontClose(idEnum); NtGdiEnumFontClose(idEnum);
// Test no logfont (NULL): should word // Test no logfont (NULL): should word
// Test empty lfFaceName string: should not work // Test empty lfFaceName string: should not work
} }

View file

@ -33,11 +33,11 @@ START_TEST(NtGdiExtTextOutW)
ULONG len; ULONG len;
INT Dx[10] = {10, -5, 10, 5, 10, -10, 10, 5, 10, 5}; INT Dx[10] = {10, -5, 10, 5, 10, -10, 10, 5, 10, 5};
/* Create a window */ /* Create a window */
hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE, hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
NULL, NULL, hinst, 0); NULL, NULL, hinst, 0);
hDC = GetDC(hWnd); hDC = GetDC(hWnd);
lpstr = L"Hallo"; lpstr = L"Hallo";
len = wcslen(lpstr); len = wcslen(lpstr);

View file

@ -13,36 +13,36 @@ NTSTATUS
START_TEST(NtGdiFlushUserBatch) START_TEST(NtGdiFlushUserBatch)
{ {
PVOID pRet; PVOID pRet;
PTEB pTeb; PTEB pTeb;
pNtGdiFlushUserBatch = (PVOID)GetProcAddress(g_hModule, "NtGdiFlushUserBatch"); pNtGdiFlushUserBatch = (PVOID)GetProcAddress(g_hModule, "NtGdiFlushUserBatch");
if (pNtGdiFlushUserBatch == NULL) if (pNtGdiFlushUserBatch == NULL)
return APISTATUS_NOT_FOUND; return APISTATUS_NOT_FOUND;
pTeb = NtCurrentTeb(); pTeb = NtCurrentTeb();
ok(pTeb != NULL, "pTeb was NULL.\n"); ok(pTeb != NULL, "pTeb was NULL.\n");
pRet = (PVOID)pNtGdiFlushUserBatch(); pRet = (PVOID)pNtGdiFlushUserBatch();
ok(pRet != NULL, "pRet was NULL.\n"); ok(pRet != NULL, "pRet was NULL.\n");
ok_ptr(pRet, &pTeb->RealClientId); ok_ptr(pRet, &pTeb->RealClientId);
ok_long(pTeb->GdiBatchCount, 0); ok_long(pTeb->GdiBatchCount, 0);
ok_long(pTeb->GdiTebBatch.Offset, 0); ok_long(pTeb->GdiTebBatch.Offset, 0);
ok_ptr(pTeb->GdiTebBatch.HDC, NULL); ok_ptr(pTeb->GdiTebBatch.HDC, NULL);
/* Set up some bullshit */ /* Set up some bullshit */
pTeb->InDbgPrint = 1; pTeb->InDbgPrint = 1;
pTeb->GdiBatchCount = 12; pTeb->GdiBatchCount = 12;
pTeb->GdiTebBatch.Offset = 21; pTeb->GdiTebBatch.Offset = 21;
pTeb->GdiTebBatch.HDC = (HDC)123; pTeb->GdiTebBatch.HDC = (HDC)123;
pRet = (PVOID)pNtGdiFlushUserBatch(); pRet = (PVOID)pNtGdiFlushUserBatch();
ok_ptr(pRet, &pTeb->RealClientId); ok_ptr(pRet, &pTeb->RealClientId);
ok_int(pTeb->InDbgPrint, 0); ok_int(pTeb->InDbgPrint, 0);
ok_long(pTeb->GdiBatchCount, 12); ok_long(pTeb->GdiBatchCount, 12);
ok_long(pTeb->GdiTebBatch.Offset, 0); ok_long(pTeb->GdiTebBatch.Offset, 0);
ok_ptr(pTeb->GdiTebBatch.HDC, NULL); ok_ptr(pTeb->GdiTebBatch.HDC, NULL);
} }

View file

@ -9,60 +9,60 @@
START_TEST(NtGdiGetBitmapBits) START_TEST(NtGdiGetBitmapBits)
{ {
BYTE Bits[50] = {0,1,2,3,4,5,6,7,8,9}; BYTE Bits[50] = {0,1,2,3,4,5,6,7,8,9};
HBITMAP hBitmap; HBITMAP hBitmap;
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_long(NtGdiGetBitmapBits(0, 0, 0), 0); ok_long(NtGdiGetBitmapBits(0, 0, 0), 0);
ok_long(GetLastError(), ERROR_INVALID_HANDLE); ok_long(GetLastError(), ERROR_INVALID_HANDLE);
/* Test NULL bitmap handle */ /* Test NULL bitmap handle */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_long(NtGdiGetBitmapBits(0, 5, Bits), 0); ok_long(NtGdiGetBitmapBits(0, 5, Bits), 0);
ok_long(GetLastError(), ERROR_INVALID_HANDLE); ok_long(GetLastError(), ERROR_INVALID_HANDLE);
/* Test invalid bitmap handle */ /* Test invalid bitmap handle */
hBitmap = (HBITMAP)CreatePen(PS_SOLID, 1, RGB(1,2,3)); hBitmap = (HBITMAP)CreatePen(PS_SOLID, 1, RGB(1,2,3));
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_long(NtGdiGetBitmapBits(hBitmap, 5, Bits), 0); ok_long(NtGdiGetBitmapBits(hBitmap, 5, Bits), 0);
ok_long(GetLastError(), ERROR_INVALID_HANDLE); ok_long(GetLastError(), ERROR_INVALID_HANDLE);
DeleteObject(hBitmap); DeleteObject(hBitmap);
hBitmap = CreateBitmap(3, 3, 1, 8, NULL); hBitmap = CreateBitmap(3, 3, 1, 8, NULL);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
/* test NULL pointer and count buffer size != 0 */ /* test NULL pointer and count buffer size != 0 */
ok_long(NtGdiGetBitmapBits(hBitmap, 5, NULL), 12); ok_long(NtGdiGetBitmapBits(hBitmap, 5, NULL), 12);
/* test NULL pointer and buffer size == 0*/ /* test NULL pointer and buffer size == 0*/
ok_long(NtGdiGetBitmapBits(hBitmap, 0, NULL), 12); ok_long(NtGdiGetBitmapBits(hBitmap, 0, NULL), 12);
/* test bad pointer */ /* test bad pointer */
ok_long(NtGdiGetBitmapBits(hBitmap, 5, (PBYTE)0x500), 0); ok_long(NtGdiGetBitmapBits(hBitmap, 5, (PBYTE)0x500), 0);
/* Test if we can set a number of bytes between lines */ /* Test if we can set a number of bytes between lines */
ok_long(NtGdiGetBitmapBits(hBitmap, 5, Bits), 5); ok_long(NtGdiGetBitmapBits(hBitmap, 5, Bits), 5);
/* Test alignment */ /* Test alignment */
ok_long(NtGdiGetBitmapBits(hBitmap, 4, Bits+1), 4); ok_long(NtGdiGetBitmapBits(hBitmap, 4, Bits+1), 4);
/* Test 1 byte too much */ /* Test 1 byte too much */
ok_long(NtGdiGetBitmapBits(hBitmap, 10, Bits), 10); ok_long(NtGdiGetBitmapBits(hBitmap, 10, Bits), 10);
/* Test one row too much */ /* Test one row too much */
ok_long(NtGdiGetBitmapBits(hBitmap, 12, Bits), 12); ok_long(NtGdiGetBitmapBits(hBitmap, 12, Bits), 12);
ok_long(NtGdiGetBitmapBits(hBitmap, 13, Bits), 12); ok_long(NtGdiGetBitmapBits(hBitmap, 13, Bits), 12);
ok_long(NtGdiGetBitmapBits(hBitmap, 100, Bits), 12); ok_long(NtGdiGetBitmapBits(hBitmap, 100, Bits), 12);
/* Test huge bytes count */ /* Test huge bytes count */
ok_long(NtGdiGetBitmapBits(hBitmap, 12345678, Bits), 12); ok_long(NtGdiGetBitmapBits(hBitmap, 12345678, Bits), 12);
/* Test negative bytes count */ /* Test negative bytes count */
ok_long(NtGdiGetBitmapBits(hBitmap, -5, Bits), 12); ok_long(NtGdiGetBitmapBits(hBitmap, -5, Bits), 12);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
DeleteObject(hBitmap); DeleteObject(hBitmap);
} }

View file

@ -33,108 +33,108 @@ DIB_BitmapMaxBitsSize( PBITMAPINFO Info, UINT ScanLines )
START_TEST(NtGdiGetDIBitsInternal) START_TEST(NtGdiGetDIBitsInternal)
{ {
HBITMAP hBitmap; HBITMAP hBitmap;
struct struct
{ {
BITMAPINFO bi; BITMAPINFO bi;
RGBQUAD Colors[20]; RGBQUAD Colors[20];
} bmp; } bmp;
// BITMAPINFO bi; // BITMAPINFO bi;
INT ScreenBpp; INT ScreenBpp;
BITMAPCOREINFO bic; BITMAPCOREINFO bic;
DWORD data[20*16]; DWORD data[20*16];
HDC hDCScreen = GetDC(NULL); HDC hDCScreen = GetDC(NULL);
ok(hDCScreen != NULL, "hDCScreen was NULL.\n"); ok(hDCScreen != NULL, "hDCScreen was NULL.\n");
hBitmap = CreateCompatibleBitmap(hDCScreen, 16, 16); hBitmap = CreateCompatibleBitmap(hDCScreen, 16, 16);
ok(hBitmap != NULL, "hBitmap was NULL.\n"); ok(hBitmap != NULL, "hBitmap was NULL.\n");
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_int(NtGdiGetDIBitsInternal(0, 0, 0, 0, NULL, NULL, 0, 0, 0), 0); ok_int(NtGdiGetDIBitsInternal(0, 0, 0, 0, NULL, NULL, 0, 0, 0), 0);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_int(NtGdiGetDIBitsInternal((HDC)2345, 0, 0, 0, NULL, NULL, 0, 0, 0), 0); ok_int(NtGdiGetDIBitsInternal((HDC)2345, 0, 0, 0, NULL, NULL, 0, 0, 0), 0);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_int(NtGdiGetDIBitsInternal((HDC)2345, hBitmap, 0, 0, NULL, NULL, 0, 0, 0), 0); ok_int(NtGdiGetDIBitsInternal((HDC)2345, hBitmap, 0, 0, NULL, NULL, 0, 0, 0), 0);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_int(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 0, NULL, NULL, 0, 0, 0), 0); ok_int(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 0, NULL, NULL, 0, 0, 0), 0);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_int(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, NULL, 0, 0, 0), 0); ok_int(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, NULL, 0, 0, 0), 0);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
ZeroMemory(&bmp, sizeof(bmp)); ZeroMemory(&bmp, sizeof(bmp));
bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44); FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok(NtGdiGetDIBitsInternal((HDC)0, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) > 0, ok(NtGdiGetDIBitsInternal((HDC)0, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) > 0,
"NtGdiGetDIBitsInternal((HDC)0, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) <= 0.\n"); "NtGdiGetDIBitsInternal((HDC)0, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) <= 0.\n");
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
ok_int(bmp.Colors[0].rgbRed, 0x44); ok_int(bmp.Colors[0].rgbRed, 0x44);
ZeroMemory(&bmp, sizeof(bmp)); ZeroMemory(&bmp, sizeof(bmp));
bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44); FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok(NtGdiGetDIBitsInternal((HDC)2345, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) > 0, ok(NtGdiGetDIBitsInternal((HDC)2345, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) > 0,
"The return value was <= 0.\n"); "The return value was <= 0.\n");
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
ok_int(bmp.Colors[0].rgbRed, 0x44); ok_int(bmp.Colors[0].rgbRed, 0x44);
ZeroMemory(&bmp, sizeof(bmp)); ZeroMemory(&bmp, sizeof(bmp));
bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44); FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, &bmp.bi, DIB_RGB_COLORS, ok(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, &bmp.bi, DIB_RGB_COLORS,
DIB_BitmapMaxBitsSize(&bmp.bi, 15), 0) > 0, "The return value was <= 0.\n"); DIB_BitmapMaxBitsSize(&bmp.bi, 15), 0) > 0, "The return value was <= 0.\n");
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
ScreenBpp = GetDeviceCaps(hDCScreen, BITSPIXEL); ScreenBpp = GetDeviceCaps(hDCScreen, BITSPIXEL);
ok_long(bmp.bi.bmiHeader.biWidth, 16); ok_long(bmp.bi.bmiHeader.biWidth, 16);
ok_long(bmp.bi.bmiHeader.biHeight, 16); ok_long(bmp.bi.bmiHeader.biHeight, 16);
ok_long(bmp.bi.bmiHeader.biBitCount, ScreenBpp); ok_long(bmp.bi.bmiHeader.biBitCount, ScreenBpp);
ok_long(bmp.bi.bmiHeader.biSizeImage, (16 * 16) * (ScreenBpp / 8)); ok_long(bmp.bi.bmiHeader.biSizeImage, (16 * 16) * (ScreenBpp / 8));
ok_int(bmp.Colors[0].rgbRed, 0x44); ok_int(bmp.Colors[0].rgbRed, 0x44);
/* Test with pointer */ /* Test with pointer */
// ZeroMemory(&bmp.bi, sizeof(BITMAPINFO)); // ZeroMemory(&bmp.bi, sizeof(BITMAPINFO));
bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
// FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x11223344); // FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x11223344);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, (void*)data, &bmp.bi, DIB_RGB_COLORS, ok(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, (void*)data, &bmp.bi, DIB_RGB_COLORS,
DIB_BitmapMaxBitsSize(&bmp.bi, 15), 0) > 0, "The return value was <= 0.\n"); DIB_BitmapMaxBitsSize(&bmp.bi, 15), 0) > 0, "The return value was <= 0.\n");
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
ok_long(bmp.bi.bmiHeader.biWidth, 16); ok_long(bmp.bi.bmiHeader.biWidth, 16);
ok_long(bmp.bi.bmiHeader.biHeight, 16); ok_long(bmp.bi.bmiHeader.biHeight, 16);
ok_long(bmp.bi.bmiHeader.biBitCount, ScreenBpp); ok_long(bmp.bi.bmiHeader.biBitCount, ScreenBpp);
ok_long(bmp.bi.bmiHeader.biSizeImage, (16 * 16) * (ScreenBpp / 8)); ok_long(bmp.bi.bmiHeader.biSizeImage, (16 * 16) * (ScreenBpp / 8));
ok(bmp.Colors[0].rgbRed != 0x44, "bmp.Colors[0].rgbRed was 0x44.\n"); ok(bmp.Colors[0].rgbRed != 0x44, "bmp.Colors[0].rgbRed was 0x44.\n");
/* Test a BITMAPCOREINFO structure */ /* Test a BITMAPCOREINFO structure */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ZeroMemory(&bic, sizeof(BITMAPCOREINFO)); ZeroMemory(&bic, sizeof(BITMAPCOREINFO));
bic.bmciHeader.bcSize = sizeof(BITMAPCOREHEADER); bic.bmciHeader.bcSize = sizeof(BITMAPCOREHEADER);
ok(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, (PBITMAPINFO)&bic, DIB_RGB_COLORS, ok(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, (PBITMAPINFO)&bic, DIB_RGB_COLORS,
DIB_BitmapMaxBitsSize((PBITMAPINFO)&bic, 15), 0) > 0, "The return value was <= 0.\n"); DIB_BitmapMaxBitsSize((PBITMAPINFO)&bic, 15), 0) > 0, "The return value was <= 0.\n");
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
ReleaseDC(NULL, hDCScreen); ReleaseDC(NULL, hDCScreen);
DeleteObject(hBitmap); DeleteObject(hBitmap);
} }

View file

@ -9,34 +9,34 @@
START_TEST(NtGdiGetFontResourceInfoInternalW) START_TEST(NtGdiGetFontResourceInfoInternalW)
{ {
BOOL bRet; BOOL bRet;
DWORD dwBufSize; DWORD dwBufSize;
LOGFONTW logfont; LOGFONTW logfont;
UNICODE_STRING NtFileName; UNICODE_STRING NtFileName;
ASSERT(RtlDosPathNameToNtPathName_U(L".\\test.otf", ASSERT(RtlDosPathNameToNtPathName_U(L".\\test.otf",
&NtFileName, &NtFileName,
NULL, NULL,
NULL)); NULL));
dwBufSize = sizeof(logfont); dwBufSize = sizeof(logfont);
memset(&logfont, 0x0, dwBufSize); memset(&logfont, 0x0, dwBufSize);
bRet = NtGdiGetFontResourceInfoInternalW( bRet = NtGdiGetFontResourceInfoInternalW(
NtFileName.Buffer, NtFileName.Buffer,
(NtFileName.Length / sizeof(WCHAR)) +1, (NtFileName.Length / sizeof(WCHAR)) +1,
1, 1,
dwBufSize, dwBufSize,
&dwBufSize, &dwBufSize,
&logfont, &logfont,
2); 2);
ok(bRet != FALSE, "bRet was FALSE.\n"); ok(bRet != FALSE, "bRet was FALSE.\n");
printf("lfHeight = %ld\n", logfont.lfHeight); printf("lfHeight = %ld\n", logfont.lfHeight);
printf("lfWidth = %ld\n", logfont.lfWidth); printf("lfWidth = %ld\n", logfont.lfWidth);
printf("lfFaceName = %ls\n", logfont.lfFaceName); printf("lfFaceName = %ls\n", logfont.lfFaceName);
// RemoveFontResourceW(szFullFileName); // RemoveFontResourceW(szFullFileName);
} }

View file

@ -10,79 +10,79 @@
START_TEST(NtGdiGetRandomRgn) START_TEST(NtGdiGetRandomRgn)
{ {
HINSTANCE hinst = GetModuleHandle(NULL); HINSTANCE hinst = GetModuleHandle(NULL);
HWND hWnd; HWND hWnd;
HDC hDC; HDC hDC;
HRGN hrgn, hrgn2; HRGN hrgn, hrgn2;
/* Create a window */ /* Create a window */
hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE, hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
NULL, NULL, hinst, 0); NULL, NULL, hinst, 0);
// UpdateWindow(hWnd); // UpdateWindow(hWnd);
hDC = GetDC(hWnd); hDC = GetDC(hWnd);
ok(hDC != NULL, "hDC was NULL.\n"); ok(hDC != NULL, "hDC was NULL.\n");
hrgn = CreateRectRgn(0,0,0,0); hrgn = CreateRectRgn(0,0,0,0);
hrgn2 = CreateRectRgn(3,3,10,10); hrgn2 = CreateRectRgn(3,3,10,10);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_int(NtGdiGetRandomRgn(0, hrgn, 0), -1); ok_int(NtGdiGetRandomRgn(0, hrgn, 0), -1);
ok_long(GetLastError(), ERROR_INVALID_HANDLE); ok_long(GetLastError(), ERROR_INVALID_HANDLE);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_int(NtGdiGetRandomRgn((HDC)2345, hrgn, 1), -1); ok_int(NtGdiGetRandomRgn((HDC)2345, hrgn, 1), -1);
ok_long(GetLastError(), ERROR_INVALID_HANDLE); ok_long(GetLastError(), ERROR_INVALID_HANDLE);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_int(NtGdiGetRandomRgn((HDC)2345, hrgn, 10), -1); ok_int(NtGdiGetRandomRgn((HDC)2345, hrgn, 10), -1);
ok_long(GetLastError(), ERROR_INVALID_HANDLE); ok_long(GetLastError(), ERROR_INVALID_HANDLE);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_int(NtGdiGetRandomRgn((HDC)2345, (HRGN)10, 10), -1); ok_int(NtGdiGetRandomRgn((HDC)2345, (HRGN)10, 10), -1);
ok_long(GetLastError(), ERROR_INVALID_HANDLE); ok_long(GetLastError(), ERROR_INVALID_HANDLE);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_int(NtGdiGetRandomRgn((HDC)2345, 0, 1), -1); ok_int(NtGdiGetRandomRgn((HDC)2345, 0, 1), -1);
ok_long(GetLastError(), ERROR_INVALID_HANDLE); ok_long(GetLastError(), ERROR_INVALID_HANDLE);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
ok_int(NtGdiGetRandomRgn(hDC, 0, 0), 0); ok_int(NtGdiGetRandomRgn(hDC, 0, 0), 0);
ok_int(NtGdiGetRandomRgn(hDC, 0, 1), 0); ok_int(NtGdiGetRandomRgn(hDC, 0, 1), 0);
ok_int(NtGdiGetRandomRgn(hDC, (HRGN)-5, 0), 0); ok_int(NtGdiGetRandomRgn(hDC, (HRGN)-5, 0), 0);
ok_int(NtGdiGetRandomRgn(hDC, (HRGN)-5, 1), 0); ok_int(NtGdiGetRandomRgn(hDC, (HRGN)-5, 1), 0);
ok_int(NtGdiGetRandomRgn(hDC, hrgn, 0), 0); ok_int(NtGdiGetRandomRgn(hDC, hrgn, 0), 0);
ok_int(NtGdiGetRandomRgn(hDC, hrgn, 1), 0); ok_int(NtGdiGetRandomRgn(hDC, hrgn, 1), 0);
ok_int(NtGdiGetRandomRgn(hDC, hrgn, 2), 0); ok_int(NtGdiGetRandomRgn(hDC, hrgn, 2), 0);
ok_int(NtGdiGetRandomRgn(hDC, hrgn, 3), 0); ok_int(NtGdiGetRandomRgn(hDC, hrgn, 3), 0);
ok_int(NtGdiGetRandomRgn(hDC, hrgn, 4), 1); ok_int(NtGdiGetRandomRgn(hDC, hrgn, 4), 1);
ok_int(NtGdiGetRandomRgn(hDC, hrgn, 5), 0); ok_int(NtGdiGetRandomRgn(hDC, hrgn, 5), 0);
ok_int(NtGdiGetRandomRgn(hDC, hrgn, 10), 0); ok_int(NtGdiGetRandomRgn(hDC, hrgn, 10), 0);
ok_int(NtGdiGetRandomRgn(hDC, hrgn, -10), 0); ok_int(NtGdiGetRandomRgn(hDC, hrgn, -10), 0);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
SelectClipRgn(hDC, hrgn2); SelectClipRgn(hDC, hrgn2);
ok_int(NtGdiGetRandomRgn(hDC, 0, 1), -1); ok_int(NtGdiGetRandomRgn(hDC, 0, 1), -1);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
ok_int(NtGdiGetRandomRgn(hDC, hrgn, 1), 1); ok_int(NtGdiGetRandomRgn(hDC, hrgn, 1), 1);
ok_int(CombineRgn(hrgn, hrgn, hrgn, RGN_OR), SIMPLEREGION); ok_int(CombineRgn(hrgn, hrgn, hrgn, RGN_OR), SIMPLEREGION);
ok_int(CombineRgn(hrgn, hrgn, hrgn2, RGN_XOR), NULLREGION); ok_int(CombineRgn(hrgn, hrgn, hrgn2, RGN_XOR), NULLREGION);
SetRectRgn(hrgn2,0,0,0,0); SetRectRgn(hrgn2,0,0,0,0);
SelectClipRgn(hDC, hrgn2); SelectClipRgn(hDC, hrgn2);
ok_int(NtGdiGetRandomRgn(hDC, hrgn, 1), 1); ok_int(NtGdiGetRandomRgn(hDC, hrgn, 1), 1);
ok_int(CombineRgn(hrgn2, hrgn, hrgn2, RGN_XOR), NULLREGION); ok_int(CombineRgn(hrgn2, hrgn, hrgn2, RGN_XOR), NULLREGION);
ok_int(CombineRgn(hrgn2, hrgn, hrgn, RGN_OR), NULLREGION); ok_int(CombineRgn(hrgn2, hrgn, hrgn, RGN_OR), NULLREGION);
SelectClipRgn(hDC, NULL); SelectClipRgn(hDC, NULL);
ok_int(NtGdiGetRandomRgn(hDC, hrgn, 1), 0); ok_int(NtGdiGetRandomRgn(hDC, hrgn, 1), 0);
ok_int(NtGdiGetRandomRgn(hDC, hrgn, 4), 1); ok_int(NtGdiGetRandomRgn(hDC, hrgn, 4), 1);
ok_long(GetLastError(), ERROR_SUCCESS); ok_long(GetLastError(), ERROR_SUCCESS);
ReleaseDC(hWnd, hDC); ReleaseDC(hWnd, hDC);
DestroyWindow(hWnd); DestroyWindow(hWnd);
} }

View file

@ -38,10 +38,10 @@ START_TEST(NtGdiSaveDC)
TEST(NtGdiSaveDC(hdc) == 2); TEST(NtGdiSaveDC(hdc) == 2);
DeleteDC(hdc); DeleteDC(hdc);
/* Create a window */ /* Create a window */
hwnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE, hwnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
10, 10, 100, 100, 10, 10, 100, 100,
NULL, NULL, hinst, 0); NULL, NULL, hinst, 0);
hdc = GetDC(hwnd); hdc = GetDC(hwnd);
TEST(hdc != NULL); TEST(hdc != NULL);
TEST(NtGdiSaveDC(hdc) == 1); TEST(NtGdiSaveDC(hdc) == 1);

View file

@ -45,72 +45,72 @@ Test_SelectDIBSection(void)
START_TEST(NtGdiSelectBitmap) START_TEST(NtGdiSelectBitmap)
{ {
HDC hDC; HDC hDC;
HBITMAP hBmp, hOldBmp; HBITMAP hBmp, hOldBmp;
HPALETTE hOldPalette, hPalette; HPALETTE hOldPalette, hPalette;
LOGPALETTE logpal = {0x300, 1, {{12,13,14,15}}}; LOGPALETTE logpal = {0x300, 1, {{12,13,14,15}}};
hBmp = CreateBitmap(2,2,1,1,NULL); hBmp = CreateBitmap(2,2,1,1,NULL);
ASSERT(hBmp); ASSERT(hBmp);
/* We cannot select a bitmap into a display DC */ /* We cannot select a bitmap into a display DC */
hDC = GetDC(NULL); hDC = GetDC(NULL);
ASSERT(hDC); ASSERT(hDC);
hOldBmp = NtGdiSelectBitmap(hDC, hBmp); hOldBmp = NtGdiSelectBitmap(hDC, hBmp);
TEST(hOldBmp == NULL); TEST(hOldBmp == NULL);
hDC = CreateCompatibleDC(GetDC(NULL)); hDC = CreateCompatibleDC(GetDC(NULL));
ASSERT(hDC); ASSERT(hDC);
/* Check the palette before we mess it up*/ /* Check the palette before we mess it up*/
hPalette = CreatePalette(&logpal); hPalette = CreatePalette(&logpal);
hOldPalette = SelectPalette(hDC, hPalette, 0); hOldPalette = SelectPalette(hDC, hPalette, 0);
TEST(hOldPalette == GetStockObject(DEFAULT_PALETTE)); TEST(hOldPalette == GetStockObject(DEFAULT_PALETTE));
/* Test NULL DC */ /* Test NULL DC */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
hOldBmp = NtGdiSelectBitmap(NULL, hBmp); hOldBmp = NtGdiSelectBitmap(NULL, hBmp);
TEST(hOldBmp == NULL); TEST(hOldBmp == NULL);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
/* Test invalid DC */ /* Test invalid DC */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
hOldBmp = NtGdiSelectBitmap((HDC)((ULONG_PTR)hDC & 0x0000ffff), hBmp); hOldBmp = NtGdiSelectBitmap((HDC)((ULONG_PTR)hDC & 0x0000ffff), hBmp);
TEST(hOldBmp == NULL); TEST(hOldBmp == NULL);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
/* Test NULL bitmap */ /* Test NULL bitmap */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
hOldBmp = NtGdiSelectBitmap(hDC, NULL); hOldBmp = NtGdiSelectBitmap(hDC, NULL);
TEST(hOldBmp == NULL); TEST(hOldBmp == NULL);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
/* Test bitmap with only index */ /* Test bitmap with only index */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
hOldBmp = NtGdiSelectBitmap(hDC, (HBITMAP)((ULONG_PTR)hBmp & 0x0000ffff)); hOldBmp = NtGdiSelectBitmap(hDC, (HBITMAP)((ULONG_PTR)hBmp & 0x0000ffff));
TEST(hOldBmp == NULL); TEST(hOldBmp == NULL);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
/* Test valid bitmap */ /* Test valid bitmap */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
hOldBmp = NtGdiSelectBitmap(hDC, hBmp); hOldBmp = NtGdiSelectBitmap(hDC, hBmp);
TEST(hOldBmp != NULL); TEST(hOldBmp != NULL);
/* The default bitmap should be GetStockObject(21) */ /* The default bitmap should be GetStockObject(21) */
TEST(hOldBmp == GetStockObject(21)); TEST(hOldBmp == GetStockObject(21));
/* Check the palette */ /* Check the palette */
hOldPalette = SelectPalette(hDC, hOldPalette, 0); hOldPalette = SelectPalette(hDC, hOldPalette, 0);
TEST(hOldPalette == hPalette); TEST(hOldPalette == hPalette);
DeleteObject(hPalette); DeleteObject(hPalette);
/* Select the old one again and check */ /* Select the old one again and check */
hOldBmp = NtGdiSelectBitmap(hDC, hOldBmp); hOldBmp = NtGdiSelectBitmap(hDC, hOldBmp);
TEST(hOldBmp == hBmp); TEST(hOldBmp == hBmp);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
/* cleanup */ /* cleanup */
DeleteObject(hBmp); DeleteObject(hBmp);
DeleteDC(hDC); DeleteDC(hDC);
Test_SelectDIBSection(); Test_SelectDIBSection();

View file

@ -9,65 +9,65 @@
START_TEST(NtGdiSelectBrush) START_TEST(NtGdiSelectBrush)
{ {
HDC hDC; HDC hDC;
HBRUSH hBrush, hOldBrush; HBRUSH hBrush, hOldBrush;
DC_ATTR *pdcattr; DC_ATTR *pdcattr;
hDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL); hDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL);
hBrush = GetStockObject(GRAY_BRUSH); hBrush = GetStockObject(GRAY_BRUSH);
/* Test NULL DC */ /* Test NULL DC */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
hOldBrush = NtGdiSelectBrush(NULL, hBrush); hOldBrush = NtGdiSelectBrush(NULL, hBrush);
TEST(hOldBrush == NULL); TEST(hOldBrush == NULL);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
/* Test invalid DC */ /* Test invalid DC */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
hOldBrush = NtGdiSelectBrush((HDC)((ULONG_PTR)hDC & 0x0000ffff), hBrush); hOldBrush = NtGdiSelectBrush((HDC)((ULONG_PTR)hDC & 0x0000ffff), hBrush);
TEST(hOldBrush == NULL); TEST(hOldBrush == NULL);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
/* Test NULL brush */ /* Test NULL brush */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
hOldBrush = NtGdiSelectBrush(hDC, NULL); hOldBrush = NtGdiSelectBrush(hDC, NULL);
TEST(hOldBrush == NULL); TEST(hOldBrush == NULL);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
/* Test invalid brush */ /* Test invalid brush */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
hOldBrush = NtGdiSelectBrush(hDC, (HBRUSH)((ULONG_PTR)hBrush & 0x0000ffff)); hOldBrush = NtGdiSelectBrush(hDC, (HBRUSH)((ULONG_PTR)hBrush & 0x0000ffff));
TEST(hOldBrush == NULL); TEST(hOldBrush == NULL);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
hOldBrush = NtGdiSelectBrush(hDC, hBrush); hOldBrush = NtGdiSelectBrush(hDC, hBrush);
TEST(hOldBrush != NULL); TEST(hOldBrush != NULL);
hOldBrush = NtGdiSelectBrush(hDC, hOldBrush); hOldBrush = NtGdiSelectBrush(hDC, hOldBrush);
TEST(hOldBrush == hBrush); TEST(hOldBrush == hBrush);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
/* Begin with a white brush */ /* Begin with a white brush */
NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH)); NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH));
/* Select a brush in user mode */ /* Select a brush in user mode */
SelectObject(hDC, GetStockObject(BLACK_BRUSH)); SelectObject(hDC, GetStockObject(BLACK_BRUSH));
/* See what we get returned */ /* See what we get returned */
hOldBrush = NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH)); hOldBrush = NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH));
TEST(hOldBrush == GetStockObject(BLACK_BRUSH)); TEST(hOldBrush == GetStockObject(BLACK_BRUSH));
/* Begin with a white brush */ /* Begin with a white brush */
NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH)); NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH));
pdcattr = GdiGetHandleUserData(hDC); pdcattr = GdiGetHandleUserData(hDC);
/* Change the brush in user mode, without setting flags */ /* Change the brush in user mode, without setting flags */
pdcattr->hbrush = (HBRUSH)12345; pdcattr->hbrush = (HBRUSH)12345;
hOldBrush = NtGdiSelectBrush(hDC, GetStockObject(BLACK_BRUSH)); hOldBrush = NtGdiSelectBrush(hDC, GetStockObject(BLACK_BRUSH));
TEST(hOldBrush == (HBRUSH)12345); TEST(hOldBrush == (HBRUSH)12345);
DeleteDC(hDC); DeleteDC(hDC);
} }

View file

@ -9,45 +9,45 @@
START_TEST(NtGdiSelectFont) START_TEST(NtGdiSelectFont)
{ {
HDC hDC; HDC hDC;
HFONT hFont, hOldFont; HFONT hFont, hOldFont;
hDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL); hDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL);
hFont = GetStockObject(DEFAULT_GUI_FONT); hFont = GetStockObject(DEFAULT_GUI_FONT);
/* Test NULL DC */ /* Test NULL DC */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
hOldFont = NtGdiSelectFont(NULL, hFont); hOldFont = NtGdiSelectFont(NULL, hFont);
TEST(hOldFont == NULL); TEST(hOldFont == NULL);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
/* Test invalid DC */ /* Test invalid DC */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
hOldFont = NtGdiSelectFont((HDC)((ULONG_PTR)hDC & 0x0000ffff), hFont); hOldFont = NtGdiSelectFont((HDC)((ULONG_PTR)hDC & 0x0000ffff), hFont);
TEST(hOldFont == NULL); TEST(hOldFont == NULL);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
/* Test NULL font */ /* Test NULL font */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
hOldFont = NtGdiSelectFont(hDC, NULL); hOldFont = NtGdiSelectFont(hDC, NULL);
TEST(hOldFont == NULL); TEST(hOldFont == NULL);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
/* Test invalid font */ /* Test invalid font */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
hOldFont = NtGdiSelectFont(hDC, (HFONT)((ULONG_PTR)hFont & 0x0000ffff)); hOldFont = NtGdiSelectFont(hDC, (HFONT)((ULONG_PTR)hFont & 0x0000ffff));
TEST(hOldFont == NULL); TEST(hOldFont == NULL);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
hOldFont = NtGdiSelectFont(hDC, hFont); hOldFont = NtGdiSelectFont(hDC, hFont);
TEST(hOldFont != NULL); TEST(hOldFont != NULL);
hOldFont = NtGdiSelectFont(hDC, hOldFont); hOldFont = NtGdiSelectFont(hDC, hOldFont);
TEST(hOldFont == hFont); TEST(hOldFont == hFont);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
DeleteDC(hDC); DeleteDC(hDC);
} }

View file

@ -9,69 +9,69 @@
START_TEST(NtGdiSelectPen) START_TEST(NtGdiSelectPen)
{ {
HDC hDC; HDC hDC;
HPEN hPen, hOldPen; HPEN hPen, hOldPen;
LOGBRUSH logbrush; LOGBRUSH logbrush;
hDC = GetDC(NULL); hDC = GetDC(NULL);
ASSERT(hDC); ASSERT(hDC);
hPen = GetStockObject(WHITE_PEN); hPen = GetStockObject(WHITE_PEN);
/* Test NULL DC */ /* Test NULL DC */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
hOldPen = NtGdiSelectPen(NULL, hPen); hOldPen = NtGdiSelectPen(NULL, hPen);
TEST(hOldPen == NULL); TEST(hOldPen == NULL);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
/* Test invalid DC */ /* Test invalid DC */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
hOldPen = NtGdiSelectPen((HDC)((ULONG_PTR)hDC & 0x0000ffff), hPen); hOldPen = NtGdiSelectPen((HDC)((ULONG_PTR)hDC & 0x0000ffff), hPen);
TEST(hOldPen == NULL); TEST(hOldPen == NULL);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
/* Test NULL pen */ /* Test NULL pen */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
hOldPen = NtGdiSelectPen(hDC, NULL); hOldPen = NtGdiSelectPen(hDC, NULL);
TEST(hOldPen == NULL); TEST(hOldPen == NULL);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
/* Test invalid pen */ /* Test invalid pen */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
hOldPen = NtGdiSelectPen(hDC, (HPEN)((ULONG_PTR)hPen & 0x0000ffff)); hOldPen = NtGdiSelectPen(hDC, (HPEN)((ULONG_PTR)hPen & 0x0000ffff));
TEST(hOldPen == NULL); TEST(hOldPen == NULL);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
/* Test valid pen */ /* Test valid pen */
SelectObject(hDC, GetStockObject(BLACK_PEN)); SelectObject(hDC, GetStockObject(BLACK_PEN));
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
hOldPen = NtGdiSelectPen(hDC, hPen); hOldPen = NtGdiSelectPen(hDC, hPen);
TEST(hOldPen == GetStockObject(BLACK_PEN)); TEST(hOldPen == GetStockObject(BLACK_PEN));
hOldPen = NtGdiSelectPen(hDC, hOldPen); hOldPen = NtGdiSelectPen(hDC, hOldPen);
TEST(hOldPen == hPen); TEST(hOldPen == hPen);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
/* Test extpen */ /* Test extpen */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
logbrush.lbStyle = BS_SOLID; logbrush.lbStyle = BS_SOLID;
logbrush.lbColor = RGB(0x12,0x34,0x56); logbrush.lbColor = RGB(0x12,0x34,0x56);
hPen = ExtCreatePen(PS_COSMETIC|PS_ALTERNATE, 1, &logbrush, 0, NULL); hPen = ExtCreatePen(PS_COSMETIC|PS_ALTERNATE, 1, &logbrush, 0, NULL);
ASSERT(hPen); ASSERT(hPen);
hOldPen = NtGdiSelectPen(hDC, hPen); hOldPen = NtGdiSelectPen(hDC, hPen);
TEST(hOldPen != NULL); TEST(hOldPen != NULL);
hOldPen = NtGdiSelectPen(hDC, hOldPen); hOldPen = NtGdiSelectPen(hDC, hOldPen);
TEST(hOldPen == hPen); TEST(hOldPen == hPen);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
/* Test deleting pen */ /* Test deleting pen */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
hOldPen = NtGdiSelectPen(hDC, hPen); hOldPen = NtGdiSelectPen(hDC, hPen);
TEST(DeleteObject(hPen) == 1); TEST(DeleteObject(hPen) == 1);
hOldPen = NtGdiSelectPen(hDC, hOldPen); hOldPen = NtGdiSelectPen(hDC, hOldPen);
TEST(hOldPen == hPen); TEST(hOldPen == hPen);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
/* Test that fallback pen is BLACK_PEN */ /* Test that fallback pen is BLACK_PEN */
DeleteDC(hDC); DeleteDC(hDC);
} }

View file

@ -10,89 +10,89 @@
void void
ReadBits(HDC hDC, PDWORD OutBits) ReadBits(HDC hDC, PDWORD OutBits)
{ {
int x,y; int x,y;
for (y = 0; y < 8; y++) for (y = 0; y < 8; y++)
{ {
DWORD Row = 0; DWORD Row = 0;
for (x = 0; x < 8; x++) for (x = 0; x < 8; x++)
Row |= (0x80 & GetPixel(hDC, 2 + x, 3 + y)) >> x; Row |= (0x80 & GetPixel(hDC, 2 + x, 3 + y)) >> x;
OutBits[y] = Row; OutBits[y] = Row;
} }
} }
START_TEST(NtGdiSetDIBitsToDeviceInternal) START_TEST(NtGdiSetDIBitsToDeviceInternal)
{ {
static const DWORD InBits[8] = { 0x81, 0x7E, 0x5A, 0x7E, 0x7E, 0x42, 0x7E, 0x81 }; static const DWORD InBits[8] = { 0x81, 0x7E, 0x5A, 0x7E, 0x7E, 0x42, 0x7E, 0x81 };
DWORD OutBits[8]; DWORD OutBits[8];
XFORM xform; XFORM xform;
HWND hWnd = CreateWindowW(L"Static", NULL, WS_VISIBLE, HWND hWnd = CreateWindowW(L"Static", NULL, WS_VISIBLE,
100, 100, 200, 200, 100, 100, 200, 200,
NULL, NULL, NULL, NULL); NULL, NULL, NULL, NULL);
/* This DC has an nonzero origin */ /* This DC has an nonzero origin */
HDC hDC = GetDC(hWnd); HDC hDC = GetDC(hWnd);
struct struct
{ {
BITMAPINFOHEADER bmiHeader; BITMAPINFOHEADER bmiHeader;
RGBQUAD bmiColors[2]; RGBQUAD bmiColors[2];
} bmi; } bmi;
int x, y; int x, y;
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = 8; bmi.bmiHeader.biWidth = 8;
bmi.bmiHeader.biHeight = -8; bmi.bmiHeader.biHeight = -8;
bmi.bmiHeader.biPlanes = 1; bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 1; bmi.bmiHeader.biBitCount = 1;
bmi.bmiHeader.biCompression = 0; bmi.bmiHeader.biCompression = 0;
bmi.bmiHeader.biSizeImage = 0; bmi.bmiHeader.biSizeImage = 0;
bmi.bmiHeader.biXPelsPerMeter = 0; bmi.bmiHeader.biXPelsPerMeter = 0;
bmi.bmiHeader.biYPelsPerMeter = 0; bmi.bmiHeader.biYPelsPerMeter = 0;
bmi.bmiHeader.biClrUsed = 0; bmi.bmiHeader.biClrUsed = 0;
bmi.bmiHeader.biClrImportant = 0; bmi.bmiHeader.biClrImportant = 0;
*(DWORD *)&bmi.bmiColors[0] = 0x000000; *(DWORD *)&bmi.bmiColors[0] = 0x000000;
*(DWORD *)&bmi.bmiColors[1] = 0xFFFFFF; *(DWORD *)&bmi.bmiColors[1] = 0xFFFFFF;
/* The destination coordinates are relative to the DC origin */ /* The destination coordinates are relative to the DC origin */
TEST(NtGdiSetDIBitsToDeviceInternal(hDC, 2, 3, 8, 8, 0, 0, 0, 8, TEST(NtGdiSetDIBitsToDeviceInternal(hDC, 2, 3, 8, 8, 0, 0, 0, 8,
(PVOID)InBits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS, (PVOID)InBits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS,
sizeof(InBits), sizeof(bmi), TRUE, NULL)); sizeof(InBits), sizeof(bmi), TRUE, NULL));
/* Now get the data from the screen, and see if it matches */ /* Now get the data from the screen, and see if it matches */
ReadBits(hDC, OutBits); ReadBits(hDC, OutBits);
TEST(memcmp(InBits, OutBits, sizeof(InBits)) == 0); TEST(memcmp(InBits, OutBits, sizeof(InBits)) == 0);
/* Change transformation */ /* Change transformation */
GetWorldTransform(hDC, &xform); GetWorldTransform(hDC, &xform);
xform.eM11 = 2; xform.eM11 = 2;
xform.eM22 = 2; xform.eM22 = 2;
xform.eDx = 10; xform.eDx = 10;
SetWorldTransform(hDC, &xform); SetWorldTransform(hDC, &xform);
TEST(NtGdiSetDIBitsToDeviceInternal(hDC, 2, 3, 8, 8, 0, 0, 0, 8, TEST(NtGdiSetDIBitsToDeviceInternal(hDC, 2, 3, 8, 8, 0, 0, 0, 8,
(PVOID)InBits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS, (PVOID)InBits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS,
sizeof(InBits), sizeof(bmi), TRUE, NULL)); sizeof(InBits), sizeof(bmi), TRUE, NULL));
xform.eM11 = 1; xform.eM11 = 1;
xform.eM22 = 1; xform.eM22 = 1;
xform.eDx = 0; xform.eDx = 0;
SetWorldTransform(hDC, &xform); SetWorldTransform(hDC, &xform);
/* Now get the data from the screen, and see if it matches */ /* Now get the data from the screen, and see if it matches */
for (y = 0; y < 8; y++) for (y = 0; y < 8; y++)
{ {
DWORD Row = 0; DWORD Row = 0;
for (x = 0; x < 8; x++) for (x = 0; x < 8; x++)
Row |= (0x80 & GetPixel(hDC, 2 + x, 3 + y)) >> x; Row |= (0x80 & GetPixel(hDC, 2 + x, 3 + y)) >> x;
OutBits[y] = Row; OutBits[y] = Row;
} }
TEST(memcmp(InBits, OutBits, sizeof(InBits)) == 0); TEST(memcmp(InBits, OutBits, sizeof(InBits)) == 0);
ReleaseDC(hWnd, hDC); ReleaseDC(hWnd, hDC);
DestroyWindow(hWnd); DestroyWindow(hWnd);
} }

View file

@ -10,22 +10,22 @@
void void
Test_HwndRoutine_DeregisterShellHookWindow(HWND hWnd) Test_HwndRoutine_DeregisterShellHookWindow(HWND hWnd)
{ {
TEST(NtUserCallHwnd(hWnd, _HWND_ROUTINE_DEREGISTERSHELLHOOKWINDOW) == TRUE); TEST(NtUserCallHwnd(hWnd, _HWND_ROUTINE_DEREGISTERSHELLHOOKWINDOW) == TRUE);
} }
void void
Test_HwndRoutine_GetWindowContextHelpId (HWND hWnd) Test_HwndRoutine_GetWindowContextHelpId (HWND hWnd)
{ {
TEST(NtUserCallHwndParam(hWnd, 0xbadb00b, _HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID) == TRUE); TEST(NtUserCallHwndParam(hWnd, 0xbadb00b, _HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID) == TRUE);
TEST(NtUserCallHwnd(hWnd, _HWND_ROUTINE_GETWNDCONTEXTHLPID) == 0xbadb00b); TEST(NtUserCallHwnd(hWnd, _HWND_ROUTINE_GETWNDCONTEXTHLPID) == 0xbadb00b);
} }
void void
Test_HwndRoutine_SetMsgBox(HWND hWnd) Test_HwndRoutine_SetMsgBox(HWND hWnd)
{ {
TEST(NtUserCallHwnd(hWnd, 0x49) != FALSE); TEST(NtUserCallHwnd(hWnd, 0x49) != FALSE);
} }
@ -34,27 +34,27 @@ START_TEST(NtUserCallHwnd)
{ {
HWND hWnd; HWND hWnd;
hWnd = CreateWindowA("BUTTON", hWnd = CreateWindowA("BUTTON",
"Test", "Test",
BS_PUSHBUTTON | WS_VISIBLE, BS_PUSHBUTTON | WS_VISIBLE,
0, 0,
0, 0,
50, 50,
30, 30,
NULL, NULL,
NULL, NULL,
g_hInstance, g_hInstance,
0); 0);
ASSERT(hWnd); ASSERT(hWnd);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
TEST(NtUserCallHwnd(hWnd, 0x44) == FALSE); TEST(NtUserCallHwnd(hWnd, 0x44) == FALSE);
Test_HwndRoutine_DeregisterShellHookWindow(hWnd); /* 0x45 */ Test_HwndRoutine_DeregisterShellHookWindow(hWnd); /* 0x45 */
TEST(NtUserCallHwnd(hWnd, 0x46) == FALSE); // DWP_GetEnabledPopup TEST(NtUserCallHwnd(hWnd, 0x46) == FALSE); // DWP_GetEnabledPopup
Test_HwndRoutine_GetWindowContextHelpId (hWnd); /* 0x47 */ Test_HwndRoutine_GetWindowContextHelpId (hWnd); /* 0x47 */
TEST(NtUserCallHwnd(hWnd, 0x48) == TRUE); TEST(NtUserCallHwnd(hWnd, 0x48) == TRUE);
Test_HwndRoutine_SetMsgBox(hWnd); /* 0x49 */ Test_HwndRoutine_SetMsgBox(hWnd); /* 0x49 */
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
DestroyWindow(hWnd); DestroyWindow(hWnd);
} }

View file

@ -15,7 +15,7 @@ HMENU g_hMenu;
void void
Test_HwndLockRoutine_WindowHasShadow(HWND hWnd) /* 0x53 */ Test_HwndLockRoutine_WindowHasShadow(HWND hWnd) /* 0x53 */
{ {
// TEST(NtUserCallHwndLock(hWnd, 0x53) == 0); // TEST(NtUserCallHwndLock(hWnd, 0x53) == 0);
} }
@ -23,86 +23,86 @@ Test_HwndLockRoutine_WindowHasShadow(HWND hWnd) /* 0x53 */
void void
Test_HwndLockRoutine_ArrangeIconicWindows(HWND hWnd) /* 0x54 */ Test_HwndLockRoutine_ArrangeIconicWindows(HWND hWnd) /* 0x54 */
{ {
// TEST(NtUserCallHwndLock(hWnd, _HWNDLOCK_ROUTINE_ARRANGEICONICWINDOWS) == 0); // TEST(NtUserCallHwndLock(hWnd, _HWNDLOCK_ROUTINE_ARRANGEICONICWINDOWS) == 0);
} }
void void
Test_HwndLockRoutine_DrawMenuBar(HWND hWnd) /* 0x55 */ Test_HwndLockRoutine_DrawMenuBar(HWND hWnd) /* 0x55 */
{ {
TEST(NtUserCallHwndLock(hWnd, 0x55) == 1); TEST(NtUserCallHwndLock(hWnd, 0x55) == 1);
return APISTATUS_NORMAL; return APISTATUS_NORMAL;
} }
void void
Test_HwndLockRoutine_CheckImeShowStatusInThread(HWND hWnd) /* 0x56 */ Test_HwndLockRoutine_CheckImeShowStatusInThread(HWND hWnd) /* 0x56 */
{ {
TEST(NtUserCallHwndLock(hWnd, 0x56) != 0); TEST(NtUserCallHwndLock(hWnd, 0x56) != 0);
} }
void void
Test_HwndLockRoutine_GetSysMenuHandle(HWND hWnd) /* 0x57 */ Test_HwndLockRoutine_GetSysMenuHandle(HWND hWnd) /* 0x57 */
{ {
NtUserCallHwndLock(hWnd, 0x5c); NtUserCallHwndLock(hWnd, 0x5c);
// HMENU hMenu = (HMENU)NtUserCallHwndLock(hWnd, 0x57); // HMENU hMenu = (HMENU)NtUserCallHwndLock(hWnd, 0x57);
// TEST(hMenu != 0); // TEST(hMenu != 0);
} }
void void
Test_HwndLockRoutine_RedrawFrame(HWND hWnd) /* 0x58 */ Test_HwndLockRoutine_RedrawFrame(HWND hWnd) /* 0x58 */
{ {
// TEST(NtUserCallHwndLock(hWnd, 0x68) != 0); // TEST(NtUserCallHwndLock(hWnd, 0x68) != 0);
} }
void void
Test_HwndLockRoutine_UpdateWindow(HWND hWnd) /* 0x5e */ Test_HwndLockRoutine_UpdateWindow(HWND hWnd) /* 0x5e */
{ {
TEST(NtUserCallHwndLock(hWnd, 0x5e) == 1); TEST(NtUserCallHwndLock(hWnd, 0x5e) == 1);
} }
START_TEST(NtUserCallHwndLock) START_TEST(NtUserCallHwndLock)
{ {
HWND hWnd; HWND hWnd;
g_hMenu = CreateMenu(); g_hMenu = CreateMenu();
hWnd = CreateWindowA("BUTTON", hWnd = CreateWindowA("BUTTON",
"Test", "Test",
BS_PUSHBUTTON | WS_VISIBLE, BS_PUSHBUTTON | WS_VISIBLE,
0, 0,
0, 0,
50, 50,
30, 30,
NULL, NULL,
g_hMenu, g_hMenu,
g_hInstance, g_hInstance,
0); 0);
ASSERT(hWnd); ASSERT(hWnd);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
TEST(NtUserCallHwndLock((HWND)-22, 999) == 0); TEST(NtUserCallHwndLock((HWND)-22, 999) == 0);
TEST(GetLastError() == ERROR_INVALID_WINDOW_HANDLE); TEST(GetLastError() == ERROR_INVALID_WINDOW_HANDLE);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
TEST(NtUserCallHwndLock((HWND)0, 0x55) == 0); TEST(NtUserCallHwndLock((HWND)0, 0x55) == 0);
TEST(GetLastError() == ERROR_INVALID_WINDOW_HANDLE); TEST(GetLastError() == ERROR_INVALID_WINDOW_HANDLE);
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
TEST(NtUserCallHwndLock(hWnd, 999) == 0); TEST(NtUserCallHwndLock(hWnd, 999) == 0);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
Test_HwndLockRoutine_WindowHasShadow (hWnd); /* 0x53 */ Test_HwndLockRoutine_WindowHasShadow (hWnd); /* 0x53 */
Test_HwndLockRoutine_ArrangeIconicWindows(hWnd); Test_HwndLockRoutine_ArrangeIconicWindows(hWnd);
Test_HwndLockRoutine_DrawMenuBar(hWnd); Test_HwndLockRoutine_DrawMenuBar(hWnd);
Test_HwndLockRoutine_CheckImeShowStatusInThread(hWnd); Test_HwndLockRoutine_CheckImeShowStatusInThread(hWnd);
Test_HwndLockRoutine_GetSysMenuHandle(hWnd); Test_HwndLockRoutine_GetSysMenuHandle(hWnd);
Test_HwndLockRoutine_RedrawFrame(hWnd); Test_HwndLockRoutine_RedrawFrame(hWnd);
Test_HwndLockRoutine_UpdateWindow(hWnd); Test_HwndLockRoutine_UpdateWindow(hWnd);
DestroyWindow(hWnd); DestroyWindow(hWnd);
} }

View file

@ -10,18 +10,18 @@
void void
Test_HwndOptRoutine_SetProgmanWindow(void) /* 0x4a */ Test_HwndOptRoutine_SetProgmanWindow(void) /* 0x4a */
{ {
// NtUserCallHwndOpt(hWnd, HWNDOPT_ROUTINE_SETPROGMANWINDOW); // NtUserCallHwndOpt(hWnd, HWNDOPT_ROUTINE_SETPROGMANWINDOW);
} }
void void
Test_HwndOptRoutine_SetTaskmanWindow (void) /* 0x4b */ Test_HwndOptRoutine_SetTaskmanWindow (void) /* 0x4b */
{ {
// NtUserCallHwndOpt(hWnd, HWNDOPT_ROUTINE_SETTASKMANWINDOW); // NtUserCallHwndOpt(hWnd, HWNDOPT_ROUTINE_SETTASKMANWINDOW);
} }
START_TEST(NtUserCallHwndOpt) START_TEST(NtUserCallHwndOpt)
{ {
Test_HwndOptRoutine_SetProgmanWindow(pti); /* 0x4a */ Test_HwndOptRoutine_SetProgmanWindow(pti); /* 0x4a */
Test_HwndOptRoutine_SetTaskmanWindow (pti); /* 0x4b */ Test_HwndOptRoutine_SetTaskmanWindow (pti); /* 0x4b */
} }

View file

@ -10,28 +10,28 @@
void void
Test_HwndParamRoutine_SetWindowContextHelpId(HWND hWnd) Test_HwndParamRoutine_SetWindowContextHelpId(HWND hWnd)
{ {
TEST(NtUserCallHwndParam(hWnd, 12345, _HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID) == TRUE); TEST(NtUserCallHwndParam(hWnd, 12345, _HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID) == TRUE);
TEST(NtUserCallHwnd(hWnd, HWND_ROUTINE_GETWNDCONTEXTHLPID) == 12345); TEST(NtUserCallHwnd(hWnd, HWND_ROUTINE_GETWNDCONTEXTHLPID) == 12345);
} }
START_TEST(NtUserCallHwndParam) START_TEST(NtUserCallHwndParam)
{ {
HWND hWnd; HWND hWnd;
hWnd = CreateWindowA("BUTTON", hWnd = CreateWindowA("BUTTON",
"Test", "Test",
BS_PUSHBUTTON | WS_VISIBLE, BS_PUSHBUTTON | WS_VISIBLE,
0, 0,
0, 0,
50, 50,
30, 30,
NULL, NULL,
NULL, NULL,
g_hInstance, g_hInstance,
0); 0);
ASSERT(hWnd); ASSERT(hWnd);
Test_HwndParamRoutine_SetWindowContextHelpId(hWnd); Test_HwndParamRoutine_SetWindowContextHelpId(hWnd);
DestroyWindow(hWnd); DestroyWindow(hWnd);
} }

View file

@ -10,22 +10,22 @@
void void
Test_NoParamRoutine_CreateMenu(void) /* 0 */ Test_NoParamRoutine_CreateMenu(void) /* 0 */
{ {
HMENU hMenu; HMENU hMenu;
hMenu = (HMENU)NtUserCallNoParam(_NOPARAM_ROUTINE_CREATEMENU); hMenu = (HMENU)NtUserCallNoParam(_NOPARAM_ROUTINE_CREATEMENU);
TEST(IsMenu(hMenu) == TRUE); TEST(IsMenu(hMenu) == TRUE);
DestroyMenu(hMenu); DestroyMenu(hMenu);
} }
void void
Test_NoParamRoutine_CreatePopupMenu(void) /* 1 */ Test_NoParamRoutine_CreatePopupMenu(void) /* 1 */
{ {
HMENU hMenu; HMENU hMenu;
hMenu = (HMENU)NtUserCallNoParam(_NOPARAM_ROUTINE_CREATEMENUPOPUP); hMenu = (HMENU)NtUserCallNoParam(_NOPARAM_ROUTINE_CREATEMENUPOPUP);
TEST(IsMenu(hMenu) == TRUE); TEST(IsMenu(hMenu) == TRUE);
DestroyMenu(hMenu); DestroyMenu(hMenu);
} }
@ -56,19 +56,19 @@ Test_NoParamRoutine_DestroyCaret(void) /* 5 */
void void
Test_NoParamRoutine_LoadUserApiHook(void) /* 0x1d */ Test_NoParamRoutine_LoadUserApiHook(void) /* 0x1d */
{ {
//DWORD dwRet; //DWORD dwRet;
/* dwRet = */NtUserCallNoParam(_NOPARAM_ROUTINE_LOADUSERAPIHOOK); /* dwRet = */NtUserCallNoParam(_NOPARAM_ROUTINE_LOADUSERAPIHOOK);
// TEST(dwRet != 0); // TEST(dwRet != 0);
} }
START_TEST(NtUserCallNoParam) START_TEST(NtUserCallNoParam)
{ {
Test_NoParamRoutine_CreateMenu(); Test_NoParamRoutine_CreateMenu();
Test_NoParamRoutine_CreatePopupMenu(); Test_NoParamRoutine_CreatePopupMenu();
Test_NoParamRoutine_LoadUserApiHook(); /* 0x1d */ Test_NoParamRoutine_LoadUserApiHook(); /* 0x1d */
return APISTATUS_NORMAL; return APISTATUS_NORMAL;
} }

View file

@ -12,85 +12,85 @@
void void
Test_OneParamRoutine_BeginDeferWindowPos(void) /* 0x1e */ Test_OneParamRoutine_BeginDeferWindowPos(void) /* 0x1e */
{ {
HDWP hWinPosInfo; HDWP hWinPosInfo;
hWinPosInfo = (HDWP)NtUserCallOneParam(5, 0x1e); hWinPosInfo = (HDWP)NtUserCallOneParam(5, 0x1e);
TEST(hWinPosInfo != 0); TEST(hWinPosInfo != 0);
TEST(EndDeferWindowPos(hWinPosInfo) != 0); TEST(EndDeferWindowPos(hWinPosInfo) != 0);
} }
void void
Test_OneParamRoutine_WindowFromDC(void) /* 0x1f */ Test_OneParamRoutine_WindowFromDC(void) /* 0x1f */
{ {
HDC hDC = GetDC(NULL); HDC hDC = GetDC(NULL);
HWND hWnd; HWND hWnd;
hWnd = (HWND)NtUserCallOneParam((DWORD)hDC, 0x1f); hWnd = (HWND)NtUserCallOneParam((DWORD)hDC, 0x1f);
TEST(hWnd != 0); TEST(hWnd != 0);
TEST(IsWindow(hWnd)); TEST(IsWindow(hWnd));
TEST(hWnd == GetDesktopWindow()); TEST(hWnd == GetDesktopWindow());
} }
void void
Test_OneParamRoutine_CreateEmptyCurObject(void) /* XP/2k3 : 0x21, vista 0x25 */ Test_OneParamRoutine_CreateEmptyCurObject(void) /* XP/2k3 : 0x21, vista 0x25 */
{ {
HICON hIcon ; HICON hIcon ;
/* Test 0 */ /* Test 0 */
hIcon = (HICON) NtUserCallOneParam(0, _ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT); hIcon = (HICON) NtUserCallOneParam(0, _ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT);
TEST(hIcon != NULL); TEST(hIcon != NULL);
TEST(NtUserDestroyCursor(hIcon, 0) == TRUE); TEST(NtUserDestroyCursor(hIcon, 0) == TRUE);
/* Test Garbage */ /* Test Garbage */
hIcon = (HICON) NtUserCallOneParam(0xdeadbeef, _ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT); hIcon = (HICON) NtUserCallOneParam(0xdeadbeef, _ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT);
TEST(hIcon != NULL); TEST(hIcon != NULL);
TEST(NtUserDestroyCursor(hIcon, 0xbaadf00d) == TRUE); TEST(NtUserDestroyCursor(hIcon, 0xbaadf00d) == TRUE);
} }
void void
Test_OneParamRoutine_MapDesktopObject(void) /* 0x30 */ Test_OneParamRoutine_MapDesktopObject(void) /* 0x30 */
{ {
DWORD pObject; DWORD pObject;
HWND hWnd; HWND hWnd;
HMENU hMenu; HMENU hMenu;
hWnd = GetDesktopWindow(); hWnd = GetDesktopWindow();
pObject = NtUserCallOneParam((DWORD)hWnd, _ONEPARAM_ROUTINE_MAPDEKTOPOBJECT); pObject = NtUserCallOneParam((DWORD)hWnd, _ONEPARAM_ROUTINE_MAPDEKTOPOBJECT);
TEST(pObject > 0); TEST(pObject > 0);
TEST(pObject < 0x80000000); TEST(pObject < 0x80000000);
hMenu = CreateMenu(); hMenu = CreateMenu();
pObject = NtUserCallOneParam((DWORD)hMenu, _ONEPARAM_ROUTINE_MAPDEKTOPOBJECT); pObject = NtUserCallOneParam((DWORD)hMenu, _ONEPARAM_ROUTINE_MAPDEKTOPOBJECT);
DestroyMenu(hMenu); DestroyMenu(hMenu);
TEST(pObject > 0); TEST(pObject > 0);
TEST(pObject < 0x80000000); TEST(pObject < 0x80000000);
} }
void void
Test_OneParamRoutine_SwapMouseButtons(void) /* 0x42 */ Test_OneParamRoutine_SwapMouseButtons(void) /* 0x42 */
{ {
BOOL bInverse; BOOL bInverse;
NtUserCallOneParam(TRUE, _ONEPARAM_ROUTINE_SWAPMOUSEBUTTON); NtUserCallOneParam(TRUE, _ONEPARAM_ROUTINE_SWAPMOUSEBUTTON);
bInverse = (BOOL)NtUserCallOneParam(FALSE, _ONEPARAM_ROUTINE_SWAPMOUSEBUTTON); bInverse = (BOOL)NtUserCallOneParam(FALSE, _ONEPARAM_ROUTINE_SWAPMOUSEBUTTON);
TEST(bInverse == TRUE); TEST(bInverse == TRUE);
bInverse = (BOOL)NtUserCallOneParam(FALSE, _ONEPARAM_ROUTINE_SWAPMOUSEBUTTON); bInverse = (BOOL)NtUserCallOneParam(FALSE, _ONEPARAM_ROUTINE_SWAPMOUSEBUTTON);
TEST(bInverse == FALSE); TEST(bInverse == FALSE);
// TODO: test other values // TODO: test other values
} }
START_TEST(NtUserCallOneParam) START_TEST(NtUserCallOneParam)
{ {
Test_OneParamRoutine_BeginDeferWindowPos(); /* 0x1e */ Test_OneParamRoutine_BeginDeferWindowPos(); /* 0x1e */
Test_OneParamRoutine_WindowFromDC(); /* 0x1f */ Test_OneParamRoutine_WindowFromDC(); /* 0x1f */
Test_OneParamRoutine_CreateEmptyCurObject(); /* XP/2k3 : 0x21, vista 0x25 */ Test_OneParamRoutine_CreateEmptyCurObject(); /* XP/2k3 : 0x21, vista 0x25 */
Test_OneParamRoutine_MapDesktopObject(); /* 0x30 */ Test_OneParamRoutine_MapDesktopObject(); /* 0x30 */
Test_OneParamRoutine_SwapMouseButtons(); /* 0x42 */ Test_OneParamRoutine_SwapMouseButtons(); /* 0x42 */
} }

View file

@ -10,6 +10,6 @@
START_TEST(NtUserCountClipboardFormats) START_TEST(NtUserCountClipboardFormats)
{ {
RTEST(NtUserCountClipboardFormats() < 1000); RTEST(NtUserCountClipboardFormats() < 1000);
} }

View file

@ -43,7 +43,7 @@ START_TEST(NtUserEnumDisplayMonitors)
BOOL ret; BOOL ret;
// WILL crash! // WILL crash!
// TEST(NtUserEnumDisplayMonitors1(NULL, NULL, NULL, 0) == 0); // TEST(NtUserEnumDisplayMonitors1(NULL, NULL, NULL, 0) == 0);
ret = NtUserEnumDisplayMonitors(0, NULL, MonitorEnumProc, 0); ret = NtUserEnumDisplayMonitors(0, NULL, MonitorEnumProc, 0);
TEST(ret == TRUE); TEST(ret == TRUE);

View file

@ -11,97 +11,97 @@
static struct static struct
{ {
DEVMODEW devmode; DEVMODEW devmode;
CHAR buffer[0xffff]; CHAR buffer[0xffff];
} data; } data;
START_TEST(NtUserEnumDisplaySettings) START_TEST(NtUserEnumDisplaySettings)
{ {
UNICODE_STRING usDeviceName; UNICODE_STRING usDeviceName;
WCHAR szName[] = L"DISPLAY"; WCHAR szName[] = L"DISPLAY";
NTSTATUS Status; NTSTATUS Status;
INT i; INT i;
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
Status = NtUserEnumDisplaySettings(NULL, 0, 0, 0); Status = NtUserEnumDisplaySettings(NULL, 0, 0, 0);
TEST(Status == STATUS_ACCESS_VIOLATION); TEST(Status == STATUS_ACCESS_VIOLATION);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
data.devmode.dmDriverExtra = 0; data.devmode.dmDriverExtra = 0;
for (i = 0; i < 2 * sizeof(DEVMODEW); i++) for (i = 0; i < 2 * sizeof(DEVMODEW); i++)
{ {
data.devmode.dmSize = i; data.devmode.dmSize = i;
Status = NtUserEnumDisplaySettings(NULL, 1000, (DEVMODEW*)&data, 0); Status = NtUserEnumDisplaySettings(NULL, 1000, (DEVMODEW*)&data, 0);
if (i != sizeof(DEVMODEW)) if (i != sizeof(DEVMODEW))
{ {
TEST(Status == STATUS_BUFFER_TOO_SMALL); TEST(Status == STATUS_BUFFER_TOO_SMALL);
} }
} }
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
usDeviceName.Buffer = NULL; usDeviceName.Buffer = NULL;
usDeviceName.Length = 0; usDeviceName.Length = 0;
usDeviceName.MaximumLength = 0; usDeviceName.MaximumLength = 0;
Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0);
TEST(Status == STATUS_BUFFER_TOO_SMALL); TEST(Status == STATUS_BUFFER_TOO_SMALL);
Status = NtUserEnumDisplaySettings(&usDeviceName, -4, (DEVMODEW*)&data, 0); Status = NtUserEnumDisplaySettings(&usDeviceName, -4, (DEVMODEW*)&data, 0);
TEST(Status == STATUS_BUFFER_TOO_SMALL); TEST(Status == STATUS_BUFFER_TOO_SMALL);
data.devmode.dmSize = sizeof(DEVMODEW); data.devmode.dmSize = sizeof(DEVMODEW);
data.devmode.dmDriverExtra = 0xffff; data.devmode.dmDriverExtra = 0xffff;
Status = NtUserEnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); Status = NtUserEnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0);
TEST(Status == STATUS_SUCCESS); TEST(Status == STATUS_SUCCESS);
data.devmode.dmSize = sizeof(DEVMODEW); data.devmode.dmSize = sizeof(DEVMODEW);
data.devmode.dmDriverExtra = 0; data.devmode.dmDriverExtra = 0;
Status = NtUserEnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); Status = NtUserEnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0);
TEST(Status == STATUS_SUCCESS); TEST(Status == STATUS_SUCCESS);
usDeviceName.Buffer = NULL; usDeviceName.Buffer = NULL;
usDeviceName.Length = 0; usDeviceName.Length = 0;
usDeviceName.MaximumLength = 0; usDeviceName.MaximumLength = 0;
Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0);
TEST(Status == STATUS_INVALID_PARAMETER_1); TEST(Status == STATUS_INVALID_PARAMETER_1);
Status = NtUserEnumDisplaySettings(&usDeviceName, -4, (DEVMODEW*)&data, 0); Status = NtUserEnumDisplaySettings(&usDeviceName, -4, (DEVMODEW*)&data, 0);
TEST(Status == STATUS_INVALID_PARAMETER_1); TEST(Status == STATUS_INVALID_PARAMETER_1);
Status = NtUserEnumDisplaySettings(NULL, 0, (DEVMODEW*)&data, 0); Status = NtUserEnumDisplaySettings(NULL, 0, (DEVMODEW*)&data, 0);
TEST(Status == STATUS_SUCCESS); TEST(Status == STATUS_SUCCESS);
Status = NtUserEnumDisplaySettings(NULL, 1, (DEVMODEW*)&data, 0); Status = NtUserEnumDisplaySettings(NULL, 1, (DEVMODEW*)&data, 0);
TEST(Status == STATUS_SUCCESS); TEST(Status == STATUS_SUCCESS);
Status = NtUserEnumDisplaySettings(NULL, 2, (DEVMODEW*)&data, 0); Status = NtUserEnumDisplaySettings(NULL, 2, (DEVMODEW*)&data, 0);
TEST(Status == STATUS_SUCCESS); TEST(Status == STATUS_SUCCESS);
Status = NtUserEnumDisplaySettings(NULL, 4, (DEVMODEW*)&data, 0); Status = NtUserEnumDisplaySettings(NULL, 4, (DEVMODEW*)&data, 0);
TEST(Status == STATUS_SUCCESS); TEST(Status == STATUS_SUCCESS);
Status = NtUserEnumDisplaySettings(NULL, 8, (DEVMODEW*)&data, 0); Status = NtUserEnumDisplaySettings(NULL, 8, (DEVMODEW*)&data, 0);
TEST(Status == STATUS_SUCCESS); TEST(Status == STATUS_SUCCESS);
Status = NtUserEnumDisplaySettings(NULL, 247, (DEVMODEW*)&data, 0); Status = NtUserEnumDisplaySettings(NULL, 247, (DEVMODEW*)&data, 0);
TEST(Status == STATUS_SUCCESS); TEST(Status == STATUS_SUCCESS);
Status = NtUserEnumDisplaySettings(NULL, 248, (DEVMODEW*)&data, 0); Status = NtUserEnumDisplaySettings(NULL, 248, (DEVMODEW*)&data, 0);
TEST(Status == STATUS_INVALID_PARAMETER_2); TEST(Status == STATUS_INVALID_PARAMETER_2);
Status = NtUserEnumDisplaySettings(NULL, -1, (DEVMODEW*)&data, 0); Status = NtUserEnumDisplaySettings(NULL, -1, (DEVMODEW*)&data, 0);
TEST(Status == STATUS_SUCCESS); TEST(Status == STATUS_SUCCESS);
Status = NtUserEnumDisplaySettings(NULL, -2, (DEVMODEW*)&data, 0); Status = NtUserEnumDisplaySettings(NULL, -2, (DEVMODEW*)&data, 0);
TEST(Status == STATUS_SUCCESS); TEST(Status == STATUS_SUCCESS);
Status = NtUserEnumDisplaySettings(NULL, -3, (DEVMODEW*)&data, 0); Status = NtUserEnumDisplaySettings(NULL, -3, (DEVMODEW*)&data, 0);
TEST(Status == STATUS_SUCCESS); TEST(Status == STATUS_SUCCESS);
Status = NtUserEnumDisplaySettings(NULL, -4, (DEVMODEW*)&data, 0); Status = NtUserEnumDisplaySettings(NULL, -4, (DEVMODEW*)&data, 0);
TEST(Status == STATUS_INVALID_PARAMETER_2); TEST(Status == STATUS_INVALID_PARAMETER_2);
Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0);
TEST(Status == STATUS_INVALID_PARAMETER_1); TEST(Status == STATUS_INVALID_PARAMETER_1);
usDeviceName.Buffer = szName; usDeviceName.Buffer = szName;
usDeviceName.Length = (USHORT)wcslen(szName); usDeviceName.Length = (USHORT)wcslen(szName);
usDeviceName.MaximumLength = usDeviceName.Length; usDeviceName.MaximumLength = usDeviceName.Length;
Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0);
TEST(Status == STATUS_INVALID_PARAMETER_1); TEST(Status == STATUS_INVALID_PARAMETER_1);
Status = NtUserEnumDisplaySettings(&usDeviceName, 1000, (DEVMODEW*)&data, 123456); Status = NtUserEnumDisplaySettings(&usDeviceName, 1000, (DEVMODEW*)&data, 123456);
TEST(Status == STATUS_INVALID_PARAMETER_1); TEST(Status == STATUS_INVALID_PARAMETER_1);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
} }

View file

@ -10,32 +10,32 @@
START_TEST(NtUserGetClassInfo) START_TEST(NtUserGetClassInfo)
{ {
HINSTANCE hinst = GetModuleHandle(NULL); HINSTANCE hinst = GetModuleHandle(NULL);
WNDCLASSEXW wclex, wclex2 = {0}; WNDCLASSEXW wclex, wclex2 = {0};
UNICODE_STRING us; UNICODE_STRING us;
PWSTR pwstr = NULL; PWSTR pwstr = NULL;
us.Length = 8; us.Length = 8;
us.MaximumLength = 8; us.MaximumLength = 8;
us.Buffer = L"test"; us.Buffer = L"test";
wclex.cbSize = sizeof(WNDCLASSEXW); wclex.cbSize = sizeof(WNDCLASSEXW);
wclex.style = 0; wclex.style = 0;
wclex.lpfnWndProc = NULL; wclex.lpfnWndProc = NULL;
wclex.cbClsExtra = 2; wclex.cbClsExtra = 2;
wclex.cbWndExtra = 4; wclex.cbWndExtra = 4;
wclex.hInstance = hinst; wclex.hInstance = hinst;
wclex.hIcon = NULL; wclex.hIcon = NULL;
wclex.hCursor = NULL; wclex.hCursor = NULL;
wclex.hbrBackground = CreateSolidBrush(RGB(4,7,5)); wclex.hbrBackground = CreateSolidBrush(RGB(4,7,5));
wclex.lpszMenuName = L"MyMenu"; wclex.lpszMenuName = L"MyMenu";
wclex.lpszClassName = us.Buffer; wclex.lpszClassName = us.Buffer;
wclex.hIconSm = NULL; wclex.hIconSm = NULL;
ASSERT(RegisterClassExW(&wclex) != 0); ASSERT(RegisterClassExW(&wclex) != 0);
TEST(GetClassInfoExW(hinst, us.Buffer, &wclex) != 0); TEST(GetClassInfoExW(hinst, us.Buffer, &wclex) != 0);
wclex2.cbSize = sizeof(WNDCLASSEXW); wclex2.cbSize = sizeof(WNDCLASSEXW);
TEST(NtUserGetClassInfo(hinst, &us, &wclex2, &pwstr, 0) != 0); TEST(NtUserGetClassInfo(hinst, &us, &wclex2, &pwstr, 0) != 0);
TEST(pwstr == wclex.lpszMenuName); TEST(pwstr == wclex.lpszMenuName);
TEST(wclex2.cbSize == wclex.cbSize); TEST(wclex2.cbSize == wclex.cbSize);

View file

@ -9,151 +9,151 @@
START_TEST(NtUserGetIconInfo) START_TEST(NtUserGetIconInfo)
{ {
HICON hIcon; HICON hIcon;
ICONINFO iinfo; ICONINFO iinfo;
HBITMAP mask, color; HBITMAP mask, color;
UNICODE_STRING hInstStr; UNICODE_STRING hInstStr;
UNICODE_STRING ResourceStr; UNICODE_STRING ResourceStr;
DWORD bpp = 0; DWORD bpp = 0;
ZeroMemory(&iinfo, sizeof(ICONINFO)); ZeroMemory(&iinfo, sizeof(ICONINFO));
/* BASIC TESTS */ /* BASIC TESTS */
hIcon = (HICON) NtUserCallOneParam(0, _ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT); hIcon = (HICON) NtUserCallOneParam(0, _ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT);
TEST(hIcon != NULL); TEST(hIcon != NULL);
/* Last param is unknown */ /* Last param is unknown */
TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, FALSE) == FALSE); TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, FALSE) == FALSE);
TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, TRUE) == FALSE); TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, TRUE) == FALSE);
TEST(NtUserDestroyCursor(hIcon, 0) == TRUE); TEST(NtUserDestroyCursor(hIcon, 0) == TRUE);
mask = CreateBitmap(16,16,1,1,NULL); mask = CreateBitmap(16,16,1,1,NULL);
color = CreateBitmap(16,16,1,16,NULL); color = CreateBitmap(16,16,1,16,NULL);
iinfo.hbmMask = mask; iinfo.hbmMask = mask;
iinfo.hbmColor = color ; iinfo.hbmColor = color ;
iinfo.fIcon = TRUE; iinfo.fIcon = TRUE;
iinfo.xHotspot = 8; iinfo.xHotspot = 8;
iinfo.yHotspot = 8; iinfo.yHotspot = 8;
hIcon = CreateIconIndirect(&iinfo); hIcon = CreateIconIndirect(&iinfo);
TEST(hIcon!=NULL); TEST(hIcon!=NULL);
// TODO : test last parameter... // TODO : test last parameter...
TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, FALSE) == TRUE); TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, FALSE) == TRUE);
TEST(iinfo.hbmMask != NULL); TEST(iinfo.hbmMask != NULL);
TEST(iinfo.hbmColor != NULL); TEST(iinfo.hbmColor != NULL);
TEST(iinfo.fIcon == TRUE); TEST(iinfo.fIcon == TRUE);
TEST(iinfo.yHotspot == 8); TEST(iinfo.yHotspot == 8);
TEST(iinfo.xHotspot == 8); TEST(iinfo.xHotspot == 8);
TEST(iinfo.hbmMask != mask); TEST(iinfo.hbmMask != mask);
TEST(iinfo.hbmColor != color); TEST(iinfo.hbmColor != color);
/* Does it make a difference? */ /* Does it make a difference? */
TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, TRUE) == TRUE); TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, TRUE) == TRUE);
TEST(iinfo.hbmMask != NULL); TEST(iinfo.hbmMask != NULL);
TEST(iinfo.hbmColor != NULL); TEST(iinfo.hbmColor != NULL);
TEST(iinfo.fIcon == TRUE); TEST(iinfo.fIcon == TRUE);
TEST(iinfo.yHotspot == 8); TEST(iinfo.yHotspot == 8);
TEST(iinfo.xHotspot == 8); TEST(iinfo.xHotspot == 8);
TEST(iinfo.hbmMask != mask); TEST(iinfo.hbmMask != mask);
TEST(iinfo.hbmColor != color); TEST(iinfo.hbmColor != color);
DeleteObject(mask); DeleteObject(mask);
DeleteObject(color); DeleteObject(color);
DestroyIcon(hIcon); DestroyIcon(hIcon);
/* Test full param, with local icon */ /* Test full param, with local icon */
hIcon = LoadImageA(GetModuleHandle(NULL), hIcon = LoadImageA(GetModuleHandle(NULL),
MAKEINTRESOURCE(IDI_ICON), MAKEINTRESOURCE(IDI_ICON),
IMAGE_ICON, IMAGE_ICON,
0, 0,
0, 0,
LR_DEFAULTSIZE); LR_DEFAULTSIZE);
TEST(hIcon != NULL); TEST(hIcon != NULL);
RtlInitUnicodeString(&hInstStr, NULL); RtlInitUnicodeString(&hInstStr, NULL);
RtlInitUnicodeString(&ResourceStr, NULL); RtlInitUnicodeString(&ResourceStr, NULL);
TEST(NtUserGetIconInfo(hIcon, TEST(NtUserGetIconInfo(hIcon,
&iinfo, &iinfo,
&hInstStr, &hInstStr,
&ResourceStr, &ResourceStr,
&bpp, &bpp,
FALSE) == TRUE); FALSE) == TRUE);
TESTX(hInstStr.Buffer == NULL, "hInstStr.buffer : %p\n", hInstStr.Buffer); TESTX(hInstStr.Buffer == NULL, "hInstStr.buffer : %p\n", hInstStr.Buffer);
TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(IDI_ICON)); TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(IDI_ICON));
TEST(bpp == 32); TEST(bpp == 32);
/* Last param doesn't seem to matter*/ /* Last param doesn't seem to matter*/
TEST(NtUserGetIconInfo(hIcon, TEST(NtUserGetIconInfo(hIcon,
&iinfo, &iinfo,
&hInstStr, &hInstStr,
&ResourceStr, &ResourceStr,
&bpp, &bpp,
TRUE) == TRUE); TRUE) == TRUE);
TESTX(hInstStr.Buffer == NULL, "hInstStr.buffer : %p\n", hInstStr.Buffer); TESTX(hInstStr.Buffer == NULL, "hInstStr.buffer : %p\n", hInstStr.Buffer);
TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(IDI_ICON)); TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(IDI_ICON));
TEST(bpp == 32); TEST(bpp == 32);
DestroyIcon(hIcon); DestroyIcon(hIcon);
/* Test full param, with foreign icon */ /* Test full param, with foreign icon */
hIcon = LoadImageA(GetModuleHandleA("shell32.dll"), hIcon = LoadImageA(GetModuleHandleA("shell32.dll"),
MAKEINTRESOURCE(293), MAKEINTRESOURCE(293),
IMAGE_ICON, IMAGE_ICON,
0, 0,
0, 0,
LR_DEFAULTSIZE); LR_DEFAULTSIZE);
TEST(hIcon != NULL); TEST(hIcon != NULL);
hInstStr.Buffer = HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR)); hInstStr.Buffer = HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR));
hInstStr.MaximumLength = MAX_PATH; hInstStr.MaximumLength = MAX_PATH;
hInstStr.Length = 0; hInstStr.Length = 0;
RtlInitUnicodeString(&ResourceStr, NULL); RtlInitUnicodeString(&ResourceStr, NULL);
TEST(NtUserGetIconInfo(hIcon, TEST(NtUserGetIconInfo(hIcon,
&iinfo, &iinfo,
&hInstStr, &hInstStr,
&ResourceStr, &ResourceStr,
&bpp, &bpp,
FALSE) == TRUE); FALSE) == TRUE);
TEST(hInstStr.Length != 0);
hInstStr.Buffer[hInstStr.Length] = 0;
printf("%s,%i: hInstStr.buffer : %S\n", __FUNCTION__, __LINE__, hInstStr.Buffer);
TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(293));
TEST(ResourceStr.Length == 0);
TEST(ResourceStr.MaximumLength == 0);
TEST(bpp == 32);
ZeroMemory(hInstStr.Buffer, MAX_PATH*sizeof(WCHAR));
hInstStr.Length = 0;
RtlInitUnicodeString(&ResourceStr, NULL);
TEST(NtUserGetIconInfo(hIcon,
&iinfo,
&hInstStr,
&ResourceStr,
&bpp,
TRUE) == TRUE);
TEST(hInstStr.Length != 0); TEST(hInstStr.Length != 0);
hInstStr.Buffer[hInstStr.Length] = 0; hInstStr.Buffer[hInstStr.Length] = 0;
printf("%s,%i: hInstStr.buffer : %S\n", __FUNCTION__, __LINE__, hInstStr.Buffer); printf("%s,%i: hInstStr.buffer : %S\n", __FUNCTION__, __LINE__, hInstStr.Buffer);
TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(293)); TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(293));
TEST(bpp == 32); TEST(ResourceStr.Length == 0);
TEST(ResourceStr.MaximumLength == 0);
TEST(bpp == 32);
DestroyIcon(hIcon); ZeroMemory(hInstStr.Buffer, MAX_PATH*sizeof(WCHAR));
hInstStr.Length = 0;
RtlInitUnicodeString(&ResourceStr, NULL);
TEST(NtUserGetIconInfo(hIcon,
&iinfo,
&hInstStr,
&ResourceStr,
&bpp,
TRUE) == TRUE);
TEST(hInstStr.Length != 0);
hInstStr.Buffer[hInstStr.Length] = 0;
printf("%s,%i: hInstStr.buffer : %S\n", __FUNCTION__, __LINE__, hInstStr.Buffer);
TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(293));
TEST(bpp == 32);
DestroyIcon(hIcon);
} }

View file

@ -10,29 +10,29 @@
START_TEST(NtUserRedrawWindow) START_TEST(NtUserRedrawWindow)
{ {
HINSTANCE hinst = GetModuleHandle(NULL); HINSTANCE hinst = GetModuleHandle(NULL);
HWND hWnd; HWND hWnd;
RECT rect; RECT rect;
hWnd = CreateWindowA("BUTTON", hWnd = CreateWindowA("BUTTON",
"Test", "Test",
BS_PUSHBUTTON | WS_VISIBLE, BS_PUSHBUTTON | WS_VISIBLE,
0, 0,
0, 0,
50, 50,
30, 30,
NULL, NULL,
NULL, NULL,
hinst, hinst,
0); 0);
ASSERT(hWnd); ASSERT(hWnd);
rect.left = 0; rect.left = 0;
rect.top = 0; rect.top = 0;
rect.right = 10; rect.right = 10;
rect.bottom = 10; rect.bottom = 10;
TEST(NtUserRedrawWindow(hWnd, &rect, NULL, RDW_VALIDATE) == TRUE); TEST(NtUserRedrawWindow(hWnd, &rect, NULL, RDW_VALIDATE) == TRUE);
DestroyWindow(hWnd); DestroyWindow(hWnd);
} }

View file

@ -10,108 +10,108 @@
START_TEST(NtUserScrollDC) START_TEST(NtUserScrollDC)
{ {
HINSTANCE hinst = GetModuleHandle(NULL); HINSTANCE hinst = GetModuleHandle(NULL);
HWND hWnd; HWND hWnd;
HDC hDC; HDC hDC;
HRGN hRgn, hTmpRgn; HRGN hRgn, hTmpRgn;
RECT rcScroll, rcClip, rcUpdate; RECT rcScroll, rcClip, rcUpdate;
RECT rect = {0,0,100,100}; RECT rect = {0,0,100,100};
INT Result; INT Result;
hWnd = CreateWindowA("BUTTON", hWnd = CreateWindowA("BUTTON",
"Test", "Test",
BS_PUSHBUTTON | WS_VISIBLE, BS_PUSHBUTTON | WS_VISIBLE,
0, 0,
0, 0,
50, 50,
100, 100,
NULL, NULL,
NULL, NULL,
hinst, hinst,
0); 0);
ASSERT(hWnd); ASSERT(hWnd);
RedrawWindow(hWnd, &rect, NULL, RDW_UPDATENOW); RedrawWindow(hWnd, &rect, NULL, RDW_UPDATENOW);
hDC = GetDC(hWnd); hDC = GetDC(hWnd);
ASSERT(hDC); ASSERT(hDC);
hRgn = CreateRectRgn(0,0,10,10); hRgn = CreateRectRgn(0,0,10,10);
/* Test inverted clip rect */ /* Test inverted clip rect */
rcScroll.left = 0; rcScroll.left = 0;
rcScroll.top = 25; rcScroll.top = 25;
rcScroll.right = 100; rcScroll.right = 100;
rcScroll.bottom = 40; rcScroll.bottom = 40;
rcClip.left = 0; rcClip.left = 0;
rcClip.top = 35; rcClip.top = 35;
rcClip.right = -70; rcClip.right = -70;
rcClip.bottom = -1000; rcClip.bottom = -1000;
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate); Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate);
RTEST(Result == 1); RTEST(Result == 1);
RTEST(GetLastError() == ERROR_SUCCESS); RTEST(GetLastError() == ERROR_SUCCESS);
/* Test inverted scroll rect */ /* Test inverted scroll rect */
rcScroll.left = 0; rcScroll.left = 0;
rcScroll.top = 25; rcScroll.top = 25;
rcScroll.right = -100; rcScroll.right = -100;
rcScroll.bottom = -40; rcScroll.bottom = -40;
rcClip.left = 0; rcClip.left = 0;
rcClip.top = 35; rcClip.top = 35;
rcClip.right = 70; rcClip.right = 70;
rcClip.bottom = 1000; rcClip.bottom = 1000;
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate); Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate);
RTEST(Result == 1); RTEST(Result == 1);
RTEST(GetLastError() == ERROR_SUCCESS); RTEST(GetLastError() == ERROR_SUCCESS);
rcScroll.left = 0; rcScroll.left = 0;
rcScroll.top = 25; rcScroll.top = 25;
rcScroll.right = 100; rcScroll.right = 100;
rcScroll.bottom = 40; rcScroll.bottom = 40;
/* Test invalid update region */ /* Test invalid update region */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, (HRGN)0x123456, &rcUpdate); Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, (HRGN)0x123456, &rcUpdate);
RTEST(Result == 0); RTEST(Result == 0);
TEST(GetLastError() == ERROR_INVALID_HANDLE); TEST(GetLastError() == ERROR_INVALID_HANDLE);
/* Test invalid dc */ /* Test invalid dc */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
Result = NtUserScrollDC((HDC)0x123456, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate); Result = NtUserScrollDC((HDC)0x123456, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate);
RTEST(Result == 0); RTEST(Result == 0);
RTEST(GetLastError() == ERROR_SUCCESS); RTEST(GetLastError() == ERROR_SUCCESS);
/* Test invalid update rect */ /* Test invalid update rect */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, (PVOID)0x80001000); Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, (PVOID)0x80001000);
RTEST(Result == 0); RTEST(Result == 0);
RTEST(GetLastError() == ERROR_NOACCESS); RTEST(GetLastError() == ERROR_NOACCESS);
Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate); Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate);
RTEST(Result == TRUE); RTEST(Result == TRUE);
RTEST(rcUpdate.left == 0); RTEST(rcUpdate.left == 0);
RTEST(rcUpdate.top == 35); RTEST(rcUpdate.top == 35);
RTEST(rcUpdate.right == 70); RTEST(rcUpdate.right == 70);
RTEST(rcUpdate.bottom == 55); RTEST(rcUpdate.bottom == 55);
hTmpRgn = CreateRectRgn(10,45,70,55); hTmpRgn = CreateRectRgn(10,45,70,55);
Result = CombineRgn(hRgn, hRgn, hTmpRgn, RGN_XOR); Result = CombineRgn(hRgn, hRgn, hTmpRgn, RGN_XOR);
RTEST(Result == SIMPLEREGION); RTEST(Result == SIMPLEREGION);
SetRectRgn(hTmpRgn,0,35,70,40); SetRectRgn(hTmpRgn,0,35,70,40);
Result = CombineRgn(hRgn, hRgn, hTmpRgn, RGN_XOR); Result = CombineRgn(hRgn, hRgn, hTmpRgn, RGN_XOR);
RTEST(Result == NULLREGION); RTEST(Result == NULLREGION);
DeleteObject(hTmpRgn); DeleteObject(hTmpRgn);
/* TODO: Test with another window in front */ /* TODO: Test with another window in front */
/* TODO: Test with different viewport extension */ /* TODO: Test with different viewport extension */
ReleaseDC(hWnd, hDC); ReleaseDC(hWnd, hDC);
DestroyWindow(hWnd); DestroyWindow(hWnd);
DeleteObject(hRgn); DeleteObject(hRgn);
} }

View file

@ -11,141 +11,141 @@ FORCEINLINE
PALETTEENTRY PALETTEENTRY
PALENTRY(BYTE r, BYTE g, BYTE b) PALENTRY(BYTE r, BYTE g, BYTE b)
{ {
PALETTEENTRY ret; PALETTEENTRY ret;
ret.peRed = r; ret.peRed = r;
ret.peGreen = g; ret.peGreen = g;
ret.peBlue = b; ret.peBlue = b;
ret.peFlags = 0; ret.peFlags = 0;
return ret; return ret;
} }
START_TEST(NtUserSelectPalette) START_TEST(NtUserSelectPalette)
{ {
HINSTANCE hinst = GetModuleHandle(NULL); HINSTANCE hinst = GetModuleHandle(NULL);
HPALETTE hPal, hOldPal; HPALETTE hPal, hOldPal;
HWND hWnd; HWND hWnd;
HDC hDC, hCompDC; HDC hDC, hCompDC;
struct struct
{ {
LOGPALETTE logpal; LOGPALETTE logpal;
PALETTEENTRY entry[20]; PALETTEENTRY entry[20];
} pal; } pal;
ZeroMemory(&pal, sizeof(pal)); ZeroMemory(&pal, sizeof(pal));
pal.logpal.palVersion = 0x300; pal.logpal.palVersion = 0x300;
pal.logpal.palNumEntries = 6; pal.logpal.palNumEntries = 6;
pal.entry[0] = PALENTRY(0,0,0); pal.entry[0] = PALENTRY(0,0,0);
pal.entry[1] = PALENTRY(255,255,255); pal.entry[1] = PALENTRY(255,255,255);
pal.entry[2] = PALENTRY(128,128,128); pal.entry[2] = PALENTRY(128,128,128);
pal.entry[3] = PALENTRY(128,0,0); pal.entry[3] = PALENTRY(128,0,0);
pal.entry[4] = PALENTRY(0,128,0); pal.entry[4] = PALENTRY(0,128,0);
pal.entry[5] = PALENTRY(0,0,128); pal.entry[5] = PALENTRY(0,0,128);
hPal = CreatePalette(&pal.logpal); hPal = CreatePalette(&pal.logpal);
ASSERT(hPal); ASSERT(hPal);
TEST(DeleteObject(hPal) == 1); TEST(DeleteObject(hPal) == 1);
hPal = CreatePalette(&pal.logpal); hPal = CreatePalette(&pal.logpal);
ASSERT(hPal); ASSERT(hPal);
/* Create a window */ /* Create a window */
hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE, hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
NULL, NULL, hinst, 0); NULL, NULL, hinst, 0);
hDC = GetDC(hWnd); hDC = GetDC(hWnd);
ASSERT(hDC); ASSERT(hDC);
hCompDC = CreateCompatibleDC(hDC); hCompDC = CreateCompatibleDC(hDC);
ASSERT(hCompDC); ASSERT(hCompDC);
/* Test NULL DC */ /* Test NULL DC */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
hOldPal = NtUserSelectPalette(NULL, hPal, 0); hOldPal = NtUserSelectPalette(NULL, hPal, 0);
TEST(hOldPal == 0); TEST(hOldPal == 0);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
/* Test invalid DC */ /* Test invalid DC */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
hOldPal = NtUserSelectPalette((HDC)-1, hPal, 0); hOldPal = NtUserSelectPalette((HDC)-1, hPal, 0);
TEST(hOldPal == 0); TEST(hOldPal == 0);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
/* Test NULL palette */ /* Test NULL palette */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
hOldPal = NtUserSelectPalette(hDC, NULL, 0); hOldPal = NtUserSelectPalette(hDC, NULL, 0);
TEST(hOldPal == 0); TEST(hOldPal == 0);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
/* Test invalid palette */ /* Test invalid palette */
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
hOldPal = NtUserSelectPalette(hDC, (HPALETTE)-1, 0); hOldPal = NtUserSelectPalette(hDC, (HPALETTE)-1, 0);
TEST(hOldPal == 0); TEST(hOldPal == 0);
TEST(GetLastError() == ERROR_SUCCESS); TEST(GetLastError() == ERROR_SUCCESS);
/* Test valid palette */ /* Test valid palette */
hOldPal = NtUserSelectPalette(hDC, hPal, 0); hOldPal = NtUserSelectPalette(hDC, hPal, 0);
TEST(hOldPal != 0); TEST(hOldPal != 0);
TEST(hOldPal == GetStockObject(DEFAULT_PALETTE)); TEST(hOldPal == GetStockObject(DEFAULT_PALETTE));
/* We cannot Delete the palette */ /* We cannot Delete the palette */
TEST(DeleteObject(hPal) == 0); TEST(DeleteObject(hPal) == 0);
/* We can still select the Palette into a compatible DC */ /* We can still select the Palette into a compatible DC */
hOldPal = NtUserSelectPalette(hCompDC, hPal, 0); hOldPal = NtUserSelectPalette(hCompDC, hPal, 0);
TEST(hOldPal != 0); TEST(hOldPal != 0);
#if 0 #if 0
RealizePalette(hDC); RealizePalette(hDC);
GetClientRect(hWnd, &rect); GetClientRect(hWnd, &rect);
FillRect(hDC, &rect, GetSysColorBrush(COLOR_BTNSHADOW)); FillRect(hDC, &rect, GetSysColorBrush(COLOR_BTNSHADOW));
TEST(GetNearestColor(hDC, RGB(0,0,0)) == RGB(0,0,0)); TEST(GetNearestColor(hDC, RGB(0,0,0)) == RGB(0,0,0));
TEST(GetNearestColor(hDC, RGB(0,0,1)) == RGB(0,0,1)); TEST(GetNearestColor(hDC, RGB(0,0,1)) == RGB(0,0,1));
ReleaseDC(hWnd, hDC); ReleaseDC(hWnd, hDC);
DestroyWindow(hWnd); DestroyWindow(hWnd);
RECT rect; RECT rect;
HBITMAP hBmp; HBITMAP hBmp;
BITMAPINFOHEADER bmih = {sizeof(BITMAPINFOHEADER), // biSize BITMAPINFOHEADER bmih = {sizeof(BITMAPINFOHEADER), // biSize
3, // biWidth 3, // biWidth
3, // biHeight 3, // biHeight
1, // biPlanes 1, // biPlanes
8, // biBitCount 8, // biBitCount
BI_RGB, // biCompression BI_RGB, // biCompression
0, // biSizeImage 0, // biSizeImage
92, // biXPelsPerMeter 92, // biXPelsPerMeter
92, // biYPelsPerMeter 92, // biYPelsPerMeter
6, // biClrUsed 6, // biClrUsed
6}; // biClrImportant 6}; // biClrImportant
BYTE bits[3][3] = {{0,1,2},{3,4,5},{6,1,2}}; BYTE bits[3][3] = {{0,1,2},{3,4,5},{6,1,2}};
struct struct
{ {
BITMAPINFOHEADER bmih; BITMAPINFOHEADER bmih;
RGBQUAD colors[6]; RGBQUAD colors[6];
} bmi = {{sizeof(BITMAPINFOHEADER),3,3,1,8,BI_RGB,0,92,92,6,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,0,0,0},{255,255,255,0},{255,0,0,0},
{0,255,0,0},{0,0,255,0},{128,128,128,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); hBmp = CreateDIBitmap(hCompDC, &bmih, CBM_INIT, &bits, (BITMAPINFO*)&bmi, DIB_RGB_COLORS);
ASSERT(hBmp); ASSERT(hBmp);
SetLastError(0); SetLastError(0);
TEST(NtGdiSelectBitmap(hCompDC, hBmp)); TEST(NtGdiSelectBitmap(hCompDC, hBmp));
hOldPal = NtUserSelectPalette(hCompDC, hPal, 0); hOldPal = NtUserSelectPalette(hCompDC, hPal, 0);
TEST(hOldPal != NULL); TEST(hOldPal != NULL);
RealizePalette(hCompDC); RealizePalette(hCompDC);
TEST(GetNearestColor(hCompDC, RGB(0,0,0)) == RGB(0,0,0)); 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(0,0,1)) == RGB(0,0,0));
TEST(GetNearestColor(hCompDC, RGB(100,0,0)) == 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(250,250,250)) == RGB(255,255,255));
TEST(GetNearestColor(hCompDC, RGB(120,100,110)) == RGB(128,128,128)); TEST(GetNearestColor(hCompDC, RGB(120,100,110)) == RGB(128,128,128));
printf("nearest = 0x%x\n", GetNearestColor(hCompDC, RGB(120,100,110))); printf("nearest = 0x%x\n", GetNearestColor(hCompDC, RGB(120,100,110)));
#endif #endif

View file

@ -11,8 +11,8 @@ START_TEST(NtUserSetTimer)
{ {
// check valid argument // check valid argument
// check for replacement / new timers // check for replacement / new timers
// check when expiries are handled (msgs and calls) // check when expiries are handled (msgs and calls)
} }

View file

@ -9,435 +9,435 @@
START_TEST(NtUserToUnicodeEx) START_TEST(NtUserToUnicodeEx)
{ {
BYTE KeyState[256] = {0}; BYTE KeyState[256] = {0};
WCHAR Buffer[10]; WCHAR Buffer[10];
HKL hkl = LoadKeyboardLayoutW(L"00000409", KLF_NOTELLSHELL); HKL hkl = LoadKeyboardLayoutW(L"00000409", KLF_NOTELLSHELL);
TEST(NtUserToUnicodeEx(27, 1, KeyState, Buffer, 10, 0, 0) == 1); TEST(NtUserToUnicodeEx(27, 1, KeyState, Buffer, 10, 0, 0) == 1);
/* Test with no key pressed */ /* Test with no key pressed */
ZeroMemory(KeyState, 256); ZeroMemory(KeyState, 256);
TEST(NtUserToUnicodeEx(27, 1, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(27, 1, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 27); TEST(Buffer[0] == 27);
TEST(NtUserToUnicodeEx(49, 2, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(49, 2, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '1'); TEST(Buffer[0] == '1');
TEST(NtUserToUnicodeEx(50, 3, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(50, 3, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '2'); TEST(Buffer[0] == '2');
TEST(NtUserToUnicodeEx(51, 4, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(51, 4, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '3'); TEST(Buffer[0] == '3');
TEST(NtUserToUnicodeEx(52, 5, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(52, 5, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '4'); TEST(Buffer[0] == '4');
TEST(NtUserToUnicodeEx(53, 6, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(53, 6, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '5'); TEST(Buffer[0] == '5');
TEST(NtUserToUnicodeEx(54, 7, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(54, 7, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '6'); TEST(Buffer[0] == '6');
TEST(NtUserToUnicodeEx(55, 8, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(55, 8, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '7'); TEST(Buffer[0] == '7');
TEST(NtUserToUnicodeEx(56, 9, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(56, 9, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '8'); TEST(Buffer[0] == '8');
TEST(NtUserToUnicodeEx(57, 10, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(57, 10, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '9'); TEST(Buffer[0] == '9');
TEST(NtUserToUnicodeEx(48, 11, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(48, 11, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '0'); TEST(Buffer[0] == '0');
TEST(NtUserToUnicodeEx(189, 12, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(189, 12, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '-'); TEST(Buffer[0] == '-');
TEST(NtUserToUnicodeEx(187, 13, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(187, 13, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '='); TEST(Buffer[0] == '=');
TEST(NtUserToUnicodeEx(8, 14, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(8, 14, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 8); TEST(Buffer[0] == 8);
TEST(NtUserToUnicodeEx(9, 15, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(9, 15, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 9); TEST(Buffer[0] == 9);
TEST(NtUserToUnicodeEx(81, 16, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(81, 16, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'q'); TEST(Buffer[0] == 'q');
TEST(NtUserToUnicodeEx(87, 17, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(87, 17, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'w'); TEST(Buffer[0] == 'w');
TEST(NtUserToUnicodeEx(69, 18, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(69, 18, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'e'); TEST(Buffer[0] == 'e');
TEST(NtUserToUnicodeEx(82, 19, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(82, 19, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'r'); TEST(Buffer[0] == 'r');
TEST(NtUserToUnicodeEx(84, 20, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(84, 20, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 't'); TEST(Buffer[0] == 't');
TEST(NtUserToUnicodeEx(89, 21, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(89, 21, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'y'); TEST(Buffer[0] == 'y');
TEST(NtUserToUnicodeEx(85, 22, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(85, 22, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'u'); TEST(Buffer[0] == 'u');
TEST(NtUserToUnicodeEx(73, 23, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(73, 23, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'i'); TEST(Buffer[0] == 'i');
TEST(NtUserToUnicodeEx(79, 24, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(79, 24, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'o'); TEST(Buffer[0] == 'o');
TEST(NtUserToUnicodeEx(80, 25, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(80, 25, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'p'); TEST(Buffer[0] == 'p');
TEST(NtUserToUnicodeEx(219, 26, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(219, 26, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '['); TEST(Buffer[0] == '[');
TEST(NtUserToUnicodeEx(221, 27, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(221, 27, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == ']'); TEST(Buffer[0] == ']');
TEST(NtUserToUnicodeEx(13, 28, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(13, 28, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 13); TEST(Buffer[0] == 13);
TEST(NtUserToUnicodeEx(65, 30, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(65, 30, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'a'); TEST(Buffer[0] == 'a');
TEST(NtUserToUnicodeEx(83, 31, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(83, 31, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 's'); TEST(Buffer[0] == 's');
TEST(NtUserToUnicodeEx(68, 32, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(68, 32, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'd'); TEST(Buffer[0] == 'd');
TEST(NtUserToUnicodeEx(70, 33, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(70, 33, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'f'); TEST(Buffer[0] == 'f');
TEST(NtUserToUnicodeEx(71, 34, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(71, 34, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'g'); TEST(Buffer[0] == 'g');
TEST(NtUserToUnicodeEx(72, 35, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(72, 35, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'h'); TEST(Buffer[0] == 'h');
TEST(NtUserToUnicodeEx(74, 36, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(74, 36, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'j'); TEST(Buffer[0] == 'j');
TEST(NtUserToUnicodeEx(75, 37, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(75, 37, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'k'); TEST(Buffer[0] == 'k');
TEST(NtUserToUnicodeEx(76, 38, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(76, 38, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'l'); TEST(Buffer[0] == 'l');
TEST(NtUserToUnicodeEx(186, 39, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(186, 39, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == ';'); TEST(Buffer[0] == ';');
TEST(NtUserToUnicodeEx(222, 40, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(222, 40, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '\''); TEST(Buffer[0] == '\'');
TEST(NtUserToUnicodeEx(192, 41, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(192, 41, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '`'); TEST(Buffer[0] == '`');
TEST(NtUserToUnicodeEx(220, 43, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(220, 43, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '\\'); TEST(Buffer[0] == '\\');
TEST(NtUserToUnicodeEx(90, 44, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(90, 44, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'z'); TEST(Buffer[0] == 'z');
TEST(NtUserToUnicodeEx(88, 45, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(88, 45, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'x'); TEST(Buffer[0] == 'x');
TEST(NtUserToUnicodeEx(67, 46, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(67, 46, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'c'); TEST(Buffer[0] == 'c');
TEST(NtUserToUnicodeEx(86, 47, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(86, 47, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'v'); TEST(Buffer[0] == 'v');
TEST(NtUserToUnicodeEx(66, 48, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(66, 48, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'b'); TEST(Buffer[0] == 'b');
TEST(NtUserToUnicodeEx(78, 49, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(78, 49, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'n'); TEST(Buffer[0] == 'n');
TEST(NtUserToUnicodeEx(77, 50, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(77, 50, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'm'); TEST(Buffer[0] == 'm');
TEST(NtUserToUnicodeEx(188, 51, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(188, 51, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == ','); TEST(Buffer[0] == ',');
TEST(NtUserToUnicodeEx(190, 52, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(190, 52, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '.'); TEST(Buffer[0] == '.');
TEST(NtUserToUnicodeEx(191, 53, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(191, 53, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '/'); TEST(Buffer[0] == '/');
TEST(NtUserToUnicodeEx(106, 55, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(106, 55, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '*'); TEST(Buffer[0] == '*');
TEST(NtUserToUnicodeEx(32, 57, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(32, 57, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == ' '); TEST(Buffer[0] == ' ');
TEST(NtUserToUnicodeEx(109, 74, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(109, 74, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '-'); TEST(Buffer[0] == '-');
TEST(NtUserToUnicodeEx(107, 78, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(107, 78, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '+'); TEST(Buffer[0] == '+');
TEST(NtUserToUnicodeEx(226, 86, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(226, 86, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '\\'); TEST(Buffer[0] == '\\');
TEST(NtUserToUnicodeEx(9, 124, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(9, 124, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 9); TEST(Buffer[0] == 9);
/* Test with shift key pressed */ /* Test with shift key pressed */
ZeroMemory(KeyState, 256); ZeroMemory(KeyState, 256);
KeyState[VK_SHIFT] = 0xff; KeyState[VK_SHIFT] = 0xff;
TEST(NtUserToUnicodeEx(27, 1, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(27, 1, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 27); TEST(Buffer[0] == 27);
TEST(NtUserToUnicodeEx(49, 2, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(49, 2, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '!'); TEST(Buffer[0] == '!');
TEST(NtUserToUnicodeEx(50, 3, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(50, 3, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '@'); TEST(Buffer[0] == '@');
TEST(NtUserToUnicodeEx(51, 4, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(51, 4, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '#'); TEST(Buffer[0] == '#');
TEST(NtUserToUnicodeEx(52, 5, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(52, 5, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '$'); TEST(Buffer[0] == '$');
TEST(NtUserToUnicodeEx(53, 6, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(53, 6, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '%'); TEST(Buffer[0] == '%');
TEST(NtUserToUnicodeEx(54, 7, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(54, 7, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '^'); TEST(Buffer[0] == '^');
TEST(NtUserToUnicodeEx(55, 8, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(55, 8, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '&'); TEST(Buffer[0] == '&');
TEST(NtUserToUnicodeEx(56, 9, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(56, 9, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '*'); TEST(Buffer[0] == '*');
TEST(NtUserToUnicodeEx(57, 10, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(57, 10, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '('); TEST(Buffer[0] == '(');
TEST(NtUserToUnicodeEx(48, 11, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(48, 11, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == ')'); TEST(Buffer[0] == ')');
TEST(NtUserToUnicodeEx(189, 12, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(189, 12, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '_'); TEST(Buffer[0] == '_');
TEST(NtUserToUnicodeEx(187, 13, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(187, 13, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '+'); TEST(Buffer[0] == '+');
TEST(NtUserToUnicodeEx(8, 14, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(8, 14, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 8); TEST(Buffer[0] == 8);
TEST(NtUserToUnicodeEx(9, 15, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(9, 15, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 9); TEST(Buffer[0] == 9);
TEST(NtUserToUnicodeEx(81, 16, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(81, 16, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'Q'); TEST(Buffer[0] == 'Q');
TEST(NtUserToUnicodeEx(87, 17, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(87, 17, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'W'); TEST(Buffer[0] == 'W');
TEST(NtUserToUnicodeEx(69, 18, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(69, 18, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'E'); TEST(Buffer[0] == 'E');
TEST(NtUserToUnicodeEx(82, 19, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(82, 19, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'R'); TEST(Buffer[0] == 'R');
TEST(NtUserToUnicodeEx(84, 20, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(84, 20, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'T'); TEST(Buffer[0] == 'T');
TEST(NtUserToUnicodeEx(89, 21, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(89, 21, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'Y'); TEST(Buffer[0] == 'Y');
TEST(NtUserToUnicodeEx(85, 22, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(85, 22, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'U'); TEST(Buffer[0] == 'U');
TEST(NtUserToUnicodeEx(73, 23, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(73, 23, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'I'); TEST(Buffer[0] == 'I');
TEST(NtUserToUnicodeEx(79, 24, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(79, 24, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'O'); TEST(Buffer[0] == 'O');
TEST(NtUserToUnicodeEx(80, 25, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(80, 25, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'P'); TEST(Buffer[0] == 'P');
TEST(NtUserToUnicodeEx(219, 26, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(219, 26, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '{'); TEST(Buffer[0] == '{');
TEST(NtUserToUnicodeEx(221, 27, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(221, 27, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '}'); TEST(Buffer[0] == '}');
TEST(NtUserToUnicodeEx(13, 28, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(13, 28, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 13); TEST(Buffer[0] == 13);
TEST(NtUserToUnicodeEx(65, 30, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(65, 30, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'A'); TEST(Buffer[0] == 'A');
TEST(NtUserToUnicodeEx(83, 31, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(83, 31, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'S'); TEST(Buffer[0] == 'S');
TEST(NtUserToUnicodeEx(68, 32, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(68, 32, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'D'); TEST(Buffer[0] == 'D');
TEST(NtUserToUnicodeEx(70, 33, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(70, 33, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'F'); TEST(Buffer[0] == 'F');
TEST(NtUserToUnicodeEx(71, 34, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(71, 34, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'G'); TEST(Buffer[0] == 'G');
TEST(NtUserToUnicodeEx(72, 35, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(72, 35, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'H'); TEST(Buffer[0] == 'H');
TEST(NtUserToUnicodeEx(74, 36, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(74, 36, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'J'); TEST(Buffer[0] == 'J');
TEST(NtUserToUnicodeEx(75, 37, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(75, 37, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'K'); TEST(Buffer[0] == 'K');
TEST(NtUserToUnicodeEx(76, 38, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(76, 38, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'L'); TEST(Buffer[0] == 'L');
TEST(NtUserToUnicodeEx(186, 39, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(186, 39, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == ':'); TEST(Buffer[0] == ':');
TEST(NtUserToUnicodeEx(222, 40, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(222, 40, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '"'); TEST(Buffer[0] == '"');
TEST(NtUserToUnicodeEx(192, 41, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(192, 41, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '~'); TEST(Buffer[0] == '~');
TEST(NtUserToUnicodeEx(220, 43, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(220, 43, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '|'); TEST(Buffer[0] == '|');
TEST(NtUserToUnicodeEx(90, 44, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(90, 44, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'Z'); TEST(Buffer[0] == 'Z');
TEST(NtUserToUnicodeEx(88, 45, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(88, 45, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'X'); TEST(Buffer[0] == 'X');
TEST(NtUserToUnicodeEx(67, 46, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(67, 46, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'C'); TEST(Buffer[0] == 'C');
TEST(NtUserToUnicodeEx(86, 47, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(86, 47, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'V'); TEST(Buffer[0] == 'V');
TEST(NtUserToUnicodeEx(66, 48, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(66, 48, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'B'); TEST(Buffer[0] == 'B');
TEST(NtUserToUnicodeEx(78, 49, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(78, 49, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'N'); TEST(Buffer[0] == 'N');
TEST(NtUserToUnicodeEx(77, 50, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(77, 50, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'M'); TEST(Buffer[0] == 'M');
TEST(NtUserToUnicodeEx(188, 51, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(188, 51, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '<'); TEST(Buffer[0] == '<');
TEST(NtUserToUnicodeEx(190, 52, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(190, 52, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '>'); TEST(Buffer[0] == '>');
TEST(NtUserToUnicodeEx(191, 53, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(191, 53, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '?'); TEST(Buffer[0] == '?');
TEST(NtUserToUnicodeEx(106, 55, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(106, 55, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '*'); TEST(Buffer[0] == '*');
TEST(NtUserToUnicodeEx(32, 57, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(32, 57, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == ' '); TEST(Buffer[0] == ' ');
TEST(NtUserToUnicodeEx(109, 74, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(109, 74, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '-'); TEST(Buffer[0] == '-');
TEST(NtUserToUnicodeEx(107, 78, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(107, 78, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '+'); TEST(Buffer[0] == '+');
TEST(NtUserToUnicodeEx(226, 86, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(226, 86, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '|'); TEST(Buffer[0] == '|');
TEST(NtUserToUnicodeEx(9, 124, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(9, 124, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 9); TEST(Buffer[0] == 9);
/* Test with ctrl key pressed */ /* Test with ctrl key pressed */
ZeroMemory(KeyState, 256); ZeroMemory(KeyState, 256);
KeyState[VK_CONTROL] = 0xff; KeyState[VK_CONTROL] = 0xff;
// TEST(NtUserToUnicodeEx(27, 1, KeyState, Buffer, 10, 0, hkl) == 1); // TEST(NtUserToUnicodeEx(27, 1, KeyState, Buffer, 10, 0, hkl) == 1);
// TEST(Buffer[0] == 27); // TEST(Buffer[0] == 27);
// TEST(NtUserToUnicodeEx(8, 14, KeyState, Buffer, 10, 0, hkl) == 1); // TEST(NtUserToUnicodeEx(8, 14, KeyState, Buffer, 10, 0, hkl) == 1);
// TEST(Buffer[0] == 127); // TEST(Buffer[0] == 127);
TEST(NtUserToUnicodeEx(81, 16, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(81, 16, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 17); TEST(Buffer[0] == 17);
TEST(NtUserToUnicodeEx(87, 17, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(87, 17, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 23); TEST(Buffer[0] == 23);
TEST(NtUserToUnicodeEx(69, 18, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(69, 18, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 5); TEST(Buffer[0] == 5);
TEST(NtUserToUnicodeEx(82, 19, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(82, 19, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 18); TEST(Buffer[0] == 18);
TEST(NtUserToUnicodeEx(84, 20, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(84, 20, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 20); TEST(Buffer[0] == 20);
TEST(NtUserToUnicodeEx(89, 21, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(89, 21, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 25); TEST(Buffer[0] == 25);
TEST(NtUserToUnicodeEx(85, 22, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(85, 22, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 21); TEST(Buffer[0] == 21);
TEST(NtUserToUnicodeEx(73, 23, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(73, 23, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 9); TEST(Buffer[0] == 9);
TEST(NtUserToUnicodeEx(79, 24, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(79, 24, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 15); TEST(Buffer[0] == 15);
TEST(NtUserToUnicodeEx(80, 25, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(80, 25, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 16); TEST(Buffer[0] == 16);
TEST(NtUserToUnicodeEx(219, 26, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(219, 26, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 27); TEST(Buffer[0] == 27);
TEST(NtUserToUnicodeEx(221, 27, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(221, 27, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 29); TEST(Buffer[0] == 29);
TEST(NtUserToUnicodeEx(13, 28, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(13, 28, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 10); TEST(Buffer[0] == 10);
TEST(NtUserToUnicodeEx(65, 30, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(65, 30, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 1); TEST(Buffer[0] == 1);
TEST(NtUserToUnicodeEx(83, 31, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(83, 31, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 19); TEST(Buffer[0] == 19);
TEST(NtUserToUnicodeEx(68, 32, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(68, 32, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 4); TEST(Buffer[0] == 4);
TEST(NtUserToUnicodeEx(70, 33, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(70, 33, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 6); TEST(Buffer[0] == 6);
TEST(NtUserToUnicodeEx(71, 34, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(71, 34, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 7); TEST(Buffer[0] == 7);
TEST(NtUserToUnicodeEx(72, 35, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(72, 35, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 8); TEST(Buffer[0] == 8);
TEST(NtUserToUnicodeEx(74, 36, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(74, 36, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 10); TEST(Buffer[0] == 10);
TEST(NtUserToUnicodeEx(75, 37, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(75, 37, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 11); TEST(Buffer[0] == 11);
TEST(NtUserToUnicodeEx(76, 38, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(76, 38, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 12); TEST(Buffer[0] == 12);
TEST(NtUserToUnicodeEx(220, 43, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(220, 43, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 28); TEST(Buffer[0] == 28);
TEST(NtUserToUnicodeEx(90, 44, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(90, 44, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 26); TEST(Buffer[0] == 26);
TEST(NtUserToUnicodeEx(88, 45, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(88, 45, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 24); TEST(Buffer[0] == 24);
TEST(NtUserToUnicodeEx(67, 46, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(67, 46, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 3); TEST(Buffer[0] == 3);
TEST(NtUserToUnicodeEx(86, 47, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(86, 47, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 22); TEST(Buffer[0] == 22);
TEST(NtUserToUnicodeEx(66, 48, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(66, 48, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 2); TEST(Buffer[0] == 2);
TEST(NtUserToUnicodeEx(78, 49, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(78, 49, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 14); TEST(Buffer[0] == 14);
TEST(NtUserToUnicodeEx(77, 50, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(77, 50, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 13); TEST(Buffer[0] == 13);
// TEST(NtUserToUnicodeEx(32, 57, KeyState, Buffer, 10, 0, hkl) == 1); // TEST(NtUserToUnicodeEx(32, 57, KeyState, Buffer, 10, 0, hkl) == 1);
// TEST(Buffer[0] == 32); // TEST(Buffer[0] == 32);
TEST(NtUserToUnicodeEx(226, 86, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(226, 86, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 28); TEST(Buffer[0] == 28);
/* Test with VK_CAPITAL key pressed */ /* Test with VK_CAPITAL key pressed */
ZeroMemory(KeyState, 256); ZeroMemory(KeyState, 256);
KeyState[VK_CAPITAL] = 0xff; KeyState[VK_CAPITAL] = 0xff;
TEST(NtUserToUnicodeEx(27, 1, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(27, 1, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 27); TEST(Buffer[0] == 27);
TEST(NtUserToUnicodeEx(49, 2, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(49, 2, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '1'); TEST(Buffer[0] == '1');
TEST(NtUserToUnicodeEx(50, 3, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(50, 3, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '2'); TEST(Buffer[0] == '2');
TEST(NtUserToUnicodeEx(51, 4, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(51, 4, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '3'); TEST(Buffer[0] == '3');
TEST(NtUserToUnicodeEx(52, 5, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(52, 5, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '4'); TEST(Buffer[0] == '4');
TEST(NtUserToUnicodeEx(53, 6, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(53, 6, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '5'); TEST(Buffer[0] == '5');
TEST(NtUserToUnicodeEx(54, 7, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(54, 7, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '6'); TEST(Buffer[0] == '6');
TEST(NtUserToUnicodeEx(55, 8, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(55, 8, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '7'); TEST(Buffer[0] == '7');
TEST(NtUserToUnicodeEx(56, 9, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(56, 9, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '8'); TEST(Buffer[0] == '8');
TEST(NtUserToUnicodeEx(57, 10, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(57, 10, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '9'); TEST(Buffer[0] == '9');
TEST(NtUserToUnicodeEx(48, 11, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(48, 11, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '0'); TEST(Buffer[0] == '0');
TEST(NtUserToUnicodeEx(189, 12, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(189, 12, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '-'); TEST(Buffer[0] == '-');
TEST(NtUserToUnicodeEx(187, 13, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(187, 13, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '='); TEST(Buffer[0] == '=');
TEST(NtUserToUnicodeEx(8, 14, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(8, 14, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 8); TEST(Buffer[0] == 8);
TEST(NtUserToUnicodeEx(9, 15, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(9, 15, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 9); TEST(Buffer[0] == 9);
TEST(NtUserToUnicodeEx(81, 16, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(81, 16, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'Q'); TEST(Buffer[0] == 'Q');
TEST(NtUserToUnicodeEx(87, 17, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(87, 17, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'W'); TEST(Buffer[0] == 'W');
TEST(NtUserToUnicodeEx(69, 18, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(69, 18, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'E'); TEST(Buffer[0] == 'E');
TEST(NtUserToUnicodeEx(82, 19, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(82, 19, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'R'); TEST(Buffer[0] == 'R');
TEST(NtUserToUnicodeEx(84, 20, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(84, 20, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'T'); TEST(Buffer[0] == 'T');
TEST(NtUserToUnicodeEx(89, 21, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(89, 21, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'Y'); TEST(Buffer[0] == 'Y');
TEST(NtUserToUnicodeEx(85, 22, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(85, 22, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'U'); TEST(Buffer[0] == 'U');
TEST(NtUserToUnicodeEx(73, 23, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(73, 23, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'I'); TEST(Buffer[0] == 'I');
TEST(NtUserToUnicodeEx(79, 24, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(79, 24, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'O'); TEST(Buffer[0] == 'O');
TEST(NtUserToUnicodeEx(80, 25, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(80, 25, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'P'); TEST(Buffer[0] == 'P');
TEST(NtUserToUnicodeEx(219, 26, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(219, 26, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '['); TEST(Buffer[0] == '[');
TEST(NtUserToUnicodeEx(221, 27, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(221, 27, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == ']'); TEST(Buffer[0] == ']');
TEST(NtUserToUnicodeEx(13, 28, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(13, 28, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 13); TEST(Buffer[0] == 13);
TEST(NtUserToUnicodeEx(65, 30, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(65, 30, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'A'); TEST(Buffer[0] == 'A');
TEST(NtUserToUnicodeEx(83, 31, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(83, 31, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'S'); TEST(Buffer[0] == 'S');
TEST(NtUserToUnicodeEx(68, 32, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(68, 32, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'D'); TEST(Buffer[0] == 'D');
TEST(NtUserToUnicodeEx(70, 33, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(70, 33, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'F'); TEST(Buffer[0] == 'F');
TEST(NtUserToUnicodeEx(71, 34, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(71, 34, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'G'); TEST(Buffer[0] == 'G');
TEST(NtUserToUnicodeEx(72, 35, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(72, 35, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'H'); TEST(Buffer[0] == 'H');
TEST(NtUserToUnicodeEx(74, 36, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(74, 36, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'J'); TEST(Buffer[0] == 'J');
TEST(NtUserToUnicodeEx(75, 37, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(75, 37, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'K'); TEST(Buffer[0] == 'K');
TEST(NtUserToUnicodeEx(76, 38, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(76, 38, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'L'); TEST(Buffer[0] == 'L');
TEST(NtUserToUnicodeEx(186, 39, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(186, 39, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == ';'); TEST(Buffer[0] == ';');
TEST(NtUserToUnicodeEx(222, 40, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(222, 40, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '\''); TEST(Buffer[0] == '\'');
TEST(NtUserToUnicodeEx(192, 41, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(192, 41, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '`'); TEST(Buffer[0] == '`');
TEST(NtUserToUnicodeEx(220, 43, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(220, 43, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '\\'); TEST(Buffer[0] == '\\');
TEST(NtUserToUnicodeEx(90, 44, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(90, 44, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'Z'); TEST(Buffer[0] == 'Z');
TEST(NtUserToUnicodeEx(88, 45, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(88, 45, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'X'); TEST(Buffer[0] == 'X');
TEST(NtUserToUnicodeEx(67, 46, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(67, 46, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'C'); TEST(Buffer[0] == 'C');
TEST(NtUserToUnicodeEx(86, 47, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(86, 47, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'V'); TEST(Buffer[0] == 'V');
TEST(NtUserToUnicodeEx(66, 48, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(66, 48, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'B'); TEST(Buffer[0] == 'B');
TEST(NtUserToUnicodeEx(78, 49, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(78, 49, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'N'); TEST(Buffer[0] == 'N');
TEST(NtUserToUnicodeEx(77, 50, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(77, 50, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 'M'); TEST(Buffer[0] == 'M');
TEST(NtUserToUnicodeEx(188, 51, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(188, 51, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == ','); TEST(Buffer[0] == ',');
TEST(NtUserToUnicodeEx(190, 52, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(190, 52, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '.'); TEST(Buffer[0] == '.');
TEST(NtUserToUnicodeEx(191, 53, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(191, 53, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '/'); TEST(Buffer[0] == '/');
TEST(NtUserToUnicodeEx(106, 55, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(106, 55, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '*'); TEST(Buffer[0] == '*');
TEST(NtUserToUnicodeEx(32, 57, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(32, 57, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == ' '); TEST(Buffer[0] == ' ');
TEST(NtUserToUnicodeEx(109, 74, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(109, 74, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '-'); TEST(Buffer[0] == '-');
TEST(NtUserToUnicodeEx(107, 78, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(107, 78, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '+'); TEST(Buffer[0] == '+');
TEST(NtUserToUnicodeEx(226, 86, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(226, 86, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == '\\'); TEST(Buffer[0] == '\\');
TEST(NtUserToUnicodeEx(9, 124, KeyState, Buffer, 10, 0, hkl) == 1); TEST(NtUserToUnicodeEx(9, 124, KeyState, Buffer, 10, 0, hkl) == 1);
TEST(Buffer[0] == 9); TEST(Buffer[0] == 9);
} }

View file

@ -16,35 +16,35 @@ ASPI gHWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID = {-1,-1,0x51,-1,0x52};
BOOL InitOsVersion() BOOL InitOsVersion()
{ {
g_OsVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); g_OsVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
GetVersionExW((LPOSVERSIONINFOW)&g_OsVer); GetVersionExW((LPOSVERSIONINFOW)&g_OsVer);
if (g_OsVer.dwMajorVersion == 4) if (g_OsVer.dwMajorVersion == 4)
{ {
g_OsIdx = 0; g_OsIdx = 0;
return TRUE; return TRUE;
} }
else if (g_OsVer.dwMajorVersion == 5) else if (g_OsVer.dwMajorVersion == 5)
{ {
if (g_OsVer.dwMinorVersion == 0) if (g_OsVer.dwMinorVersion == 0)
{ {
g_OsIdx = 1; g_OsIdx = 1;
return TRUE; return TRUE;
} }
else if (g_OsVer.dwMinorVersion == 1) else if (g_OsVer.dwMinorVersion == 1)
{ {
g_OsIdx = 2; g_OsIdx = 2;
return TRUE; return TRUE;
} }
else if (g_OsVer.dwMinorVersion == 2) else if (g_OsVer.dwMinorVersion == 2)
{ {
g_OsIdx = 3; g_OsIdx = 3;
return TRUE; return TRUE;
} }
} }
else if (g_OsVer.dwMajorVersion == 6) else if (g_OsVer.dwMajorVersion == 6)
{ {
g_OsIdx = 4; g_OsIdx = 4;
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }

View file

@ -8,9 +8,9 @@ static
PGDI_TABLE_ENTRY PGDI_TABLE_ENTRY
MyGdiQueryTable() MyGdiQueryTable()
{ {
PTEB pTeb = NtCurrentTeb(); PTEB pTeb = NtCurrentTeb();
PPEB pPeb = pTeb->ProcessEnvironmentBlock; PPEB pPeb = pTeb->ProcessEnvironmentBlock;
return pPeb->GdiSharedHandleTable; return pPeb->GdiSharedHandleTable;
} }
BOOL BOOL
@ -49,66 +49,66 @@ GetHandleUserData(HGDIOBJ hobj)
static DWORD WINAPI static DWORD WINAPI
IntSyscall(FARPROC proc, UINT cParams, PVOID pFirstParam) IntSyscall(FARPROC proc, UINT cParams, PVOID pFirstParam)
{ {
DWORD retval; DWORD retval;
#ifdef __GNUC__ #ifdef __GNUC__
asm volatile asm volatile
( (
"pushfl;" // Save flags "pushfl;" // Save flags
"movl %%ecx, %%eax;" "movl %%ecx, %%eax;"
"shl $2, %%eax;" // Calculate param size "shl $2, %%eax;" // Calculate param size
"subl %%eax, %%esp;" // Calculate new stack pos "subl %%eax, %%esp;" // Calculate new stack pos
"movl %%esp, %%edi;" // Destination is stackpointer "movl %%esp, %%edi;" // Destination is stackpointer
"cld;" // Clear direction flag "cld;" // Clear direction flag
"rep movsd;" // Copy params to the stack "rep movsd;" // Copy params to the stack
"call *%%edx;" // Call function "call *%%edx;" // Call function
"popfl;" // Restore flags "popfl;" // Restore flags
: "=a" (retval) : "=a" (retval)
: "S" (pFirstParam), "c" (cParams), "d"(proc) : "S" (pFirstParam), "c" (cParams), "d"(proc)
: "%edi" : "%edi"
); );
#else #else
__asm __asm
{ {
pushf pushf
mov eax, cParams mov eax, cParams
shl eax, 2 shl eax, 2
sub esp, eax sub esp, eax
mov edi, esp mov edi, esp
cld cld
rep movsd rep movsd
call proc call proc
mov retval, eax mov retval, eax
popf popf
}; };
#endif #endif
return retval; return retval;
} }
DWORD DWORD
Syscall(LPWSTR pszFunction, int cParams, void* pParams) Syscall(LPWSTR pszFunction, int cParams, void* pParams)
{ {
char szFunctionName[MAX_PATH]; char szFunctionName[MAX_PATH];
FARPROC proc; FARPROC proc;
sprintf(szFunctionName, "%ls", pszFunction); sprintf(szFunctionName, "%ls", pszFunction);
proc = (FARPROC)GetProcAddress(g_hModule, szFunctionName); proc = (FARPROC)GetProcAddress(g_hModule, szFunctionName);
if (!proc) if (!proc)
{ {
printf("Couldn't find proc: %s\n", szFunctionName); printf("Couldn't find proc: %s\n", szFunctionName);
return FALSE; return FALSE;
} }
return IntSyscall(proc, cParams, pParams); return IntSyscall(proc, cParams, pParams);
} }
BOOL BOOL
IsFunctionPresent(LPWSTR lpszFunction) IsFunctionPresent(LPWSTR lpszFunction)
{ {
char szFunctionName[MAX_PATH]; char szFunctionName[MAX_PATH];
sprintf(szFunctionName, "%ls", lpszFunction); sprintf(szFunctionName, "%ls", lpszFunction);
return (GetProcAddress(g_hModule, szFunctionName) != NULL); return (GetProcAddress(g_hModule, szFunctionName) != NULL);
} }
int APIENTRY int APIENTRY
@ -117,32 +117,32 @@ WinMain(HINSTANCE hInstance,
LPSTR lpCmdLine, LPSTR lpCmdLine,
int nCmdShow) int nCmdShow)
{ {
g_hInstance = hInstance; g_hInstance = hInstance;
printf("Win32k native API test\n"); printf("Win32k native API test\n");
/* Convert to gui thread */ /* Convert to gui thread */
// IsGUIThread(TRUE); <- does not exists on win2k // IsGUIThread(TRUE); <- does not exists on win2k
InitOsVersion(); InitOsVersion();
printf("g_OsIdx = %d\n", g_OsIdx); printf("g_OsIdx = %d\n", g_OsIdx);
g_hModule = LoadLibraryW(L"w32kdll.dll"); g_hModule = LoadLibraryW(L"w32kdll.dll");
if (!g_hModule) if (!g_hModule)
{ {
printf("w32kdll.dll not found!\n"); printf("w32kdll.dll not found!\n");
return -1; return -1;
} }
GdiHandleTable = MyGdiQueryTable(); GdiHandleTable = MyGdiQueryTable();
if(!GdiHandleTable) if(!GdiHandleTable)
{ {
FreeLibrary(g_hModule); FreeLibrary(g_hModule);
printf("GdiHandleTable not found!\n"); printf("GdiHandleTable not found!\n");
return -1; return -1;
} }
printf("\n"); printf("\n");
return TestMain(L"w32knapi", L"win32k.sys Nt-Api"); return TestMain(L"w32knapi", L"win32k.sys Nt-Api");
} }

View file

@ -31,9 +31,9 @@
typedef struct typedef struct
{ {
LPWSTR lpszFunction; LPWSTR lpszFunction;
INT nSyscallNum; INT nSyscallNum;
INT nParams; INT nParams;
} SYCALL_ENTRY, *PSYSCALL_ENTRY; } SYCALL_ENTRY, *PSYSCALL_ENTRY;
extern HINSTANCE g_hInstance; extern HINSTANCE g_hInstance;