[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)
{
HANDLE hDirectDraw;
HDC hdc = CreateDCW(L"DISPLAY",NULL,NULL,NULL);
ok(hdc != NULL, "\n");
HANDLE hDirectDraw;
HDC hdc = CreateDCW(L"DISPLAY",NULL,NULL,NULL);
ok(hdc != NULL, "\n");
/* Test ReactX */
ok(NtGdiDdCreateDirectDrawObject(NULL) == NULL, "\n");
ok((hDirectDraw = NtGdiDdCreateDirectDrawObject(hdc)) != NULL, "\n");
/* Test ReactX */
ok(NtGdiDdCreateDirectDrawObject(NULL) == NULL, "\n");
ok((hDirectDraw = NtGdiDdCreateDirectDrawObject(hdc)) != NULL, "\n");
/* Cleanup ReactX setup */
DeleteDC(hdc);
NtGdiDdDeleteDirectDrawObject(hDirectDraw);
/* Cleanup ReactX setup */
DeleteDC(hdc);
NtGdiDdDeleteDirectDrawObject(hDirectDraw);
}

View file

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

View file

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

View file

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

View file

@ -9,44 +9,44 @@
START_TEST(NtGdiCombineRgn)
{
HRGN hRgnDest, hRgn1, hRgn2;
HRGN hRgnDest, hRgn1, hRgn2;
// test what params are accepted for what operations
// 0? invalid? are params maybe ignored in some cases?
// LastError
/* Preparation */
hRgnDest = CreateRectRgn(0,0,1,1);
hRgn1 = CreateRectRgn(1,1,4,4);
hRgn2 = CreateRectRgn(2,2,6,3);
/* Preparation */
hRgnDest = CreateRectRgn(0,0,1,1);
hRgn1 = CreateRectRgn(1,1,4,4);
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, 6), ERROR);
ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, 0), ERROR);
ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, 6), ERROR);
SetLastError(ERROR_SUCCESS);
ok_int(NtGdiCombineRgn(hRgnDest, 0, 0, RGN_AND), ERROR);
ok_long(GetLastError(), ERROR_INVALID_HANDLE);
SetLastError(ERROR_SUCCESS);
ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, 0, RGN_AND), ERROR);
ok_long(GetLastError(), ERROR_INVALID_HANDLE);
SetLastError(ERROR_SUCCESS);
ok_int(NtGdiCombineRgn(hRgnDest, 0, hRgn1, RGN_AND), ERROR);
ok_long(GetLastError(), ERROR_INVALID_HANDLE);
SetLastError(ERROR_SUCCESS);
ok_int(NtGdiCombineRgn(0, hRgn1, hRgn2, RGN_AND), ERROR);
ok_long(GetLastError(), ERROR_INVALID_HANDLE);
SetLastError(ERROR_SUCCESS);
ok_int(NtGdiCombineRgn(hRgnDest, 0, 0, RGN_AND), ERROR);
ok_long(GetLastError(), ERROR_INVALID_HANDLE);
SetLastError(ERROR_SUCCESS);
ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, 0, RGN_AND), ERROR);
ok_long(GetLastError(), ERROR_INVALID_HANDLE);
SetLastError(ERROR_SUCCESS);
ok_int(NtGdiCombineRgn(hRgnDest, 0, hRgn1, RGN_AND), ERROR);
ok_long(GetLastError(), ERROR_INVALID_HANDLE);
SetLastError(ERROR_SUCCESS);
ok_int(NtGdiCombineRgn(0, hRgn1, hRgn2, RGN_AND), ERROR);
ok_long(GetLastError(), ERROR_INVALID_HANDLE);
/* Create intersection */
ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, RGN_AND), SIMPLEREGION);
SetRectRgn(hRgn1, 2, 2, 4, 3);
ok_int(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgn1, RGN_XOR), NULLREGION);
/* Create intersection */
ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, RGN_AND), SIMPLEREGION);
SetRectRgn(hRgn1, 2, 2, 4, 3);
ok_int(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgn1, RGN_XOR), NULLREGION);
/* Create intersection with itself */
SetRectRgn(hRgnDest, 2, 2, 4, 3);
ok_int(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgnDest, RGN_AND), SIMPLEREGION);
SetRectRgn(hRgn1, 2, 2, 4, 3);
ok_int(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgn1, RGN_XOR), NULLREGION);
/* Create intersection with itself */
SetRectRgn(hRgnDest, 2, 2, 4, 3);
ok_int(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgnDest, RGN_AND), SIMPLEREGION);
SetRectRgn(hRgn1, 2, 2, 4, 3);
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)
{
HBITMAP hBmp;
BITMAP bitmap;
BYTE BitmapData[10] = {0x11, 0x22, 0x33};
HBITMAP hBmp;
BITMAP bitmap;
BYTE BitmapData[10] = {0x11, 0x22, 0x33};
/* Test simple params */
SetLastError(ERROR_SUCCESS);
ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 1, NULL)) != NULL, "hBmp was NULL.\n");
ok_long(GetLastError(), ERROR_SUCCESS);
DeleteObject(hBmp);
/* Test simple params */
SetLastError(ERROR_SUCCESS);
ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 1, NULL)) != NULL, "hBmp was NULL.\n");
ok_long(GetLastError(), ERROR_SUCCESS);
DeleteObject(hBmp);
/* Test all zero */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(0, 0, 0, 0, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test all zero */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(0, 0, 0, 0, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test cx == 0 */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(0, 1, 1, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test cx == 0 */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(0, 1, 1, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test negative cx */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(-10, 1, 1, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test negative cx */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(-10, 1, 1, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test cy == 0 */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(1, 0, 1, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test cy == 0 */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(1, 0, 1, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test negative cy */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(1, -2, 1, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test negative cy */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(1, -2, 1, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test negative cy and valid bits */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(1, -2, 1, 1, BitmapData), NULL);
ok_long(GetLastError(), ERROR_SUCCESS);
/* Test negative cy and valid bits */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(1, -2, 1, 1, BitmapData), NULL);
ok_long(GetLastError(), ERROR_SUCCESS);
/* Test negative cy and invalid bits */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(1, -2, 1, 1, (BYTE*)0x80001234), NULL);
ok_long(GetLastError(), ERROR_SUCCESS);
/* Test negative cy and invalid bits */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(1, -2, 1, 1, (BYTE*)0x80001234), NULL);
ok_long(GetLastError(), ERROR_SUCCESS);
/* Test huge size */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(100000, 100000, 1, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_NOT_ENOUGH_MEMORY);
/* Test huge size */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(100000, 100000, 1, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_NOT_ENOUGH_MEMORY);
/* Test huge size and valid bits */
SetLastError(ERROR_SUCCESS);
TEST(NtGdiCreateBitmap(1000, 1000, 1, 1, BitmapData) == NULL);
ok_long(GetLastError(), ERROR_SUCCESS);
/* Test huge size and valid bits */
SetLastError(ERROR_SUCCESS);
TEST(NtGdiCreateBitmap(1000, 1000, 1, 1, BitmapData) == NULL);
ok_long(GetLastError(), ERROR_SUCCESS);
/* Test huge size and invalid bits */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(100000, 100000, 1, 1, (BYTE*)0x80001234), NULL);
ok_long(GetLastError(), ERROR_SUCCESS);
/* Test huge size and invalid bits */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(100000, 100000, 1, 1, (BYTE*)0x80001234), NULL);
ok_long(GetLastError(), ERROR_SUCCESS);
/* Test cPlanes == 0 */
SetLastError(ERROR_SUCCESS);
ok((hBmp = NtGdiCreateBitmap(1, 1, 0, 1, NULL)) != NULL, "hBmp was NULL.\n");
ok_long(GetLastError(), ERROR_SUCCESS);
ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP));
ok_int(bitmap.bmType, 0);
ok_int(bitmap.bmWidth, 1);
ok_int(bitmap.bmHeight, 1);
ok_int(bitmap.bmWidthBytes, 2);
ok_int(bitmap.bmPlanes, 1);
ok_int(bitmap.bmBitsPixel, 1);
DeleteObject(hBmp);
/* Test cPlanes == 0 */
SetLastError(ERROR_SUCCESS);
ok((hBmp = NtGdiCreateBitmap(1, 1, 0, 1, NULL)) != NULL, "hBmp was NULL.\n");
ok_long(GetLastError(), ERROR_SUCCESS);
ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP));
ok_int(bitmap.bmType, 0);
ok_int(bitmap.bmWidth, 1);
ok_int(bitmap.bmHeight, 1);
ok_int(bitmap.bmWidthBytes, 2);
ok_int(bitmap.bmPlanes, 1);
ok_int(bitmap.bmBitsPixel, 1);
DeleteObject(hBmp);
/* Test big cPlanes */
SetLastError(ERROR_SUCCESS);
ok((hBmp = NtGdiCreateBitmap(1, 1, 32, 1, NULL)) != NULL, "hBmp was NULL.\n");
ok_long(GetLastError(), ERROR_SUCCESS);
DeleteObject(hBmp);
/* Test big cPlanes */
SetLastError(ERROR_SUCCESS);
ok((hBmp = NtGdiCreateBitmap(1, 1, 32, 1, NULL)) != NULL, "hBmp was NULL.\n");
ok_long(GetLastError(), ERROR_SUCCESS);
DeleteObject(hBmp);
ok_ptr(NtGdiCreateBitmap(1, 1, 33, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
ok_ptr(NtGdiCreateBitmap(1, 1, 33, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test cBPP == 0 */
SetLastError(ERROR_SUCCESS);
ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 0, NULL)) != NULL, "hBmp was NULL.\n");
ok_long(GetLastError(), ERROR_SUCCESS);
ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP));
ok_int(bitmap.bmType, 0);
ok_int(bitmap.bmWidth, 1);
ok_int(bitmap.bmHeight, 1);
ok_int(bitmap.bmWidthBytes, 2);
ok_int(bitmap.bmPlanes, 1);
ok_int(bitmap.bmBitsPixel, 1);
DeleteObject(hBmp);
/* Test cBPP == 0 */
SetLastError(ERROR_SUCCESS);
ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 0, NULL)) != NULL, "hBmp was NULL.\n");
ok_long(GetLastError(), ERROR_SUCCESS);
ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP));
ok_int(bitmap.bmType, 0);
ok_int(bitmap.bmWidth, 1);
ok_int(bitmap.bmHeight, 1);
ok_int(bitmap.bmWidthBytes, 2);
ok_int(bitmap.bmPlanes, 1);
ok_int(bitmap.bmBitsPixel, 1);
DeleteObject(hBmp);
/* Test negative cBPP */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(1, 1, 1, -1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test negative cBPP */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(1, 1, 1, -1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test bad cBPP */
SetLastError(ERROR_SUCCESS);
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(bitmap.bmBitsPixel, 4);
DeleteObject(hBmp);
/* Test bad cBPP */
SetLastError(ERROR_SUCCESS);
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(bitmap.bmBitsPixel, 4);
DeleteObject(hBmp);
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(bitmap.bmBitsPixel, 8);
DeleteObject(hBmp);
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(bitmap.bmBitsPixel, 8);
DeleteObject(hBmp);
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(bitmap.bmBitsPixel, 16);
DeleteObject(hBmp);
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(bitmap.bmBitsPixel, 16);
DeleteObject(hBmp);
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(bitmap.bmBitsPixel, 24);
DeleteObject(hBmp);
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(bitmap.bmBitsPixel, 24);
DeleteObject(hBmp);
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(bitmap.bmBitsPixel, 24);
DeleteObject(hBmp);
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(bitmap.bmBitsPixel, 24);
DeleteObject(hBmp);
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(bitmap.bmBitsPixel, 32);
DeleteObject(hBmp);
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(bitmap.bmBitsPixel, 32);
DeleteObject(hBmp);
ok_long(GetLastError(), ERROR_SUCCESS);
ok_long(GetLastError(), ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(1, 1, 1, 33, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
ok_ptr(NtGdiCreateBitmap(1, 1, 1, 33, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test bad pointer */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(1, 1, 1, 1, (BYTE*)0x80001234), NULL);
ok_long(GetLastError(), ERROR_SUCCESS);
/* Test bad pointer */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(1, 1, 1, 1, (BYTE*)0x80001234), NULL);
ok_long(GetLastError(), ERROR_SUCCESS);
/* Test pointer alignment */
SetLastError(ERROR_SUCCESS);
ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 1, &BitmapData[1])) != NULL, "hBmp was NULL.\n");
ok_long(GetLastError(), ERROR_SUCCESS);
DeleteObject(hBmp);
/* Test pointer alignment */
SetLastError(ERROR_SUCCESS);
ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 1, &BitmapData[1])) != NULL, "hBmp was NULL.\n");
ok_long(GetLastError(), ERROR_SUCCESS);
DeleteObject(hBmp);
/* Test normal params */
SetLastError(ERROR_SUCCESS);
ok((hBmp = NtGdiCreateBitmap(5, 7, 2, 4, NULL)) != NULL, "hBmp was NULL.\n");
ok_long(GetLastError(), ERROR_SUCCESS);
ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP));
ok_int(bitmap.bmType, 0);
ok_int(bitmap.bmWidth, 5);
ok_int(bitmap.bmHeight, 7);
ok_int(bitmap.bmWidthBytes, 6);
ok_int(bitmap.bmPlanes, 1);
ok_int(bitmap.bmBitsPixel, 8);
DeleteObject(hBmp);
/* Test normal params */
SetLastError(ERROR_SUCCESS);
ok((hBmp = NtGdiCreateBitmap(5, 7, 2, 4, NULL)) != NULL, "hBmp was NULL.\n");
ok_long(GetLastError(), ERROR_SUCCESS);
ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP));
ok_int(bitmap.bmType, 0);
ok_int(bitmap.bmWidth, 5);
ok_int(bitmap.bmHeight, 7);
ok_int(bitmap.bmWidthBytes, 6);
ok_int(bitmap.bmPlanes, 1);
ok_int(bitmap.bmBitsPixel, 8);
DeleteObject(hBmp);
/* Test height 0 params */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(1, 0, 1, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test height 0 params */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(1, 0, 1, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test height -1 params */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(1, -1, 1, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test height -1 params */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(1, -1, 1, 1, NULL), NULL);
ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
/* Test witdth 0 params */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(0, 1, 1, 1, NULL), NULL);
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 0 params */
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(0, 1, 1, 1, NULL), NULL);
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);
SetLastError(ERROR_SUCCESS);
ok_ptr(NtGdiCreateBitmap(-1, 0, 1, 1, NULL), NULL);
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)
{
Test_NtGdiCreateBitmap_Params();
// Test_NtGdiCreateBitmap_Pixel();
Test_NtGdiCreateBitmap_Params();
// Test_NtGdiCreateBitmap_Pixel();
}

View file

@ -9,25 +9,25 @@
START_TEST(NtGdiCreateCompatibleDC)
{
HDC hDC;
HGDIOBJ hObj;
HDC hDC;
HGDIOBJ hObj;
/* Test if aa NULL DC is accepted */
hDC = NtGdiCreateCompatibleDC(NULL);
ok(hDC != NULL, "hDC was NULL.\n");
/* Test if aa NULL DC is accepted */
hDC = NtGdiCreateCompatibleDC(NULL);
ok(hDC != NULL, "hDC was NULL.\n");
/* We select a nwe palette. Note: SelectObject doesn't work with palettes! */
hObj = SelectPalette(hDC, GetStockObject(DEFAULT_PALETTE), 0);
/* The old palette should be GetStockObject(DEFAULT_PALETTE) */
ok_ptr(hObj, GetStockObject(DEFAULT_PALETTE));
/* We select a nwe palette. Note: SelectObject doesn't work with palettes! */
hObj = SelectPalette(hDC, GetStockObject(DEFAULT_PALETTE), 0);
/* The old palette should be GetStockObject(DEFAULT_PALETTE) */
ok_ptr(hObj, GetStockObject(DEFAULT_PALETTE));
/* The default bitmap should be GetStockObject(21) */
hObj = SelectObject(hDC, GetStockObject(21));
ok_ptr(hObj, GetStockObject(21));
/* The default bitmap should be GetStockObject(21) */
hObj = SelectObject(hDC, GetStockObject(21));
ok_ptr(hObj, GetStockObject(21));
/* The default pen should be GetStockObject(BLACK_PEN) */
hObj = SelectObject(hDC, GetStockObject(WHITE_PEN));
ok_ptr(hObj, GetStockObject(BLACK_PEN));
/* The default pen should be GetStockObject(BLACK_PEN) */
hObj = SelectObject(hDC, GetStockObject(WHITE_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
CreateTestPalette()
{
struct
{
LOGPALETTE logpal;
PALETTEENTRY entry[5];
} palstruct =
{ {0x300,5,
{ {1,2,3,0} }},
{ {22,33,44,PC_RESERVED},
{11,55,77,PC_EXPLICIT},
{00,77,66,PC_RESERVED | PC_NOCOLLAPSE},
{12,34,56,78}} };
struct
{
LOGPALETTE logpal;
PALETTEENTRY entry[5];
} palstruct =
{ {0x300,5,
{ {1,2,3,0} }},
{ {22,33,44,PC_RESERVED},
{11,55,77,PC_EXPLICIT},
{00,77,66,PC_RESERVED | PC_NOCOLLAPSE},
{12,34,56,78}} };
return CreatePalette((LOGPALETTE*)&palstruct);
return CreatePalette((LOGPALETTE*)&palstruct);
}
void
Test_NtGdiDoPalette_GdiPalAnimate(void)
{
HPALETTE hPal;
PALETTEENTRY palEntries[5] = {
{0,0,0,0},
{0xff,0xff,0xff,0},
{0x33,0x66,0x99,0},
{0x25,0x84,0x14,0},
{0x12,0x34,0x56,0x11}};
PALETTEENTRY palEntries2[5];
HPALETTE hPal;
PALETTEENTRY palEntries[5] = {
{0,0,0,0},
{0xff,0xff,0xff,0},
{0x33,0x66,0x99,0},
{0x25,0x84,0x14,0},
{0x12,0x34,0x56,0x11}};
PALETTEENTRY palEntries2[5];
/* Test stock palette */
SetLastError(ERROR_SUCCESS);
ok_long(NtGdiDoPalette(GetStockObject(DEFAULT_PALETTE), 0, 1, palEntries, GdiPalAnimate, FALSE), 0);
ok_long(GetLastError(), ERROR_SUCCESS);
/* Test stock palette */
SetLastError(ERROR_SUCCESS);
ok_long(NtGdiDoPalette(GetStockObject(DEFAULT_PALETTE), 0, 1, palEntries, GdiPalAnimate, FALSE), 0);
ok_long(GetLastError(), ERROR_SUCCESS);
/* Test pEntries = NULL */
hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalAnimate, TRUE), 0);
ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalAnimate, FALSE), 0);
DeleteObject(hPal);
/* Test pEntries = NULL */
hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalAnimate, TRUE), 0);
ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalAnimate, FALSE), 0);
DeleteObject(hPal);
/* Test PC_RESERVED */
hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, TRUE), 2);
DeleteObject(hPal);
/* Test PC_RESERVED */
hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, TRUE), 2);
DeleteObject(hPal);
hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 1, 5, palEntries, GdiPalAnimate, TRUE), 2);
DeleteObject(hPal);
hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 1, 5, palEntries, GdiPalAnimate, TRUE), 2);
DeleteObject(hPal);
hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 2, 5, palEntries, GdiPalAnimate, TRUE), 1);
DeleteObject(hPal);
hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 2, 5, palEntries, GdiPalAnimate, TRUE), 1);
DeleteObject(hPal);
hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 3, 5, palEntries, GdiPalAnimate, TRUE), 1);
DeleteObject(hPal);
hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 3, 5, palEntries, GdiPalAnimate, TRUE), 1);
DeleteObject(hPal);
hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 4, 5, palEntries, GdiPalAnimate, TRUE), 0);
DeleteObject(hPal);
hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 4, 5, palEntries, GdiPalAnimate, TRUE), 0);
DeleteObject(hPal);
hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 5, 5, palEntries, GdiPalAnimate, TRUE), 0);
DeleteObject(hPal);
hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 5, 5, palEntries, GdiPalAnimate, TRUE), 0);
DeleteObject(hPal);
hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, FALSE), 2);
DeleteObject(hPal);
hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, FALSE), 2);
DeleteObject(hPal);
hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 3, 5, palEntries, GdiPalAnimate, FALSE), 1);
DeleteObject(hPal);
hPal = CreateTestPalette();
ok_long(NtGdiDoPalette(hPal, 3, 5, palEntries, GdiPalAnimate, FALSE), 1);
DeleteObject(hPal);
/* Test if entries are set correctly */
hPal = CreateTestPalette();
NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, TRUE);
NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE);
ok_int(palEntries2[0].peRed, 1);
ok_int(palEntries2[0].peGreen, 2);
ok_int(palEntries2[0].peBlue, 3);
ok_int(palEntries2[0].peFlags, 0);
ok_int(palEntries2[1].peRed, palEntries[1].peRed);
ok_int(palEntries2[1].peGreen, palEntries[1].peGreen);
ok_int(palEntries2[1].peBlue, palEntries[1].peBlue);
ok_int(palEntries2[1].peFlags, palEntries[1].peFlags);
ok_int(palEntries2[2].peRed, 11);
ok_int(palEntries2[2].peGreen, 55);
ok_int(palEntries2[2].peBlue, 77);
ok_int(palEntries2[2].peFlags, PC_EXPLICIT);
ok_int(palEntries2[3].peRed, palEntries[3].peRed);
ok_int(palEntries2[3].peGreen, palEntries[3].peGreen);
ok_int(palEntries2[3].peBlue, palEntries[3].peBlue);
ok_int(palEntries2[3].peFlags, palEntries[3].peFlags);
DeleteObject(hPal);
/* Test if entries are set correctly */
hPal = CreateTestPalette();
NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, TRUE);
NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE);
ok_int(palEntries2[0].peRed, 1);
ok_int(palEntries2[0].peGreen, 2);
ok_int(palEntries2[0].peBlue, 3);
ok_int(palEntries2[0].peFlags, 0);
ok_int(palEntries2[1].peRed, palEntries[1].peRed);
ok_int(palEntries2[1].peGreen, palEntries[1].peGreen);
ok_int(palEntries2[1].peBlue, palEntries[1].peBlue);
ok_int(palEntries2[1].peFlags, palEntries[1].peFlags);
ok_int(palEntries2[2].peRed, 11);
ok_int(palEntries2[2].peGreen, 55);
ok_int(palEntries2[2].peBlue, 77);
ok_int(palEntries2[2].peFlags, PC_EXPLICIT);
ok_int(palEntries2[3].peRed, palEntries[3].peRed);
ok_int(palEntries2[3].peGreen, palEntries[3].peGreen);
ok_int(palEntries2[3].peBlue, palEntries[3].peBlue);
ok_int(palEntries2[3].peFlags, palEntries[3].peFlags);
DeleteObject(hPal);
}
void
Test_NtGdiDoPalette_GdiPalSetEntries(void)
{
HDC hDC;
HPALETTE hPal, hOldPal;
PALETTEENTRY palEntries[5] = {
{0,0,0,0},
{0xff,0xff,0xff,0},
{0x33,0x66,0x99,0},
{0x25,0x84,0x14,0},
{0x12,0x34,0x56,0x11}};
PALETTEENTRY palEntries2[5];
HDC hDC;
HPALETTE hPal, hOldPal;
PALETTEENTRY palEntries[5] = {
{0,0,0,0},
{0xff,0xff,0xff,0},
{0x33,0x66,0x99,0},
{0x25,0x84,0x14,0},
{0x12,0x34,0x56,0x11}};
PALETTEENTRY palEntries2[5];
hPal = CreateTestPalette();
hPal = CreateTestPalette();
/* Test invalid handle */
SetLastError(ERROR_SUCCESS);
ok_long(NtGdiDoPalette((HPALETTE)23, 0, 1, palEntries, GdiPalSetEntries, TRUE), 0);
ok_long(GetLastError(), ERROR_SUCCESS);
/* Test invalid handle */
SetLastError(ERROR_SUCCESS);
ok_long(NtGdiDoPalette((HPALETTE)23, 0, 1, palEntries, GdiPalSetEntries, TRUE), 0);
ok_long(GetLastError(), ERROR_SUCCESS);
/* Test system palette */
ok_long(NtGdiDoPalette(GetStockObject(DEFAULT_PALETTE), 0, 1, palEntries, GdiPalSetEntries, TRUE), 0);
ok_long(GetLastError(), ERROR_SUCCESS);
/* Test system palette */
ok_long(NtGdiDoPalette(GetStockObject(DEFAULT_PALETTE), 0, 1, palEntries, GdiPalSetEntries, TRUE), 0);
ok_long(GetLastError(), ERROR_SUCCESS);
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, 3, palEntries, GdiPalSetEntries, TRUE), 3);
ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE), 5);
ok_long(NtGdiDoPalette(hPal, 0, 6, palEntries, GdiPalSetEntries, TRUE), 5);
ok_long(NtGdiDoPalette(hPal, 3, 6, palEntries, GdiPalSetEntries, TRUE), 2);
// TEST(NtGdiDoPalette(hPal, 4, 23247, palEntries, GdiPalSetEntries, TRUE), 0);
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, 3, palEntries, GdiPalSetEntries, TRUE), 3);
ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE), 5);
ok_long(NtGdiDoPalette(hPal, 0, 6, palEntries, GdiPalSetEntries, TRUE), 5);
ok_long(NtGdiDoPalette(hPal, 3, 6, palEntries, GdiPalSetEntries, TRUE), 2);
// TEST(NtGdiDoPalette(hPal, 4, 23247, palEntries, GdiPalSetEntries, TRUE), 0);
/* Test bInbound, FALSE */
NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE);
ZeroMemory(palEntries2, sizeof(palEntries2));
ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalSetEntries, FALSE), 5);
/* we should get the old values returned in our buffer! */
ok_int(memcmp(palEntries2, palEntries, sizeof(palEntries)), 0);
/* Test bInbound, FALSE */
NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE);
ZeroMemory(palEntries2, sizeof(palEntries2));
ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalSetEntries, FALSE), 5);
/* we should get the old values returned in our buffer! */
ok_int(memcmp(palEntries2, palEntries, sizeof(palEntries)), 0);
/* check what we have in our palette now */
ZeroMemory(palEntries2, sizeof(palEntries2));
ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE), 5);
ok_int(memcmp(palEntries2, palEntries, sizeof(palEntries)), 0);
/* check what we have in our palette now */
ZeroMemory(palEntries2, sizeof(palEntries2));
ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE), 5);
ok_int(memcmp(palEntries2, palEntries, sizeof(palEntries)), 0);
ok_long(NtGdiDoPalette(hPal, 0, 4, palEntries2, GdiPalSetEntries, TRUE), 4);
ok_long(GetLastError(), ERROR_SUCCESS);
ok_long(NtGdiDoPalette(hPal, 0, 4, palEntries2, GdiPalSetEntries, TRUE), 4);
ok_long(GetLastError(), ERROR_SUCCESS);
/* Test if entries are set correctly */
hPal = CreateTestPalette();
NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE);
NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE);
ok_int(palEntries2[0].peRed, 0);
ok_int(palEntries2[0].peGreen, 0);
ok_int(palEntries2[0].peBlue, 0);
ok_int(palEntries2[0].peFlags, 0);
/* Test if entries are set correctly */
hPal = CreateTestPalette();
NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE);
NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE);
ok_int(palEntries2[0].peRed, 0);
ok_int(palEntries2[0].peGreen, 0);
ok_int(palEntries2[0].peBlue, 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 */
hDC = CreateCompatibleDC(NULL);
hOldPal = SelectPalette(hDC, hPal, 0);
ok_long(NtGdiDoPalette(hPal, 0, 4, palEntries, GdiPalSetEntries, TRUE), 4);
SelectPalette(hDC, hOldPal, 0);
/* Test with palette selected into dc */
hDC = CreateCompatibleDC(NULL);
hOldPal = SelectPalette(hDC, hPal, 0);
ok_long(NtGdiDoPalette(hPal, 0, 4, palEntries, GdiPalSetEntries, TRUE), 4);
SelectPalette(hDC, hOldPal, 0);
/* Test pEntries = NULL */
ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, TRUE), 0);
/* Test pEntries = NULL */
ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, TRUE), 0);
}
void
Test_NtGdiDoPalette_GdiPalGetEntries(void)
{
HPALETTE hPal;
HPALETTE hPal;
hPal = CreateTestPalette();
hPal = CreateTestPalette();
/* Test pEntries = NULL */
ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, TRUE), 0);
ok_long(NtGdiDoPalette(hPal, 0, 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, 2, 0, NULL, GdiPalGetEntries, FALSE), 5);
/* Test pEntries = NULL */
ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, TRUE), 0);
ok_long(NtGdiDoPalette(hPal, 0, 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, 2, 0, NULL, GdiPalGetEntries, FALSE), 5);
// Test flags 0xf0
@ -245,7 +245,7 @@ Test_NtGdiDoPalette_SetDIBColorTable(void)
bmi.bmiColors[7] = 0xE0E0E0;
bmi.bmiColors[8] = 0xffffff;
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");
SelectObject(hdc, hbmp);
@ -264,7 +264,7 @@ Test_NtGdiDoPalette_SetDIBColorTable(void)
bmi.bmiColors[2] = 0xC0C0C0;
bmi.bmiColors[1] = 0xE0E0E0;
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);
SetDCBrushColor(hdc, 0x202020);
@ -276,10 +276,10 @@ Test_NtGdiDoPalette_SetDIBColorTable(void)
START_TEST(NtGdiDoPalette)
{
Test_NtGdiDoPalette_GdiPalAnimate();
Test_NtGdiDoPalette_GdiPalSetEntries();
Test_NtGdiDoPalette_GdiPalGetEntries();
Test_NtGdiDoPalette_GetSystemPalette();
Test_NtGdiDoPalette_GetBIBColorTable();
Test_NtGdiDoPalette_SetDIBColorTable();
Test_NtGdiDoPalette_GdiPalAnimate();
Test_NtGdiDoPalette_GdiPalSetEntries();
Test_NtGdiDoPalette_GdiPalGetEntries();
Test_NtGdiDoPalette_GetSystemPalette();
Test_NtGdiDoPalette_GetBIBColorTable();
Test_NtGdiDoPalette_SetDIBColorTable();
}

View file

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

View file

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

View file

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

View file

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

View file

@ -9,60 +9,60 @@
START_TEST(NtGdiGetBitmapBits)
{
BYTE Bits[50] = {0,1,2,3,4,5,6,7,8,9};
HBITMAP hBitmap;
BYTE Bits[50] = {0,1,2,3,4,5,6,7,8,9};
HBITMAP hBitmap;
SetLastError(ERROR_SUCCESS);
ok_long(NtGdiGetBitmapBits(0, 0, 0), 0);
ok_long(GetLastError(), ERROR_INVALID_HANDLE);
SetLastError(ERROR_SUCCESS);
ok_long(NtGdiGetBitmapBits(0, 0, 0), 0);
ok_long(GetLastError(), ERROR_INVALID_HANDLE);
/* Test NULL bitmap handle */
SetLastError(ERROR_SUCCESS);
ok_long(NtGdiGetBitmapBits(0, 5, Bits), 0);
ok_long(GetLastError(), ERROR_INVALID_HANDLE);
/* Test NULL bitmap handle */
SetLastError(ERROR_SUCCESS);
ok_long(NtGdiGetBitmapBits(0, 5, Bits), 0);
ok_long(GetLastError(), ERROR_INVALID_HANDLE);
/* Test invalid bitmap handle */
hBitmap = (HBITMAP)CreatePen(PS_SOLID, 1, RGB(1,2,3));
SetLastError(ERROR_SUCCESS);
ok_long(NtGdiGetBitmapBits(hBitmap, 5, Bits), 0);
ok_long(GetLastError(), ERROR_INVALID_HANDLE);
DeleteObject(hBitmap);
/* Test invalid bitmap handle */
hBitmap = (HBITMAP)CreatePen(PS_SOLID, 1, RGB(1,2,3));
SetLastError(ERROR_SUCCESS);
ok_long(NtGdiGetBitmapBits(hBitmap, 5, Bits), 0);
ok_long(GetLastError(), ERROR_INVALID_HANDLE);
DeleteObject(hBitmap);
hBitmap = CreateBitmap(3, 3, 1, 8, NULL);
SetLastError(ERROR_SUCCESS);
hBitmap = CreateBitmap(3, 3, 1, 8, NULL);
SetLastError(ERROR_SUCCESS);
/* test NULL pointer and count buffer size != 0 */
ok_long(NtGdiGetBitmapBits(hBitmap, 5, NULL), 12);
/* test NULL pointer and count buffer size != 0 */
ok_long(NtGdiGetBitmapBits(hBitmap, 5, NULL), 12);
/* test NULL pointer and buffer size == 0*/
ok_long(NtGdiGetBitmapBits(hBitmap, 0, NULL), 12);
/* test NULL pointer and buffer size == 0*/
ok_long(NtGdiGetBitmapBits(hBitmap, 0, NULL), 12);
/* test bad pointer */
ok_long(NtGdiGetBitmapBits(hBitmap, 5, (PBYTE)0x500), 0);
/* test bad pointer */
ok_long(NtGdiGetBitmapBits(hBitmap, 5, (PBYTE)0x500), 0);
/* Test if we can set a number of bytes between lines */
ok_long(NtGdiGetBitmapBits(hBitmap, 5, Bits), 5);
/* Test if we can set a number of bytes between lines */
ok_long(NtGdiGetBitmapBits(hBitmap, 5, Bits), 5);
/* Test alignment */
ok_long(NtGdiGetBitmapBits(hBitmap, 4, Bits+1), 4);
/* Test alignment */
ok_long(NtGdiGetBitmapBits(hBitmap, 4, Bits+1), 4);
/* Test 1 byte too much */
ok_long(NtGdiGetBitmapBits(hBitmap, 10, Bits), 10);
/* Test 1 byte too much */
ok_long(NtGdiGetBitmapBits(hBitmap, 10, Bits), 10);
/* Test one row too much */
ok_long(NtGdiGetBitmapBits(hBitmap, 12, Bits), 12);
/* Test one row too much */
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 */
ok_long(NtGdiGetBitmapBits(hBitmap, 12345678, Bits), 12);
/* Test huge bytes count */
ok_long(NtGdiGetBitmapBits(hBitmap, 12345678, Bits), 12);
/* Test negative bytes count */
ok_long(NtGdiGetBitmapBits(hBitmap, -5, Bits), 12);
/* Test negative bytes count */
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)
{
HBITMAP hBitmap;
struct
{
BITMAPINFO bi;
RGBQUAD Colors[20];
} bmp;
// BITMAPINFO bi;
INT ScreenBpp;
BITMAPCOREINFO bic;
DWORD data[20*16];
HBITMAP hBitmap;
struct
{
BITMAPINFO bi;
RGBQUAD Colors[20];
} bmp;
// BITMAPINFO bi;
INT ScreenBpp;
BITMAPCOREINFO bic;
DWORD data[20*16];
HDC hDCScreen = GetDC(NULL);
ok(hDCScreen != NULL, "hDCScreen was NULL.\n");
HDC hDCScreen = GetDC(NULL);
ok(hDCScreen != NULL, "hDCScreen was NULL.\n");
hBitmap = CreateCompatibleBitmap(hDCScreen, 16, 16);
ok(hBitmap != NULL, "hBitmap was NULL.\n");
hBitmap = CreateCompatibleBitmap(hDCScreen, 16, 16);
ok(hBitmap != NULL, "hBitmap was NULL.\n");
SetLastError(ERROR_SUCCESS);
ok_int(NtGdiGetDIBitsInternal(0, 0, 0, 0, NULL, NULL, 0, 0, 0), 0);
ok_long(GetLastError(), ERROR_SUCCESS);
SetLastError(ERROR_SUCCESS);
ok_int(NtGdiGetDIBitsInternal(0, 0, 0, 0, NULL, NULL, 0, 0, 0), 0);
ok_long(GetLastError(), ERROR_SUCCESS);
SetLastError(ERROR_SUCCESS);
ok_int(NtGdiGetDIBitsInternal((HDC)2345, 0, 0, 0, NULL, NULL, 0, 0, 0), 0);
ok_long(GetLastError(), ERROR_SUCCESS);
SetLastError(ERROR_SUCCESS);
ok_int(NtGdiGetDIBitsInternal((HDC)2345, 0, 0, 0, NULL, NULL, 0, 0, 0), 0);
ok_long(GetLastError(), ERROR_SUCCESS);
SetLastError(ERROR_SUCCESS);
ok_int(NtGdiGetDIBitsInternal((HDC)2345, hBitmap, 0, 0, NULL, NULL, 0, 0, 0), 0);
ok_long(GetLastError(), ERROR_SUCCESS);
SetLastError(ERROR_SUCCESS);
ok_int(NtGdiGetDIBitsInternal((HDC)2345, hBitmap, 0, 0, NULL, NULL, 0, 0, 0), 0);
ok_long(GetLastError(), ERROR_SUCCESS);
SetLastError(ERROR_SUCCESS);
ok_int(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 0, NULL, NULL, 0, 0, 0), 0);
ok_long(GetLastError(), ERROR_SUCCESS);
SetLastError(ERROR_SUCCESS);
ok_int(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 0, NULL, NULL, 0, 0, 0), 0);
ok_long(GetLastError(), ERROR_SUCCESS);
SetLastError(ERROR_SUCCESS);
ok_int(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, NULL, 0, 0, 0), 0);
ok_long(GetLastError(), ERROR_SUCCESS);
SetLastError(ERROR_SUCCESS);
ok_int(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, NULL, 0, 0, 0), 0);
ok_long(GetLastError(), ERROR_SUCCESS);
ZeroMemory(&bmp, sizeof(bmp));
bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44);
ZeroMemory(&bmp, sizeof(bmp));
bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44);
SetLastError(ERROR_SUCCESS);
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");
ok_long(GetLastError(), ERROR_SUCCESS);
ok_int(bmp.Colors[0].rgbRed, 0x44);
SetLastError(ERROR_SUCCESS);
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");
ok_long(GetLastError(), ERROR_SUCCESS);
ok_int(bmp.Colors[0].rgbRed, 0x44);
ZeroMemory(&bmp, sizeof(bmp));
bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44);
ZeroMemory(&bmp, sizeof(bmp));
bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44);
SetLastError(ERROR_SUCCESS);
ok(NtGdiGetDIBitsInternal((HDC)2345, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) > 0,
"The return value was <= 0.\n");
ok_long(GetLastError(), ERROR_SUCCESS);
ok_int(bmp.Colors[0].rgbRed, 0x44);
SetLastError(ERROR_SUCCESS);
ok(NtGdiGetDIBitsInternal((HDC)2345, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) > 0,
"The return value was <= 0.\n");
ok_long(GetLastError(), ERROR_SUCCESS);
ok_int(bmp.Colors[0].rgbRed, 0x44);
ZeroMemory(&bmp, sizeof(bmp));
bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44);
ZeroMemory(&bmp, sizeof(bmp));
bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44);
SetLastError(ERROR_SUCCESS);
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");
ok_long(GetLastError(), ERROR_SUCCESS);
SetLastError(ERROR_SUCCESS);
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");
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.biHeight, 16);
ok_long(bmp.bi.bmiHeader.biBitCount, ScreenBpp);
ok_long(bmp.bi.bmiHeader.biSizeImage, (16 * 16) * (ScreenBpp / 8));
ok_long(bmp.bi.bmiHeader.biWidth, 16);
ok_long(bmp.bi.bmiHeader.biHeight, 16);
ok_long(bmp.bi.bmiHeader.biBitCount, ScreenBpp);
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 */
// ZeroMemory(&bmp.bi, sizeof(BITMAPINFO));
bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
// FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x11223344);
/* Test with pointer */
// ZeroMemory(&bmp.bi, sizeof(BITMAPINFO));
bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
// FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x11223344);
SetLastError(ERROR_SUCCESS);
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");
ok_long(GetLastError(), ERROR_SUCCESS);
SetLastError(ERROR_SUCCESS);
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");
ok_long(GetLastError(), ERROR_SUCCESS);
ok_long(bmp.bi.bmiHeader.biWidth, 16);
ok_long(bmp.bi.bmiHeader.biHeight, 16);
ok_long(bmp.bi.bmiHeader.biBitCount, ScreenBpp);
ok_long(bmp.bi.bmiHeader.biSizeImage, (16 * 16) * (ScreenBpp / 8));
ok_long(bmp.bi.bmiHeader.biWidth, 16);
ok_long(bmp.bi.bmiHeader.biHeight, 16);
ok_long(bmp.bi.bmiHeader.biBitCount, ScreenBpp);
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 */
SetLastError(ERROR_SUCCESS);
ZeroMemory(&bic, sizeof(BITMAPCOREINFO));
bic.bmciHeader.bcSize = sizeof(BITMAPCOREHEADER);
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");
ok_long(GetLastError(), ERROR_SUCCESS);
/* Test a BITMAPCOREINFO structure */
SetLastError(ERROR_SUCCESS);
ZeroMemory(&bic, sizeof(BITMAPCOREINFO));
bic.bmciHeader.bcSize = sizeof(BITMAPCOREHEADER);
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");
ok_long(GetLastError(), ERROR_SUCCESS);
ReleaseDC(NULL, hDCScreen);
DeleteObject(hBitmap);
ReleaseDC(NULL, hDCScreen);
DeleteObject(hBitmap);
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -9,45 +9,45 @@
START_TEST(NtGdiSelectFont)
{
HDC hDC;
HFONT hFont, hOldFont;
HDC hDC;
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 */
SetLastError(ERROR_SUCCESS);
hOldFont = NtGdiSelectFont(NULL, hFont);
TEST(hOldFont == NULL);
TEST(GetLastError() == ERROR_SUCCESS);
/* Test NULL DC */
SetLastError(ERROR_SUCCESS);
hOldFont = NtGdiSelectFont(NULL, hFont);
TEST(hOldFont == NULL);
TEST(GetLastError() == ERROR_SUCCESS);
/* Test invalid DC */
SetLastError(ERROR_SUCCESS);
hOldFont = NtGdiSelectFont((HDC)((ULONG_PTR)hDC & 0x0000ffff), hFont);
TEST(hOldFont == NULL);
TEST(GetLastError() == ERROR_SUCCESS);
/* Test invalid DC */
SetLastError(ERROR_SUCCESS);
hOldFont = NtGdiSelectFont((HDC)((ULONG_PTR)hDC & 0x0000ffff), hFont);
TEST(hOldFont == NULL);
TEST(GetLastError() == ERROR_SUCCESS);
/* Test NULL font */
SetLastError(ERROR_SUCCESS);
hOldFont = NtGdiSelectFont(hDC, NULL);
TEST(hOldFont == NULL);
TEST(GetLastError() == ERROR_SUCCESS);
/* Test NULL font */
SetLastError(ERROR_SUCCESS);
hOldFont = NtGdiSelectFont(hDC, NULL);
TEST(hOldFont == NULL);
TEST(GetLastError() == ERROR_SUCCESS);
/* Test invalid font */
SetLastError(ERROR_SUCCESS);
hOldFont = NtGdiSelectFont(hDC, (HFONT)((ULONG_PTR)hFont & 0x0000ffff));
TEST(hOldFont == NULL);
TEST(GetLastError() == ERROR_SUCCESS);
/* Test invalid font */
SetLastError(ERROR_SUCCESS);
hOldFont = NtGdiSelectFont(hDC, (HFONT)((ULONG_PTR)hFont & 0x0000ffff));
TEST(hOldFont == NULL);
TEST(GetLastError() == ERROR_SUCCESS);
SetLastError(ERROR_SUCCESS);
hOldFont = NtGdiSelectFont(hDC, hFont);
TEST(hOldFont != NULL);
hOldFont = NtGdiSelectFont(hDC, hOldFont);
TEST(hOldFont == hFont);
TEST(GetLastError() == ERROR_SUCCESS);
SetLastError(ERROR_SUCCESS);
hOldFont = NtGdiSelectFont(hDC, hFont);
TEST(hOldFont != NULL);
hOldFont = NtGdiSelectFont(hDC, hOldFont);
TEST(hOldFont == hFont);
TEST(GetLastError() == ERROR_SUCCESS);
DeleteDC(hDC);
DeleteDC(hDC);
}

View file

@ -9,69 +9,69 @@
START_TEST(NtGdiSelectPen)
{
HDC hDC;
HPEN hPen, hOldPen;
LOGBRUSH logbrush;
HDC hDC;
HPEN hPen, hOldPen;
LOGBRUSH logbrush;
hDC = GetDC(NULL);
ASSERT(hDC);
hDC = GetDC(NULL);
ASSERT(hDC);
hPen = GetStockObject(WHITE_PEN);
hPen = GetStockObject(WHITE_PEN);
/* Test NULL DC */
SetLastError(ERROR_SUCCESS);
hOldPen = NtGdiSelectPen(NULL, hPen);
TEST(hOldPen == NULL);
TEST(GetLastError() == ERROR_SUCCESS);
/* Test NULL DC */
SetLastError(ERROR_SUCCESS);
hOldPen = NtGdiSelectPen(NULL, hPen);
TEST(hOldPen == NULL);
TEST(GetLastError() == ERROR_SUCCESS);
/* Test invalid DC */
SetLastError(ERROR_SUCCESS);
hOldPen = NtGdiSelectPen((HDC)((ULONG_PTR)hDC & 0x0000ffff), hPen);
TEST(hOldPen == NULL);
TEST(GetLastError() == ERROR_SUCCESS);
/* Test invalid DC */
SetLastError(ERROR_SUCCESS);
hOldPen = NtGdiSelectPen((HDC)((ULONG_PTR)hDC & 0x0000ffff), hPen);
TEST(hOldPen == NULL);
TEST(GetLastError() == ERROR_SUCCESS);
/* Test NULL pen */
SetLastError(ERROR_SUCCESS);
hOldPen = NtGdiSelectPen(hDC, NULL);
TEST(hOldPen == NULL);
TEST(GetLastError() == ERROR_SUCCESS);
/* Test NULL pen */
SetLastError(ERROR_SUCCESS);
hOldPen = NtGdiSelectPen(hDC, NULL);
TEST(hOldPen == NULL);
TEST(GetLastError() == ERROR_SUCCESS);
/* Test invalid pen */
SetLastError(ERROR_SUCCESS);
hOldPen = NtGdiSelectPen(hDC, (HPEN)((ULONG_PTR)hPen & 0x0000ffff));
TEST(hOldPen == NULL);
TEST(GetLastError() == ERROR_SUCCESS);
/* Test invalid pen */
SetLastError(ERROR_SUCCESS);
hOldPen = NtGdiSelectPen(hDC, (HPEN)((ULONG_PTR)hPen & 0x0000ffff));
TEST(hOldPen == NULL);
TEST(GetLastError() == ERROR_SUCCESS);
/* Test valid pen */
SelectObject(hDC, GetStockObject(BLACK_PEN));
SetLastError(ERROR_SUCCESS);
hOldPen = NtGdiSelectPen(hDC, hPen);
TEST(hOldPen == GetStockObject(BLACK_PEN));
hOldPen = NtGdiSelectPen(hDC, hOldPen);
TEST(hOldPen == hPen);
TEST(GetLastError() == ERROR_SUCCESS);
/* Test valid pen */
SelectObject(hDC, GetStockObject(BLACK_PEN));
SetLastError(ERROR_SUCCESS);
hOldPen = NtGdiSelectPen(hDC, hPen);
TEST(hOldPen == GetStockObject(BLACK_PEN));
hOldPen = NtGdiSelectPen(hDC, hOldPen);
TEST(hOldPen == hPen);
TEST(GetLastError() == ERROR_SUCCESS);
/* Test extpen */
SetLastError(ERROR_SUCCESS);
logbrush.lbStyle = BS_SOLID;
logbrush.lbColor = RGB(0x12,0x34,0x56);
hPen = ExtCreatePen(PS_COSMETIC|PS_ALTERNATE, 1, &logbrush, 0, NULL);
ASSERT(hPen);
hOldPen = NtGdiSelectPen(hDC, hPen);
TEST(hOldPen != NULL);
hOldPen = NtGdiSelectPen(hDC, hOldPen);
TEST(hOldPen == hPen);
TEST(GetLastError() == ERROR_SUCCESS);
/* Test extpen */
SetLastError(ERROR_SUCCESS);
logbrush.lbStyle = BS_SOLID;
logbrush.lbColor = RGB(0x12,0x34,0x56);
hPen = ExtCreatePen(PS_COSMETIC|PS_ALTERNATE, 1, &logbrush, 0, NULL);
ASSERT(hPen);
hOldPen = NtGdiSelectPen(hDC, hPen);
TEST(hOldPen != NULL);
hOldPen = NtGdiSelectPen(hDC, hOldPen);
TEST(hOldPen == hPen);
TEST(GetLastError() == ERROR_SUCCESS);
/* Test deleting pen */
SetLastError(ERROR_SUCCESS);
hOldPen = NtGdiSelectPen(hDC, hPen);
TEST(DeleteObject(hPen) == 1);
hOldPen = NtGdiSelectPen(hDC, hOldPen);
TEST(hOldPen == hPen);
TEST(GetLastError() == ERROR_SUCCESS);
/* Test deleting pen */
SetLastError(ERROR_SUCCESS);
hOldPen = NtGdiSelectPen(hDC, hPen);
TEST(DeleteObject(hPen) == 1);
hOldPen = NtGdiSelectPen(hDC, hOldPen);
TEST(hOldPen == hPen);
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
ReadBits(HDC hDC, PDWORD OutBits)
{
int x,y;
int x,y;
for (y = 0; y < 8; y++)
{
DWORD Row = 0;
for (x = 0; x < 8; x++)
Row |= (0x80 & GetPixel(hDC, 2 + x, 3 + y)) >> x;
OutBits[y] = Row;
}
for (y = 0; y < 8; y++)
{
DWORD Row = 0;
for (x = 0; x < 8; x++)
Row |= (0x80 & GetPixel(hDC, 2 + x, 3 + y)) >> x;
OutBits[y] = Row;
}
}
START_TEST(NtGdiSetDIBitsToDeviceInternal)
{
static const DWORD InBits[8] = { 0x81, 0x7E, 0x5A, 0x7E, 0x7E, 0x42, 0x7E, 0x81 };
DWORD OutBits[8];
XFORM xform;
static const DWORD InBits[8] = { 0x81, 0x7E, 0x5A, 0x7E, 0x7E, 0x42, 0x7E, 0x81 };
DWORD OutBits[8];
XFORM xform;
HWND hWnd = CreateWindowW(L"Static", NULL, WS_VISIBLE,
100, 100, 200, 200,
NULL, NULL, NULL, NULL);
/* This DC has an nonzero origin */
HDC hDC = GetDC(hWnd);
struct
{
BITMAPINFOHEADER bmiHeader;
RGBQUAD bmiColors[2];
} bmi;
int x, y;
HWND hWnd = CreateWindowW(L"Static", NULL, WS_VISIBLE,
100, 100, 200, 200,
NULL, NULL, NULL, NULL);
/* This DC has an nonzero origin */
HDC hDC = GetDC(hWnd);
struct
{
BITMAPINFOHEADER bmiHeader;
RGBQUAD bmiColors[2];
} bmi;
int x, y;
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = 8;
bmi.bmiHeader.biHeight = -8;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 1;
bmi.bmiHeader.biCompression = 0;
bmi.bmiHeader.biSizeImage = 0;
bmi.bmiHeader.biXPelsPerMeter = 0;
bmi.bmiHeader.biYPelsPerMeter = 0;
bmi.bmiHeader.biClrUsed = 0;
bmi.bmiHeader.biClrImportant = 0;
*(DWORD *)&bmi.bmiColors[0] = 0x000000;
*(DWORD *)&bmi.bmiColors[1] = 0xFFFFFF;
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = 8;
bmi.bmiHeader.biHeight = -8;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 1;
bmi.bmiHeader.biCompression = 0;
bmi.bmiHeader.biSizeImage = 0;
bmi.bmiHeader.biXPelsPerMeter = 0;
bmi.bmiHeader.biYPelsPerMeter = 0;
bmi.bmiHeader.biClrUsed = 0;
bmi.bmiHeader.biClrImportant = 0;
*(DWORD *)&bmi.bmiColors[0] = 0x000000;
*(DWORD *)&bmi.bmiColors[1] = 0xFFFFFF;
/* The destination coordinates are relative to the DC origin */
TEST(NtGdiSetDIBitsToDeviceInternal(hDC, 2, 3, 8, 8, 0, 0, 0, 8,
(PVOID)InBits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS,
sizeof(InBits), sizeof(bmi), TRUE, NULL));
/* The destination coordinates are relative to the DC origin */
TEST(NtGdiSetDIBitsToDeviceInternal(hDC, 2, 3, 8, 8, 0, 0, 0, 8,
(PVOID)InBits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS,
sizeof(InBits), sizeof(bmi), TRUE, NULL));
/* Now get the data from the screen, and see if it matches */
ReadBits(hDC, OutBits);
/* Now get the data from the screen, and see if it matches */
ReadBits(hDC, OutBits);
TEST(memcmp(InBits, OutBits, sizeof(InBits)) == 0);
TEST(memcmp(InBits, OutBits, sizeof(InBits)) == 0);
/* Change transformation */
GetWorldTransform(hDC, &xform);
xform.eM11 = 2;
xform.eM22 = 2;
xform.eDx = 10;
SetWorldTransform(hDC, &xform);
/* Change transformation */
GetWorldTransform(hDC, &xform);
xform.eM11 = 2;
xform.eM22 = 2;
xform.eDx = 10;
SetWorldTransform(hDC, &xform);
TEST(NtGdiSetDIBitsToDeviceInternal(hDC, 2, 3, 8, 8, 0, 0, 0, 8,
(PVOID)InBits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS,
sizeof(InBits), sizeof(bmi), TRUE, NULL));
TEST(NtGdiSetDIBitsToDeviceInternal(hDC, 2, 3, 8, 8, 0, 0, 0, 8,
(PVOID)InBits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS,
sizeof(InBits), sizeof(bmi), TRUE, NULL));
xform.eM11 = 1;
xform.eM22 = 1;
xform.eDx = 0;
SetWorldTransform(hDC, &xform);
xform.eM11 = 1;
xform.eM22 = 1;
xform.eDx = 0;
SetWorldTransform(hDC, &xform);
/* Now get the data from the screen, and see if it matches */
for (y = 0; y < 8; y++)
{
DWORD Row = 0;
for (x = 0; x < 8; x++)
Row |= (0x80 & GetPixel(hDC, 2 + x, 3 + y)) >> x;
OutBits[y] = Row;
}
/* Now get the data from the screen, and see if it matches */
for (y = 0; y < 8; y++)
{
DWORD Row = 0;
for (x = 0; x < 8; x++)
Row |= (0x80 & GetPixel(hDC, 2 + x, 3 + y)) >> x;
OutBits[y] = Row;
}
TEST(memcmp(InBits, OutBits, sizeof(InBits)) == 0);
TEST(memcmp(InBits, OutBits, sizeof(InBits)) == 0);
ReleaseDC(hWnd, hDC);
DestroyWindow(hWnd);
ReleaseDC(hWnd, hDC);
DestroyWindow(hWnd);
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -9,151 +9,151 @@
START_TEST(NtUserGetIconInfo)
{
HICON hIcon;
ICONINFO iinfo;
HBITMAP mask, color;
UNICODE_STRING hInstStr;
UNICODE_STRING ResourceStr;
DWORD bpp = 0;
HICON hIcon;
ICONINFO iinfo;
HBITMAP mask, color;
UNICODE_STRING hInstStr;
UNICODE_STRING ResourceStr;
DWORD bpp = 0;
ZeroMemory(&iinfo, sizeof(ICONINFO));
ZeroMemory(&iinfo, sizeof(ICONINFO));
/* BASIC TESTS */
hIcon = (HICON) NtUserCallOneParam(0, _ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT);
TEST(hIcon != NULL);
/* BASIC TESTS */
hIcon = (HICON) NtUserCallOneParam(0, _ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT);
TEST(hIcon != NULL);
/* Last param is unknown */
TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, FALSE) == FALSE);
TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, TRUE) == FALSE);
/* Last param is unknown */
TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, FALSE) == 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);
color = CreateBitmap(16,16,1,16,NULL);
mask = CreateBitmap(16,16,1,1,NULL);
color = CreateBitmap(16,16,1,16,NULL);
iinfo.hbmMask = mask;
iinfo.hbmColor = color ;
iinfo.fIcon = TRUE;
iinfo.xHotspot = 8;
iinfo.yHotspot = 8;
iinfo.hbmMask = mask;
iinfo.hbmColor = color ;
iinfo.fIcon = TRUE;
iinfo.xHotspot = 8;
iinfo.yHotspot = 8;
hIcon = CreateIconIndirect(&iinfo);
TEST(hIcon!=NULL);
hIcon = CreateIconIndirect(&iinfo);
TEST(hIcon!=NULL);
// TODO : test last parameter...
TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, FALSE) == TRUE);
// TODO : test last parameter...
TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, FALSE) == TRUE);
TEST(iinfo.hbmMask != NULL);
TEST(iinfo.hbmColor != NULL);
TEST(iinfo.fIcon == TRUE);
TEST(iinfo.yHotspot == 8);
TEST(iinfo.xHotspot == 8);
TEST(iinfo.hbmMask != NULL);
TEST(iinfo.hbmColor != NULL);
TEST(iinfo.fIcon == TRUE);
TEST(iinfo.yHotspot == 8);
TEST(iinfo.xHotspot == 8);
TEST(iinfo.hbmMask != mask);
TEST(iinfo.hbmColor != color);
TEST(iinfo.hbmMask != mask);
TEST(iinfo.hbmColor != color);
/* Does it make a difference? */
TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, TRUE) == TRUE);
/* Does it make a difference? */
TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, TRUE) == TRUE);
TEST(iinfo.hbmMask != NULL);
TEST(iinfo.hbmColor != NULL);
TEST(iinfo.fIcon == TRUE);
TEST(iinfo.yHotspot == 8);
TEST(iinfo.xHotspot == 8);
TEST(iinfo.hbmMask != NULL);
TEST(iinfo.hbmColor != NULL);
TEST(iinfo.fIcon == TRUE);
TEST(iinfo.yHotspot == 8);
TEST(iinfo.xHotspot == 8);
TEST(iinfo.hbmMask != mask);
TEST(iinfo.hbmColor != color);
TEST(iinfo.hbmMask != mask);
TEST(iinfo.hbmColor != color);
DeleteObject(mask);
DeleteObject(color);
DeleteObject(mask);
DeleteObject(color);
DestroyIcon(hIcon);
DestroyIcon(hIcon);
/* Test full param, with local icon */
hIcon = LoadImageA(GetModuleHandle(NULL),
MAKEINTRESOURCE(IDI_ICON),
IMAGE_ICON,
0,
0,
LR_DEFAULTSIZE);
/* Test full param, with local icon */
hIcon = LoadImageA(GetModuleHandle(NULL),
MAKEINTRESOURCE(IDI_ICON),
IMAGE_ICON,
0,
0,
LR_DEFAULTSIZE);
TEST(hIcon != NULL);
TEST(hIcon != NULL);
RtlInitUnicodeString(&hInstStr, NULL);
RtlInitUnicodeString(&ResourceStr, NULL);
RtlInitUnicodeString(&hInstStr, NULL);
RtlInitUnicodeString(&ResourceStr, NULL);
TEST(NtUserGetIconInfo(hIcon,
&iinfo,
&hInstStr,
&ResourceStr,
&bpp,
FALSE) == TRUE);
TEST(NtUserGetIconInfo(hIcon,
&iinfo,
&hInstStr,
&ResourceStr,
&bpp,
FALSE) == TRUE);
TESTX(hInstStr.Buffer == NULL, "hInstStr.buffer : %p\n", hInstStr.Buffer);
TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(IDI_ICON));
TEST(bpp == 32);
TESTX(hInstStr.Buffer == NULL, "hInstStr.buffer : %p\n", hInstStr.Buffer);
TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(IDI_ICON));
TEST(bpp == 32);
/* Last param doesn't seem to matter*/
TEST(NtUserGetIconInfo(hIcon,
&iinfo,
&hInstStr,
&ResourceStr,
&bpp,
TRUE) == TRUE);
/* Last param doesn't seem to matter*/
TEST(NtUserGetIconInfo(hIcon,
&iinfo,
&hInstStr,
&ResourceStr,
&bpp,
TRUE) == TRUE);
TESTX(hInstStr.Buffer == NULL, "hInstStr.buffer : %p\n", hInstStr.Buffer);
TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(IDI_ICON));
TEST(bpp == 32);
TESTX(hInstStr.Buffer == NULL, "hInstStr.buffer : %p\n", hInstStr.Buffer);
TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(IDI_ICON));
TEST(bpp == 32);
DestroyIcon(hIcon);
DestroyIcon(hIcon);
/* Test full param, with foreign icon */
hIcon = LoadImageA(GetModuleHandleA("shell32.dll"),
MAKEINTRESOURCE(293),
IMAGE_ICON,
0,
0,
LR_DEFAULTSIZE);
/* Test full param, with foreign icon */
hIcon = LoadImageA(GetModuleHandleA("shell32.dll"),
MAKEINTRESOURCE(293),
IMAGE_ICON,
0,
0,
LR_DEFAULTSIZE);
TEST(hIcon != NULL);
TEST(hIcon != NULL);
hInstStr.Buffer = HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR));
hInstStr.MaximumLength = MAX_PATH;
hInstStr.Length = 0;
RtlInitUnicodeString(&ResourceStr, NULL);
RtlInitUnicodeString(&ResourceStr, NULL);
TEST(NtUserGetIconInfo(hIcon,
&iinfo,
&hInstStr,
&ResourceStr,
&bpp,
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(NtUserGetIconInfo(hIcon,
&iinfo,
&hInstStr,
&ResourceStr,
&bpp,
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(bpp == 32);
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);
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)
{
HINSTANCE hinst = GetModuleHandle(NULL);
HWND hWnd;
RECT rect;
HWND hWnd;
RECT rect;
hWnd = CreateWindowA("BUTTON",
"Test",
BS_PUSHBUTTON | WS_VISIBLE,
0,
0,
50,
30,
NULL,
NULL,
hinst,
0);
ASSERT(hWnd);
hWnd = CreateWindowA("BUTTON",
"Test",
BS_PUSHBUTTON | WS_VISIBLE,
0,
0,
50,
30,
NULL,
NULL,
hinst,
0);
ASSERT(hWnd);
rect.left = 0;
rect.top = 0;
rect.right = 10;
rect.bottom = 10;
rect.left = 0;
rect.top = 0;
rect.right = 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)
{
HINSTANCE hinst = GetModuleHandle(NULL);
HWND hWnd;
HDC hDC;
HRGN hRgn, hTmpRgn;
RECT rcScroll, rcClip, rcUpdate;
RECT rect = {0,0,100,100};
INT Result;
HWND hWnd;
HDC hDC;
HRGN hRgn, hTmpRgn;
RECT rcScroll, rcClip, rcUpdate;
RECT rect = {0,0,100,100};
INT Result;
hWnd = CreateWindowA("BUTTON",
"Test",
BS_PUSHBUTTON | WS_VISIBLE,
0,
0,
50,
100,
NULL,
NULL,
hinst,
0);
ASSERT(hWnd);
RedrawWindow(hWnd, &rect, NULL, RDW_UPDATENOW);
hWnd = CreateWindowA("BUTTON",
"Test",
BS_PUSHBUTTON | WS_VISIBLE,
0,
0,
50,
100,
NULL,
NULL,
hinst,
0);
ASSERT(hWnd);
RedrawWindow(hWnd, &rect, NULL, RDW_UPDATENOW);
hDC = GetDC(hWnd);
ASSERT(hDC);
hDC = GetDC(hWnd);
ASSERT(hDC);
hRgn = CreateRectRgn(0,0,10,10);
hRgn = CreateRectRgn(0,0,10,10);
/* Test inverted clip rect */
rcScroll.left = 0;
rcScroll.top = 25;
rcScroll.right = 100;
rcScroll.bottom = 40;
rcClip.left = 0;
rcClip.top = 35;
rcClip.right = -70;
rcClip.bottom = -1000;
SetLastError(ERROR_SUCCESS);
Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate);
RTEST(Result == 1);
RTEST(GetLastError() == ERROR_SUCCESS);
/* Test inverted clip rect */
rcScroll.left = 0;
rcScroll.top = 25;
rcScroll.right = 100;
rcScroll.bottom = 40;
rcClip.left = 0;
rcClip.top = 35;
rcClip.right = -70;
rcClip.bottom = -1000;
SetLastError(ERROR_SUCCESS);
Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate);
RTEST(Result == 1);
RTEST(GetLastError() == ERROR_SUCCESS);
/* Test inverted scroll rect */
rcScroll.left = 0;
rcScroll.top = 25;
rcScroll.right = -100;
rcScroll.bottom = -40;
rcClip.left = 0;
rcClip.top = 35;
rcClip.right = 70;
rcClip.bottom = 1000;
SetLastError(ERROR_SUCCESS);
Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate);
RTEST(Result == 1);
RTEST(GetLastError() == ERROR_SUCCESS);
/* Test inverted scroll rect */
rcScroll.left = 0;
rcScroll.top = 25;
rcScroll.right = -100;
rcScroll.bottom = -40;
rcClip.left = 0;
rcClip.top = 35;
rcClip.right = 70;
rcClip.bottom = 1000;
SetLastError(ERROR_SUCCESS);
Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate);
RTEST(Result == 1);
RTEST(GetLastError() == ERROR_SUCCESS);
rcScroll.left = 0;
rcScroll.top = 25;
rcScroll.right = 100;
rcScroll.bottom = 40;
rcScroll.left = 0;
rcScroll.top = 25;
rcScroll.right = 100;
rcScroll.bottom = 40;
/* Test invalid update region */
SetLastError(ERROR_SUCCESS);
Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, (HRGN)0x123456, &rcUpdate);
RTEST(Result == 0);
TEST(GetLastError() == ERROR_INVALID_HANDLE);
/* Test invalid update region */
SetLastError(ERROR_SUCCESS);
Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, (HRGN)0x123456, &rcUpdate);
RTEST(Result == 0);
TEST(GetLastError() == ERROR_INVALID_HANDLE);
/* Test invalid dc */
SetLastError(ERROR_SUCCESS);
Result = NtUserScrollDC((HDC)0x123456, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate);
RTEST(Result == 0);
RTEST(GetLastError() == ERROR_SUCCESS);
/* Test invalid dc */
SetLastError(ERROR_SUCCESS);
Result = NtUserScrollDC((HDC)0x123456, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate);
RTEST(Result == 0);
RTEST(GetLastError() == ERROR_SUCCESS);
/* Test invalid update rect */
SetLastError(ERROR_SUCCESS);
Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, (PVOID)0x80001000);
RTEST(Result == 0);
RTEST(GetLastError() == ERROR_NOACCESS);
/* Test invalid update rect */
SetLastError(ERROR_SUCCESS);
Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, (PVOID)0x80001000);
RTEST(Result == 0);
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(rcUpdate.left == 0);
RTEST(rcUpdate.top == 35);
RTEST(rcUpdate.right == 70);
RTEST(rcUpdate.bottom == 55);
RTEST(Result == TRUE);
RTEST(rcUpdate.left == 0);
RTEST(rcUpdate.top == 35);
RTEST(rcUpdate.right == 70);
RTEST(rcUpdate.bottom == 55);
hTmpRgn = CreateRectRgn(10,45,70,55);
Result = CombineRgn(hRgn, hRgn, hTmpRgn, RGN_XOR);
RTEST(Result == SIMPLEREGION);
hTmpRgn = CreateRectRgn(10,45,70,55);
Result = CombineRgn(hRgn, hRgn, hTmpRgn, RGN_XOR);
RTEST(Result == SIMPLEREGION);
SetRectRgn(hTmpRgn,0,35,70,40);
Result = CombineRgn(hRgn, hRgn, hTmpRgn, RGN_XOR);
RTEST(Result == NULLREGION);
SetRectRgn(hTmpRgn,0,35,70,40);
Result = CombineRgn(hRgn, hRgn, hTmpRgn, RGN_XOR);
RTEST(Result == NULLREGION);
DeleteObject(hTmpRgn);
DeleteObject(hTmpRgn);
/* TODO: Test with another window in front */
/* TODO: Test with different viewport extension */
/* TODO: Test with another window in front */
/* TODO: Test with different viewport extension */
ReleaseDC(hWnd, hDC);
DestroyWindow(hWnd);
DeleteObject(hRgn);
ReleaseDC(hWnd, hDC);
DestroyWindow(hWnd);
DeleteObject(hRgn);
}

View file

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

View file

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

View file

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

View file

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

View file

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