mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 12:23:31 +00:00
Set svn:eol-style "native" for all apitest stuff
svn path=/trunk/; revision=33818
This commit is contained in:
+169
-169
@@ -1,169 +1,169 @@
|
||||
#include "apitest.h"
|
||||
|
||||
const char szFileHeader[] = "<html><head><style>\ntd.red {color:red}\ntd.green{color:green}\n</style>\n</head>\n<body>\n<head>\n";
|
||||
const char szTableHeader[] = "<table width = '800'><tr><th align='left'>Function</th><th align='left'>Status</th><th align='left'>Tests (all/passed/failed)</th><th align='left'>Regressions</th></tr>";
|
||||
const char szFileFooter[] = "</table></body></html>";
|
||||
|
||||
void
|
||||
OutputUsage(LPWSTR pszName)
|
||||
{
|
||||
printf("\nUsage:\n\n");
|
||||
printf("%ls.exe <TestName> - perform individual test\n", pszName);
|
||||
printf("%ls.exe all - perform all tests\n", pszName);
|
||||
printf("%ls.exe status - create api status file\n", pszName);
|
||||
printf("%ls.exe -r ... - perform regression testing\n", pszName);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
BOOL
|
||||
WriteFileHeader(UINT hFile, LPWSTR pszModule)
|
||||
{
|
||||
char szHeader[100];
|
||||
|
||||
_write(hFile, szFileHeader, strlen(szFileHeader));
|
||||
sprintf(szHeader, "<H1>Test results for %ls</H1>", pszModule);
|
||||
_write(hFile, szHeader, strlen(szHeader));
|
||||
_write(hFile, szTableHeader, strlen(szTableHeader));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL
|
||||
WriteRow(UINT hFile, LPWSTR pszFunction, PTESTINFO pti)
|
||||
{
|
||||
char szLine[500];
|
||||
|
||||
sprintf(szLine, "<tr><td>%ls</td>", pszFunction);
|
||||
|
||||
switch(pti->nApiStatus)
|
||||
{
|
||||
case APISTATUS_NOT_FOUND:
|
||||
strcat(szLine, "<td class='red'>not found</td>");
|
||||
break;
|
||||
case APISTATUS_UNIMPLEMENTED:
|
||||
strcat(szLine, "<td class='red'>unimplemented</td>");
|
||||
break;
|
||||
case APISTATUS_ASSERTION_FAILED:
|
||||
strcat(szLine, "<td class='red'>assertion failed</td>");
|
||||
break;
|
||||
case APISTATUS_REGRESSION:
|
||||
strcat(szLine, "<td class='red'>Regression!</td>");
|
||||
break;
|
||||
case APISTATUS_NORMAL:
|
||||
strcat(szLine, "<td class='green'>Implemented</td>");
|
||||
break;
|
||||
}
|
||||
|
||||
sprintf(szLine + strlen(szLine), "<td>%d / %d / %d</td><td>%d</td></tr>\n",
|
||||
pti->passed+pti->failed, pti->passed, pti->failed, pti->rfailed);
|
||||
|
||||
_write(hFile, szLine, strlen(szLine));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
TestMain(LPWSTR pszName, LPWSTR pszModule)
|
||||
{
|
||||
INT argc, i, j;
|
||||
LPWSTR *argv;
|
||||
TESTINFO ti;
|
||||
INT opassed, ofailed, orfailed;
|
||||
BOOL bAll, bStatus;
|
||||
UINT hFile = 0;
|
||||
|
||||
ti.bRegress = FALSE;
|
||||
bAll = FALSE;
|
||||
bStatus = FALSE;
|
||||
opassed = ofailed = orfailed = 0;
|
||||
|
||||
argv = CommandLineToArgvW(GetCommandLineW(), &argc);
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
OutputUsage(pszName);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Get options */
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if (_wcsicmp(argv[i], L"-r") == 0)
|
||||
{
|
||||
ti.bRegress = TRUE;
|
||||
}
|
||||
else if (_wcsicmp(argv[i], L"all") == 0)
|
||||
{
|
||||
bAll = TRUE;
|
||||
}
|
||||
else if (_wcsicmp(argv[i], L"status") == 0)
|
||||
{
|
||||
bAll = TRUE;
|
||||
bStatus = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (bStatus)
|
||||
{
|
||||
ti.bRegress = TRUE;
|
||||
char szOutputFile[MAX_PATH];
|
||||
wsprintf(szOutputFile, "%ls.html", pszName);
|
||||
hFile = _open(szOutputFile, O_CREAT | O_TRUNC | O_RDWR, 00700);
|
||||
if (hFile == -1)
|
||||
{
|
||||
printf("Could not create output file.\n");
|
||||
return 0;
|
||||
}
|
||||
WriteFileHeader(hFile, pszModule);
|
||||
}
|
||||
|
||||
for (i = 0; i < NumTests(); i++)
|
||||
{
|
||||
for (j = 1; j < argc; j++)
|
||||
{
|
||||
if (bAll || _wcsicmp(argv[j], TestList[i].Test) == 0)
|
||||
{
|
||||
ti.passed = 0;
|
||||
ti.failed = 0;
|
||||
ti.rfailed = 0;
|
||||
if (!IsFunctionPresent(TestList[i].Test))
|
||||
{
|
||||
printf("Function %ls was not found!\n", TestList[i].Test);
|
||||
ti.nApiStatus = APISTATUS_NOT_FOUND;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Executing test: %ls\n", TestList[i].Test);
|
||||
ti.nApiStatus = TestList[i].Proc(&ti);
|
||||
opassed += ti.passed;
|
||||
ofailed += ti.failed;
|
||||
orfailed += ti.rfailed;
|
||||
printf(" tests: %d, passed: %d, failed: %d\n\n", ti.passed+ti.failed, ti.passed, ti.failed);
|
||||
}
|
||||
if (bStatus)
|
||||
{
|
||||
if (ti.rfailed > 0)
|
||||
ti.nApiStatus = APISTATUS_REGRESSION;
|
||||
WriteRow(hFile, TestList[i].Test, &ti);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("Overall:\n");
|
||||
printf(" tests: %d, passed: %d, failed: %d\n\n", opassed+ofailed, opassed, ofailed);
|
||||
if (ti.bRegress)
|
||||
{
|
||||
printf(" regressions: %d\n", orfailed);
|
||||
}
|
||||
|
||||
if (bStatus)
|
||||
{
|
||||
_write(hFile, szFileFooter, strlen(szFileFooter));
|
||||
_close(hFile);
|
||||
}
|
||||
|
||||
if (ti.bRegress)
|
||||
return ti.rfailed;
|
||||
|
||||
return ti.failed;
|
||||
}
|
||||
#include "apitest.h"
|
||||
|
||||
const char szFileHeader[] = "<html><head><style>\ntd.red {color:red}\ntd.green{color:green}\n</style>\n</head>\n<body>\n<head>\n";
|
||||
const char szTableHeader[] = "<table width = '800'><tr><th align='left'>Function</th><th align='left'>Status</th><th align='left'>Tests (all/passed/failed)</th><th align='left'>Regressions</th></tr>";
|
||||
const char szFileFooter[] = "</table></body></html>";
|
||||
|
||||
void
|
||||
OutputUsage(LPWSTR pszName)
|
||||
{
|
||||
printf("\nUsage:\n\n");
|
||||
printf("%ls.exe <TestName> - perform individual test\n", pszName);
|
||||
printf("%ls.exe all - perform all tests\n", pszName);
|
||||
printf("%ls.exe status - create api status file\n", pszName);
|
||||
printf("%ls.exe -r ... - perform regression testing\n", pszName);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
BOOL
|
||||
WriteFileHeader(UINT hFile, LPWSTR pszModule)
|
||||
{
|
||||
char szHeader[100];
|
||||
|
||||
_write(hFile, szFileHeader, strlen(szFileHeader));
|
||||
sprintf(szHeader, "<H1>Test results for %ls</H1>", pszModule);
|
||||
_write(hFile, szHeader, strlen(szHeader));
|
||||
_write(hFile, szTableHeader, strlen(szTableHeader));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL
|
||||
WriteRow(UINT hFile, LPWSTR pszFunction, PTESTINFO pti)
|
||||
{
|
||||
char szLine[500];
|
||||
|
||||
sprintf(szLine, "<tr><td>%ls</td>", pszFunction);
|
||||
|
||||
switch(pti->nApiStatus)
|
||||
{
|
||||
case APISTATUS_NOT_FOUND:
|
||||
strcat(szLine, "<td class='red'>not found</td>");
|
||||
break;
|
||||
case APISTATUS_UNIMPLEMENTED:
|
||||
strcat(szLine, "<td class='red'>unimplemented</td>");
|
||||
break;
|
||||
case APISTATUS_ASSERTION_FAILED:
|
||||
strcat(szLine, "<td class='red'>assertion failed</td>");
|
||||
break;
|
||||
case APISTATUS_REGRESSION:
|
||||
strcat(szLine, "<td class='red'>Regression!</td>");
|
||||
break;
|
||||
case APISTATUS_NORMAL:
|
||||
strcat(szLine, "<td class='green'>Implemented</td>");
|
||||
break;
|
||||
}
|
||||
|
||||
sprintf(szLine + strlen(szLine), "<td>%d / %d / %d</td><td>%d</td></tr>\n",
|
||||
pti->passed+pti->failed, pti->passed, pti->failed, pti->rfailed);
|
||||
|
||||
_write(hFile, szLine, strlen(szLine));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
TestMain(LPWSTR pszName, LPWSTR pszModule)
|
||||
{
|
||||
INT argc, i, j;
|
||||
LPWSTR *argv;
|
||||
TESTINFO ti;
|
||||
INT opassed, ofailed, orfailed;
|
||||
BOOL bAll, bStatus;
|
||||
UINT hFile = 0;
|
||||
|
||||
ti.bRegress = FALSE;
|
||||
bAll = FALSE;
|
||||
bStatus = FALSE;
|
||||
opassed = ofailed = orfailed = 0;
|
||||
|
||||
argv = CommandLineToArgvW(GetCommandLineW(), &argc);
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
OutputUsage(pszName);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Get options */
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if (_wcsicmp(argv[i], L"-r") == 0)
|
||||
{
|
||||
ti.bRegress = TRUE;
|
||||
}
|
||||
else if (_wcsicmp(argv[i], L"all") == 0)
|
||||
{
|
||||
bAll = TRUE;
|
||||
}
|
||||
else if (_wcsicmp(argv[i], L"status") == 0)
|
||||
{
|
||||
bAll = TRUE;
|
||||
bStatus = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (bStatus)
|
||||
{
|
||||
ti.bRegress = TRUE;
|
||||
char szOutputFile[MAX_PATH];
|
||||
wsprintf(szOutputFile, "%ls.html", pszName);
|
||||
hFile = _open(szOutputFile, O_CREAT | O_TRUNC | O_RDWR, 00700);
|
||||
if (hFile == -1)
|
||||
{
|
||||
printf("Could not create output file.\n");
|
||||
return 0;
|
||||
}
|
||||
WriteFileHeader(hFile, pszModule);
|
||||
}
|
||||
|
||||
for (i = 0; i < NumTests(); i++)
|
||||
{
|
||||
for (j = 1; j < argc; j++)
|
||||
{
|
||||
if (bAll || _wcsicmp(argv[j], TestList[i].Test) == 0)
|
||||
{
|
||||
ti.passed = 0;
|
||||
ti.failed = 0;
|
||||
ti.rfailed = 0;
|
||||
if (!IsFunctionPresent(TestList[i].Test))
|
||||
{
|
||||
printf("Function %ls was not found!\n", TestList[i].Test);
|
||||
ti.nApiStatus = APISTATUS_NOT_FOUND;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Executing test: %ls\n", TestList[i].Test);
|
||||
ti.nApiStatus = TestList[i].Proc(&ti);
|
||||
opassed += ti.passed;
|
||||
ofailed += ti.failed;
|
||||
orfailed += ti.rfailed;
|
||||
printf(" tests: %d, passed: %d, failed: %d\n\n", ti.passed+ti.failed, ti.passed, ti.failed);
|
||||
}
|
||||
if (bStatus)
|
||||
{
|
||||
if (ti.rfailed > 0)
|
||||
ti.nApiStatus = APISTATUS_REGRESSION;
|
||||
WriteRow(hFile, TestList[i].Test, &ti);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("Overall:\n");
|
||||
printf(" tests: %d, passed: %d, failed: %d\n\n", opassed+ofailed, opassed, ofailed);
|
||||
if (ti.bRegress)
|
||||
{
|
||||
printf(" regressions: %d\n", orfailed);
|
||||
}
|
||||
|
||||
if (bStatus)
|
||||
{
|
||||
_write(hFile, szFileFooter, strlen(szFileFooter));
|
||||
_close(hFile);
|
||||
}
|
||||
|
||||
if (ti.bRegress)
|
||||
return ti.rfailed;
|
||||
|
||||
return ti.failed;
|
||||
}
|
||||
|
||||
+98
-98
@@ -1,98 +1,98 @@
|
||||
#ifndef _APITEST_H
|
||||
#define _APITEST_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define open _open
|
||||
|
||||
#define APISTATUS_NORMAL 0
|
||||
#define APISTATUS_NOT_FOUND 1
|
||||
#define APISTATUS_UNIMPLEMENTED 2
|
||||
#define APISTATUS_ASSERTION_FAILED 3
|
||||
#define APISTATUS_REGRESSION 4
|
||||
|
||||
/* type definitions */
|
||||
|
||||
typedef struct tagTESTINFO
|
||||
{
|
||||
INT passed;
|
||||
INT failed;
|
||||
INT rfailed;
|
||||
BOOL bRegress;
|
||||
INT nApiStatus;
|
||||
} TESTINFO, *PTESTINFO;
|
||||
|
||||
typedef INT (*TESTPROC)(PTESTINFO);
|
||||
|
||||
typedef struct tagTEST
|
||||
{
|
||||
WCHAR* Test;
|
||||
TESTPROC Proc;
|
||||
} TESTENTRY, *PTESTENTRY;
|
||||
|
||||
|
||||
/* macros */
|
||||
|
||||
#define TEST(x) \
|
||||
if (pti->bRegress) \
|
||||
{ \
|
||||
if (x)\
|
||||
{\
|
||||
(pti->passed)++;\
|
||||
printf("non-rtest succeeded in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
|
||||
} else {\
|
||||
(pti->failed)++;\
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if (x)\
|
||||
{\
|
||||
(pti->passed)++;\
|
||||
} else {\
|
||||
(pti->failed)++;\
|
||||
printf("test failed in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
|
||||
} \
|
||||
}
|
||||
|
||||
#define RTEST(x) \
|
||||
if (pti->bRegress) \
|
||||
{ \
|
||||
if (x)\
|
||||
{\
|
||||
(pti->passed)++;\
|
||||
} else {\
|
||||
(pti->failed)++;\
|
||||
(pti->rfailed)++;\
|
||||
printf("rtest failed in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if (x)\
|
||||
{\
|
||||
(pti->passed)++;\
|
||||
} else {\
|
||||
(pti->failed)++;\
|
||||
printf("test failed in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
|
||||
} \
|
||||
}
|
||||
|
||||
#undef ASSERT
|
||||
#define ASSERT(x) \
|
||||
if (!(x)) \
|
||||
{ \
|
||||
printf("Assertion failed in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
|
||||
return APISTATUS_ASSERTION_FAILED; \
|
||||
}
|
||||
|
||||
int TestMain(LPWSTR pszExe, LPWSTR pszModule);
|
||||
extern TESTENTRY TestList[];
|
||||
INT NumTests(void);
|
||||
BOOL IsFunctionPresent(LPWSTR lpszFunction);
|
||||
|
||||
#endif /* _APITEST_H */
|
||||
#ifndef _APITEST_H
|
||||
#define _APITEST_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define open _open
|
||||
|
||||
#define APISTATUS_NORMAL 0
|
||||
#define APISTATUS_NOT_FOUND 1
|
||||
#define APISTATUS_UNIMPLEMENTED 2
|
||||
#define APISTATUS_ASSERTION_FAILED 3
|
||||
#define APISTATUS_REGRESSION 4
|
||||
|
||||
/* type definitions */
|
||||
|
||||
typedef struct tagTESTINFO
|
||||
{
|
||||
INT passed;
|
||||
INT failed;
|
||||
INT rfailed;
|
||||
BOOL bRegress;
|
||||
INT nApiStatus;
|
||||
} TESTINFO, *PTESTINFO;
|
||||
|
||||
typedef INT (*TESTPROC)(PTESTINFO);
|
||||
|
||||
typedef struct tagTEST
|
||||
{
|
||||
WCHAR* Test;
|
||||
TESTPROC Proc;
|
||||
} TESTENTRY, *PTESTENTRY;
|
||||
|
||||
|
||||
/* macros */
|
||||
|
||||
#define TEST(x) \
|
||||
if (pti->bRegress) \
|
||||
{ \
|
||||
if (x)\
|
||||
{\
|
||||
(pti->passed)++;\
|
||||
printf("non-rtest succeeded in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
|
||||
} else {\
|
||||
(pti->failed)++;\
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if (x)\
|
||||
{\
|
||||
(pti->passed)++;\
|
||||
} else {\
|
||||
(pti->failed)++;\
|
||||
printf("test failed in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
|
||||
} \
|
||||
}
|
||||
|
||||
#define RTEST(x) \
|
||||
if (pti->bRegress) \
|
||||
{ \
|
||||
if (x)\
|
||||
{\
|
||||
(pti->passed)++;\
|
||||
} else {\
|
||||
(pti->failed)++;\
|
||||
(pti->rfailed)++;\
|
||||
printf("rtest failed in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if (x)\
|
||||
{\
|
||||
(pti->passed)++;\
|
||||
} else {\
|
||||
(pti->failed)++;\
|
||||
printf("test failed in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
|
||||
} \
|
||||
}
|
||||
|
||||
#undef ASSERT
|
||||
#define ASSERT(x) \
|
||||
if (!(x)) \
|
||||
{ \
|
||||
printf("Assertion failed in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
|
||||
return APISTATUS_ASSERTION_FAILED; \
|
||||
}
|
||||
|
||||
int TestMain(LPWSTR pszExe, LPWSTR pszModule);
|
||||
extern TESTENTRY TestList[];
|
||||
INT NumTests(void);
|
||||
BOOL IsFunctionPresent(LPWSTR lpszFunction);
|
||||
|
||||
#endif /* _APITEST_H */
|
||||
|
||||
@@ -1,63 +1,63 @@
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0501
|
||||
#endif
|
||||
|
||||
|
||||
typedef PGDI_TABLE_ENTRY (CALLBACK * GDIQUERYPROC) (void);
|
||||
|
||||
/* GDI handle table can hold 0x4000 handles */
|
||||
#define GDI_HANDLE_COUNT 0x10000
|
||||
#define GDI_GLOBAL_PROCESS (0x0)
|
||||
|
||||
/* Handle Masks and shifts */
|
||||
#define GDI_HANDLE_INDEX_MASK (GDI_HANDLE_COUNT - 1)
|
||||
#define GDI_HANDLE_TYPE_MASK 0x007f0000
|
||||
#define GDI_HANDLE_STOCK_MASK 0x00800000
|
||||
#define GDI_HANDLE_REUSE_MASK 0xff000000
|
||||
#define GDI_HANDLE_REUSECNT_SHIFT 24
|
||||
|
||||
|
||||
#define GDI_OBJECT_TYPE_DC 0x00010000
|
||||
#define GDI_OBJECT_TYPE_REGION 0x00040000
|
||||
#define GDI_OBJECT_TYPE_BITMAP 0x00050000
|
||||
#define GDI_OBJECT_TYPE_PALETTE 0x00080000
|
||||
#define GDI_OBJECT_TYPE_FONT 0x000a0000
|
||||
#define GDI_OBJECT_TYPE_BRUSH 0x00100000
|
||||
#define GDI_OBJECT_TYPE_EMF 0x00210000
|
||||
#define GDI_OBJECT_TYPE_PEN 0x00300000
|
||||
#define GDI_OBJECT_TYPE_EXTPEN 0x00500000
|
||||
#define GDI_OBJECT_TYPE_COLORSPACE 0x00090000
|
||||
#define GDI_OBJECT_TYPE_METADC 0x00660000
|
||||
#define GDI_OBJECT_TYPE_METAFILE 0x00260000
|
||||
#define GDI_OBJECT_TYPE_ENHMETAFILE 0x00460000
|
||||
/* Following object types made up for ROS */
|
||||
#define GDI_OBJECT_TYPE_ENHMETADC 0x00740000
|
||||
#define GDI_OBJECT_TYPE_MEMDC 0x00750000
|
||||
#define GDI_OBJECT_TYPE_DCE 0x00770000
|
||||
#define GDI_OBJECT_TYPE_DONTCARE 0x007f0000
|
||||
/** Not really an object type. Forces GDI_FreeObj to be silent. */
|
||||
#define GDI_OBJECT_TYPE_SILENT 0x80000000
|
||||
|
||||
|
||||
|
||||
/* Number Representation */
|
||||
|
||||
typedef LONG FIX;
|
||||
|
||||
|
||||
|
||||
|
||||
HDC WINAPI GdiConvertBitmap(HDC hdc);
|
||||
HBRUSH WINAPI GdiConvertBrush(HBRUSH hbr);
|
||||
HDC WINAPI GdiConvertDC(HDC hdc);
|
||||
HFONT WINAPI GdiConvertFont(HFONT hfont);
|
||||
HPALETTE WINAPI GdiConvertPalette(HPALETTE hpal);
|
||||
HRGN WINAPI GdiConvertRegion(HRGN hregion);
|
||||
HBRUSH WINAPI GdiGetLocalBrush(HBRUSH hbr);
|
||||
HDC WINAPI GdiGetLocalDC(HDC hdc);
|
||||
BOOL WINAPI GdiDeleteLocalDC(HDC hdc);
|
||||
BOOL WINAPI GdiReleaseLocalDC(HDC hdc);
|
||||
BOOL WINAPI GdiSetAttrs(HDC hdc);
|
||||
|
||||
|
||||
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0501
|
||||
#endif
|
||||
|
||||
|
||||
typedef PGDI_TABLE_ENTRY (CALLBACK * GDIQUERYPROC) (void);
|
||||
|
||||
/* GDI handle table can hold 0x4000 handles */
|
||||
#define GDI_HANDLE_COUNT 0x10000
|
||||
#define GDI_GLOBAL_PROCESS (0x0)
|
||||
|
||||
/* Handle Masks and shifts */
|
||||
#define GDI_HANDLE_INDEX_MASK (GDI_HANDLE_COUNT - 1)
|
||||
#define GDI_HANDLE_TYPE_MASK 0x007f0000
|
||||
#define GDI_HANDLE_STOCK_MASK 0x00800000
|
||||
#define GDI_HANDLE_REUSE_MASK 0xff000000
|
||||
#define GDI_HANDLE_REUSECNT_SHIFT 24
|
||||
|
||||
|
||||
#define GDI_OBJECT_TYPE_DC 0x00010000
|
||||
#define GDI_OBJECT_TYPE_REGION 0x00040000
|
||||
#define GDI_OBJECT_TYPE_BITMAP 0x00050000
|
||||
#define GDI_OBJECT_TYPE_PALETTE 0x00080000
|
||||
#define GDI_OBJECT_TYPE_FONT 0x000a0000
|
||||
#define GDI_OBJECT_TYPE_BRUSH 0x00100000
|
||||
#define GDI_OBJECT_TYPE_EMF 0x00210000
|
||||
#define GDI_OBJECT_TYPE_PEN 0x00300000
|
||||
#define GDI_OBJECT_TYPE_EXTPEN 0x00500000
|
||||
#define GDI_OBJECT_TYPE_COLORSPACE 0x00090000
|
||||
#define GDI_OBJECT_TYPE_METADC 0x00660000
|
||||
#define GDI_OBJECT_TYPE_METAFILE 0x00260000
|
||||
#define GDI_OBJECT_TYPE_ENHMETAFILE 0x00460000
|
||||
/* Following object types made up for ROS */
|
||||
#define GDI_OBJECT_TYPE_ENHMETADC 0x00740000
|
||||
#define GDI_OBJECT_TYPE_MEMDC 0x00750000
|
||||
#define GDI_OBJECT_TYPE_DCE 0x00770000
|
||||
#define GDI_OBJECT_TYPE_DONTCARE 0x007f0000
|
||||
/** Not really an object type. Forces GDI_FreeObj to be silent. */
|
||||
#define GDI_OBJECT_TYPE_SILENT 0x80000000
|
||||
|
||||
|
||||
|
||||
/* Number Representation */
|
||||
|
||||
typedef LONG FIX;
|
||||
|
||||
|
||||
|
||||
|
||||
HDC WINAPI GdiConvertBitmap(HDC hdc);
|
||||
HBRUSH WINAPI GdiConvertBrush(HBRUSH hbr);
|
||||
HDC WINAPI GdiConvertDC(HDC hdc);
|
||||
HFONT WINAPI GdiConvertFont(HFONT hfont);
|
||||
HPALETTE WINAPI GdiConvertPalette(HPALETTE hpal);
|
||||
HRGN WINAPI GdiConvertRegion(HRGN hregion);
|
||||
HBRUSH WINAPI GdiGetLocalBrush(HBRUSH hbr);
|
||||
HDC WINAPI GdiGetLocalDC(HDC hdc);
|
||||
BOOL WINAPI GdiDeleteLocalDC(HDC hdc);
|
||||
BOOL WINAPI GdiReleaseLocalDC(HDC hdc);
|
||||
BOOL WINAPI GdiSetAttrs(HDC hdc);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
#include "gdi32api.h"
|
||||
|
||||
HINSTANCE g_hInstance;
|
||||
PGDI_TABLE_ENTRY GdiHandleTable;
|
||||
|
||||
BOOL
|
||||
IsFunctionPresent(LPWSTR lpszFunction)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static
|
||||
PGDI_TABLE_ENTRY
|
||||
MyGdiQueryTable()
|
||||
{
|
||||
PTEB pTeb = NtCurrentTeb();
|
||||
PPEB pPeb = pTeb->ProcessEnvironmentBlock;
|
||||
return pPeb->GdiSharedHandleTable;
|
||||
}
|
||||
|
||||
int APIENTRY
|
||||
WinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
g_hInstance = hInstance;
|
||||
|
||||
GdiHandleTable = MyGdiQueryTable();
|
||||
if(!GdiHandleTable)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return TestMain(L"gdi32api", L"gdi32.dll");
|
||||
}
|
||||
#include "gdi32api.h"
|
||||
|
||||
HINSTANCE g_hInstance;
|
||||
PGDI_TABLE_ENTRY GdiHandleTable;
|
||||
|
||||
BOOL
|
||||
IsFunctionPresent(LPWSTR lpszFunction)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static
|
||||
PGDI_TABLE_ENTRY
|
||||
MyGdiQueryTable()
|
||||
{
|
||||
PTEB pTeb = NtCurrentTeb();
|
||||
PPEB pPeb = pTeb->ProcessEnvironmentBlock;
|
||||
return pPeb->GdiSharedHandleTable;
|
||||
}
|
||||
|
||||
int APIENTRY
|
||||
WinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
g_hInstance = hInstance;
|
||||
|
||||
GdiHandleTable = MyGdiQueryTable();
|
||||
if(!GdiHandleTable)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return TestMain(L"gdi32api", L"gdi32.dll");
|
||||
}
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
#ifndef _GDITEST_H
|
||||
#define _GDITEST_H
|
||||
|
||||
#define WIN32_NO_STATUS
|
||||
#include <windows.h>
|
||||
#include <windows.h>
|
||||
#include <ndk/ntndk.h>
|
||||
#include <wingdi.h>
|
||||
#include <winddi.h>
|
||||
#include <d3dnthal.h>
|
||||
#include <prntfont.h>
|
||||
|
||||
/* Public Win32K Headers */
|
||||
#include <win32k/ntgdityp.h>
|
||||
#include <ntgdi.h>
|
||||
#include <win32k/ntgdihdl.h>
|
||||
|
||||
#include "../apitest.h"
|
||||
#include "gdi.h"
|
||||
|
||||
extern HINSTANCE g_hInstance;
|
||||
extern PGDI_TABLE_ENTRY GdiHandleTable;
|
||||
|
||||
#endif /* _GDITEST_H */
|
||||
|
||||
/* EOF */
|
||||
#ifndef _GDITEST_H
|
||||
#define _GDITEST_H
|
||||
|
||||
#define WIN32_NO_STATUS
|
||||
#include <windows.h>
|
||||
#include <windows.h>
|
||||
#include <ndk/ntndk.h>
|
||||
#include <wingdi.h>
|
||||
#include <winddi.h>
|
||||
#include <d3dnthal.h>
|
||||
#include <prntfont.h>
|
||||
|
||||
/* Public Win32K Headers */
|
||||
#include <win32k/ntgdityp.h>
|
||||
#include <ntgdi.h>
|
||||
#include <win32k/ntgdihdl.h>
|
||||
|
||||
#include "../apitest.h"
|
||||
#include "gdi.h"
|
||||
|
||||
extern HINSTANCE g_hInstance;
|
||||
extern PGDI_TABLE_ENTRY GdiHandleTable;
|
||||
|
||||
#endif /* _GDITEST_H */
|
||||
|
||||
/* EOF */
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<module name="gdi32api" type="win32cui">
|
||||
<include base="gdi32api">.</include>
|
||||
<define name="__USE_W32API" />
|
||||
<define name="_WIN32_WINNT">0x0501</define>
|
||||
<library>apitest</library>
|
||||
<library>kernel32</library>
|
||||
<library>user32</library>
|
||||
<library>gdi32</library>
|
||||
<library>shell32</library>
|
||||
<file>gdi32api.c</file>
|
||||
<file>testlist.c</file>
|
||||
</module>
|
||||
<module name="gdi32api" type="win32cui">
|
||||
<include base="gdi32api">.</include>
|
||||
<define name="__USE_W32API" />
|
||||
<define name="_WIN32_WINNT">0x0501</define>
|
||||
<library>apitest</library>
|
||||
<library>kernel32</library>
|
||||
<library>user32</library>
|
||||
<library>gdi32</library>
|
||||
<library>shell32</library>
|
||||
<file>gdi32api.c</file>
|
||||
<file>testlist.c</file>
|
||||
</module>
|
||||
|
||||
@@ -1,94 +1,94 @@
|
||||
#ifndef _GDITESTLIST_H
|
||||
#define _GDITESTLIST_H
|
||||
|
||||
#include "gdi32api.h"
|
||||
|
||||
/* include the tests */
|
||||
#include "tests/AddFontResource.c"
|
||||
#include "tests/AddFontResourceEx.c"
|
||||
#include "tests/CreateBitmapIndirect.c"
|
||||
#include "tests/CreateCompatibleDC.c"
|
||||
#include "tests/CreateFont.c"
|
||||
#include "tests/CreatePen.c"
|
||||
#include "tests/CreateRectRgn.c"
|
||||
#include "tests/EngCreateSemaphore.c"
|
||||
#include "tests/EngAcquireSemaphore.c"
|
||||
#include "tests/EngDeleteSemaphore.c"
|
||||
#include "tests/EngReleaseSemaphore.c"
|
||||
#include "tests/ExtCreatePen.c"
|
||||
#include "tests/GdiConvertBitmap.c"
|
||||
#include "tests/GdiConvertBrush.c"
|
||||
#include "tests/GdiConvertDC.c"
|
||||
#include "tests/GdiConvertFont.c"
|
||||
#include "tests/GdiConvertPalette.c"
|
||||
#include "tests/GdiConvertRegion.c"
|
||||
#include "tests/GdiDeleteLocalDC.c"
|
||||
#include "tests/GdiGetLocalBrush.c"
|
||||
#include "tests/GdiGetLocalDC.c"
|
||||
#include "tests/GdiReleaseLocalDC.c"
|
||||
#include "tests/GdiSetAttrs.c"
|
||||
#include "tests/GetClipRgn.c"
|
||||
#include "tests/GetCurrentObject.c"
|
||||
#include "tests/GetDIBits.c"
|
||||
#include "tests/GetObject.c"
|
||||
#include "tests/GetStockObject.c"
|
||||
#include "tests/SelectObject.c"
|
||||
#include "tests/SetDCPenColor.c"
|
||||
#include "tests/SetSysColors.c"
|
||||
#include "tests/SetWorldTransform.c"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The List of tests */
|
||||
TESTENTRY TestList[] =
|
||||
{
|
||||
{ L"AddFontResourceA", Test_AddFontResourceA },
|
||||
{ L"AddFontResourceEx", Test_AddFontResourceEx },
|
||||
{ L"CreateBitmapIndirect", Test_CreateBitmapIndirect },
|
||||
{ L"CreateCompatibleDC", Test_CreateCompatibleDC },
|
||||
{ L"CreateFont", Test_CreateFont },
|
||||
{ L"CreatePen", Test_CreatePen },
|
||||
{ L"EngCreateSemaphore", Test_EngCreateSemaphore },
|
||||
{ L"EngAcquireSemaphore", Test_EngAcquireSemaphore },
|
||||
{ L"EngDeleteSemaphore", Test_EngDeleteSemaphore },
|
||||
{ L"EngReleaseSemaphore", Test_EngReleaseSemaphore },
|
||||
{ L"CreateRectRgn", Test_CreateRectRgn },
|
||||
{ L"ExtCreatePen", Test_ExtCreatePen },
|
||||
{ L"GdiConvertBitmap", Test_GdiConvertBitmap },
|
||||
{ L"GdiConvertBrush", Test_GdiConvertBrush },
|
||||
{ L"GdiConvertBrush", Test_GdiConvertDC },
|
||||
{ L"GdiConvertFont", Test_GdiConvertFont },
|
||||
{ L"GdiConvertPalette", Test_GdiConvertPalette },
|
||||
{ L"GdiConvertRegion", Test_GdiConvertRegion },
|
||||
{ L"GdiDeleteLocalDC", Test_GdiDeleteLocalDC },
|
||||
{ L"GdiGetLocalBrush", Test_GdiGetLocalBrush },
|
||||
{ L"GdiGetLocalDC", Test_GdiGetLocalDC },
|
||||
{ L"GdiReleaseLocalDC", Test_GdiReleaseLocalDC },
|
||||
{ L"GdiSetAttrs", Test_GdiSetAttrs },
|
||||
{ L"GetClipRgn", Test_GetClipRgn },
|
||||
{ L"GetCurrentObject", Test_GetCurrentObject },
|
||||
{ L"GetDIBits", Test_GetDIBits },
|
||||
{ L"GetObject", Test_GetObject },
|
||||
{ L"GetStockObject", Test_GetStockObject },
|
||||
{ L"SelectObject", Test_SelectObject },
|
||||
{ L"SetDCPenColor", Test_SetDCPenColor },
|
||||
{ L"SetSysColors", Test_SetSysColors },
|
||||
{ L"SetWorldTransform", Test_SetWorldTransform },
|
||||
};
|
||||
|
||||
/* The function that gives us the number of tests */
|
||||
INT NumTests(void)
|
||||
{
|
||||
return sizeof(TestList) / sizeof(TESTENTRY);
|
||||
}
|
||||
|
||||
#endif /* _GDITESTLIST_H */
|
||||
|
||||
/* EOF */
|
||||
#ifndef _GDITESTLIST_H
|
||||
#define _GDITESTLIST_H
|
||||
|
||||
#include "gdi32api.h"
|
||||
|
||||
/* include the tests */
|
||||
#include "tests/AddFontResource.c"
|
||||
#include "tests/AddFontResourceEx.c"
|
||||
#include "tests/CreateBitmapIndirect.c"
|
||||
#include "tests/CreateCompatibleDC.c"
|
||||
#include "tests/CreateFont.c"
|
||||
#include "tests/CreatePen.c"
|
||||
#include "tests/CreateRectRgn.c"
|
||||
#include "tests/EngCreateSemaphore.c"
|
||||
#include "tests/EngAcquireSemaphore.c"
|
||||
#include "tests/EngDeleteSemaphore.c"
|
||||
#include "tests/EngReleaseSemaphore.c"
|
||||
#include "tests/ExtCreatePen.c"
|
||||
#include "tests/GdiConvertBitmap.c"
|
||||
#include "tests/GdiConvertBrush.c"
|
||||
#include "tests/GdiConvertDC.c"
|
||||
#include "tests/GdiConvertFont.c"
|
||||
#include "tests/GdiConvertPalette.c"
|
||||
#include "tests/GdiConvertRegion.c"
|
||||
#include "tests/GdiDeleteLocalDC.c"
|
||||
#include "tests/GdiGetLocalBrush.c"
|
||||
#include "tests/GdiGetLocalDC.c"
|
||||
#include "tests/GdiReleaseLocalDC.c"
|
||||
#include "tests/GdiSetAttrs.c"
|
||||
#include "tests/GetClipRgn.c"
|
||||
#include "tests/GetCurrentObject.c"
|
||||
#include "tests/GetDIBits.c"
|
||||
#include "tests/GetObject.c"
|
||||
#include "tests/GetStockObject.c"
|
||||
#include "tests/SelectObject.c"
|
||||
#include "tests/SetDCPenColor.c"
|
||||
#include "tests/SetSysColors.c"
|
||||
#include "tests/SetWorldTransform.c"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The List of tests */
|
||||
TESTENTRY TestList[] =
|
||||
{
|
||||
{ L"AddFontResourceA", Test_AddFontResourceA },
|
||||
{ L"AddFontResourceEx", Test_AddFontResourceEx },
|
||||
{ L"CreateBitmapIndirect", Test_CreateBitmapIndirect },
|
||||
{ L"CreateCompatibleDC", Test_CreateCompatibleDC },
|
||||
{ L"CreateFont", Test_CreateFont },
|
||||
{ L"CreatePen", Test_CreatePen },
|
||||
{ L"EngCreateSemaphore", Test_EngCreateSemaphore },
|
||||
{ L"EngAcquireSemaphore", Test_EngAcquireSemaphore },
|
||||
{ L"EngDeleteSemaphore", Test_EngDeleteSemaphore },
|
||||
{ L"EngReleaseSemaphore", Test_EngReleaseSemaphore },
|
||||
{ L"CreateRectRgn", Test_CreateRectRgn },
|
||||
{ L"ExtCreatePen", Test_ExtCreatePen },
|
||||
{ L"GdiConvertBitmap", Test_GdiConvertBitmap },
|
||||
{ L"GdiConvertBrush", Test_GdiConvertBrush },
|
||||
{ L"GdiConvertBrush", Test_GdiConvertDC },
|
||||
{ L"GdiConvertFont", Test_GdiConvertFont },
|
||||
{ L"GdiConvertPalette", Test_GdiConvertPalette },
|
||||
{ L"GdiConvertRegion", Test_GdiConvertRegion },
|
||||
{ L"GdiDeleteLocalDC", Test_GdiDeleteLocalDC },
|
||||
{ L"GdiGetLocalBrush", Test_GdiGetLocalBrush },
|
||||
{ L"GdiGetLocalDC", Test_GdiGetLocalDC },
|
||||
{ L"GdiReleaseLocalDC", Test_GdiReleaseLocalDC },
|
||||
{ L"GdiSetAttrs", Test_GdiSetAttrs },
|
||||
{ L"GetClipRgn", Test_GetClipRgn },
|
||||
{ L"GetCurrentObject", Test_GetCurrentObject },
|
||||
{ L"GetDIBits", Test_GetDIBits },
|
||||
{ L"GetObject", Test_GetObject },
|
||||
{ L"GetStockObject", Test_GetStockObject },
|
||||
{ L"SelectObject", Test_SelectObject },
|
||||
{ L"SetDCPenColor", Test_SetDCPenColor },
|
||||
{ L"SetSysColors", Test_SetSysColors },
|
||||
{ L"SetWorldTransform", Test_SetWorldTransform },
|
||||
};
|
||||
|
||||
/* The function that gives us the number of tests */
|
||||
INT NumTests(void)
|
||||
{
|
||||
return sizeof(TestList) / sizeof(TESTENTRY);
|
||||
}
|
||||
|
||||
#endif /* _GDITESTLIST_H */
|
||||
|
||||
/* EOF */
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
#define STAMP_DESIGNVECTOR (0x8000000 + 'd' + ('v' << 8))
|
||||
|
||||
INT
|
||||
Test_AddFontResourceEx(PTESTINFO pti)
|
||||
{
|
||||
WCHAR szFileName[MAX_PATH];
|
||||
|
||||
/* Test NULL filename */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
/* Windows crashes, would need SEH here */
|
||||
// TEST(AddFontResourceExW(NULL, 0, 0) != 0);
|
||||
// TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test "" filename */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(AddFontResourceExW(L"", 0, 0) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
GetEnvironmentVariableW(L"systemroot", szFileName, MAX_PATH);
|
||||
wcscat(szFileName, L"\\Fonts\\cour.ttf");
|
||||
|
||||
/* Test flags = 0 */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(AddFontResourceExW(szFileName, 0, 0) != 0);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(AddFontResourceExW(szFileName, 256, 0) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test invalid pointer as last parameter */
|
||||
TEST(AddFontResourceExW(szFileName, 0, (void*)-1) != 0);
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
#define STAMP_DESIGNVECTOR (0x8000000 + 'd' + ('v' << 8))
|
||||
|
||||
INT
|
||||
Test_AddFontResourceEx(PTESTINFO pti)
|
||||
{
|
||||
WCHAR szFileName[MAX_PATH];
|
||||
|
||||
/* Test NULL filename */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
/* Windows crashes, would need SEH here */
|
||||
// TEST(AddFontResourceExW(NULL, 0, 0) != 0);
|
||||
// TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test "" filename */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(AddFontResourceExW(L"", 0, 0) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
GetEnvironmentVariableW(L"systemroot", szFileName, MAX_PATH);
|
||||
wcscat(szFileName, L"\\Fonts\\cour.ttf");
|
||||
|
||||
/* Test flags = 0 */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(AddFontResourceExW(szFileName, 0, 0) != 0);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(AddFontResourceExW(szFileName, 256, 0) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test invalid pointer as last parameter */
|
||||
TEST(AddFontResourceExW(szFileName, 0, (void*)-1) != 0);
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
@@ -1,47 +1,47 @@
|
||||
INT
|
||||
Test_CreateCompatibleDC(PTESTINFO pti)
|
||||
{
|
||||
HDC hDCScreen, hOldDC, hDC, hDC2;
|
||||
|
||||
/* Get screen DC */
|
||||
hDCScreen = GetDC(NULL);
|
||||
ASSERT(hDCScreen != NULL);
|
||||
|
||||
/* Test NULL DC handle */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hDC = CreateCompatibleDC(NULL);
|
||||
TEST(hDC != NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
if(hDC) DeleteDC(hDC);
|
||||
|
||||
/* Test invalid DC handle */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hDC = CreateCompatibleDC((HDC)0x123456);
|
||||
TEST(hDC == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
if(hDC) DeleteDC(hDC);
|
||||
|
||||
hDC = CreateCompatibleDC(hDCScreen);
|
||||
RTEST(hDC != NULL);
|
||||
|
||||
// Test if first selected pen is BLACK_PEN (? or same as screen DC's pen?)
|
||||
TEST(SelectObject(hDC, GetStockObject(DC_PEN)) == GetStockObject(BLACK_PEN));
|
||||
TEST(SelectObject(hDC, GetStockObject(BLACK_PEN)) == GetStockObject(DC_PEN));
|
||||
|
||||
// Test for the starting Color == RGB(0,0,0)
|
||||
TEST(SetDCPenColor(hDC, RGB(1,2,3)) == RGB(0,0,0));
|
||||
|
||||
// Check for reuse counter
|
||||
hOldDC = hDC;
|
||||
DeleteDC(hDC);
|
||||
hDC = CreateCompatibleDC(hDCScreen);
|
||||
hDC2 = CreateCompatibleDC(hOldDC);
|
||||
RTEST(hDC2 == NULL);
|
||||
if (hDC2 != NULL) DeleteDC(hDC2);
|
||||
|
||||
// cleanup
|
||||
DeleteDC(hDC);
|
||||
|
||||
ReleaseDC(NULL, hDCScreen);
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
INT
|
||||
Test_CreateCompatibleDC(PTESTINFO pti)
|
||||
{
|
||||
HDC hDCScreen, hOldDC, hDC, hDC2;
|
||||
|
||||
/* Get screen DC */
|
||||
hDCScreen = GetDC(NULL);
|
||||
ASSERT(hDCScreen != NULL);
|
||||
|
||||
/* Test NULL DC handle */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hDC = CreateCompatibleDC(NULL);
|
||||
TEST(hDC != NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
if(hDC) DeleteDC(hDC);
|
||||
|
||||
/* Test invalid DC handle */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hDC = CreateCompatibleDC((HDC)0x123456);
|
||||
TEST(hDC == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
if(hDC) DeleteDC(hDC);
|
||||
|
||||
hDC = CreateCompatibleDC(hDCScreen);
|
||||
RTEST(hDC != NULL);
|
||||
|
||||
// Test if first selected pen is BLACK_PEN (? or same as screen DC's pen?)
|
||||
TEST(SelectObject(hDC, GetStockObject(DC_PEN)) == GetStockObject(BLACK_PEN));
|
||||
TEST(SelectObject(hDC, GetStockObject(BLACK_PEN)) == GetStockObject(DC_PEN));
|
||||
|
||||
// Test for the starting Color == RGB(0,0,0)
|
||||
TEST(SetDCPenColor(hDC, RGB(1,2,3)) == RGB(0,0,0));
|
||||
|
||||
// Check for reuse counter
|
||||
hOldDC = hDC;
|
||||
DeleteDC(hDC);
|
||||
hDC = CreateCompatibleDC(hDCScreen);
|
||||
hDC2 = CreateCompatibleDC(hOldDC);
|
||||
RTEST(hDC2 == NULL);
|
||||
if (hDC2 != NULL) DeleteDC(hDC2);
|
||||
|
||||
// cleanup
|
||||
DeleteDC(hDC);
|
||||
|
||||
ReleaseDC(NULL, hDCScreen);
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
#define INVALIDFONT "ThisFontDoesNotExist"
|
||||
|
||||
INT
|
||||
Test_CreateFont(PTESTINFO pti)
|
||||
{
|
||||
HFONT hFont;
|
||||
LOGFONTA logfonta;
|
||||
|
||||
/* Test invalid font name */
|
||||
hFont = CreateFontA(15, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE,
|
||||
DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
|
||||
DEFAULT_QUALITY, DEFAULT_PITCH, INVALIDFONT);
|
||||
RTEST(hFont);
|
||||
RTEST(GetObjectA(hFont, sizeof(LOGFONTA), &logfonta) == sizeof(LOGFONTA));
|
||||
RTEST(memcmp(logfonta.lfFaceName, INVALIDFONT, strlen(INVALIDFONT)) == 0);
|
||||
RTEST(logfonta.lfWeight == FW_DONTCARE);
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
#define INVALIDFONT "ThisFontDoesNotExist"
|
||||
|
||||
INT
|
||||
Test_CreateFont(PTESTINFO pti)
|
||||
{
|
||||
HFONT hFont;
|
||||
LOGFONTA logfonta;
|
||||
|
||||
/* Test invalid font name */
|
||||
hFont = CreateFontA(15, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE,
|
||||
DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
|
||||
DEFAULT_QUALITY, DEFAULT_PITCH, INVALIDFONT);
|
||||
RTEST(hFont);
|
||||
RTEST(GetObjectA(hFont, sizeof(LOGFONTA), &logfonta) == sizeof(LOGFONTA));
|
||||
RTEST(memcmp(logfonta.lfFaceName, INVALIDFONT, strlen(INVALIDFONT)) == 0);
|
||||
RTEST(logfonta.lfWeight == FW_DONTCARE);
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,56 +1,56 @@
|
||||
INT
|
||||
Test_CreatePen(PTESTINFO pti)
|
||||
{
|
||||
HPEN hPen;
|
||||
LOGPEN logpen;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hPen = CreatePen(PS_DASHDOT, 5, RGB(1,2,3));
|
||||
RTEST(hPen);
|
||||
|
||||
/* Test if we have a PEN */
|
||||
RTEST(GDI_HANDLE_GET_TYPE(hPen) == GDI_OBJECT_TYPE_PEN);
|
||||
|
||||
GetObject(hPen, sizeof(logpen), &logpen);
|
||||
RTEST(logpen.lopnStyle == PS_DASHDOT);
|
||||
RTEST(logpen.lopnWidth.x == 5);
|
||||
RTEST(logpen.lopnColor == RGB(1,2,3));
|
||||
DeleteObject(hPen);
|
||||
|
||||
/* PS_GEOMETRIC | PS_DASHDOT = 0x00001011 will become PS_SOLID */
|
||||
logpen.lopnStyle = 22;
|
||||
hPen = CreatePen(PS_GEOMETRIC | PS_DASHDOT, 5, RGB(1,2,3));
|
||||
RTEST(hPen);
|
||||
GetObject(hPen, sizeof(logpen), &logpen);
|
||||
RTEST(logpen.lopnStyle == PS_SOLID);
|
||||
DeleteObject(hPen);
|
||||
|
||||
/* PS_USERSTYLE will become PS_SOLID */
|
||||
logpen.lopnStyle = 22;
|
||||
hPen = CreatePen(PS_USERSTYLE, 5, RGB(1,2,3));
|
||||
RTEST(hPen);
|
||||
GetObject(hPen, sizeof(logpen), &logpen);
|
||||
RTEST(logpen.lopnStyle == PS_SOLID);
|
||||
DeleteObject(hPen);
|
||||
|
||||
/* PS_ALTERNATE will become PS_SOLID */
|
||||
logpen.lopnStyle = 22;
|
||||
hPen = CreatePen(PS_ALTERNATE, 5, RGB(1,2,3));
|
||||
RTEST(hPen);
|
||||
GetObject(hPen, sizeof(logpen), &logpen);
|
||||
RTEST(logpen.lopnStyle == PS_SOLID);
|
||||
DeleteObject(hPen);
|
||||
|
||||
/* PS_INSIDEFRAME is ok */
|
||||
logpen.lopnStyle = 22;
|
||||
hPen = CreatePen(PS_INSIDEFRAME, 5, RGB(1,2,3));
|
||||
RTEST(hPen);
|
||||
GetObject(hPen, sizeof(logpen), &logpen);
|
||||
RTEST(logpen.lopnStyle == PS_INSIDEFRAME);
|
||||
DeleteObject(hPen);
|
||||
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_CreatePen(PTESTINFO pti)
|
||||
{
|
||||
HPEN hPen;
|
||||
LOGPEN logpen;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hPen = CreatePen(PS_DASHDOT, 5, RGB(1,2,3));
|
||||
RTEST(hPen);
|
||||
|
||||
/* Test if we have a PEN */
|
||||
RTEST(GDI_HANDLE_GET_TYPE(hPen) == GDI_OBJECT_TYPE_PEN);
|
||||
|
||||
GetObject(hPen, sizeof(logpen), &logpen);
|
||||
RTEST(logpen.lopnStyle == PS_DASHDOT);
|
||||
RTEST(logpen.lopnWidth.x == 5);
|
||||
RTEST(logpen.lopnColor == RGB(1,2,3));
|
||||
DeleteObject(hPen);
|
||||
|
||||
/* PS_GEOMETRIC | PS_DASHDOT = 0x00001011 will become PS_SOLID */
|
||||
logpen.lopnStyle = 22;
|
||||
hPen = CreatePen(PS_GEOMETRIC | PS_DASHDOT, 5, RGB(1,2,3));
|
||||
RTEST(hPen);
|
||||
GetObject(hPen, sizeof(logpen), &logpen);
|
||||
RTEST(logpen.lopnStyle == PS_SOLID);
|
||||
DeleteObject(hPen);
|
||||
|
||||
/* PS_USERSTYLE will become PS_SOLID */
|
||||
logpen.lopnStyle = 22;
|
||||
hPen = CreatePen(PS_USERSTYLE, 5, RGB(1,2,3));
|
||||
RTEST(hPen);
|
||||
GetObject(hPen, sizeof(logpen), &logpen);
|
||||
RTEST(logpen.lopnStyle == PS_SOLID);
|
||||
DeleteObject(hPen);
|
||||
|
||||
/* PS_ALTERNATE will become PS_SOLID */
|
||||
logpen.lopnStyle = 22;
|
||||
hPen = CreatePen(PS_ALTERNATE, 5, RGB(1,2,3));
|
||||
RTEST(hPen);
|
||||
GetObject(hPen, sizeof(logpen), &logpen);
|
||||
RTEST(logpen.lopnStyle == PS_SOLID);
|
||||
DeleteObject(hPen);
|
||||
|
||||
/* PS_INSIDEFRAME is ok */
|
||||
logpen.lopnStyle = 22;
|
||||
hPen = CreatePen(PS_INSIDEFRAME, 5, RGB(1,2,3));
|
||||
RTEST(hPen);
|
||||
GetObject(hPen, sizeof(logpen), &logpen);
|
||||
RTEST(logpen.lopnStyle == PS_INSIDEFRAME);
|
||||
DeleteObject(hPen);
|
||||
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
INT
|
||||
Test_CreateRectRgn(PTESTINFO pti)
|
||||
{
|
||||
// HRGN hRgn;
|
||||
|
||||
// hRgn = CreateRectRgn(
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
INT
|
||||
Test_CreateRectRgn(PTESTINFO pti)
|
||||
{
|
||||
// HRGN hRgn;
|
||||
|
||||
// hRgn = CreateRectRgn(
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
INT
|
||||
Test_ExtCreatePen(PTESTINFO pti)
|
||||
{
|
||||
HPEN hPen;
|
||||
LOGBRUSH logbrush;
|
||||
DWORD dwStyles[17] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17};
|
||||
|
||||
logbrush.lbStyle = BS_SOLID;
|
||||
logbrush.lbColor = RGB(1,2,3);
|
||||
logbrush.lbHatch = 0;
|
||||
hPen = ExtCreatePen(PS_COSMETIC, 1,&logbrush, 0, 0);
|
||||
if (!hPen) return FALSE;
|
||||
|
||||
/* Test if we have an EXTPEN */
|
||||
RTEST(GDI_HANDLE_GET_TYPE(hPen) == GDI_OBJECT_TYPE_EXTPEN);
|
||||
DeleteObject(hPen);
|
||||
|
||||
/* test userstyles */
|
||||
hPen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 5, &logbrush, 17, (CONST DWORD*)&dwStyles);
|
||||
RTEST(hPen == 0);
|
||||
hPen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 5, &logbrush, 16, (CONST DWORD*)&dwStyles);
|
||||
RTEST(hPen != 0);
|
||||
|
||||
DeleteObject(hPen);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
INT
|
||||
Test_ExtCreatePen(PTESTINFO pti)
|
||||
{
|
||||
HPEN hPen;
|
||||
LOGBRUSH logbrush;
|
||||
DWORD dwStyles[17] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17};
|
||||
|
||||
logbrush.lbStyle = BS_SOLID;
|
||||
logbrush.lbColor = RGB(1,2,3);
|
||||
logbrush.lbHatch = 0;
|
||||
hPen = ExtCreatePen(PS_COSMETIC, 1,&logbrush, 0, 0);
|
||||
if (!hPen) return FALSE;
|
||||
|
||||
/* Test if we have an EXTPEN */
|
||||
RTEST(GDI_HANDLE_GET_TYPE(hPen) == GDI_OBJECT_TYPE_EXTPEN);
|
||||
DeleteObject(hPen);
|
||||
|
||||
/* test userstyles */
|
||||
hPen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 5, &logbrush, 17, (CONST DWORD*)&dwStyles);
|
||||
RTEST(hPen == 0);
|
||||
hPen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 5, &logbrush, 16, (CONST DWORD*)&dwStyles);
|
||||
RTEST(hPen != 0);
|
||||
|
||||
DeleteObject(hPen);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
INT
|
||||
Test_GetClipRgn(PTESTINFO pti)
|
||||
{
|
||||
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, g_hInstance, 0);
|
||||
|
||||
hDC = GetDC(hWnd);
|
||||
hrgn = CreateRectRgn(0,0,0,0);
|
||||
|
||||
/* Test invalid DC */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetClipRgn((HDC)0x12345, hrgn) == -1);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test invalid hrgn */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetClipRgn(hDC, (HRGN)0x12345) == 0);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
ReleaseDC(hWnd, hDC);
|
||||
DestroyWindow(hWnd);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_GetClipRgn(PTESTINFO pti)
|
||||
{
|
||||
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, g_hInstance, 0);
|
||||
|
||||
hDC = GetDC(hWnd);
|
||||
hrgn = CreateRectRgn(0,0,0,0);
|
||||
|
||||
/* Test invalid DC */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetClipRgn((HDC)0x12345, hrgn) == -1);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test invalid hrgn */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetClipRgn(hDC, (HRGN)0x12345) == 0);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
ReleaseDC(hWnd, hDC);
|
||||
DestroyWindow(hWnd);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,89 +1,89 @@
|
||||
INT
|
||||
Test_GetDIBits(PTESTINFO pti)
|
||||
{
|
||||
HDC hDCScreen;
|
||||
HBITMAP hBitmap;
|
||||
BITMAPINFO bi;
|
||||
INT ScreenBpp;
|
||||
|
||||
hDCScreen = GetDC(NULL);
|
||||
if (hDCScreen == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
hBitmap = CreateCompatibleBitmap(hDCScreen, 16, 16);
|
||||
RTEST(hBitmap != NULL);
|
||||
|
||||
/* misc */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetDIBits(0, 0, 0, 0, NULL, NULL, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetDIBits((HDC)2345, 0, 0, 0, NULL, NULL, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetDIBits((HDC)2345, hBitmap, 0, 0, NULL, NULL, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetDIBits((HDC)2345, hBitmap, 0, 15, NULL, &bi, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
|
||||
|
||||
/* null hdc */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ZeroMemory(&bi, sizeof(BITMAPINFO));
|
||||
bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
RTEST(GetDIBits(NULL, hBitmap, 0, 15, NULL, &bi, DIB_RGB_COLORS) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* null bitmap */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ZeroMemory(&bi, sizeof(BITMAPINFO));
|
||||
bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
RTEST(GetDIBits(hDCScreen, NULL, 0, 15, NULL, &bi, DIB_RGB_COLORS) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* 0 scan lines */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ZeroMemory(&bi, sizeof(BITMAPINFO));
|
||||
bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
RTEST(GetDIBits(hDCScreen, hBitmap, 0, 0, NULL, &bi, DIB_RGB_COLORS) > 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* null bitmap info - crashes XP*/
|
||||
//SetLastError(ERROR_SUCCESS);
|
||||
//RTEST(GetDIBits(hDCScreen, NULL, 0, 15, NULL, NULL, DIB_RGB_COLORS) == 0);
|
||||
//RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* bad bmi colours (uUsage) */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ZeroMemory(&bi, sizeof(BITMAPINFO));
|
||||
bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
RTEST(GetDIBits(hDCScreen, hBitmap, 0, 15, NULL, &bi, 100) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
RTEST(bi.bmiHeader.biWidth == 0);
|
||||
RTEST(bi.bmiHeader.biHeight == 0);
|
||||
RTEST(bi.bmiHeader.biBitCount == 0);
|
||||
RTEST(bi.bmiHeader.biSizeImage == 0);
|
||||
|
||||
/* basic call */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ZeroMemory(&bi, sizeof(BITMAPINFO));
|
||||
bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
RTEST(GetDIBits(hDCScreen, hBitmap, 0, 15, NULL, &bi, DIB_RGB_COLORS) > 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
ScreenBpp = GetDeviceCaps(hDCScreen, BITSPIXEL);
|
||||
RTEST(bi.bmiHeader.biWidth == 16);
|
||||
RTEST(bi.bmiHeader.biHeight == 16);
|
||||
RTEST(bi.bmiHeader.biBitCount == ScreenBpp);
|
||||
RTEST(bi.bmiHeader.biSizeImage == (16 * 16) * (ScreenBpp / 8));
|
||||
|
||||
DeleteObject(hBitmap);
|
||||
ReleaseDC(NULL, hDCScreen);
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
INT
|
||||
Test_GetDIBits(PTESTINFO pti)
|
||||
{
|
||||
HDC hDCScreen;
|
||||
HBITMAP hBitmap;
|
||||
BITMAPINFO bi;
|
||||
INT ScreenBpp;
|
||||
|
||||
hDCScreen = GetDC(NULL);
|
||||
if (hDCScreen == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
hBitmap = CreateCompatibleBitmap(hDCScreen, 16, 16);
|
||||
RTEST(hBitmap != NULL);
|
||||
|
||||
/* misc */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetDIBits(0, 0, 0, 0, NULL, NULL, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetDIBits((HDC)2345, 0, 0, 0, NULL, NULL, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetDIBits((HDC)2345, hBitmap, 0, 0, NULL, NULL, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetDIBits((HDC)2345, hBitmap, 0, 15, NULL, &bi, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
|
||||
|
||||
/* null hdc */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ZeroMemory(&bi, sizeof(BITMAPINFO));
|
||||
bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
RTEST(GetDIBits(NULL, hBitmap, 0, 15, NULL, &bi, DIB_RGB_COLORS) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* null bitmap */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ZeroMemory(&bi, sizeof(BITMAPINFO));
|
||||
bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
RTEST(GetDIBits(hDCScreen, NULL, 0, 15, NULL, &bi, DIB_RGB_COLORS) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* 0 scan lines */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ZeroMemory(&bi, sizeof(BITMAPINFO));
|
||||
bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
RTEST(GetDIBits(hDCScreen, hBitmap, 0, 0, NULL, &bi, DIB_RGB_COLORS) > 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* null bitmap info - crashes XP*/
|
||||
//SetLastError(ERROR_SUCCESS);
|
||||
//RTEST(GetDIBits(hDCScreen, NULL, 0, 15, NULL, NULL, DIB_RGB_COLORS) == 0);
|
||||
//RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* bad bmi colours (uUsage) */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ZeroMemory(&bi, sizeof(BITMAPINFO));
|
||||
bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
RTEST(GetDIBits(hDCScreen, hBitmap, 0, 15, NULL, &bi, 100) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
RTEST(bi.bmiHeader.biWidth == 0);
|
||||
RTEST(bi.bmiHeader.biHeight == 0);
|
||||
RTEST(bi.bmiHeader.biBitCount == 0);
|
||||
RTEST(bi.bmiHeader.biSizeImage == 0);
|
||||
|
||||
/* basic call */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ZeroMemory(&bi, sizeof(BITMAPINFO));
|
||||
bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
RTEST(GetDIBits(hDCScreen, hBitmap, 0, 15, NULL, &bi, DIB_RGB_COLORS) > 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
ScreenBpp = GetDeviceCaps(hDCScreen, BITSPIXEL);
|
||||
RTEST(bi.bmiHeader.biWidth == 16);
|
||||
RTEST(bi.bmiHeader.biHeight == 16);
|
||||
RTEST(bi.bmiHeader.biBitCount == ScreenBpp);
|
||||
RTEST(bi.bmiHeader.biSizeImage == (16 * 16) * (ScreenBpp / 8));
|
||||
|
||||
DeleteObject(hBitmap);
|
||||
ReleaseDC(NULL, hDCScreen);
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
@@ -1,444 +1,444 @@
|
||||
static INT
|
||||
Test_General(PTESTINFO pti)
|
||||
{
|
||||
struct
|
||||
{
|
||||
LOGBRUSH logbrush;
|
||||
BYTE additional[5];
|
||||
} TestStruct;
|
||||
PLOGBRUSH plogbrush;
|
||||
HBRUSH hBrush;
|
||||
|
||||
/* Test null pointer and invalid handles */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectA(0, 0, NULL) == 0);
|
||||
TEST(GetObjectA((HANDLE)-1, 0, NULL) == 0);
|
||||
TEST(GetObjectA((HANDLE)0x00380000, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_DC, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_DC, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_REGION, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_REGION, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_EMF, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_EMF, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_METAFILE, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_METAFILE, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_ENHMETAFILE, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_ENHMETAFILE, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
/* Test need of alignment */
|
||||
hBrush = GetStockObject(WHITE_BRUSH);
|
||||
plogbrush = (PVOID)((ULONG_PTR)&TestStruct.logbrush);
|
||||
TEST(GetObject(hBrush, sizeof(LOGBRUSH), plogbrush) == sizeof(LOGBRUSH));
|
||||
plogbrush = (PVOID)((ULONG_PTR)&TestStruct.logbrush + 2);
|
||||
TEST(GetObject(hBrush, sizeof(LOGBRUSH), plogbrush) == sizeof(LOGBRUSH));
|
||||
plogbrush = (PVOID)((ULONG_PTR)&TestStruct.logbrush + 1);
|
||||
TEST(GetObject(hBrush, sizeof(LOGBRUSH), plogbrush) == 0);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_Bitmap(PTESTINFO pti)
|
||||
{
|
||||
HBITMAP hBitmap;
|
||||
BITMAP bitmap;
|
||||
DIBSECTION dibsection;
|
||||
BYTE bData[100] = {0};
|
||||
BYTE Buffer[100] = {48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,0};
|
||||
|
||||
FillMemory(&bitmap, sizeof(BITMAP), 0x77);
|
||||
hBitmap = CreateBitmap(10,10,1,8,bData);
|
||||
if (!hBitmap) return FALSE;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_BITMAP, 0, NULL) == sizeof(BITMAP));
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_BITMAP, 0, NULL) == sizeof(BITMAP));
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_BITMAP, sizeof(BITMAP), NULL) == sizeof(BITMAP));
|
||||
TEST(GetObjectA(hBitmap, sizeof(DIBSECTION), NULL) == sizeof(BITMAP));
|
||||
TEST(GetObjectA(hBitmap, 0, NULL) == sizeof(BITMAP));
|
||||
TEST(GetObjectA((HANDLE)((UINT)hBitmap & 0x0000ffff), 0, NULL) == sizeof(BITMAP));
|
||||
TEST(GetObjectA(hBitmap, 5, NULL) == sizeof(BITMAP));
|
||||
TEST(GetObjectA(hBitmap, -5, NULL) == sizeof(BITMAP));
|
||||
TEST(GetObjectA(hBitmap, 0, Buffer) == 0);
|
||||
TEST(GetObjectA(hBitmap, 5, Buffer) == 0);
|
||||
TEST(GetObjectA(hBitmap, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(GetObjectA(hBitmap, sizeof(BITMAP)+2, &bitmap) == sizeof(BITMAP));
|
||||
TEST(GetObjectA(hBitmap, sizeof(DIBSECTION), &dibsection) == sizeof(BITMAP));
|
||||
TEST(GetObjectA(hBitmap, -5, &bitmap) == sizeof(BITMAP));
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
// todo: test invalid handle + buffer
|
||||
|
||||
DeleteObject(hBitmap);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_Dibsection(PTESTINFO pti)
|
||||
{
|
||||
BITMAPINFO bmi = {{sizeof(BITMAPINFOHEADER), 10, 10, 1, 8, BI_RGB, 0, 10, 10, 0,0}};
|
||||
HBITMAP hBitmap;
|
||||
DIBSECTION dibsection;
|
||||
PVOID pData;
|
||||
|
||||
FillMemory(&dibsection, sizeof(DIBSECTION), 0x77);
|
||||
HDC hDC = GetDC(0);
|
||||
hBitmap = CreateDIBSection(hDC, &bmi, DIB_RGB_COLORS, &pData, NULL, 0);
|
||||
if(!hBitmap) return FALSE;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObject(hBitmap, sizeof(DIBSECTION), NULL) == sizeof(BITMAP));
|
||||
TEST(GetObject(hBitmap, 0, NULL) == sizeof(BITMAP));
|
||||
TEST(GetObject(hBitmap, 5, NULL) == sizeof(BITMAP));
|
||||
TEST(GetObject(hBitmap, -5, NULL) == sizeof(BITMAP));
|
||||
TEST(GetObject(hBitmap, 0, &dibsection) == 0);
|
||||
TEST(GetObject(hBitmap, 5, &dibsection) == 0);
|
||||
TEST(GetObject(hBitmap, sizeof(BITMAP), &dibsection) == sizeof(BITMAP));
|
||||
TEST(GetObject(hBitmap, sizeof(BITMAP)+2, &dibsection) == sizeof(BITMAP));
|
||||
TEST(GetObject(hBitmap, sizeof(DIBSECTION), &dibsection) == sizeof(DIBSECTION));
|
||||
TEST(GetObject(hBitmap, sizeof(DIBSECTION)+2, &dibsection) == sizeof(DIBSECTION));
|
||||
TEST(GetObject(hBitmap, -5, &dibsection) == sizeof(DIBSECTION));
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
DeleteObject(hBitmap);
|
||||
ReleaseDC(0, hDC);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_Palette(PTESTINFO pti)
|
||||
{
|
||||
LOGPALETTE logpal;
|
||||
HPALETTE hPalette;
|
||||
WORD wPalette;
|
||||
|
||||
FillMemory(&wPalette, sizeof(WORD), 0x77);
|
||||
logpal.palVersion = 0x0300;
|
||||
logpal.palNumEntries = 1;
|
||||
logpal.palPalEntry[0].peRed = 0;
|
||||
logpal.palPalEntry[0].peGreen = 0;
|
||||
logpal.palPalEntry[0].peBlue = 0;
|
||||
logpal.palPalEntry[0].peFlags = PC_EXPLICIT;
|
||||
hPalette = CreatePalette(&logpal);
|
||||
if (!hPalette) return FALSE;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_PALETTE, 0, NULL) == sizeof(WORD));
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_PALETTE, 0, NULL) == sizeof(WORD));
|
||||
TEST(GetObject(hPalette, sizeof(WORD), NULL) == sizeof(WORD));
|
||||
TEST(GetObject(hPalette, 0, NULL) == sizeof(WORD));
|
||||
TEST(GetObject(hPalette, 5, NULL) == sizeof(WORD));
|
||||
TEST(GetObject(hPalette, -5, NULL) == sizeof(WORD));
|
||||
TEST(GetObject(hPalette, sizeof(WORD), &wPalette) == sizeof(WORD));
|
||||
TEST(GetObject(hPalette, sizeof(WORD)+2, &wPalette) == sizeof(WORD));
|
||||
TEST(GetObject(hPalette, 0, &wPalette) == 0);
|
||||
TEST(GetObject(hPalette, 1, &wPalette) == 0);
|
||||
TEST(GetObject(hPalette, -1, &wPalette) == sizeof(WORD));
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
DeleteObject(hPalette);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_Brush(PTESTINFO pti)
|
||||
{
|
||||
LOGBRUSH logbrush;
|
||||
HBRUSH hBrush;
|
||||
|
||||
FillMemory(&logbrush, sizeof(LOGBRUSH), 0x77);
|
||||
hBrush = CreateSolidBrush(RGB(1,2,3));
|
||||
if (!hBrush) return FALSE;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_BRUSH, 0, NULL) == sizeof(LOGBRUSH));
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_BRUSH, 0, NULL) == sizeof(LOGBRUSH));
|
||||
TEST(GetObject(hBrush, sizeof(WORD), NULL) == sizeof(LOGBRUSH));
|
||||
TEST(GetObject(hBrush, 0, NULL) == sizeof(LOGBRUSH));
|
||||
RTEST(GetObject(hBrush, 5, NULL) == sizeof(LOGBRUSH));
|
||||
RTEST(GetObject(hBrush, -5, NULL) == sizeof(LOGBRUSH));
|
||||
|
||||
RTEST(GetObject(hBrush, 0, &logbrush) == 0);
|
||||
RTEST(logbrush.lbStyle == 0x77777777);
|
||||
RTEST(GetObject(hBrush, 5, &logbrush) == sizeof(LOGBRUSH));
|
||||
RTEST(logbrush.lbStyle == 0);
|
||||
RTEST(logbrush.lbColor == 0x77777701);
|
||||
|
||||
RTEST(GetObject(hBrush, sizeof(LOGBRUSH), &logbrush) == sizeof(LOGBRUSH));
|
||||
RTEST(GetObject(hBrush, sizeof(LOGBRUSH)+2, &logbrush) == sizeof(LOGBRUSH));
|
||||
RTEST(GetObject(hBrush, -1, &logbrush) == sizeof(LOGBRUSH));
|
||||
// TODO: test all members
|
||||
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
DeleteObject(hBrush);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_Pen(PTESTINFO pti)
|
||||
{
|
||||
LOGPEN logpen;
|
||||
HPEN hPen;
|
||||
|
||||
FillMemory(&logpen, sizeof(LOGPEN), 0x77);
|
||||
hPen = CreatePen(PS_SOLID, 3, RGB(4,5,6));
|
||||
if (!hPen) return FALSE;
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_PEN, 0, NULL) == sizeof(LOGPEN));
|
||||
RTEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_PEN, 0, NULL) == sizeof(LOGPEN));
|
||||
RTEST(GetObject(hPen, sizeof(BITMAP), NULL) == sizeof(LOGPEN));
|
||||
RTEST(GetObject(hPen, 0, NULL) == sizeof(LOGPEN));
|
||||
RTEST(GetObject(hPen, 5, NULL) == sizeof(LOGPEN));
|
||||
RTEST(GetObject(hPen, -5, NULL) == sizeof(LOGPEN));
|
||||
RTEST(GetObject(hPen, sizeof(LOGPEN), &logpen) == sizeof(LOGPEN));
|
||||
RTEST(GetObject(hPen, sizeof(LOGPEN)-1, &logpen) == 0);
|
||||
RTEST(GetObject(hPen, sizeof(LOGPEN)+2, &logpen) == sizeof(LOGPEN));
|
||||
RTEST(GetObject(hPen, 0, &logpen) == 0);
|
||||
RTEST(GetObject(hPen, -5, &logpen) == sizeof(LOGPEN));
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* test if the fields are filled correctly */
|
||||
RTEST(logpen.lopnStyle == PS_SOLID);
|
||||
|
||||
|
||||
DeleteObject(hPen);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_ExtPen(PTESTINFO pti)
|
||||
{
|
||||
HPEN hPen;
|
||||
EXTLOGPEN extlogpen;
|
||||
LOGBRUSH logbrush;
|
||||
DWORD dwStyles[17] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
|
||||
struct
|
||||
{
|
||||
EXTLOGPEN extlogpen;
|
||||
DWORD dwStyles[50];
|
||||
} elpUserStyle;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_EXTPEN, 0, NULL) == 0);
|
||||
RTEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_EXTPEN, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
FillMemory(&extlogpen, sizeof(EXTLOGPEN), 0x77);
|
||||
logbrush.lbStyle = BS_SOLID;
|
||||
logbrush.lbColor = RGB(1,2,3);
|
||||
logbrush.lbHatch = 22;
|
||||
hPen = ExtCreatePen(PS_GEOMETRIC | PS_DASH, 5, &logbrush, 0, NULL);
|
||||
|
||||
RTEST(GDI_HANDLE_GET_TYPE(hPen) == GDI_OBJECT_TYPE_EXTPEN);
|
||||
RTEST(GetObject((HANDLE)GDI_OBJECT_TYPE_EXTPEN, 0, NULL) == 0);
|
||||
RTEST(GetObject(hPen, sizeof(EXTLOGPEN), NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
RTEST(GetObject(hPen, 0, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
RTEST(GetObject((HANDLE)GDI_HANDLE_GET_INDEX(hPen), 0, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
RTEST(GetObject(hPen, 5, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
RTEST(GetObject(hPen, -5, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
RTEST(GetObject(hPen, 0, &extlogpen) == 0);
|
||||
RTEST(GetObject(hPen, 4, &extlogpen) == 0);
|
||||
|
||||
/* Nothing should be filled */
|
||||
RTEST(extlogpen.elpPenStyle == 0x77777777);
|
||||
RTEST(extlogpen.elpWidth == 0x77777777);
|
||||
|
||||
RTEST(GetObject(hPen, sizeof(EXTLOGPEN), &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
RTEST(GetObject(hPen, sizeof(EXTLOGPEN)-sizeof(DWORD), &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
RTEST(GetObject(hPen, sizeof(EXTLOGPEN)-sizeof(DWORD)-1, &extlogpen) == 0);
|
||||
RTEST(GetObject(hPen, sizeof(EXTLOGPEN)+2, &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
RTEST(GetObject(hPen, -5, &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
|
||||
/* test if the fields are filled correctly */
|
||||
RTEST(extlogpen.elpPenStyle == (PS_GEOMETRIC | PS_DASH));
|
||||
RTEST(extlogpen.elpWidth == 5);
|
||||
RTEST(extlogpen.elpBrushStyle == 0);
|
||||
RTEST(extlogpen.elpColor == RGB(1,2,3));
|
||||
RTEST(extlogpen.elpHatch == 22);
|
||||
RTEST(extlogpen.elpNumEntries == 0);
|
||||
DeleteObject(hPen);
|
||||
|
||||
/* A maximum of 16 Styles is allowed */
|
||||
hPen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 5, &logbrush, 16, (CONST DWORD*)&dwStyles);
|
||||
RTEST(GetObject(hPen, 0, NULL) == sizeof(EXTLOGPEN) + 15*sizeof(DWORD));
|
||||
RTEST(GetObject(hPen, sizeof(EXTLOGPEN) + 15*sizeof(DWORD), &elpUserStyle) == sizeof(EXTLOGPEN) + 15*sizeof(DWORD));
|
||||
RTEST(((EXTLOGPEN*)&elpUserStyle)->elpStyleEntry[0] == 0);
|
||||
RTEST(((EXTLOGPEN*)&elpUserStyle)->elpStyleEntry[1] == 1);
|
||||
RTEST(((EXTLOGPEN*)&elpUserStyle)->elpStyleEntry[15] == 15);
|
||||
DeleteObject(hPen);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_Font(PTESTINFO pti)
|
||||
{
|
||||
HFONT hFont;
|
||||
LOGFONTA logfonta;
|
||||
LOGFONTW logfontw;
|
||||
EXTLOGFONTA extlogfonta;
|
||||
EXTLOGFONTW extlogfontw;
|
||||
ENUMLOGFONTEXA enumlogfontexa;
|
||||
ENUMLOGFONTEXW enumlogfontexw;
|
||||
ENUMLOGFONTEXDVA enumlogfontexdva;
|
||||
ENUMLOGFONTEXDVW enumlogfontexdvw;
|
||||
ENUMLOGFONTA enumlogfonta;
|
||||
ENUMLOGFONTW enumlogfontw;
|
||||
BYTE bData[270];
|
||||
|
||||
FillMemory(&logfonta, sizeof(LOGFONTA), 0x77);
|
||||
hFont = CreateFontA(8, 8, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE,
|
||||
ANSI_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,
|
||||
ANTIALIASED_QUALITY, DEFAULT_PITCH, "testfont");
|
||||
TEST(hFont);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, 0, NULL) == sizeof(LOGFONTA));
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, 0, NULL) == sizeof(LOGFONTW));
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(LOGFONTA), NULL) == sizeof(LOGFONTA)); // 60
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTA), NULL) == sizeof(LOGFONTA)); // 156
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXA), NULL) == sizeof(LOGFONTA)); // 188
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(EXTLOGFONTA), NULL) == sizeof(LOGFONTA)); // 192
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXDVA), NULL) == sizeof(LOGFONTA)); // 260
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXDVA)+1, NULL) == sizeof(LOGFONTA)); // 260
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(LOGFONTW), NULL) == sizeof(LOGFONTW)); // 92
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTW), NULL) == sizeof(LOGFONTW)); // 284
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(EXTLOGFONTW), NULL) == sizeof(LOGFONTW)); // 320
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXW), NULL) == sizeof(LOGFONTW)); // 348
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXDVW), NULL) == sizeof(LOGFONTW)); // 420
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXDVW)+1, NULL) == sizeof(LOGFONTW)); // 356!
|
||||
|
||||
TEST(GetObjectA(hFont, sizeof(LOGFONTA), NULL) == sizeof(LOGFONTA));
|
||||
TEST(GetObjectA(hFont, 0, NULL) == sizeof(LOGFONTA));
|
||||
TEST(GetObjectA(hFont, 5, NULL) == sizeof(LOGFONTA));
|
||||
TEST(GetObjectA(hFont, -5, NULL) == sizeof(LOGFONTA));
|
||||
TEST(GetObjectA(hFont, 0, &logfonta) == 0);
|
||||
TEST(logfonta.lfHeight == 0x77777777);
|
||||
|
||||
TEST(GetObjectA(hFont, 5, &logfonta) == 5);
|
||||
TEST(logfonta.lfHeight == 8);
|
||||
TEST(logfonta.lfWidth == 0x77777708);
|
||||
|
||||
TEST(GetObjectA(hFont, sizeof(LOGFONTA), &logfonta) == sizeof(LOGFONTA)); // 60
|
||||
TEST(GetObjectA(hFont, sizeof(LOGFONTW), &logfontw) == sizeof(LOGFONTA)); // 92
|
||||
TEST(GetObjectA(hFont, sizeof(EXTLOGFONTA), &extlogfonta) == sizeof(EXTLOGFONTA)); // 192
|
||||
TEST(GetObjectA(hFont, sizeof(EXTLOGFONTA)+1, &extlogfonta) == sizeof(EXTLOGFONTA)+1); // 192
|
||||
TEST(GetObjectA(hFont, sizeof(EXTLOGFONTW), &extlogfontw) == sizeof(ENUMLOGFONTEXDVA)); // 320
|
||||
|
||||
TEST(GetObjectA(hFont, 261, &bData) == 260); // no
|
||||
|
||||
/* LOGFONT / GetObjectW */
|
||||
FillMemory(&logfontw, sizeof(LOGFONTW), 0x77);
|
||||
|
||||
TEST(GetObjectW(hFont, sizeof(LOGFONTW), NULL) == sizeof(LOGFONTW));
|
||||
TEST(GetObjectW(hFont, 0, NULL) == sizeof(LOGFONTW));
|
||||
TEST(GetObjectW(hFont, 5, NULL) == sizeof(LOGFONTW));
|
||||
TEST(GetObjectW(hFont, -5, NULL) == sizeof(LOGFONTW));
|
||||
TEST(GetObjectW(hFont, 0, &logfontw) == 0);
|
||||
TEST(logfontw.lfHeight == 0x77777777);
|
||||
|
||||
TEST(GetObjectW(hFont, 5, &logfontw) == 5);
|
||||
TEST(logfontw.lfHeight == 8);
|
||||
TEST(logfontw.lfWidth == 0x77777708);
|
||||
|
||||
TEST(GetObjectA(hFont, sizeof(LOGFONTA), &logfonta) == sizeof(LOGFONTA)); // 60
|
||||
TEST(logfonta.lfHeight == 8);
|
||||
TEST(GetObjectA(hFont, sizeof(ENUMLOGFONTA), &enumlogfonta) == sizeof(ENUMLOGFONTA)); // 156
|
||||
TEST(GetObjectA(hFont, sizeof(ENUMLOGFONTEXA), &enumlogfontexa) == sizeof(ENUMLOGFONTEXA)); // 188
|
||||
TEST(GetObjectA(hFont, sizeof(EXTLOGFONTA), &extlogfonta) == sizeof(EXTLOGFONTA)); // 192
|
||||
TEST(GetObjectA(hFont, sizeof(ENUMLOGFONTEXDVA), &enumlogfontexdva) == sizeof(ENUMLOGFONTEXDVA)); // 260
|
||||
TEST(GetObjectA(hFont, sizeof(ENUMLOGFONTEXDVA)+1, &enumlogfontexdva) == sizeof(ENUMLOGFONTEXDVA)); // 260
|
||||
|
||||
TEST(GetObjectW(hFont, sizeof(LOGFONTW), &logfontw) == sizeof(LOGFONTW)); // 92
|
||||
TEST(GetObjectW(hFont, sizeof(ENUMLOGFONTW), &enumlogfontw) == sizeof(ENUMLOGFONTW)); // 284
|
||||
TEST(GetObjectW(hFont, sizeof(EXTLOGFONTW), &extlogfontw) == sizeof(EXTLOGFONTW)); // 320
|
||||
TEST(GetObjectW(hFont, sizeof(ENUMLOGFONTEXW), &enumlogfontexw) == sizeof(ENUMLOGFONTEXW)); // 348
|
||||
TEST(GetObjectW(hFont, sizeof(ENUMLOGFONTEXDVW), &enumlogfontexdvw) == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD)); // 420
|
||||
TEST(GetObjectW(hFont, sizeof(ENUMLOGFONTEXDVW)+1, &enumlogfontexdvw) == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD)); // 356!
|
||||
|
||||
TEST(GetObjectW(hFont, 356, &bData) == 356);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
DeleteObject(hFont);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_Colorspace(PTESTINFO pti)
|
||||
{
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_COLORSPACE, 0, NULL) == 60);// FIXME: what structure?
|
||||
TEST(GetLastError() == ERROR_INSUFFICIENT_BUFFER);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_COLORSPACE, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INSUFFICIENT_BUFFER);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_MetaDC(PTESTINFO pti)
|
||||
{
|
||||
/* Windows does not SetLastError() on a metadc, but it doesn't seem to do anything with it */
|
||||
HDC hMetaDC;
|
||||
BYTE buffer[100];
|
||||
|
||||
hMetaDC = CreateMetaFile(NULL);
|
||||
if(!hMetaDC) return FALSE;
|
||||
if(((UINT)hMetaDC & GDI_HANDLE_TYPE_MASK) != GDI_OBJECT_TYPE_METADC) return FALSE;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_METADC, 0, NULL) == 0);
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_METADC, 100, &buffer) == 0);
|
||||
TEST(GetObjectA(hMetaDC, 0, NULL) == 0);
|
||||
TEST(GetObjectA(hMetaDC, 100, &buffer) == 0);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_GetObject(PTESTINFO pti)
|
||||
{
|
||||
|
||||
HRGN hRgn;
|
||||
hRgn = CreateRectRgn(0,0,5,5);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectW(hRgn, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
DeleteObject(hRgn);
|
||||
|
||||
Test_Font(pti);
|
||||
Test_Colorspace(pti);
|
||||
Test_General(pti);
|
||||
Test_Bitmap(pti);
|
||||
Test_Dibsection(pti);
|
||||
Test_Palette(pti);
|
||||
Test_Brush(pti);
|
||||
Test_Pen(pti);
|
||||
Test_ExtPen(pti); // not implemented yet in ROS
|
||||
Test_MetaDC(pti);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
static INT
|
||||
Test_General(PTESTINFO pti)
|
||||
{
|
||||
struct
|
||||
{
|
||||
LOGBRUSH logbrush;
|
||||
BYTE additional[5];
|
||||
} TestStruct;
|
||||
PLOGBRUSH plogbrush;
|
||||
HBRUSH hBrush;
|
||||
|
||||
/* Test null pointer and invalid handles */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectA(0, 0, NULL) == 0);
|
||||
TEST(GetObjectA((HANDLE)-1, 0, NULL) == 0);
|
||||
TEST(GetObjectA((HANDLE)0x00380000, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_DC, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_DC, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_REGION, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_REGION, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_EMF, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_EMF, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_METAFILE, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_METAFILE, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_ENHMETAFILE, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_ENHMETAFILE, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
/* Test need of alignment */
|
||||
hBrush = GetStockObject(WHITE_BRUSH);
|
||||
plogbrush = (PVOID)((ULONG_PTR)&TestStruct.logbrush);
|
||||
TEST(GetObject(hBrush, sizeof(LOGBRUSH), plogbrush) == sizeof(LOGBRUSH));
|
||||
plogbrush = (PVOID)((ULONG_PTR)&TestStruct.logbrush + 2);
|
||||
TEST(GetObject(hBrush, sizeof(LOGBRUSH), plogbrush) == sizeof(LOGBRUSH));
|
||||
plogbrush = (PVOID)((ULONG_PTR)&TestStruct.logbrush + 1);
|
||||
TEST(GetObject(hBrush, sizeof(LOGBRUSH), plogbrush) == 0);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_Bitmap(PTESTINFO pti)
|
||||
{
|
||||
HBITMAP hBitmap;
|
||||
BITMAP bitmap;
|
||||
DIBSECTION dibsection;
|
||||
BYTE bData[100] = {0};
|
||||
BYTE Buffer[100] = {48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,0};
|
||||
|
||||
FillMemory(&bitmap, sizeof(BITMAP), 0x77);
|
||||
hBitmap = CreateBitmap(10,10,1,8,bData);
|
||||
if (!hBitmap) return FALSE;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_BITMAP, 0, NULL) == sizeof(BITMAP));
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_BITMAP, 0, NULL) == sizeof(BITMAP));
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_BITMAP, sizeof(BITMAP), NULL) == sizeof(BITMAP));
|
||||
TEST(GetObjectA(hBitmap, sizeof(DIBSECTION), NULL) == sizeof(BITMAP));
|
||||
TEST(GetObjectA(hBitmap, 0, NULL) == sizeof(BITMAP));
|
||||
TEST(GetObjectA((HANDLE)((UINT)hBitmap & 0x0000ffff), 0, NULL) == sizeof(BITMAP));
|
||||
TEST(GetObjectA(hBitmap, 5, NULL) == sizeof(BITMAP));
|
||||
TEST(GetObjectA(hBitmap, -5, NULL) == sizeof(BITMAP));
|
||||
TEST(GetObjectA(hBitmap, 0, Buffer) == 0);
|
||||
TEST(GetObjectA(hBitmap, 5, Buffer) == 0);
|
||||
TEST(GetObjectA(hBitmap, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(GetObjectA(hBitmap, sizeof(BITMAP)+2, &bitmap) == sizeof(BITMAP));
|
||||
TEST(GetObjectA(hBitmap, sizeof(DIBSECTION), &dibsection) == sizeof(BITMAP));
|
||||
TEST(GetObjectA(hBitmap, -5, &bitmap) == sizeof(BITMAP));
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
// todo: test invalid handle + buffer
|
||||
|
||||
DeleteObject(hBitmap);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_Dibsection(PTESTINFO pti)
|
||||
{
|
||||
BITMAPINFO bmi = {{sizeof(BITMAPINFOHEADER), 10, 10, 1, 8, BI_RGB, 0, 10, 10, 0,0}};
|
||||
HBITMAP hBitmap;
|
||||
DIBSECTION dibsection;
|
||||
PVOID pData;
|
||||
|
||||
FillMemory(&dibsection, sizeof(DIBSECTION), 0x77);
|
||||
HDC hDC = GetDC(0);
|
||||
hBitmap = CreateDIBSection(hDC, &bmi, DIB_RGB_COLORS, &pData, NULL, 0);
|
||||
if(!hBitmap) return FALSE;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObject(hBitmap, sizeof(DIBSECTION), NULL) == sizeof(BITMAP));
|
||||
TEST(GetObject(hBitmap, 0, NULL) == sizeof(BITMAP));
|
||||
TEST(GetObject(hBitmap, 5, NULL) == sizeof(BITMAP));
|
||||
TEST(GetObject(hBitmap, -5, NULL) == sizeof(BITMAP));
|
||||
TEST(GetObject(hBitmap, 0, &dibsection) == 0);
|
||||
TEST(GetObject(hBitmap, 5, &dibsection) == 0);
|
||||
TEST(GetObject(hBitmap, sizeof(BITMAP), &dibsection) == sizeof(BITMAP));
|
||||
TEST(GetObject(hBitmap, sizeof(BITMAP)+2, &dibsection) == sizeof(BITMAP));
|
||||
TEST(GetObject(hBitmap, sizeof(DIBSECTION), &dibsection) == sizeof(DIBSECTION));
|
||||
TEST(GetObject(hBitmap, sizeof(DIBSECTION)+2, &dibsection) == sizeof(DIBSECTION));
|
||||
TEST(GetObject(hBitmap, -5, &dibsection) == sizeof(DIBSECTION));
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
DeleteObject(hBitmap);
|
||||
ReleaseDC(0, hDC);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_Palette(PTESTINFO pti)
|
||||
{
|
||||
LOGPALETTE logpal;
|
||||
HPALETTE hPalette;
|
||||
WORD wPalette;
|
||||
|
||||
FillMemory(&wPalette, sizeof(WORD), 0x77);
|
||||
logpal.palVersion = 0x0300;
|
||||
logpal.palNumEntries = 1;
|
||||
logpal.palPalEntry[0].peRed = 0;
|
||||
logpal.palPalEntry[0].peGreen = 0;
|
||||
logpal.palPalEntry[0].peBlue = 0;
|
||||
logpal.palPalEntry[0].peFlags = PC_EXPLICIT;
|
||||
hPalette = CreatePalette(&logpal);
|
||||
if (!hPalette) return FALSE;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_PALETTE, 0, NULL) == sizeof(WORD));
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_PALETTE, 0, NULL) == sizeof(WORD));
|
||||
TEST(GetObject(hPalette, sizeof(WORD), NULL) == sizeof(WORD));
|
||||
TEST(GetObject(hPalette, 0, NULL) == sizeof(WORD));
|
||||
TEST(GetObject(hPalette, 5, NULL) == sizeof(WORD));
|
||||
TEST(GetObject(hPalette, -5, NULL) == sizeof(WORD));
|
||||
TEST(GetObject(hPalette, sizeof(WORD), &wPalette) == sizeof(WORD));
|
||||
TEST(GetObject(hPalette, sizeof(WORD)+2, &wPalette) == sizeof(WORD));
|
||||
TEST(GetObject(hPalette, 0, &wPalette) == 0);
|
||||
TEST(GetObject(hPalette, 1, &wPalette) == 0);
|
||||
TEST(GetObject(hPalette, -1, &wPalette) == sizeof(WORD));
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
DeleteObject(hPalette);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_Brush(PTESTINFO pti)
|
||||
{
|
||||
LOGBRUSH logbrush;
|
||||
HBRUSH hBrush;
|
||||
|
||||
FillMemory(&logbrush, sizeof(LOGBRUSH), 0x77);
|
||||
hBrush = CreateSolidBrush(RGB(1,2,3));
|
||||
if (!hBrush) return FALSE;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_BRUSH, 0, NULL) == sizeof(LOGBRUSH));
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_BRUSH, 0, NULL) == sizeof(LOGBRUSH));
|
||||
TEST(GetObject(hBrush, sizeof(WORD), NULL) == sizeof(LOGBRUSH));
|
||||
TEST(GetObject(hBrush, 0, NULL) == sizeof(LOGBRUSH));
|
||||
RTEST(GetObject(hBrush, 5, NULL) == sizeof(LOGBRUSH));
|
||||
RTEST(GetObject(hBrush, -5, NULL) == sizeof(LOGBRUSH));
|
||||
|
||||
RTEST(GetObject(hBrush, 0, &logbrush) == 0);
|
||||
RTEST(logbrush.lbStyle == 0x77777777);
|
||||
RTEST(GetObject(hBrush, 5, &logbrush) == sizeof(LOGBRUSH));
|
||||
RTEST(logbrush.lbStyle == 0);
|
||||
RTEST(logbrush.lbColor == 0x77777701);
|
||||
|
||||
RTEST(GetObject(hBrush, sizeof(LOGBRUSH), &logbrush) == sizeof(LOGBRUSH));
|
||||
RTEST(GetObject(hBrush, sizeof(LOGBRUSH)+2, &logbrush) == sizeof(LOGBRUSH));
|
||||
RTEST(GetObject(hBrush, -1, &logbrush) == sizeof(LOGBRUSH));
|
||||
// TODO: test all members
|
||||
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
DeleteObject(hBrush);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_Pen(PTESTINFO pti)
|
||||
{
|
||||
LOGPEN logpen;
|
||||
HPEN hPen;
|
||||
|
||||
FillMemory(&logpen, sizeof(LOGPEN), 0x77);
|
||||
hPen = CreatePen(PS_SOLID, 3, RGB(4,5,6));
|
||||
if (!hPen) return FALSE;
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_PEN, 0, NULL) == sizeof(LOGPEN));
|
||||
RTEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_PEN, 0, NULL) == sizeof(LOGPEN));
|
||||
RTEST(GetObject(hPen, sizeof(BITMAP), NULL) == sizeof(LOGPEN));
|
||||
RTEST(GetObject(hPen, 0, NULL) == sizeof(LOGPEN));
|
||||
RTEST(GetObject(hPen, 5, NULL) == sizeof(LOGPEN));
|
||||
RTEST(GetObject(hPen, -5, NULL) == sizeof(LOGPEN));
|
||||
RTEST(GetObject(hPen, sizeof(LOGPEN), &logpen) == sizeof(LOGPEN));
|
||||
RTEST(GetObject(hPen, sizeof(LOGPEN)-1, &logpen) == 0);
|
||||
RTEST(GetObject(hPen, sizeof(LOGPEN)+2, &logpen) == sizeof(LOGPEN));
|
||||
RTEST(GetObject(hPen, 0, &logpen) == 0);
|
||||
RTEST(GetObject(hPen, -5, &logpen) == sizeof(LOGPEN));
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* test if the fields are filled correctly */
|
||||
RTEST(logpen.lopnStyle == PS_SOLID);
|
||||
|
||||
|
||||
DeleteObject(hPen);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_ExtPen(PTESTINFO pti)
|
||||
{
|
||||
HPEN hPen;
|
||||
EXTLOGPEN extlogpen;
|
||||
LOGBRUSH logbrush;
|
||||
DWORD dwStyles[17] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
|
||||
struct
|
||||
{
|
||||
EXTLOGPEN extlogpen;
|
||||
DWORD dwStyles[50];
|
||||
} elpUserStyle;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_EXTPEN, 0, NULL) == 0);
|
||||
RTEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_EXTPEN, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
FillMemory(&extlogpen, sizeof(EXTLOGPEN), 0x77);
|
||||
logbrush.lbStyle = BS_SOLID;
|
||||
logbrush.lbColor = RGB(1,2,3);
|
||||
logbrush.lbHatch = 22;
|
||||
hPen = ExtCreatePen(PS_GEOMETRIC | PS_DASH, 5, &logbrush, 0, NULL);
|
||||
|
||||
RTEST(GDI_HANDLE_GET_TYPE(hPen) == GDI_OBJECT_TYPE_EXTPEN);
|
||||
RTEST(GetObject((HANDLE)GDI_OBJECT_TYPE_EXTPEN, 0, NULL) == 0);
|
||||
RTEST(GetObject(hPen, sizeof(EXTLOGPEN), NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
RTEST(GetObject(hPen, 0, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
RTEST(GetObject((HANDLE)GDI_HANDLE_GET_INDEX(hPen), 0, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
RTEST(GetObject(hPen, 5, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
RTEST(GetObject(hPen, -5, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
RTEST(GetObject(hPen, 0, &extlogpen) == 0);
|
||||
RTEST(GetObject(hPen, 4, &extlogpen) == 0);
|
||||
|
||||
/* Nothing should be filled */
|
||||
RTEST(extlogpen.elpPenStyle == 0x77777777);
|
||||
RTEST(extlogpen.elpWidth == 0x77777777);
|
||||
|
||||
RTEST(GetObject(hPen, sizeof(EXTLOGPEN), &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
RTEST(GetObject(hPen, sizeof(EXTLOGPEN)-sizeof(DWORD), &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
RTEST(GetObject(hPen, sizeof(EXTLOGPEN)-sizeof(DWORD)-1, &extlogpen) == 0);
|
||||
RTEST(GetObject(hPen, sizeof(EXTLOGPEN)+2, &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
RTEST(GetObject(hPen, -5, &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
|
||||
/* test if the fields are filled correctly */
|
||||
RTEST(extlogpen.elpPenStyle == (PS_GEOMETRIC | PS_DASH));
|
||||
RTEST(extlogpen.elpWidth == 5);
|
||||
RTEST(extlogpen.elpBrushStyle == 0);
|
||||
RTEST(extlogpen.elpColor == RGB(1,2,3));
|
||||
RTEST(extlogpen.elpHatch == 22);
|
||||
RTEST(extlogpen.elpNumEntries == 0);
|
||||
DeleteObject(hPen);
|
||||
|
||||
/* A maximum of 16 Styles is allowed */
|
||||
hPen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 5, &logbrush, 16, (CONST DWORD*)&dwStyles);
|
||||
RTEST(GetObject(hPen, 0, NULL) == sizeof(EXTLOGPEN) + 15*sizeof(DWORD));
|
||||
RTEST(GetObject(hPen, sizeof(EXTLOGPEN) + 15*sizeof(DWORD), &elpUserStyle) == sizeof(EXTLOGPEN) + 15*sizeof(DWORD));
|
||||
RTEST(((EXTLOGPEN*)&elpUserStyle)->elpStyleEntry[0] == 0);
|
||||
RTEST(((EXTLOGPEN*)&elpUserStyle)->elpStyleEntry[1] == 1);
|
||||
RTEST(((EXTLOGPEN*)&elpUserStyle)->elpStyleEntry[15] == 15);
|
||||
DeleteObject(hPen);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_Font(PTESTINFO pti)
|
||||
{
|
||||
HFONT hFont;
|
||||
LOGFONTA logfonta;
|
||||
LOGFONTW logfontw;
|
||||
EXTLOGFONTA extlogfonta;
|
||||
EXTLOGFONTW extlogfontw;
|
||||
ENUMLOGFONTEXA enumlogfontexa;
|
||||
ENUMLOGFONTEXW enumlogfontexw;
|
||||
ENUMLOGFONTEXDVA enumlogfontexdva;
|
||||
ENUMLOGFONTEXDVW enumlogfontexdvw;
|
||||
ENUMLOGFONTA enumlogfonta;
|
||||
ENUMLOGFONTW enumlogfontw;
|
||||
BYTE bData[270];
|
||||
|
||||
FillMemory(&logfonta, sizeof(LOGFONTA), 0x77);
|
||||
hFont = CreateFontA(8, 8, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE,
|
||||
ANSI_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,
|
||||
ANTIALIASED_QUALITY, DEFAULT_PITCH, "testfont");
|
||||
TEST(hFont);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, 0, NULL) == sizeof(LOGFONTA));
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, 0, NULL) == sizeof(LOGFONTW));
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(LOGFONTA), NULL) == sizeof(LOGFONTA)); // 60
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTA), NULL) == sizeof(LOGFONTA)); // 156
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXA), NULL) == sizeof(LOGFONTA)); // 188
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(EXTLOGFONTA), NULL) == sizeof(LOGFONTA)); // 192
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXDVA), NULL) == sizeof(LOGFONTA)); // 260
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXDVA)+1, NULL) == sizeof(LOGFONTA)); // 260
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(LOGFONTW), NULL) == sizeof(LOGFONTW)); // 92
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTW), NULL) == sizeof(LOGFONTW)); // 284
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(EXTLOGFONTW), NULL) == sizeof(LOGFONTW)); // 320
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXW), NULL) == sizeof(LOGFONTW)); // 348
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXDVW), NULL) == sizeof(LOGFONTW)); // 420
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXDVW)+1, NULL) == sizeof(LOGFONTW)); // 356!
|
||||
|
||||
TEST(GetObjectA(hFont, sizeof(LOGFONTA), NULL) == sizeof(LOGFONTA));
|
||||
TEST(GetObjectA(hFont, 0, NULL) == sizeof(LOGFONTA));
|
||||
TEST(GetObjectA(hFont, 5, NULL) == sizeof(LOGFONTA));
|
||||
TEST(GetObjectA(hFont, -5, NULL) == sizeof(LOGFONTA));
|
||||
TEST(GetObjectA(hFont, 0, &logfonta) == 0);
|
||||
TEST(logfonta.lfHeight == 0x77777777);
|
||||
|
||||
TEST(GetObjectA(hFont, 5, &logfonta) == 5);
|
||||
TEST(logfonta.lfHeight == 8);
|
||||
TEST(logfonta.lfWidth == 0x77777708);
|
||||
|
||||
TEST(GetObjectA(hFont, sizeof(LOGFONTA), &logfonta) == sizeof(LOGFONTA)); // 60
|
||||
TEST(GetObjectA(hFont, sizeof(LOGFONTW), &logfontw) == sizeof(LOGFONTA)); // 92
|
||||
TEST(GetObjectA(hFont, sizeof(EXTLOGFONTA), &extlogfonta) == sizeof(EXTLOGFONTA)); // 192
|
||||
TEST(GetObjectA(hFont, sizeof(EXTLOGFONTA)+1, &extlogfonta) == sizeof(EXTLOGFONTA)+1); // 192
|
||||
TEST(GetObjectA(hFont, sizeof(EXTLOGFONTW), &extlogfontw) == sizeof(ENUMLOGFONTEXDVA)); // 320
|
||||
|
||||
TEST(GetObjectA(hFont, 261, &bData) == 260); // no
|
||||
|
||||
/* LOGFONT / GetObjectW */
|
||||
FillMemory(&logfontw, sizeof(LOGFONTW), 0x77);
|
||||
|
||||
TEST(GetObjectW(hFont, sizeof(LOGFONTW), NULL) == sizeof(LOGFONTW));
|
||||
TEST(GetObjectW(hFont, 0, NULL) == sizeof(LOGFONTW));
|
||||
TEST(GetObjectW(hFont, 5, NULL) == sizeof(LOGFONTW));
|
||||
TEST(GetObjectW(hFont, -5, NULL) == sizeof(LOGFONTW));
|
||||
TEST(GetObjectW(hFont, 0, &logfontw) == 0);
|
||||
TEST(logfontw.lfHeight == 0x77777777);
|
||||
|
||||
TEST(GetObjectW(hFont, 5, &logfontw) == 5);
|
||||
TEST(logfontw.lfHeight == 8);
|
||||
TEST(logfontw.lfWidth == 0x77777708);
|
||||
|
||||
TEST(GetObjectA(hFont, sizeof(LOGFONTA), &logfonta) == sizeof(LOGFONTA)); // 60
|
||||
TEST(logfonta.lfHeight == 8);
|
||||
TEST(GetObjectA(hFont, sizeof(ENUMLOGFONTA), &enumlogfonta) == sizeof(ENUMLOGFONTA)); // 156
|
||||
TEST(GetObjectA(hFont, sizeof(ENUMLOGFONTEXA), &enumlogfontexa) == sizeof(ENUMLOGFONTEXA)); // 188
|
||||
TEST(GetObjectA(hFont, sizeof(EXTLOGFONTA), &extlogfonta) == sizeof(EXTLOGFONTA)); // 192
|
||||
TEST(GetObjectA(hFont, sizeof(ENUMLOGFONTEXDVA), &enumlogfontexdva) == sizeof(ENUMLOGFONTEXDVA)); // 260
|
||||
TEST(GetObjectA(hFont, sizeof(ENUMLOGFONTEXDVA)+1, &enumlogfontexdva) == sizeof(ENUMLOGFONTEXDVA)); // 260
|
||||
|
||||
TEST(GetObjectW(hFont, sizeof(LOGFONTW), &logfontw) == sizeof(LOGFONTW)); // 92
|
||||
TEST(GetObjectW(hFont, sizeof(ENUMLOGFONTW), &enumlogfontw) == sizeof(ENUMLOGFONTW)); // 284
|
||||
TEST(GetObjectW(hFont, sizeof(EXTLOGFONTW), &extlogfontw) == sizeof(EXTLOGFONTW)); // 320
|
||||
TEST(GetObjectW(hFont, sizeof(ENUMLOGFONTEXW), &enumlogfontexw) == sizeof(ENUMLOGFONTEXW)); // 348
|
||||
TEST(GetObjectW(hFont, sizeof(ENUMLOGFONTEXDVW), &enumlogfontexdvw) == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD)); // 420
|
||||
TEST(GetObjectW(hFont, sizeof(ENUMLOGFONTEXDVW)+1, &enumlogfontexdvw) == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD)); // 356!
|
||||
|
||||
TEST(GetObjectW(hFont, 356, &bData) == 356);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
DeleteObject(hFont);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_Colorspace(PTESTINFO pti)
|
||||
{
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_COLORSPACE, 0, NULL) == 60);// FIXME: what structure?
|
||||
TEST(GetLastError() == ERROR_INSUFFICIENT_BUFFER);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_COLORSPACE, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INSUFFICIENT_BUFFER);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_MetaDC(PTESTINFO pti)
|
||||
{
|
||||
/* Windows does not SetLastError() on a metadc, but it doesn't seem to do anything with it */
|
||||
HDC hMetaDC;
|
||||
BYTE buffer[100];
|
||||
|
||||
hMetaDC = CreateMetaFile(NULL);
|
||||
if(!hMetaDC) return FALSE;
|
||||
if(((UINT)hMetaDC & GDI_HANDLE_TYPE_MASK) != GDI_OBJECT_TYPE_METADC) return FALSE;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_METADC, 0, NULL) == 0);
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_METADC, 100, &buffer) == 0);
|
||||
TEST(GetObjectA(hMetaDC, 0, NULL) == 0);
|
||||
TEST(GetObjectA(hMetaDC, 100, &buffer) == 0);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_GetObject(PTESTINFO pti)
|
||||
{
|
||||
|
||||
HRGN hRgn;
|
||||
hRgn = CreateRectRgn(0,0,5,5);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectW(hRgn, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
DeleteObject(hRgn);
|
||||
|
||||
Test_Font(pti);
|
||||
Test_Colorspace(pti);
|
||||
Test_General(pti);
|
||||
Test_Bitmap(pti);
|
||||
Test_Dibsection(pti);
|
||||
Test_Palette(pti);
|
||||
Test_Brush(pti);
|
||||
Test_Pen(pti);
|
||||
Test_ExtPen(pti); // not implemented yet in ROS
|
||||
Test_MetaDC(pti);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
INT
|
||||
Test_GetStockObject(PTESTINFO pti)
|
||||
{
|
||||
/* Test limits and error */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetStockObject(0) != NULL);
|
||||
TEST(GetStockObject(20) != NULL);
|
||||
TEST(GetStockObject(21) != NULL);
|
||||
RTEST(GetStockObject(-1) == NULL);
|
||||
RTEST(GetStockObject(9) == NULL);
|
||||
RTEST(GetStockObject(22) == NULL);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test for the stock bit */
|
||||
RTEST((UINT)GetStockObject(WHITE_BRUSH) && GDI_HANDLE_STOCK_MASK);
|
||||
|
||||
/* Test for correct types */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(WHITE_BRUSH)) == GDI_OBJECT_TYPE_BRUSH); /* 0 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(LTGRAY_BRUSH)) == GDI_OBJECT_TYPE_BRUSH); /* 1 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(GRAY_BRUSH)) == GDI_OBJECT_TYPE_BRUSH); /* 1 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(DKGRAY_BRUSH)) == GDI_OBJECT_TYPE_BRUSH); /* 1 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(BLACK_BRUSH)) == GDI_OBJECT_TYPE_BRUSH); /* 1 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(NULL_BRUSH)) == GDI_OBJECT_TYPE_BRUSH); /* 1 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(WHITE_PEN)) == GDI_OBJECT_TYPE_PEN); /* 6 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(BLACK_PEN)) == GDI_OBJECT_TYPE_PEN); /* 7 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(NULL_PEN)) == GDI_OBJECT_TYPE_PEN); /* 8 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(OEM_FIXED_FONT)) == GDI_OBJECT_TYPE_FONT); /* 10 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(ANSI_FIXED_FONT)) == GDI_OBJECT_TYPE_FONT); /* 11 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(ANSI_VAR_FONT)) == GDI_OBJECT_TYPE_FONT); /* 12 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(SYSTEM_FONT)) == GDI_OBJECT_TYPE_FONT); /* 13 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(DEVICE_DEFAULT_FONT)) == GDI_OBJECT_TYPE_FONT); /* 14 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(DEFAULT_PALETTE)) == GDI_OBJECT_TYPE_PALETTE); /* 15 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(SYSTEM_FIXED_FONT)) == GDI_OBJECT_TYPE_FONT); /* 16 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(DEFAULT_GUI_FONT)) == GDI_OBJECT_TYPE_FONT); /* 17 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(DC_BRUSH)) == GDI_OBJECT_TYPE_BRUSH); /* 18 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(DC_PEN)) == GDI_OBJECT_TYPE_PEN); /* 19 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(20)) == GDI_OBJECT_TYPE_COLORSPACE); /* 20 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(21)) == GDI_OBJECT_TYPE_BITMAP); /* 21 */
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
INT
|
||||
Test_GetStockObject(PTESTINFO pti)
|
||||
{
|
||||
/* Test limits and error */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetStockObject(0) != NULL);
|
||||
TEST(GetStockObject(20) != NULL);
|
||||
TEST(GetStockObject(21) != NULL);
|
||||
RTEST(GetStockObject(-1) == NULL);
|
||||
RTEST(GetStockObject(9) == NULL);
|
||||
RTEST(GetStockObject(22) == NULL);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test for the stock bit */
|
||||
RTEST((UINT)GetStockObject(WHITE_BRUSH) && GDI_HANDLE_STOCK_MASK);
|
||||
|
||||
/* Test for correct types */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(WHITE_BRUSH)) == GDI_OBJECT_TYPE_BRUSH); /* 0 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(LTGRAY_BRUSH)) == GDI_OBJECT_TYPE_BRUSH); /* 1 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(GRAY_BRUSH)) == GDI_OBJECT_TYPE_BRUSH); /* 1 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(DKGRAY_BRUSH)) == GDI_OBJECT_TYPE_BRUSH); /* 1 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(BLACK_BRUSH)) == GDI_OBJECT_TYPE_BRUSH); /* 1 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(NULL_BRUSH)) == GDI_OBJECT_TYPE_BRUSH); /* 1 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(WHITE_PEN)) == GDI_OBJECT_TYPE_PEN); /* 6 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(BLACK_PEN)) == GDI_OBJECT_TYPE_PEN); /* 7 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(NULL_PEN)) == GDI_OBJECT_TYPE_PEN); /* 8 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(OEM_FIXED_FONT)) == GDI_OBJECT_TYPE_FONT); /* 10 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(ANSI_FIXED_FONT)) == GDI_OBJECT_TYPE_FONT); /* 11 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(ANSI_VAR_FONT)) == GDI_OBJECT_TYPE_FONT); /* 12 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(SYSTEM_FONT)) == GDI_OBJECT_TYPE_FONT); /* 13 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(DEVICE_DEFAULT_FONT)) == GDI_OBJECT_TYPE_FONT); /* 14 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(DEFAULT_PALETTE)) == GDI_OBJECT_TYPE_PALETTE); /* 15 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(SYSTEM_FIXED_FONT)) == GDI_OBJECT_TYPE_FONT); /* 16 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(DEFAULT_GUI_FONT)) == GDI_OBJECT_TYPE_FONT); /* 17 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(DC_BRUSH)) == GDI_OBJECT_TYPE_BRUSH); /* 18 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(DC_PEN)) == GDI_OBJECT_TYPE_PEN); /* 19 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(20)) == GDI_OBJECT_TYPE_COLORSPACE); /* 20 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(21)) == GDI_OBJECT_TYPE_BITMAP); /* 21 */
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
@@ -1,152 +1,152 @@
|
||||
INT
|
||||
Test_SelectObject(PTESTINFO pti)
|
||||
{
|
||||
HGDIOBJ hOldObj, hNewObj;
|
||||
HDC hScreenDC, hDC, hDC2;
|
||||
PGDI_TABLE_ENTRY pEntry;
|
||||
PDC_ATTR pDc_Attr;
|
||||
HANDLE hcmXform;
|
||||
BYTE bmBits[4] = {0};
|
||||
|
||||
hScreenDC = GetDC(NULL);
|
||||
ASSERT (hScreenDC != NULL);
|
||||
hDC = CreateCompatibleDC(hScreenDC);
|
||||
ASSERT (hDC != NULL);
|
||||
|
||||
/* Get the Dc_Attr for later testing */
|
||||
pEntry = &GdiHandleTable[GDI_HANDLE_GET_INDEX(hDC)];
|
||||
ASSERT(pEntry);
|
||||
pDc_Attr = pEntry->UserData;
|
||||
ASSERT(pDc_Attr);
|
||||
|
||||
/* Test incomplete dc handle doesn't work */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hNewObj = GetStockObject(GRAY_BRUSH);
|
||||
hOldObj = SelectObject((HDC)GDI_HANDLE_GET_INDEX(hDC), hNewObj);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
TEST(hOldObj == NULL);
|
||||
TEST(pDc_Attr->hbrush == GetStockObject(WHITE_BRUSH));
|
||||
SelectObject(hDC, hOldObj);
|
||||
|
||||
/* Test incomplete hobj handle works */
|
||||
hNewObj = GetStockObject(GRAY_BRUSH);
|
||||
hOldObj = SelectObject(hDC, (HGDIOBJ)GDI_HANDLE_GET_INDEX(hNewObj));
|
||||
TEST(hOldObj == GetStockObject(WHITE_BRUSH));
|
||||
TEST(pDc_Attr->hbrush == hNewObj);
|
||||
SelectObject(hDC, hOldObj);
|
||||
|
||||
/* Test wrong hDC handle type */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hNewObj = GetStockObject(GRAY_BRUSH);
|
||||
hDC2 = (HDC)((UINT_PTR)hDC & ~GDI_HANDLE_TYPE_MASK);
|
||||
hDC2 = (HDC)((UINT_PTR)hDC2 | GDI_OBJECT_TYPE_PEN);
|
||||
hOldObj = SelectObject(hDC2, hNewObj);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
TEST(hOldObj == NULL);
|
||||
TEST(pDc_Attr->hbrush == GetStockObject(WHITE_BRUSH));
|
||||
|
||||
/* Test wrong hobj handle type */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hNewObj = GetStockObject(GRAY_BRUSH);
|
||||
hNewObj = (HGDIOBJ)((UINT_PTR)hNewObj & ~GDI_HANDLE_TYPE_MASK);
|
||||
hNewObj = (HGDIOBJ)((UINT_PTR)hNewObj | GDI_OBJECT_TYPE_PEN);
|
||||
hOldObj = SelectObject(hDC, hNewObj);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
TEST(hOldObj == NULL);
|
||||
TEST(pDc_Attr->hbrush == GetStockObject(WHITE_BRUSH));
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hNewObj = (HGDIOBJ)0x00761234;
|
||||
hOldObj = SelectObject(hDC, hNewObj);
|
||||
TEST(hOldObj == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
SelectObject(hDC, hOldObj);
|
||||
|
||||
/* Test DC */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldObj = SelectObject(hDC, hScreenDC);
|
||||
TEST(hOldObj == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test REGION */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hNewObj = CreateRectRgn(0,0,0,0);
|
||||
hOldObj = SelectObject(hDC, hNewObj);
|
||||
TEST((UINT_PTR)hOldObj == NULLREGION);
|
||||
DeleteObject(hNewObj);
|
||||
|
||||
hNewObj = CreateRectRgn(0,0,10,10);
|
||||
TEST((UINT_PTR)SelectObject(hDC, hNewObj) == SIMPLEREGION);
|
||||
hOldObj = CreateRectRgn(5,5,20,20);
|
||||
TEST(CombineRgn(hNewObj, hNewObj, hOldObj, RGN_OR) == COMPLEXREGION);
|
||||
DeleteObject(hOldObj);
|
||||
TEST((UINT_PTR)SelectObject(hDC, hNewObj) == SIMPLEREGION); // ??? Why this?
|
||||
DeleteObject(hNewObj);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test BITMAP */
|
||||
hNewObj = CreateBitmap(2, 2, 1, 1, &bmBits);
|
||||
ASSERT(hNewObj != NULL);
|
||||
hOldObj = SelectObject(hDC, hNewObj);
|
||||
TEST(GDI_HANDLE_GET_TYPE(hOldObj) == GDI_OBJECT_TYPE_BITMAP);
|
||||
hOldObj = SelectObject(hDC, hOldObj);
|
||||
TEST(hOldObj == hNewObj);
|
||||
|
||||
/* Test CLIOBJ */
|
||||
|
||||
/* Test PATH */
|
||||
|
||||
/* Test PALETTE */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hNewObj = GetStockObject(DEFAULT_PALETTE);
|
||||
hOldObj = SelectObject(hDC, hNewObj);
|
||||
TEST(hOldObj == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_FUNCTION);
|
||||
|
||||
/* Test COLORSPACE */
|
||||
|
||||
/* Test FONT */
|
||||
|
||||
/* Test PFE */
|
||||
|
||||
/* Test BRUSH */
|
||||
hNewObj = GetStockObject(GRAY_BRUSH);
|
||||
hOldObj = SelectObject(hDC, hNewObj);
|
||||
TEST(hOldObj == GetStockObject(WHITE_BRUSH));
|
||||
TEST(pDc_Attr->hbrush == hNewObj);
|
||||
TEST(GDI_HANDLE_GET_TYPE(hOldObj) == GDI_OBJECT_TYPE_BRUSH);
|
||||
SelectObject(hDC, hOldObj);
|
||||
|
||||
/* Test DC_BRUSH */
|
||||
hNewObj = GetStockObject(DC_BRUSH);
|
||||
hOldObj = SelectObject(hDC, hNewObj);
|
||||
TEST(pDc_Attr->hbrush == hNewObj);
|
||||
SelectObject(hDC, hOldObj);
|
||||
|
||||
/* Test BRUSH color xform */
|
||||
hcmXform = (HANDLE)pDc_Attr->hcmXform;
|
||||
|
||||
|
||||
/* Test EMF */
|
||||
|
||||
/* test METAFILE */
|
||||
|
||||
/* Test ENHMETAFILE */
|
||||
|
||||
/* Test PEN */
|
||||
hNewObj = GetStockObject(GRAY_BRUSH);
|
||||
hOldObj = SelectObject(hDC, hNewObj);
|
||||
TEST(hOldObj == GetStockObject(WHITE_BRUSH));
|
||||
TEST(pDc_Attr->hbrush == hNewObj);
|
||||
TEST(GDI_HANDLE_GET_TYPE(hOldObj) == GDI_OBJECT_TYPE_BRUSH);
|
||||
SelectObject(hDC, hOldObj);
|
||||
|
||||
|
||||
/* Test EXTPEN */
|
||||
|
||||
/* Test METADC */
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_SelectObject(PTESTINFO pti)
|
||||
{
|
||||
HGDIOBJ hOldObj, hNewObj;
|
||||
HDC hScreenDC, hDC, hDC2;
|
||||
PGDI_TABLE_ENTRY pEntry;
|
||||
PDC_ATTR pDc_Attr;
|
||||
HANDLE hcmXform;
|
||||
BYTE bmBits[4] = {0};
|
||||
|
||||
hScreenDC = GetDC(NULL);
|
||||
ASSERT (hScreenDC != NULL);
|
||||
hDC = CreateCompatibleDC(hScreenDC);
|
||||
ASSERT (hDC != NULL);
|
||||
|
||||
/* Get the Dc_Attr for later testing */
|
||||
pEntry = &GdiHandleTable[GDI_HANDLE_GET_INDEX(hDC)];
|
||||
ASSERT(pEntry);
|
||||
pDc_Attr = pEntry->UserData;
|
||||
ASSERT(pDc_Attr);
|
||||
|
||||
/* Test incomplete dc handle doesn't work */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hNewObj = GetStockObject(GRAY_BRUSH);
|
||||
hOldObj = SelectObject((HDC)GDI_HANDLE_GET_INDEX(hDC), hNewObj);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
TEST(hOldObj == NULL);
|
||||
TEST(pDc_Attr->hbrush == GetStockObject(WHITE_BRUSH));
|
||||
SelectObject(hDC, hOldObj);
|
||||
|
||||
/* Test incomplete hobj handle works */
|
||||
hNewObj = GetStockObject(GRAY_BRUSH);
|
||||
hOldObj = SelectObject(hDC, (HGDIOBJ)GDI_HANDLE_GET_INDEX(hNewObj));
|
||||
TEST(hOldObj == GetStockObject(WHITE_BRUSH));
|
||||
TEST(pDc_Attr->hbrush == hNewObj);
|
||||
SelectObject(hDC, hOldObj);
|
||||
|
||||
/* Test wrong hDC handle type */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hNewObj = GetStockObject(GRAY_BRUSH);
|
||||
hDC2 = (HDC)((UINT_PTR)hDC & ~GDI_HANDLE_TYPE_MASK);
|
||||
hDC2 = (HDC)((UINT_PTR)hDC2 | GDI_OBJECT_TYPE_PEN);
|
||||
hOldObj = SelectObject(hDC2, hNewObj);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
TEST(hOldObj == NULL);
|
||||
TEST(pDc_Attr->hbrush == GetStockObject(WHITE_BRUSH));
|
||||
|
||||
/* Test wrong hobj handle type */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hNewObj = GetStockObject(GRAY_BRUSH);
|
||||
hNewObj = (HGDIOBJ)((UINT_PTR)hNewObj & ~GDI_HANDLE_TYPE_MASK);
|
||||
hNewObj = (HGDIOBJ)((UINT_PTR)hNewObj | GDI_OBJECT_TYPE_PEN);
|
||||
hOldObj = SelectObject(hDC, hNewObj);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
TEST(hOldObj == NULL);
|
||||
TEST(pDc_Attr->hbrush == GetStockObject(WHITE_BRUSH));
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hNewObj = (HGDIOBJ)0x00761234;
|
||||
hOldObj = SelectObject(hDC, hNewObj);
|
||||
TEST(hOldObj == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
SelectObject(hDC, hOldObj);
|
||||
|
||||
/* Test DC */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldObj = SelectObject(hDC, hScreenDC);
|
||||
TEST(hOldObj == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test REGION */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hNewObj = CreateRectRgn(0,0,0,0);
|
||||
hOldObj = SelectObject(hDC, hNewObj);
|
||||
TEST((UINT_PTR)hOldObj == NULLREGION);
|
||||
DeleteObject(hNewObj);
|
||||
|
||||
hNewObj = CreateRectRgn(0,0,10,10);
|
||||
TEST((UINT_PTR)SelectObject(hDC, hNewObj) == SIMPLEREGION);
|
||||
hOldObj = CreateRectRgn(5,5,20,20);
|
||||
TEST(CombineRgn(hNewObj, hNewObj, hOldObj, RGN_OR) == COMPLEXREGION);
|
||||
DeleteObject(hOldObj);
|
||||
TEST((UINT_PTR)SelectObject(hDC, hNewObj) == SIMPLEREGION); // ??? Why this?
|
||||
DeleteObject(hNewObj);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test BITMAP */
|
||||
hNewObj = CreateBitmap(2, 2, 1, 1, &bmBits);
|
||||
ASSERT(hNewObj != NULL);
|
||||
hOldObj = SelectObject(hDC, hNewObj);
|
||||
TEST(GDI_HANDLE_GET_TYPE(hOldObj) == GDI_OBJECT_TYPE_BITMAP);
|
||||
hOldObj = SelectObject(hDC, hOldObj);
|
||||
TEST(hOldObj == hNewObj);
|
||||
|
||||
/* Test CLIOBJ */
|
||||
|
||||
/* Test PATH */
|
||||
|
||||
/* Test PALETTE */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hNewObj = GetStockObject(DEFAULT_PALETTE);
|
||||
hOldObj = SelectObject(hDC, hNewObj);
|
||||
TEST(hOldObj == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_FUNCTION);
|
||||
|
||||
/* Test COLORSPACE */
|
||||
|
||||
/* Test FONT */
|
||||
|
||||
/* Test PFE */
|
||||
|
||||
/* Test BRUSH */
|
||||
hNewObj = GetStockObject(GRAY_BRUSH);
|
||||
hOldObj = SelectObject(hDC, hNewObj);
|
||||
TEST(hOldObj == GetStockObject(WHITE_BRUSH));
|
||||
TEST(pDc_Attr->hbrush == hNewObj);
|
||||
TEST(GDI_HANDLE_GET_TYPE(hOldObj) == GDI_OBJECT_TYPE_BRUSH);
|
||||
SelectObject(hDC, hOldObj);
|
||||
|
||||
/* Test DC_BRUSH */
|
||||
hNewObj = GetStockObject(DC_BRUSH);
|
||||
hOldObj = SelectObject(hDC, hNewObj);
|
||||
TEST(pDc_Attr->hbrush == hNewObj);
|
||||
SelectObject(hDC, hOldObj);
|
||||
|
||||
/* Test BRUSH color xform */
|
||||
hcmXform = (HANDLE)pDc_Attr->hcmXform;
|
||||
|
||||
|
||||
/* Test EMF */
|
||||
|
||||
/* test METAFILE */
|
||||
|
||||
/* Test ENHMETAFILE */
|
||||
|
||||
/* Test PEN */
|
||||
hNewObj = GetStockObject(GRAY_BRUSH);
|
||||
hOldObj = SelectObject(hDC, hNewObj);
|
||||
TEST(hOldObj == GetStockObject(WHITE_BRUSH));
|
||||
TEST(pDc_Attr->hbrush == hNewObj);
|
||||
TEST(GDI_HANDLE_GET_TYPE(hOldObj) == GDI_OBJECT_TYPE_BRUSH);
|
||||
SelectObject(hDC, hOldObj);
|
||||
|
||||
|
||||
/* Test EXTPEN */
|
||||
|
||||
/* Test METADC */
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,43 +1,43 @@
|
||||
INT
|
||||
Test_SetDCPenColor(PTESTINFO pti)
|
||||
{
|
||||
HDC hScreenDC, hDC;
|
||||
|
||||
// Test an incorrect DC
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(SetDCPenColor(0, RGB(0,0,0)) == CLR_INVALID);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
// Get the Screen DC
|
||||
hScreenDC = GetDC(NULL);
|
||||
if (hScreenDC == NULL) return FALSE;
|
||||
|
||||
// Test the screen DC
|
||||
SetDCPenColor(hScreenDC, RGB(1,2,3));
|
||||
TEST(SetDCPenColor(hScreenDC, RGB(4,5,6)) == RGB(1,2,3));
|
||||
|
||||
// Create a new DC
|
||||
hDC = CreateCompatibleDC(hScreenDC);
|
||||
ReleaseDC(0, hScreenDC);
|
||||
if (hDC == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Select the DC_PEN and check if the pen returned by a new call is DC_PEN
|
||||
SelectObject(hDC, GetStockObject(DC_PEN));
|
||||
TEST(SelectObject(hDC, GetStockObject(BLACK_PEN)) == GetStockObject(DC_PEN));
|
||||
|
||||
// Test an incorrect color, yes windows sets the color!
|
||||
SetDCPenColor(hDC, 0x21123456);
|
||||
TEST(SetDCPenColor(hDC, RGB(0,0,0)) == 0x21123456);
|
||||
|
||||
// Test CLR_INVALID, it sets CLR_INVALID!
|
||||
SetDCPenColor(hDC, CLR_INVALID);
|
||||
RTEST(SetDCPenColor(hDC, RGB(0,0,0)) == CLR_INVALID);
|
||||
|
||||
// Delete the DC
|
||||
DeleteDC(hDC);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
INT
|
||||
Test_SetDCPenColor(PTESTINFO pti)
|
||||
{
|
||||
HDC hScreenDC, hDC;
|
||||
|
||||
// Test an incorrect DC
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(SetDCPenColor(0, RGB(0,0,0)) == CLR_INVALID);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
// Get the Screen DC
|
||||
hScreenDC = GetDC(NULL);
|
||||
if (hScreenDC == NULL) return FALSE;
|
||||
|
||||
// Test the screen DC
|
||||
SetDCPenColor(hScreenDC, RGB(1,2,3));
|
||||
TEST(SetDCPenColor(hScreenDC, RGB(4,5,6)) == RGB(1,2,3));
|
||||
|
||||
// Create a new DC
|
||||
hDC = CreateCompatibleDC(hScreenDC);
|
||||
ReleaseDC(0, hScreenDC);
|
||||
if (hDC == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Select the DC_PEN and check if the pen returned by a new call is DC_PEN
|
||||
SelectObject(hDC, GetStockObject(DC_PEN));
|
||||
TEST(SelectObject(hDC, GetStockObject(BLACK_PEN)) == GetStockObject(DC_PEN));
|
||||
|
||||
// Test an incorrect color, yes windows sets the color!
|
||||
SetDCPenColor(hDC, 0x21123456);
|
||||
TEST(SetDCPenColor(hDC, RGB(0,0,0)) == 0x21123456);
|
||||
|
||||
// Test CLR_INVALID, it sets CLR_INVALID!
|
||||
SetDCPenColor(hDC, CLR_INVALID);
|
||||
RTEST(SetDCPenColor(hDC, RGB(0,0,0)) == CLR_INVALID);
|
||||
|
||||
// Delete the DC
|
||||
DeleteDC(hDC);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
#define NUM_SYSCOLORS 31
|
||||
|
||||
INT
|
||||
Test_SetSysColors(PTESTINFO pti)
|
||||
{
|
||||
INT i;
|
||||
INT nElements[NUM_SYSCOLORS];
|
||||
COLORREF crOldColors[NUM_SYSCOLORS];
|
||||
COLORREF crColors[3] = {RGB(212, 208, 200),2,3};
|
||||
|
||||
/* First save the Old colors */
|
||||
for (i = 0; i < NUM_SYSCOLORS; i++)
|
||||
{
|
||||
nElements[i] = i;
|
||||
crOldColors[i] = GetSysColor(i);
|
||||
}
|
||||
|
||||
TEST((UINT)SetSysColors(0, nElements, crColors) == 1);
|
||||
RTEST((UINT)SetSysColors(1, nElements, crColors) == 1);
|
||||
RTEST((UINT)SetSysColors(2, nElements, crColors) == 1);
|
||||
|
||||
/* try more than NUM_SYSCOLORS */
|
||||
RTEST((UINT)SetSysColors(55, nElements, crColors) == 1);
|
||||
|
||||
/* restore old SysColors */
|
||||
SetSysColors(NUM_SYSCOLORS, nElements, crOldColors);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
#define NUM_SYSCOLORS 31
|
||||
|
||||
INT
|
||||
Test_SetSysColors(PTESTINFO pti)
|
||||
{
|
||||
INT i;
|
||||
INT nElements[NUM_SYSCOLORS];
|
||||
COLORREF crOldColors[NUM_SYSCOLORS];
|
||||
COLORREF crColors[3] = {RGB(212, 208, 200),2,3};
|
||||
|
||||
/* First save the Old colors */
|
||||
for (i = 0; i < NUM_SYSCOLORS; i++)
|
||||
{
|
||||
nElements[i] = i;
|
||||
crOldColors[i] = GetSysColor(i);
|
||||
}
|
||||
|
||||
TEST((UINT)SetSysColors(0, nElements, crColors) == 1);
|
||||
RTEST((UINT)SetSysColors(1, nElements, crColors) == 1);
|
||||
RTEST((UINT)SetSysColors(2, nElements, crColors) == 1);
|
||||
|
||||
/* try more than NUM_SYSCOLORS */
|
||||
RTEST((UINT)SetSysColors(55, nElements, crColors) == 1);
|
||||
|
||||
/* restore old SysColors */
|
||||
SetSysColors(NUM_SYSCOLORS, nElements, crOldColors);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
#ifndef _USER32TESTLIST_H
|
||||
#define _USER32TESTLIST_H
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
|
||||
|
||||
#include "user32api.h"
|
||||
|
||||
/* include the tests */
|
||||
#include "tests/InitializeLpkHooks.c"
|
||||
#include "tests/ScrollDC.c"
|
||||
#include "tests/ScrollWindowEx.c"
|
||||
#include "tests/RealGetWindowClass.c"
|
||||
|
||||
/* The List of tests */
|
||||
TESTENTRY TestList[] =
|
||||
{
|
||||
{ L"InitializeLpkHooks", Test_InitializeLpkHooks },
|
||||
{ L"ScrollDC", Test_ScrollDC },
|
||||
{ L"ScrollWindowEx", Test_ScrollWindowEx },
|
||||
{ L"RealGetWindowClass", Test_RealGetWindowClass },
|
||||
};
|
||||
|
||||
/* The function that gives us the number of tests */
|
||||
INT NumTests(void)
|
||||
{
|
||||
return ARRAY_SIZE(TestList);
|
||||
}
|
||||
|
||||
#endif /* _USER32TESTLIST_H */
|
||||
|
||||
/* EOF */
|
||||
#ifndef _USER32TESTLIST_H
|
||||
#define _USER32TESTLIST_H
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
|
||||
|
||||
#include "user32api.h"
|
||||
|
||||
/* include the tests */
|
||||
#include "tests/InitializeLpkHooks.c"
|
||||
#include "tests/ScrollDC.c"
|
||||
#include "tests/ScrollWindowEx.c"
|
||||
#include "tests/RealGetWindowClass.c"
|
||||
|
||||
/* The List of tests */
|
||||
TESTENTRY TestList[] =
|
||||
{
|
||||
{ L"InitializeLpkHooks", Test_InitializeLpkHooks },
|
||||
{ L"ScrollDC", Test_ScrollDC },
|
||||
{ L"ScrollWindowEx", Test_ScrollWindowEx },
|
||||
{ L"RealGetWindowClass", Test_RealGetWindowClass },
|
||||
};
|
||||
|
||||
/* The function that gives us the number of tests */
|
||||
INT NumTests(void)
|
||||
{
|
||||
return ARRAY_SIZE(TestList);
|
||||
}
|
||||
|
||||
#endif /* _USER32TESTLIST_H */
|
||||
|
||||
/* EOF */
|
||||
|
||||
@@ -1,57 +1,57 @@
|
||||
#include "../user32api.h"
|
||||
|
||||
INT
|
||||
Test_ScrollDC(PTESTINFO pti)
|
||||
{
|
||||
HWND hWnd, hWnd2;
|
||||
HDC hDC;
|
||||
HRGN hrgn;
|
||||
RECT rcClip;
|
||||
|
||||
/* Create a window */
|
||||
hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
100, 100, 100, 100,
|
||||
NULL, NULL, g_hInstance, 0);
|
||||
UpdateWindow(hWnd);
|
||||
hDC = GetDC(hWnd);
|
||||
|
||||
/* Assert that no update region is there */
|
||||
hrgn = CreateRectRgn(0,0,0,0);
|
||||
ASSERT(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION);
|
||||
|
||||
/* Test normal scrolling */
|
||||
TEST(ScrollDC(hDC, 0, 0, NULL, NULL, hrgn, NULL) == TRUE);
|
||||
|
||||
/* Scroll with invalid update region */
|
||||
DeleteObject(hrgn);
|
||||
TEST(ScrollDC(hDC, 50, 0, NULL, NULL, hrgn, NULL) == FALSE);
|
||||
hrgn = CreateRectRgn(0,0,0,0);
|
||||
TEST(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION);
|
||||
|
||||
/* Scroll with invalid update rect pointer */
|
||||
TEST(ScrollDC(hDC, 50, 0, NULL, NULL, NULL, (PRECT)1) == 0);
|
||||
TEST(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION);
|
||||
|
||||
/* Scroll with a clip rect */
|
||||
rcClip.left = 50; rcClip.top = 0; rcClip.right = 100; rcClip.bottom = 100;
|
||||
TEST(ScrollDC(hDC, 50, 0, NULL, &rcClip, hrgn, NULL) == TRUE);
|
||||
TEST(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION);
|
||||
|
||||
/* Scroll with a clip rect */
|
||||
rcClip.left = 50; rcClip.top = 0; rcClip.right = 100; rcClip.bottom = 100;
|
||||
TEST(ScrollDC(hDC, 50, 50, NULL, &rcClip, hrgn, NULL) == TRUE);
|
||||
TEST(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION);
|
||||
|
||||
/* Overlap with another window */
|
||||
hWnd2 = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
30, 160, 100, 100,
|
||||
NULL, NULL, g_hInstance, 0);
|
||||
UpdateWindow(hWnd2);
|
||||
|
||||
/* Cleanup */
|
||||
ReleaseDC(hWnd, hDC);
|
||||
DestroyWindow(hWnd);
|
||||
DestroyWindow(hWnd2);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
#include "../user32api.h"
|
||||
|
||||
INT
|
||||
Test_ScrollDC(PTESTINFO pti)
|
||||
{
|
||||
HWND hWnd, hWnd2;
|
||||
HDC hDC;
|
||||
HRGN hrgn;
|
||||
RECT rcClip;
|
||||
|
||||
/* Create a window */
|
||||
hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
100, 100, 100, 100,
|
||||
NULL, NULL, g_hInstance, 0);
|
||||
UpdateWindow(hWnd);
|
||||
hDC = GetDC(hWnd);
|
||||
|
||||
/* Assert that no update region is there */
|
||||
hrgn = CreateRectRgn(0,0,0,0);
|
||||
ASSERT(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION);
|
||||
|
||||
/* Test normal scrolling */
|
||||
TEST(ScrollDC(hDC, 0, 0, NULL, NULL, hrgn, NULL) == TRUE);
|
||||
|
||||
/* Scroll with invalid update region */
|
||||
DeleteObject(hrgn);
|
||||
TEST(ScrollDC(hDC, 50, 0, NULL, NULL, hrgn, NULL) == FALSE);
|
||||
hrgn = CreateRectRgn(0,0,0,0);
|
||||
TEST(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION);
|
||||
|
||||
/* Scroll with invalid update rect pointer */
|
||||
TEST(ScrollDC(hDC, 50, 0, NULL, NULL, NULL, (PRECT)1) == 0);
|
||||
TEST(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION);
|
||||
|
||||
/* Scroll with a clip rect */
|
||||
rcClip.left = 50; rcClip.top = 0; rcClip.right = 100; rcClip.bottom = 100;
|
||||
TEST(ScrollDC(hDC, 50, 0, NULL, &rcClip, hrgn, NULL) == TRUE);
|
||||
TEST(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION);
|
||||
|
||||
/* Scroll with a clip rect */
|
||||
rcClip.left = 50; rcClip.top = 0; rcClip.right = 100; rcClip.bottom = 100;
|
||||
TEST(ScrollDC(hDC, 50, 50, NULL, &rcClip, hrgn, NULL) == TRUE);
|
||||
TEST(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION);
|
||||
|
||||
/* Overlap with another window */
|
||||
hWnd2 = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
30, 160, 100, 100,
|
||||
NULL, NULL, g_hInstance, 0);
|
||||
UpdateWindow(hWnd2);
|
||||
|
||||
/* Cleanup */
|
||||
ReleaseDC(hWnd, hDC);
|
||||
DestroyWindow(hWnd);
|
||||
DestroyWindow(hWnd2);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
@@ -1,47 +1,47 @@
|
||||
#include "../user32api.h"
|
||||
|
||||
INT
|
||||
Test_ScrollWindowEx(PTESTINFO pti)
|
||||
{
|
||||
HWND hWnd;
|
||||
HRGN hrgn;
|
||||
int Result;
|
||||
|
||||
/* Create a window */
|
||||
hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
|
||||
NULL, NULL, g_hInstance, 0);
|
||||
UpdateWindow(hWnd);
|
||||
|
||||
/* Assert that no update region is there */
|
||||
hrgn = CreateRectRgn(0,0,0,0);
|
||||
ASSERT(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION);
|
||||
|
||||
Result = ScrollWindowEx(hWnd, 20, 0, NULL, NULL, NULL, NULL, 0);
|
||||
TEST(Result == SIMPLEREGION);
|
||||
TEST(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION);
|
||||
|
||||
Result = ScrollWindowEx(hWnd, 20, 0, NULL, NULL, NULL, NULL, SW_INVALIDATE);
|
||||
TEST(Result == SIMPLEREGION);
|
||||
TEST(GetUpdateRgn(hWnd, hrgn, FALSE) == SIMPLEREGION);
|
||||
UpdateWindow(hWnd);
|
||||
|
||||
// test invalid update region
|
||||
DeleteObject(hrgn);
|
||||
Result = ScrollWindowEx(hWnd, 20, 0, NULL, NULL, hrgn, NULL, SW_INVALIDATE);
|
||||
TEST(Result == ERROR);
|
||||
hrgn = CreateRectRgn(0,0,0,0);
|
||||
UpdateWindow(hWnd);
|
||||
|
||||
// Test invalid updaterect pointer
|
||||
Result = ScrollWindowEx(hWnd, 20, 0, NULL, NULL, NULL, (LPRECT)1, SW_INVALIDATE);
|
||||
TEST(Result == ERROR);
|
||||
TEST(GetUpdateRgn(hWnd, hrgn, FALSE) == SIMPLEREGION);
|
||||
|
||||
// test for alignment of rects
|
||||
|
||||
DeleteObject(hrgn);
|
||||
DestroyWindow(hWnd);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
#include "../user32api.h"
|
||||
|
||||
INT
|
||||
Test_ScrollWindowEx(PTESTINFO pti)
|
||||
{
|
||||
HWND hWnd;
|
||||
HRGN hrgn;
|
||||
int Result;
|
||||
|
||||
/* Create a window */
|
||||
hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
|
||||
NULL, NULL, g_hInstance, 0);
|
||||
UpdateWindow(hWnd);
|
||||
|
||||
/* Assert that no update region is there */
|
||||
hrgn = CreateRectRgn(0,0,0,0);
|
||||
ASSERT(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION);
|
||||
|
||||
Result = ScrollWindowEx(hWnd, 20, 0, NULL, NULL, NULL, NULL, 0);
|
||||
TEST(Result == SIMPLEREGION);
|
||||
TEST(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION);
|
||||
|
||||
Result = ScrollWindowEx(hWnd, 20, 0, NULL, NULL, NULL, NULL, SW_INVALIDATE);
|
||||
TEST(Result == SIMPLEREGION);
|
||||
TEST(GetUpdateRgn(hWnd, hrgn, FALSE) == SIMPLEREGION);
|
||||
UpdateWindow(hWnd);
|
||||
|
||||
// test invalid update region
|
||||
DeleteObject(hrgn);
|
||||
Result = ScrollWindowEx(hWnd, 20, 0, NULL, NULL, hrgn, NULL, SW_INVALIDATE);
|
||||
TEST(Result == ERROR);
|
||||
hrgn = CreateRectRgn(0,0,0,0);
|
||||
UpdateWindow(hWnd);
|
||||
|
||||
// Test invalid updaterect pointer
|
||||
Result = ScrollWindowEx(hWnd, 20, 0, NULL, NULL, NULL, (LPRECT)1, SW_INVALIDATE);
|
||||
TEST(Result == ERROR);
|
||||
TEST(GetUpdateRgn(hWnd, hrgn, FALSE) == SIMPLEREGION);
|
||||
|
||||
// test for alignment of rects
|
||||
|
||||
DeleteObject(hrgn);
|
||||
DestroyWindow(hWnd);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
#include "user32api.h"
|
||||
|
||||
HINSTANCE g_hInstance;
|
||||
|
||||
BOOL
|
||||
IsFunctionPresent(LPWSTR lpszFunction)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int APIENTRY WinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
g_hInstance = hInstance;
|
||||
return TestMain(L"user32api", L"user32.dll");
|
||||
}
|
||||
#include "user32api.h"
|
||||
|
||||
HINSTANCE g_hInstance;
|
||||
|
||||
BOOL
|
||||
IsFunctionPresent(LPWSTR lpszFunction)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int APIENTRY WinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
g_hInstance = hInstance;
|
||||
return TestMain(L"user32api", L"user32.dll");
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#ifndef _USER32TEST_H
|
||||
#define _USER32TEST_H
|
||||
|
||||
#include "../apitest.h"
|
||||
|
||||
extern HINSTANCE g_hInstance;
|
||||
|
||||
#endif /* _USER32TEST_H */
|
||||
|
||||
/* EOF */
|
||||
#ifndef _USER32TEST_H
|
||||
#define _USER32TEST_H
|
||||
|
||||
#include "../apitest.h"
|
||||
|
||||
extern HINSTANCE g_hInstance;
|
||||
|
||||
#endif /* _USER32TEST_H */
|
||||
|
||||
/* EOF */
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<module name="user32api" type="win32cui">
|
||||
<include base="user32api">.</include>
|
||||
<define name="__USE_W32API" />
|
||||
<define name="_WIN32_WINNT">0x0501</define>
|
||||
<library>apitest</library>
|
||||
<library>kernel32</library>
|
||||
<library>user32</library>
|
||||
<library>gdi32</library>
|
||||
<library>shell32</library>
|
||||
<file>user32api.c</file>
|
||||
<file>testlist.c</file>
|
||||
</module>
|
||||
<module name="user32api" type="win32cui">
|
||||
<include base="user32api">.</include>
|
||||
<define name="__USE_W32API" />
|
||||
<define name="_WIN32_WINNT">0x0501</define>
|
||||
<library>apitest</library>
|
||||
<library>kernel32</library>
|
||||
<library>user32</library>
|
||||
<library>gdi32</library>
|
||||
<library>shell32</library>
|
||||
<file>user32api.c</file>
|
||||
<file>testlist.c</file>
|
||||
</module>
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
|
||||
INT
|
||||
Test_NtGdiDdCreateDirectDrawObject(PTESTINFO pti)
|
||||
{
|
||||
HANDLE hDirectDraw;
|
||||
HDC hdc = CreateDCW(L"DISPLAY",NULL,NULL,NULL);
|
||||
ASSERT(hdc != NULL);
|
||||
|
||||
/* Test ReactX */
|
||||
RTEST(NtGdiDdCreateDirectDrawObject(NULL) == NULL);
|
||||
RTEST((hDirectDraw=NtGdiDdCreateDirectDrawObject(hdc)) != NULL);
|
||||
|
||||
/* Cleanup ReactX setup */
|
||||
DeleteDC(hdc);
|
||||
NtGdiDdDeleteDirectDrawObject(hDirectDraw);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiDdCreateDirectDrawObject(PTESTINFO pti)
|
||||
{
|
||||
HANDLE hDirectDraw;
|
||||
HDC hdc = CreateDCW(L"DISPLAY",NULL,NULL,NULL);
|
||||
ASSERT(hdc != NULL);
|
||||
|
||||
/* Test ReactX */
|
||||
RTEST(NtGdiDdCreateDirectDrawObject(NULL) == NULL);
|
||||
RTEST((hDirectDraw=NtGdiDdCreateDirectDrawObject(hdc)) != NULL);
|
||||
|
||||
/* Cleanup ReactX setup */
|
||||
DeleteDC(hdc);
|
||||
NtGdiDdDeleteDirectDrawObject(hDirectDraw);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
|
||||
INT
|
||||
Test_NtGdiDdDeleteDirectDrawObject(PTESTINFO pti)
|
||||
{
|
||||
HANDLE hDirectDraw;
|
||||
HDC hdc = CreateDCW(L"DISPLAY",NULL,NULL,NULL);
|
||||
ASSERT(hdc != NULL);
|
||||
|
||||
/* Test ReactX */
|
||||
RTEST(NtGdiDdDeleteDirectDrawObject(NULL) == FALSE);
|
||||
RTEST((hDirectDraw=NtGdiDdCreateDirectDrawObject(hdc)) != NULL);
|
||||
ASSERT(hDirectDraw != NULL);
|
||||
RTEST(NtGdiDdDeleteDirectDrawObject(hDirectDraw) == TRUE);
|
||||
|
||||
/* Cleanup ReactX setup */
|
||||
DeleteDC(hdc);
|
||||
Syscall(L"NtGdiDdDeleteDirectDrawObject", 1, &hDirectDraw);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiDdDeleteDirectDrawObject(PTESTINFO pti)
|
||||
{
|
||||
HANDLE hDirectDraw;
|
||||
HDC hdc = CreateDCW(L"DISPLAY",NULL,NULL,NULL);
|
||||
ASSERT(hdc != NULL);
|
||||
|
||||
/* Test ReactX */
|
||||
RTEST(NtGdiDdDeleteDirectDrawObject(NULL) == FALSE);
|
||||
RTEST((hDirectDraw=NtGdiDdCreateDirectDrawObject(hdc)) != NULL);
|
||||
ASSERT(hDirectDraw != NULL);
|
||||
RTEST(NtGdiDdDeleteDirectDrawObject(hDirectDraw) == TRUE);
|
||||
|
||||
/* Cleanup ReactX setup */
|
||||
DeleteDC(hdc);
|
||||
Syscall(L"NtGdiDdDeleteDirectDrawObject", 1, &hDirectDraw);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,36 +1,36 @@
|
||||
INT
|
||||
Test_NtGdiArcInternal(PTESTINFO pti)
|
||||
{
|
||||
HDC hDC = CreateDCW(L"Display",NULL,NULL,NULL);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiArcInternal(0, 0, 0, 0, 0, 0, 0, 0, 0, 0) == FALSE);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiArcInternal(0, hDC, 0, 0, 0, 0, 0, 0, 0, 0) == TRUE);
|
||||
TEST(NtGdiArcInternal(1, hDC, 0, 0, 0, 0, 0, 0, 0, 0) == TRUE);
|
||||
TEST(NtGdiArcInternal(2, hDC, 0, 0, 0, 0, 0, 0, 0, 0) == TRUE);
|
||||
TEST(NtGdiArcInternal(3, hDC, 0, 0, 0, 0, 0, 0, 0, 0) == TRUE);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiArcInternal(4, hDC, 0, 0, 0, 0, 0, 0, 0, 0) == FALSE);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiArcInternal(4, (HDC)10, 0, 0, 0, 0, 0, 0, 0, 0) == FALSE);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiArcInternal(0, hDC, 10, 10, 0, 0, 0, 0, 0, 0) == TRUE);
|
||||
TEST(NtGdiArcInternal(0, hDC, 10, 10, -10, -10, 0, 0, 0, 0) == TRUE);
|
||||
TEST(NtGdiArcInternal(0, hDC, 0, 0, 0, 0, 10, 0, -10, 0) == TRUE);
|
||||
|
||||
// was passiert, wenn left > right ? einfach tauschen?
|
||||
|
||||
|
||||
DeleteDC(hDC);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
INT
|
||||
Test_NtGdiArcInternal(PTESTINFO pti)
|
||||
{
|
||||
HDC hDC = CreateDCW(L"Display",NULL,NULL,NULL);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiArcInternal(0, 0, 0, 0, 0, 0, 0, 0, 0, 0) == FALSE);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiArcInternal(0, hDC, 0, 0, 0, 0, 0, 0, 0, 0) == TRUE);
|
||||
TEST(NtGdiArcInternal(1, hDC, 0, 0, 0, 0, 0, 0, 0, 0) == TRUE);
|
||||
TEST(NtGdiArcInternal(2, hDC, 0, 0, 0, 0, 0, 0, 0, 0) == TRUE);
|
||||
TEST(NtGdiArcInternal(3, hDC, 0, 0, 0, 0, 0, 0, 0, 0) == TRUE);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiArcInternal(4, hDC, 0, 0, 0, 0, 0, 0, 0, 0) == FALSE);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiArcInternal(4, (HDC)10, 0, 0, 0, 0, 0, 0, 0, 0) == FALSE);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiArcInternal(0, hDC, 10, 10, 0, 0, 0, 0, 0, 0) == TRUE);
|
||||
TEST(NtGdiArcInternal(0, hDC, 10, 10, -10, -10, 0, 0, 0, 0) == TRUE);
|
||||
TEST(NtGdiArcInternal(0, hDC, 0, 0, 0, 0, 10, 0, -10, 0) == TRUE);
|
||||
|
||||
// was passiert, wenn left > right ? einfach tauschen?
|
||||
|
||||
|
||||
DeleteDC(hDC);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
@@ -1,196 +1,196 @@
|
||||
INT
|
||||
Test_NtGdiCreateBitmap_Params(PTESTINFO pti)
|
||||
{
|
||||
HBITMAP hBmp;
|
||||
BITMAP bitmap;
|
||||
BYTE BitmapData[10] = {0x11, 0x22, 0x33};
|
||||
|
||||
/* Test simple params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 1, NULL)) != NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
/* Test all zero */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(0, 0, 0, 0, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test cx == 0 */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(0, 1, 1, 1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test negative cx */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(-10, 1, 1, 1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test cy == 0 */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(1, 0, 1, 1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test negative cy */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(1, -2, 1, 1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test negative cy */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(1, -2, 1, 1, BitmapData) == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test huge size */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(100000, 100000, 1, 1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_NOT_ENOUGH_MEMORY);
|
||||
|
||||
/* Test cPlanes == 0 */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 0, 1, NULL)) != NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmType == 0);
|
||||
TEST(bitmap.bmWidth == 1);
|
||||
TEST(bitmap.bmHeight == 1);
|
||||
TEST(bitmap.bmWidthBytes == 2);
|
||||
TEST(bitmap.bmPlanes == 1);
|
||||
TEST(bitmap.bmBitsPixel == 1);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
/* Test big cPlanes */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 32, 1, NULL)) != NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST(NtGdiCreateBitmap(1, 1, 33, 1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test cBPP == 0 */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 0, NULL)) != NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmType == 0);
|
||||
TEST(bitmap.bmWidth == 1);
|
||||
TEST(bitmap.bmHeight == 1);
|
||||
TEST(bitmap.bmWidthBytes == 2);
|
||||
TEST(bitmap.bmPlanes == 1);
|
||||
TEST(bitmap.bmBitsPixel == 1);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
/* Test negative cBPP */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(1, 1, 1, -1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test bad cBPP */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 3, NULL)) != NULL);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmBitsPixel == 4);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 6, NULL)) != NULL);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmBitsPixel == 8);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 15, NULL)) != NULL);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmBitsPixel == 16);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 17, NULL)) != NULL);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmBitsPixel == 24);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 3, 7, NULL)) != NULL);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmBitsPixel == 24);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 25, NULL)) != NULL);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmBitsPixel == 32);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
TEST(NtGdiCreateBitmap(1, 1, 1, 33, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test bad pointer */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(1, 1, 1, 1, (BYTE*)0x80001234) == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test pointer alignment */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 1, &BitmapData[1])) != NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
/* Test normal params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(5, 7, 2, 4, NULL)) != NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmType == 0);
|
||||
TEST(bitmap.bmWidth == 5);
|
||||
TEST(bitmap.bmHeight == 7);
|
||||
TEST(bitmap.bmWidthBytes == 6);
|
||||
TEST(bitmap.bmPlanes == 1);
|
||||
TEST(bitmap.bmBitsPixel == 8);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
|
||||
/* Test height 0 params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 0, 1, 1, NULL)) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test height -1 params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, -1, 1, 1, NULL)) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test witdth 0 params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(0, 1, 1, 1, NULL)) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test witdth -1 params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(-1, 0, 1, 1, NULL)) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
|
||||
/* Test witdth -1 params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(0, 0, 1, 1, NULL)) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiCreateBitmap(PTESTINFO pti)
|
||||
{
|
||||
INT ret;
|
||||
|
||||
ret = Test_NtGdiCreateBitmap_Params(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
return ret;
|
||||
|
||||
// ret = Test_NtGdiCreateBitmap_Pixel(pti);
|
||||
// if (ret != APISTATUS_NORMAL)
|
||||
// return ret;
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
|
||||
}
|
||||
INT
|
||||
Test_NtGdiCreateBitmap_Params(PTESTINFO pti)
|
||||
{
|
||||
HBITMAP hBmp;
|
||||
BITMAP bitmap;
|
||||
BYTE BitmapData[10] = {0x11, 0x22, 0x33};
|
||||
|
||||
/* Test simple params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 1, NULL)) != NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
/* Test all zero */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(0, 0, 0, 0, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test cx == 0 */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(0, 1, 1, 1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test negative cx */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(-10, 1, 1, 1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test cy == 0 */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(1, 0, 1, 1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test negative cy */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(1, -2, 1, 1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test negative cy */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(1, -2, 1, 1, BitmapData) == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test huge size */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(100000, 100000, 1, 1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_NOT_ENOUGH_MEMORY);
|
||||
|
||||
/* Test cPlanes == 0 */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 0, 1, NULL)) != NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmType == 0);
|
||||
TEST(bitmap.bmWidth == 1);
|
||||
TEST(bitmap.bmHeight == 1);
|
||||
TEST(bitmap.bmWidthBytes == 2);
|
||||
TEST(bitmap.bmPlanes == 1);
|
||||
TEST(bitmap.bmBitsPixel == 1);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
/* Test big cPlanes */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 32, 1, NULL)) != NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST(NtGdiCreateBitmap(1, 1, 33, 1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test cBPP == 0 */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 0, NULL)) != NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmType == 0);
|
||||
TEST(bitmap.bmWidth == 1);
|
||||
TEST(bitmap.bmHeight == 1);
|
||||
TEST(bitmap.bmWidthBytes == 2);
|
||||
TEST(bitmap.bmPlanes == 1);
|
||||
TEST(bitmap.bmBitsPixel == 1);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
/* Test negative cBPP */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(1, 1, 1, -1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test bad cBPP */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 3, NULL)) != NULL);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmBitsPixel == 4);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 6, NULL)) != NULL);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmBitsPixel == 8);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 15, NULL)) != NULL);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmBitsPixel == 16);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 17, NULL)) != NULL);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmBitsPixel == 24);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 3, 7, NULL)) != NULL);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmBitsPixel == 24);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 25, NULL)) != NULL);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmBitsPixel == 32);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
TEST(NtGdiCreateBitmap(1, 1, 1, 33, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test bad pointer */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(1, 1, 1, 1, (BYTE*)0x80001234) == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test pointer alignment */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 1, &BitmapData[1])) != NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
/* Test normal params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(5, 7, 2, 4, NULL)) != NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmType == 0);
|
||||
TEST(bitmap.bmWidth == 5);
|
||||
TEST(bitmap.bmHeight == 7);
|
||||
TEST(bitmap.bmWidthBytes == 6);
|
||||
TEST(bitmap.bmPlanes == 1);
|
||||
TEST(bitmap.bmBitsPixel == 8);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
|
||||
/* Test height 0 params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 0, 1, 1, NULL)) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test height -1 params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, -1, 1, 1, NULL)) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test witdth 0 params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(0, 1, 1, 1, NULL)) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test witdth -1 params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(-1, 0, 1, 1, NULL)) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
|
||||
/* Test witdth -1 params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(0, 0, 1, 1, NULL)) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiCreateBitmap(PTESTINFO pti)
|
||||
{
|
||||
INT ret;
|
||||
|
||||
ret = Test_NtGdiCreateBitmap_Params(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
return ret;
|
||||
|
||||
// ret = Test_NtGdiCreateBitmap_Pixel(pti);
|
||||
// if (ret != APISTATUS_NORMAL)
|
||||
// return ret;
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
INT
|
||||
Test_NtGdiCreateCompatibleBitmap(PTESTINFO pti)
|
||||
{
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiCreateCompatibleBitmap(PTESTINFO pti)
|
||||
{
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
@@ -1,247 +1,247 @@
|
||||
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}} };
|
||||
|
||||
return CreatePalette((LOGPALETTE*)&palstruct);
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette_GdiPalAnimate(PTESTINFO pti)
|
||||
{
|
||||
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);
|
||||
RTEST(NtGdiDoPalette(GetStockObject(DEFAULT_PALETTE), 0, 1, palEntries, GdiPalAnimate, FALSE) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
|
||||
/* Test pEntries = NULL */
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalAnimate, TRUE) == 0);
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalAnimate, FALSE) == 0);
|
||||
DeleteObject(hPal);
|
||||
|
||||
/* Test PC_RESERVED */
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, TRUE) == 2);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 1, 5, palEntries, GdiPalAnimate, TRUE) == 2);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 2, 5, palEntries, GdiPalAnimate, TRUE) == 1);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 3, 5, palEntries, GdiPalAnimate, TRUE) == 1);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 4, 5, palEntries, GdiPalAnimate, TRUE) == 0);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 5, 5, palEntries, GdiPalAnimate, TRUE) == 0);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, FALSE) == 2);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(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);
|
||||
RTEST(palEntries2[0].peRed == 1);
|
||||
RTEST(palEntries2[0].peGreen == 2);
|
||||
RTEST(palEntries2[0].peBlue == 3);
|
||||
RTEST(palEntries2[0].peFlags == 0);
|
||||
RTEST(palEntries2[1].peRed == palEntries[1].peRed);
|
||||
RTEST(palEntries2[1].peGreen == palEntries[1].peGreen);
|
||||
RTEST(palEntries2[1].peBlue == palEntries[1].peBlue);
|
||||
RTEST(palEntries2[1].peFlags == palEntries[1].peFlags);
|
||||
RTEST(palEntries2[2].peRed == 11);
|
||||
RTEST(palEntries2[2].peGreen == 55);
|
||||
RTEST(palEntries2[2].peBlue == 77);
|
||||
TEST(palEntries2[2].peFlags == PC_EXPLICIT);
|
||||
RTEST(palEntries2[3].peRed == palEntries[3].peRed);
|
||||
RTEST(palEntries2[3].peGreen == palEntries[3].peGreen);
|
||||
RTEST(palEntries2[3].peBlue == palEntries[3].peBlue);
|
||||
RTEST(palEntries2[3].peFlags == palEntries[3].peFlags);
|
||||
DeleteObject(hPal);
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette_GdiPalSetEntries(PTESTINFO pti)
|
||||
{
|
||||
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];
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
|
||||
/* Test invalid handle */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiDoPalette((HPALETTE)23, 0, 1, palEntries, GdiPalSetEntries, TRUE) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test system palette */
|
||||
RTEST(NtGdiDoPalette(GetStockObject(DEFAULT_PALETTE), 0, 1, palEntries, GdiPalSetEntries, TRUE) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 1, palEntries, GdiPalSetEntries, TRUE) == 1);
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 2, palEntries, GdiPalSetEntries, TRUE) == 2);
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 3, palEntries, GdiPalSetEntries, TRUE) == 3);
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE) == 5);
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 6, palEntries, GdiPalSetEntries, TRUE) == 5);
|
||||
RTEST(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));
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalSetEntries, FALSE) == 5);
|
||||
/* we should get the old values returned in our buffer! */
|
||||
TEST(memcmp(palEntries2, palEntries, sizeof(palEntries)) == 0);
|
||||
|
||||
/* check what we have in our palette now */
|
||||
ZeroMemory(palEntries2, sizeof(palEntries2));
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE) == 5);
|
||||
TEST(memcmp(palEntries2, palEntries, sizeof(palEntries)) == 0);
|
||||
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 4, palEntries2, GdiPalSetEntries, TRUE) == 4);
|
||||
RTEST(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);
|
||||
RTEST(palEntries2[0].peRed == 0);
|
||||
RTEST(palEntries2[0].peGreen == 0);
|
||||
RTEST(palEntries2[0].peBlue == 0);
|
||||
RTEST(palEntries2[0].peFlags == 0);
|
||||
|
||||
/* Test that the buffer was not changed */
|
||||
|
||||
/* Test pEntries = NULL */
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, TRUE) == 0);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette_GdiPalGetEntries(PTESTINFO pti)
|
||||
{
|
||||
HPALETTE hPal;
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
|
||||
/* Test pEntries = NULL */
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, TRUE) == 0);
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, FALSE) == 5);
|
||||
RTEST(NtGdiDoPalette(hPal, 2, 1, NULL, GdiPalGetEntries, FALSE) == 5);
|
||||
RTEST(NtGdiDoPalette(hPal, 20, 1, NULL, GdiPalGetEntries, FALSE) == 5);
|
||||
RTEST(NtGdiDoPalette(hPal, -20, 1, NULL, GdiPalGetEntries, FALSE) == 5);
|
||||
RTEST(NtGdiDoPalette(hPal, 2, 0, NULL, GdiPalGetEntries, FALSE) == 5);
|
||||
|
||||
|
||||
// Test flags 0xf0
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette_GetSystemPalette(PTESTINFO pti)
|
||||
{
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette_GetBIBColorTable(PTESTINFO pti)
|
||||
{
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette_SetDIBColorTable(PTESTINFO pti)
|
||||
{
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette(PTESTINFO pti)
|
||||
{
|
||||
INT ret;
|
||||
|
||||
ret = Test_NtGdiDoPalette_GdiPalAnimate(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = Test_NtGdiDoPalette_GdiPalSetEntries(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = Test_NtGdiDoPalette_GdiPalGetEntries(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = Test_NtGdiDoPalette_GetSystemPalette(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = Test_NtGdiDoPalette_GetBIBColorTable(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = Test_NtGdiDoPalette_SetDIBColorTable(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
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}} };
|
||||
|
||||
return CreatePalette((LOGPALETTE*)&palstruct);
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette_GdiPalAnimate(PTESTINFO pti)
|
||||
{
|
||||
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);
|
||||
RTEST(NtGdiDoPalette(GetStockObject(DEFAULT_PALETTE), 0, 1, palEntries, GdiPalAnimate, FALSE) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
|
||||
/* Test pEntries = NULL */
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalAnimate, TRUE) == 0);
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalAnimate, FALSE) == 0);
|
||||
DeleteObject(hPal);
|
||||
|
||||
/* Test PC_RESERVED */
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, TRUE) == 2);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 1, 5, palEntries, GdiPalAnimate, TRUE) == 2);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 2, 5, palEntries, GdiPalAnimate, TRUE) == 1);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 3, 5, palEntries, GdiPalAnimate, TRUE) == 1);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 4, 5, palEntries, GdiPalAnimate, TRUE) == 0);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 5, 5, palEntries, GdiPalAnimate, TRUE) == 0);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, FALSE) == 2);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(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);
|
||||
RTEST(palEntries2[0].peRed == 1);
|
||||
RTEST(palEntries2[0].peGreen == 2);
|
||||
RTEST(palEntries2[0].peBlue == 3);
|
||||
RTEST(palEntries2[0].peFlags == 0);
|
||||
RTEST(palEntries2[1].peRed == palEntries[1].peRed);
|
||||
RTEST(palEntries2[1].peGreen == palEntries[1].peGreen);
|
||||
RTEST(palEntries2[1].peBlue == palEntries[1].peBlue);
|
||||
RTEST(palEntries2[1].peFlags == palEntries[1].peFlags);
|
||||
RTEST(palEntries2[2].peRed == 11);
|
||||
RTEST(palEntries2[2].peGreen == 55);
|
||||
RTEST(palEntries2[2].peBlue == 77);
|
||||
TEST(palEntries2[2].peFlags == PC_EXPLICIT);
|
||||
RTEST(palEntries2[3].peRed == palEntries[3].peRed);
|
||||
RTEST(palEntries2[3].peGreen == palEntries[3].peGreen);
|
||||
RTEST(palEntries2[3].peBlue == palEntries[3].peBlue);
|
||||
RTEST(palEntries2[3].peFlags == palEntries[3].peFlags);
|
||||
DeleteObject(hPal);
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette_GdiPalSetEntries(PTESTINFO pti)
|
||||
{
|
||||
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];
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
|
||||
/* Test invalid handle */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiDoPalette((HPALETTE)23, 0, 1, palEntries, GdiPalSetEntries, TRUE) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test system palette */
|
||||
RTEST(NtGdiDoPalette(GetStockObject(DEFAULT_PALETTE), 0, 1, palEntries, GdiPalSetEntries, TRUE) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 1, palEntries, GdiPalSetEntries, TRUE) == 1);
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 2, palEntries, GdiPalSetEntries, TRUE) == 2);
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 3, palEntries, GdiPalSetEntries, TRUE) == 3);
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE) == 5);
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 6, palEntries, GdiPalSetEntries, TRUE) == 5);
|
||||
RTEST(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));
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalSetEntries, FALSE) == 5);
|
||||
/* we should get the old values returned in our buffer! */
|
||||
TEST(memcmp(palEntries2, palEntries, sizeof(palEntries)) == 0);
|
||||
|
||||
/* check what we have in our palette now */
|
||||
ZeroMemory(palEntries2, sizeof(palEntries2));
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE) == 5);
|
||||
TEST(memcmp(palEntries2, palEntries, sizeof(palEntries)) == 0);
|
||||
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 4, palEntries2, GdiPalSetEntries, TRUE) == 4);
|
||||
RTEST(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);
|
||||
RTEST(palEntries2[0].peRed == 0);
|
||||
RTEST(palEntries2[0].peGreen == 0);
|
||||
RTEST(palEntries2[0].peBlue == 0);
|
||||
RTEST(palEntries2[0].peFlags == 0);
|
||||
|
||||
/* Test that the buffer was not changed */
|
||||
|
||||
/* Test pEntries = NULL */
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, TRUE) == 0);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette_GdiPalGetEntries(PTESTINFO pti)
|
||||
{
|
||||
HPALETTE hPal;
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
|
||||
/* Test pEntries = NULL */
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, TRUE) == 0);
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, FALSE) == 5);
|
||||
RTEST(NtGdiDoPalette(hPal, 2, 1, NULL, GdiPalGetEntries, FALSE) == 5);
|
||||
RTEST(NtGdiDoPalette(hPal, 20, 1, NULL, GdiPalGetEntries, FALSE) == 5);
|
||||
RTEST(NtGdiDoPalette(hPal, -20, 1, NULL, GdiPalGetEntries, FALSE) == 5);
|
||||
RTEST(NtGdiDoPalette(hPal, 2, 0, NULL, GdiPalGetEntries, FALSE) == 5);
|
||||
|
||||
|
||||
// Test flags 0xf0
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette_GetSystemPalette(PTESTINFO pti)
|
||||
{
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette_GetBIBColorTable(PTESTINFO pti)
|
||||
{
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette_SetDIBColorTable(PTESTINFO pti)
|
||||
{
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette(PTESTINFO pti)
|
||||
{
|
||||
INT ret;
|
||||
|
||||
ret = Test_NtGdiDoPalette_GdiPalAnimate(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = Test_NtGdiDoPalette_GdiPalSetEntries(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = Test_NtGdiDoPalette_GdiPalGetEntries(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = Test_NtGdiDoPalette_GetSystemPalette(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = Test_NtGdiDoPalette_GetBIBColorTable(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = Test_NtGdiDoPalette_SetDIBColorTable(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
|
||||
INT
|
||||
Test_NtGdiEngCreatePalette(PTESTINFO pti)
|
||||
{
|
||||
HPALETTE hPal;
|
||||
ULONG Colors[3] = {1,2,3};
|
||||
PGDI_TABLE_ENTRY pEntry;
|
||||
|
||||
hPal = NtGdiEngCreatePalette(PAL_RGB, 3, Colors, 0xff000000, 0x00ff0000, 0x0000ff00);
|
||||
|
||||
TEST(hPal != 0);
|
||||
TEST(GDI_HANDLE_GET_TYPE(hPal) == GDI_OBJECT_TYPE_PALETTE);
|
||||
pEntry = &GdiHandleTable[GDI_HANDLE_GET_INDEX(hPal)];
|
||||
TEST(pEntry->KernelData != NULL);
|
||||
TEST(pEntry->ProcessId == GetCurrentProcessId());
|
||||
TEST(pEntry->UserData == 0);
|
||||
TEST(pEntry->Type == (((UINT)hPal >> 16) | GDI_OBJECT_TYPE_PALETTE));
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiEngCreatePalette(PTESTINFO pti)
|
||||
{
|
||||
HPALETTE hPal;
|
||||
ULONG Colors[3] = {1,2,3};
|
||||
PGDI_TABLE_ENTRY pEntry;
|
||||
|
||||
hPal = NtGdiEngCreatePalette(PAL_RGB, 3, Colors, 0xff000000, 0x00ff0000, 0x0000ff00);
|
||||
|
||||
TEST(hPal != 0);
|
||||
TEST(GDI_HANDLE_GET_TYPE(hPal) == GDI_OBJECT_TYPE_PALETTE);
|
||||
pEntry = &GdiHandleTable[GDI_HANDLE_GET_INDEX(hPal)];
|
||||
TEST(pEntry->KernelData != NULL);
|
||||
TEST(pEntry->ProcessId == GetCurrentProcessId());
|
||||
TEST(pEntry->UserData == 0);
|
||||
TEST(pEntry->Type == (((UINT)hPal >> 16) | GDI_OBJECT_TYPE_PALETTE));
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
|
||||
INT
|
||||
Test_NtGdiEnumFontOpen(PTESTINFO pti)
|
||||
{
|
||||
HDC hDC;
|
||||
ULONG_PTR idEnum;
|
||||
ULONG ulCount;
|
||||
PGDI_TABLE_ENTRY pEntry;
|
||||
|
||||
hDC = CreateDCW(L"DISPLAY",NULL,NULL,NULL);
|
||||
|
||||
// FIXME: We should load the font first
|
||||
|
||||
idEnum = NtGdiEnumFontOpen(hDC, 2, 0, 32, L"Courier", ANSI_CHARSET, &ulCount);
|
||||
ASSERT(idEnum != 0);
|
||||
|
||||
/* we should have a gdi handle here */
|
||||
TEST(GDI_HANDLE_GET_TYPE(idEnum) == GDI_OBJECT_TYPE_ENUMFONT);
|
||||
pEntry = &GdiHandleTable[GDI_HANDLE_GET_INDEX(idEnum)];
|
||||
TEST(pEntry->KernelData != NULL);
|
||||
TEST(pEntry->ProcessId == GetCurrentProcessId());
|
||||
TEST(pEntry->UserData == 0);
|
||||
TEST(pEntry->Type == ((idEnum >> 16) | GDI_OBJECT_TYPE_ENUMFONT));
|
||||
|
||||
/* We should not be able to use DeleteObject() on the handle */
|
||||
TEST(DeleteObject((HGDIOBJ)idEnum) == FALSE);
|
||||
|
||||
NtGdiEnumFontClose(idEnum);
|
||||
|
||||
// Test no logfont (NULL): should word
|
||||
// Test empty lfFaceName string: should not work
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
INT
|
||||
Test_NtGdiEnumFontOpen(PTESTINFO pti)
|
||||
{
|
||||
HDC hDC;
|
||||
ULONG_PTR idEnum;
|
||||
ULONG ulCount;
|
||||
PGDI_TABLE_ENTRY pEntry;
|
||||
|
||||
hDC = CreateDCW(L"DISPLAY",NULL,NULL,NULL);
|
||||
|
||||
// FIXME: We should load the font first
|
||||
|
||||
idEnum = NtGdiEnumFontOpen(hDC, 2, 0, 32, L"Courier", ANSI_CHARSET, &ulCount);
|
||||
ASSERT(idEnum != 0);
|
||||
|
||||
/* we should have a gdi handle here */
|
||||
TEST(GDI_HANDLE_GET_TYPE(idEnum) == GDI_OBJECT_TYPE_ENUMFONT);
|
||||
pEntry = &GdiHandleTable[GDI_HANDLE_GET_INDEX(idEnum)];
|
||||
TEST(pEntry->KernelData != NULL);
|
||||
TEST(pEntry->ProcessId == GetCurrentProcessId());
|
||||
TEST(pEntry->UserData == 0);
|
||||
TEST(pEntry->Type == ((idEnum >> 16) | GDI_OBJECT_TYPE_ENUMFONT));
|
||||
|
||||
/* We should not be able to use DeleteObject() on the handle */
|
||||
TEST(DeleteObject((HGDIOBJ)idEnum) == FALSE);
|
||||
|
||||
NtGdiEnumFontClose(idEnum);
|
||||
|
||||
// Test no logfont (NULL): should word
|
||||
// Test empty lfFaceName string: should not work
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,62 +1,62 @@
|
||||
INT
|
||||
Test_NtGdiGetBitmapBits(PTESTINFO pti)
|
||||
{
|
||||
BYTE Bits[50] = {0,1,2,3,4,5,6,7,8,9};
|
||||
HBITMAP hBitmap;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetBitmapBits(0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
/* Test NULL bitmap handle */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetBitmapBits(0, 5, Bits) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
/* Test invalid bitmap handle */
|
||||
hBitmap = (HBITMAP)CreatePen(PS_SOLID, 1, RGB(1,2,3));
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 5, Bits) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
DeleteObject(hBitmap);
|
||||
|
||||
hBitmap = CreateBitmap(3, 3, 1, 8, NULL);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
|
||||
/* test NULL pointer and count buffer size != 0 */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 5, NULL) == 12);
|
||||
|
||||
/* test NULL pointer and buffer size == 0*/
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 0, NULL) == 12);
|
||||
|
||||
/* test bad pointer */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 5, (PBYTE)0x500) == 0);
|
||||
|
||||
/* Test if we can set a number of bytes between lines */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 5, Bits) == 5);
|
||||
|
||||
/* Test alignment */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 4, Bits+1) == 4);
|
||||
|
||||
/* Test 1 byte too much */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 10, Bits) == 10);
|
||||
|
||||
/* Test one row too much */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 12, Bits) == 12);
|
||||
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 13, Bits) == 12);
|
||||
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 100, Bits) == 12);
|
||||
|
||||
/* Test huge bytes count */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 12345678, Bits) == 12);
|
||||
|
||||
/* Test negative bytes count */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, -5, Bits) == 12);
|
||||
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
DeleteObject(hBitmap);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
INT
|
||||
Test_NtGdiGetBitmapBits(PTESTINFO pti)
|
||||
{
|
||||
BYTE Bits[50] = {0,1,2,3,4,5,6,7,8,9};
|
||||
HBITMAP hBitmap;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetBitmapBits(0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
/* Test NULL bitmap handle */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetBitmapBits(0, 5, Bits) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
/* Test invalid bitmap handle */
|
||||
hBitmap = (HBITMAP)CreatePen(PS_SOLID, 1, RGB(1,2,3));
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 5, Bits) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
DeleteObject(hBitmap);
|
||||
|
||||
hBitmap = CreateBitmap(3, 3, 1, 8, NULL);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
|
||||
/* test NULL pointer and count buffer size != 0 */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 5, NULL) == 12);
|
||||
|
||||
/* test NULL pointer and buffer size == 0*/
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 0, NULL) == 12);
|
||||
|
||||
/* test bad pointer */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 5, (PBYTE)0x500) == 0);
|
||||
|
||||
/* Test if we can set a number of bytes between lines */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 5, Bits) == 5);
|
||||
|
||||
/* Test alignment */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 4, Bits+1) == 4);
|
||||
|
||||
/* Test 1 byte too much */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 10, Bits) == 10);
|
||||
|
||||
/* Test one row too much */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 12, Bits) == 12);
|
||||
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 13, Bits) == 12);
|
||||
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 100, Bits) == 12);
|
||||
|
||||
/* Test huge bytes count */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 12345678, Bits) == 12);
|
||||
|
||||
/* Test negative bytes count */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, -5, Bits) == 12);
|
||||
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
DeleteObject(hBitmap);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
@@ -1,131 +1,131 @@
|
||||
/* taken from gdi32, bitmap.c */
|
||||
UINT
|
||||
FASTCALL
|
||||
DIB_BitmapMaxBitsSize( PBITMAPINFO Info, UINT ScanLines )
|
||||
{
|
||||
UINT MaxBits = 0;
|
||||
|
||||
if (Info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
|
||||
{
|
||||
PBITMAPCOREHEADER Core = (PBITMAPCOREHEADER)Info;
|
||||
MaxBits = Core->bcBitCount * Core->bcPlanes * Core->bcWidth;
|
||||
}
|
||||
else /* assume BITMAPINFOHEADER */
|
||||
{
|
||||
if ((Info->bmiHeader.biCompression) && (Info->bmiHeader.biCompression != BI_BITFIELDS))
|
||||
return Info->bmiHeader.biSizeImage;
|
||||
// Planes are over looked by Yuan. I guess assumed always 1.
|
||||
MaxBits = Info->bmiHeader.biBitCount * Info->bmiHeader.biPlanes * Info->bmiHeader.biWidth;
|
||||
}
|
||||
MaxBits = ((MaxBits + 31) & ~31 ) / 8; // From Yuan, ScanLineSize = (Width * bitcount + 31)/32
|
||||
return (MaxBits * ScanLines); // ret the full Size.
|
||||
}
|
||||
|
||||
|
||||
INT
|
||||
Test_NtGdiGetDIBitsInternal(PTESTINFO pti)
|
||||
{
|
||||
HBITMAP hBitmap;
|
||||
struct
|
||||
{
|
||||
BITMAPINFO bi;
|
||||
RGBQUAD Colors[20];
|
||||
} bmp;
|
||||
// BITMAPINFO bi;
|
||||
INT ScreenBpp;
|
||||
BITMAPCOREINFO bic;
|
||||
DWORD data[20*16];
|
||||
|
||||
HDC hDCScreen = GetDC(NULL);
|
||||
ASSERT(hDCScreen != NULL);
|
||||
|
||||
hBitmap = CreateCompatibleBitmap(hDCScreen, 16, 16);
|
||||
ASSERT(hBitmap != NULL);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal(0, 0, 0, 0, NULL, NULL, 0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal((HDC)2345, 0, 0, 0, NULL, NULL, 0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal((HDC)2345, hBitmap, 0, 0, NULL, NULL, 0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 0, NULL, NULL, 0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, NULL, 0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
ZeroMemory(&bmp, sizeof(bmp));
|
||||
bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal((HDC)0, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) > 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
TEST(bmp.Colors[0].rgbRed == 0x44);
|
||||
|
||||
ZeroMemory(&bmp, sizeof(bmp));
|
||||
bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal((HDC)2345, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) > 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
TEST(bmp.Colors[0].rgbRed == 0x44);
|
||||
|
||||
ZeroMemory(&bmp, sizeof(bmp));
|
||||
bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, &bmp.bi, DIB_RGB_COLORS,
|
||||
DIB_BitmapMaxBitsSize(&bmp.bi, 15), 0) > 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
ScreenBpp = GetDeviceCaps(hDCScreen, BITSPIXEL);
|
||||
|
||||
RTEST(bmp.bi.bmiHeader.biWidth == 16);
|
||||
RTEST(bmp.bi.bmiHeader.biHeight == 16);
|
||||
RTEST(bmp.bi.bmiHeader.biBitCount == ScreenBpp);
|
||||
RTEST(bmp.bi.bmiHeader.biSizeImage == (16 * 16) * (ScreenBpp / 8));
|
||||
|
||||
TEST(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);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, (void*)data, &bmp.bi, DIB_RGB_COLORS,
|
||||
DIB_BitmapMaxBitsSize(&bmp.bi, 15), 0) > 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
RTEST(bmp.bi.bmiHeader.biWidth == 16);
|
||||
RTEST(bmp.bi.bmiHeader.biHeight == 16);
|
||||
RTEST(bmp.bi.bmiHeader.biBitCount == ScreenBpp);
|
||||
RTEST(bmp.bi.bmiHeader.biSizeImage == (16 * 16) * (ScreenBpp / 8));
|
||||
|
||||
TEST(bmp.Colors[0].rgbRed != 0x44);
|
||||
|
||||
/* Test a BITMAPCOREINFO structure */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ZeroMemory(&bic, sizeof(BITMAPCOREINFO));
|
||||
bic.bmciHeader.bcSize = sizeof(BITMAPCOREHEADER);
|
||||
TEST(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, (PBITMAPINFO)&bic, DIB_RGB_COLORS,
|
||||
DIB_BitmapMaxBitsSize((PBITMAPINFO)&bic, 15), 0) > 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
|
||||
ReleaseDC(NULL, hDCScreen);
|
||||
DeleteObject(hBitmap);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
/* taken from gdi32, bitmap.c */
|
||||
UINT
|
||||
FASTCALL
|
||||
DIB_BitmapMaxBitsSize( PBITMAPINFO Info, UINT ScanLines )
|
||||
{
|
||||
UINT MaxBits = 0;
|
||||
|
||||
if (Info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
|
||||
{
|
||||
PBITMAPCOREHEADER Core = (PBITMAPCOREHEADER)Info;
|
||||
MaxBits = Core->bcBitCount * Core->bcPlanes * Core->bcWidth;
|
||||
}
|
||||
else /* assume BITMAPINFOHEADER */
|
||||
{
|
||||
if ((Info->bmiHeader.biCompression) && (Info->bmiHeader.biCompression != BI_BITFIELDS))
|
||||
return Info->bmiHeader.biSizeImage;
|
||||
// Planes are over looked by Yuan. I guess assumed always 1.
|
||||
MaxBits = Info->bmiHeader.biBitCount * Info->bmiHeader.biPlanes * Info->bmiHeader.biWidth;
|
||||
}
|
||||
MaxBits = ((MaxBits + 31) & ~31 ) / 8; // From Yuan, ScanLineSize = (Width * bitcount + 31)/32
|
||||
return (MaxBits * ScanLines); // ret the full Size.
|
||||
}
|
||||
|
||||
|
||||
INT
|
||||
Test_NtGdiGetDIBitsInternal(PTESTINFO pti)
|
||||
{
|
||||
HBITMAP hBitmap;
|
||||
struct
|
||||
{
|
||||
BITMAPINFO bi;
|
||||
RGBQUAD Colors[20];
|
||||
} bmp;
|
||||
// BITMAPINFO bi;
|
||||
INT ScreenBpp;
|
||||
BITMAPCOREINFO bic;
|
||||
DWORD data[20*16];
|
||||
|
||||
HDC hDCScreen = GetDC(NULL);
|
||||
ASSERT(hDCScreen != NULL);
|
||||
|
||||
hBitmap = CreateCompatibleBitmap(hDCScreen, 16, 16);
|
||||
ASSERT(hBitmap != NULL);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal(0, 0, 0, 0, NULL, NULL, 0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal((HDC)2345, 0, 0, 0, NULL, NULL, 0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal((HDC)2345, hBitmap, 0, 0, NULL, NULL, 0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 0, NULL, NULL, 0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, NULL, 0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
ZeroMemory(&bmp, sizeof(bmp));
|
||||
bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal((HDC)0, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) > 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
TEST(bmp.Colors[0].rgbRed == 0x44);
|
||||
|
||||
ZeroMemory(&bmp, sizeof(bmp));
|
||||
bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal((HDC)2345, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) > 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
TEST(bmp.Colors[0].rgbRed == 0x44);
|
||||
|
||||
ZeroMemory(&bmp, sizeof(bmp));
|
||||
bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, &bmp.bi, DIB_RGB_COLORS,
|
||||
DIB_BitmapMaxBitsSize(&bmp.bi, 15), 0) > 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
ScreenBpp = GetDeviceCaps(hDCScreen, BITSPIXEL);
|
||||
|
||||
RTEST(bmp.bi.bmiHeader.biWidth == 16);
|
||||
RTEST(bmp.bi.bmiHeader.biHeight == 16);
|
||||
RTEST(bmp.bi.bmiHeader.biBitCount == ScreenBpp);
|
||||
RTEST(bmp.bi.bmiHeader.biSizeImage == (16 * 16) * (ScreenBpp / 8));
|
||||
|
||||
TEST(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);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, (void*)data, &bmp.bi, DIB_RGB_COLORS,
|
||||
DIB_BitmapMaxBitsSize(&bmp.bi, 15), 0) > 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
RTEST(bmp.bi.bmiHeader.biWidth == 16);
|
||||
RTEST(bmp.bi.bmiHeader.biHeight == 16);
|
||||
RTEST(bmp.bi.bmiHeader.biBitCount == ScreenBpp);
|
||||
RTEST(bmp.bi.bmiHeader.biSizeImage == (16 * 16) * (ScreenBpp / 8));
|
||||
|
||||
TEST(bmp.Colors[0].rgbRed != 0x44);
|
||||
|
||||
/* Test a BITMAPCOREINFO structure */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ZeroMemory(&bic, sizeof(BITMAPCOREINFO));
|
||||
bic.bmciHeader.bcSize = sizeof(BITMAPCOREHEADER);
|
||||
TEST(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, (PBITMAPINFO)&bic, DIB_RGB_COLORS,
|
||||
DIB_BitmapMaxBitsSize((PBITMAPINFO)&bic, 15), 0) > 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
|
||||
ReleaseDC(NULL, hDCScreen);
|
||||
DeleteObject(hBitmap);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
@@ -1,80 +1,80 @@
|
||||
INT
|
||||
Test_NtGdiGetRandomRgn(PTESTINFO pti)
|
||||
{
|
||||
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, g_hInstance, 0);
|
||||
// UpdateWindow(hWnd);
|
||||
hDC = GetDC(hWnd);
|
||||
|
||||
ASSERT(hDC != NULL);
|
||||
|
||||
hrgn = CreateRectRgn(0,0,0,0);
|
||||
hrgn2 = CreateRectRgn(3,3,10,10);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn(0, hrgn, 0) == -1);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn((HDC)2345, hrgn, 1) == -1);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn((HDC)2345, hrgn, 10) == -1);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn((HDC)2345, (HRGN)10, 10) == -1);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn((HDC)2345, 0, 1) == -1);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, 0, 0) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, 0, 1) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, (HRGN)-5, 0) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, (HRGN)-5, 1) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 0) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 0);
|
||||
TEST(NtGdiGetRandomRgn(hDC, hrgn, 2) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 3) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 4) == 1);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 5) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 10) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, -10) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SelectClipRgn(hDC, hrgn2);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, 0, 1) == -1);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 1);
|
||||
RTEST(CombineRgn(hrgn, hrgn, hrgn, RGN_OR) == SIMPLEREGION);
|
||||
RTEST(CombineRgn(hrgn, hrgn, hrgn2, RGN_XOR) == NULLREGION);
|
||||
|
||||
SetRectRgn(hrgn2,0,0,0,0);
|
||||
SelectClipRgn(hDC, hrgn2);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 1);
|
||||
|
||||
RTEST(CombineRgn(hrgn2, hrgn, hrgn2, RGN_XOR) == NULLREGION);
|
||||
RTEST(CombineRgn(hrgn2, hrgn, hrgn, RGN_OR) == NULLREGION);
|
||||
|
||||
SelectClipRgn(hDC, NULL);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 0);
|
||||
|
||||
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 4) == 1);
|
||||
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
ReleaseDC(hWnd, hDC);
|
||||
DestroyWindow(hWnd);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
INT
|
||||
Test_NtGdiGetRandomRgn(PTESTINFO pti)
|
||||
{
|
||||
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, g_hInstance, 0);
|
||||
// UpdateWindow(hWnd);
|
||||
hDC = GetDC(hWnd);
|
||||
|
||||
ASSERT(hDC != NULL);
|
||||
|
||||
hrgn = CreateRectRgn(0,0,0,0);
|
||||
hrgn2 = CreateRectRgn(3,3,10,10);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn(0, hrgn, 0) == -1);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn((HDC)2345, hrgn, 1) == -1);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn((HDC)2345, hrgn, 10) == -1);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn((HDC)2345, (HRGN)10, 10) == -1);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn((HDC)2345, 0, 1) == -1);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, 0, 0) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, 0, 1) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, (HRGN)-5, 0) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, (HRGN)-5, 1) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 0) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 0);
|
||||
TEST(NtGdiGetRandomRgn(hDC, hrgn, 2) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 3) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 4) == 1);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 5) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 10) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, -10) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SelectClipRgn(hDC, hrgn2);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, 0, 1) == -1);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 1);
|
||||
RTEST(CombineRgn(hrgn, hrgn, hrgn, RGN_OR) == SIMPLEREGION);
|
||||
RTEST(CombineRgn(hrgn, hrgn, hrgn2, RGN_XOR) == NULLREGION);
|
||||
|
||||
SetRectRgn(hrgn2,0,0,0,0);
|
||||
SelectClipRgn(hDC, hrgn2);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 1);
|
||||
|
||||
RTEST(CombineRgn(hrgn2, hrgn, hrgn2, RGN_XOR) == NULLREGION);
|
||||
RTEST(CombineRgn(hrgn2, hrgn, hrgn, RGN_OR) == NULLREGION);
|
||||
|
||||
SelectClipRgn(hDC, NULL);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 0);
|
||||
|
||||
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 4) == 1);
|
||||
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
ReleaseDC(hWnd, hDC);
|
||||
DestroyWindow(hWnd);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
@@ -1,62 +1,62 @@
|
||||
INT
|
||||
Test_NtGdiSetBitmapBits(PTESTINFO pti)
|
||||
{
|
||||
BYTE Bits[50] = {0,1,2,3,4,5,6,7,8,9};
|
||||
HBITMAP hBitmap;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiSetBitmapBits(0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test NULL bitnap handle */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiSetBitmapBits(0, 5, Bits) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
/* Test invalid bitmap handle */
|
||||
hBitmap = (HBITMAP)CreatePen(PS_SOLID, 1, RGB(1,2,3));
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 5, Bits) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
DeleteObject(hBitmap);
|
||||
|
||||
hBitmap = CreateBitmap(3, 3, 1, 8, NULL);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
|
||||
/* test NULL pointer and count buffer size != 0 */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 5, NULL) == 0);
|
||||
|
||||
/* test NULL pointer and buffer size == 0*/
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 0, NULL) == 0);
|
||||
|
||||
/* test bad pointer */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 5, (PBYTE)0x500) == 0);
|
||||
|
||||
/* Test if we can set a number of bytes between lines */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 5, Bits) == 5);
|
||||
|
||||
/* Test alignment */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 4, Bits+1) == 4);
|
||||
|
||||
/* Test 1 byte too much */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 10, Bits) == 10);
|
||||
|
||||
/* Test one row too much */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 12, Bits) == 12);
|
||||
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 13, Bits) == 12);
|
||||
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 100, Bits) == 12);
|
||||
|
||||
/* Test huge bytes count */
|
||||
TEST(NtGdiSetBitmapBits(hBitmap, 12345678, Bits) == 0);
|
||||
|
||||
/* Test negative bytes count */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, -5, Bits) == 0);
|
||||
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
DeleteObject(hBitmap);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
INT
|
||||
Test_NtGdiSetBitmapBits(PTESTINFO pti)
|
||||
{
|
||||
BYTE Bits[50] = {0,1,2,3,4,5,6,7,8,9};
|
||||
HBITMAP hBitmap;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiSetBitmapBits(0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test NULL bitnap handle */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiSetBitmapBits(0, 5, Bits) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
/* Test invalid bitmap handle */
|
||||
hBitmap = (HBITMAP)CreatePen(PS_SOLID, 1, RGB(1,2,3));
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 5, Bits) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
DeleteObject(hBitmap);
|
||||
|
||||
hBitmap = CreateBitmap(3, 3, 1, 8, NULL);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
|
||||
/* test NULL pointer and count buffer size != 0 */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 5, NULL) == 0);
|
||||
|
||||
/* test NULL pointer and buffer size == 0*/
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 0, NULL) == 0);
|
||||
|
||||
/* test bad pointer */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 5, (PBYTE)0x500) == 0);
|
||||
|
||||
/* Test if we can set a number of bytes between lines */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 5, Bits) == 5);
|
||||
|
||||
/* Test alignment */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 4, Bits+1) == 4);
|
||||
|
||||
/* Test 1 byte too much */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 10, Bits) == 10);
|
||||
|
||||
/* Test one row too much */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 12, Bits) == 12);
|
||||
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 13, Bits) == 12);
|
||||
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 100, Bits) == 12);
|
||||
|
||||
/* Test huge bytes count */
|
||||
TEST(NtGdiSetBitmapBits(hBitmap, 12345678, Bits) == 0);
|
||||
|
||||
/* Test negative bytes count */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, -5, Bits) == 0);
|
||||
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
DeleteObject(hBitmap);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/* First the call stub */
|
||||
DWORD STDCALL
|
||||
NtUserCountClipboardFormats(VOID)
|
||||
{
|
||||
DWORD p;
|
||||
return Syscall(L"NtUserCountClipboardFormats", 0, &p);
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtUserCountClipboardFormats(PTESTINFO pti)
|
||||
{
|
||||
RTEST(NtUserCountClipboardFormats() < 1000);
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
/* First the call stub */
|
||||
DWORD STDCALL
|
||||
NtUserCountClipboardFormats(VOID)
|
||||
{
|
||||
DWORD p;
|
||||
return Syscall(L"NtUserCountClipboardFormats", 0, &p);
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtUserCountClipboardFormats(PTESTINFO pti)
|
||||
{
|
||||
RTEST(NtUserCountClipboardFormats() < 1000);
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
INT
|
||||
Test_NtUserFindExistingCursoricon(PTESTINFO pti)
|
||||
{
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtUserFindExistingCursoricon(PTESTINFO pti)
|
||||
{
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
INT
|
||||
Test_NtUserRedrawWindow(PTESTINFO pti)
|
||||
{
|
||||
HWND hWnd;
|
||||
RECT rect;
|
||||
|
||||
hWnd = CreateWindowA("BUTTON",
|
||||
"Test",
|
||||
BS_PUSHBUTTON | WS_VISIBLE,
|
||||
0,
|
||||
0,
|
||||
50,
|
||||
30,
|
||||
NULL,
|
||||
NULL,
|
||||
g_hInstance,
|
||||
0);
|
||||
ASSERT(hWnd);
|
||||
|
||||
rect.left = 0;
|
||||
rect.top = 0;
|
||||
rect.right = 10;
|
||||
rect.bottom = 10;
|
||||
|
||||
TEST(NtUserRedrawWindow(hWnd, &rect, NULL, RDW_VALIDATE) == TRUE);
|
||||
|
||||
DestroyWindow(hWnd);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
INT
|
||||
Test_NtUserRedrawWindow(PTESTINFO pti)
|
||||
{
|
||||
HWND hWnd;
|
||||
RECT rect;
|
||||
|
||||
hWnd = CreateWindowA("BUTTON",
|
||||
"Test",
|
||||
BS_PUSHBUTTON | WS_VISIBLE,
|
||||
0,
|
||||
0,
|
||||
50,
|
||||
30,
|
||||
NULL,
|
||||
NULL,
|
||||
g_hInstance,
|
||||
0);
|
||||
ASSERT(hWnd);
|
||||
|
||||
rect.left = 0;
|
||||
rect.top = 0;
|
||||
rect.right = 10;
|
||||
rect.bottom = 10;
|
||||
|
||||
TEST(NtUserRedrawWindow(hWnd, &rect, NULL, RDW_VALIDATE) == TRUE);
|
||||
|
||||
DestroyWindow(hWnd);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
|
||||
#define IDI_ICON 1000
|
||||
|
||||
#define IDI_ICON 1000
|
||||
|
||||
@@ -1,102 +1,102 @@
|
||||
#include "w32knapi.h"
|
||||
|
||||
/* include the tests */
|
||||
|
||||
#include "ntdd/NtGdiDdCreateDirectDrawObject.c"
|
||||
#include "ntdd/NtGdiDdDeleteDirectDrawObject.c"
|
||||
#include "ntdd/NtGdiDdQueryDirectDrawObject.c"
|
||||
|
||||
#include "ntgdi/NtGdiArcInternal.c"
|
||||
#include "ntgdi/NtGdiBitBlt.c"
|
||||
#include "ntgdi/NtGdiCreateBitmap.c"
|
||||
#include "ntgdi/NtGdiCreateCompatibleBitmap.c"
|
||||
#include "ntgdi/NtGdiDoPalette.c"
|
||||
#include "ntgdi/NtGdiEngCreatePalette.c"
|
||||
//#include "ntgdi/NtGdiEnumFontChunk.c"
|
||||
#include "ntgdi/NtGdiEnumFontOpen.c"
|
||||
#include "ntgdi/NtGdiGetBitmapBits.c"
|
||||
#include "ntgdi/NtGdiGetFontResourceInfoInternalW.c"
|
||||
#include "ntgdi/NtGdiGetRandomRgn.c"
|
||||
#include "ntgdi/NtGdiSelectBitmap.c"
|
||||
#include "ntgdi/NtGdiSelectBrush.c"
|
||||
#include "ntgdi/NtGdiSelectFont.c"
|
||||
#include "ntgdi/NtGdiSelectPen.c"
|
||||
#include "ntgdi/NtGdiSetBitmapBits.c"
|
||||
#include "ntgdi/NtGdiSetDIBitsToDeviceInternal.c"
|
||||
//#include "ntgdi/NtGdiSTROBJ_vEnumStart.c"
|
||||
#include "ntgdi/NtGdiGetDIBits.c"
|
||||
#include "ntgdi/NtGdiGetStockObject.c"
|
||||
|
||||
#include "ntuser/NtUserCallHwnd.c"
|
||||
#include "ntuser/NtUserCallHwndLock.c"
|
||||
#include "ntuser/NtUserCallHwndOpt.c"
|
||||
#include "ntuser/NtUserCallHwndParam.c"
|
||||
#include "ntuser/NtUserCallHwndParamLock.c"
|
||||
#include "ntuser/NtUserCallNoParam.c"
|
||||
#include "ntuser/NtUserCallOneParam.c"
|
||||
#include "ntuser/NtUserCountClipboardFormats.c"
|
||||
//#include "ntuser/NtUserCreateWindowEx.c"
|
||||
#include "ntuser/NtUserEnumDisplaySettings.c"
|
||||
#include "ntuser/NtUserFindExistingCursorIcon.c"
|
||||
#include "ntuser/NtUserRedrawWindow.c"
|
||||
#include "ntuser/NtUserScrollDC.c"
|
||||
#include "ntuser/NtUserSystemParametersInfo.c"
|
||||
#include "ntuser/NtUserToUnicodeEx.c"
|
||||
#include "ntuser/NtUserGetTitleBarInfo.c"
|
||||
|
||||
/* The List of tests */
|
||||
TESTENTRY TestList[] =
|
||||
{
|
||||
/* DirectDraw */
|
||||
{ L"NtGdiDdCreateDirectDrawObject", Test_NtGdiDdCreateDirectDrawObject },
|
||||
{ L"NtGdiDdQueryDirectDrawObject", Test_NtGdiDdQueryDirectDrawObject },
|
||||
{ L"NtGdiDdDeleteDirectDrawObject", Test_NtGdiDdDeleteDirectDrawObject },
|
||||
|
||||
/* ntgdi */
|
||||
{ L"NtGdiArcInternal", Test_NtGdiArcInternal },
|
||||
{ L"NtGdiBitBlt", Test_NtGdiBitBlt },
|
||||
{ L"NtGdiCreateBitmap", Test_NtGdiCreateBitmap },
|
||||
{ L"NtGdiCreateCompatibleBitmap", Test_NtGdiCreateCompatibleBitmap },
|
||||
{ L"NtGdiDoPalette", Test_NtGdiDoPalette },
|
||||
{ L"NtGdiEngCreatePalette", Test_NtGdiEngCreatePalette },
|
||||
// { L"NtGdiEnumFontChunk", Test_NtGdiEnumFontChunk },
|
||||
{ L"NtGdiEnumFontOpen", Test_NtGdiEnumFontOpen },
|
||||
{ L"NtGdiGetBitmapBits", Test_NtGdiGetBitmapBits },
|
||||
{ L"NtGdiGetFontResourceInfoInternalW", Test_NtGdiGetFontResourceInfoInternalW },
|
||||
{ L"NtGdiGetRandomRgn", Test_NtGdiGetRandomRgn },
|
||||
{ L"NtGdiSetBitmapBits", Test_NtGdiSetBitmapBits },
|
||||
{ L"NtGdiSetDIBitsToDeviceInternal", Test_NtGdiSetDIBitsToDeviceInternal },
|
||||
{ L"NtGdiSelectBitmap", Test_NtGdiSelectBitmap },
|
||||
{ L"NtGdiSelectBrush", Test_NtGdiSelectBrush },
|
||||
{ L"NtGdiSelectFont", Test_NtGdiSelectFont },
|
||||
{ L"NtGdiSelectPen", Test_NtGdiSelectPen },
|
||||
// { L"NtGdiSTROBJ_vEnumStart", Test_NtGdiSTROBJ_vEnumStart },
|
||||
{ L"NtGdiGetDIBitsInternal", Test_NtGdiGetDIBitsInternal },
|
||||
{ L"NtGdiGetStockObject", Test_NtGdiGetStockObject },
|
||||
|
||||
/* ntuser */
|
||||
{ L"NtUserCallHwnd", Test_NtUserCallHwnd },
|
||||
{ L"NtUserCallHwndLock", Test_NtUserCallHwndLock },
|
||||
{ L"NtUserCallHwndOpt", Test_NtUserCallHwndOpt },
|
||||
{ L"NtUserCallHwndParam", Test_NtUserCallHwndParam },
|
||||
{ L"NtUserCallHwndParamLock", Test_NtUserCallHwndParamLock },
|
||||
{ L"NtUserCallNoParam", Test_NtUserCallNoParam },
|
||||
{ L"NtUserCallOneParam", Test_NtUserCallOneParam },
|
||||
{ L"NtUserCountClipboardFormats", Test_NtUserCountClipboardFormats },
|
||||
// { L"NtUserCreateWindowEx", Test_NtUserCreateWindowEx },
|
||||
{ L"NtUserEnumDisplaySettings", TEST_NtUserEnumDisplaySettings },
|
||||
{ L"NtUserFindExistingCursorIcon", Test_NtUserFindExistingCursoricon },
|
||||
{ L"NtUserRedrawWindow", Test_NtUserRedrawWindow },
|
||||
{ L"NtUserScrollDC", Test_NtUserScrollDC },
|
||||
{ L"NtUserSystemParametersInfo", Test_NtUserSystemParametersInfo },
|
||||
{ L"NtUserToUnicodeEx", Test_NtUserToUnicodeEx },
|
||||
{ L"NtUserGetTitleBarInfo", Test_NtUserGetTitleBarInfo }
|
||||
};
|
||||
|
||||
/* The function that gives us the number of tests */
|
||||
INT NumTests(void)
|
||||
{
|
||||
return sizeof(TestList) / sizeof(TESTENTRY);
|
||||
}
|
||||
|
||||
|
||||
#include "w32knapi.h"
|
||||
|
||||
/* include the tests */
|
||||
|
||||
#include "ntdd/NtGdiDdCreateDirectDrawObject.c"
|
||||
#include "ntdd/NtGdiDdDeleteDirectDrawObject.c"
|
||||
#include "ntdd/NtGdiDdQueryDirectDrawObject.c"
|
||||
|
||||
#include "ntgdi/NtGdiArcInternal.c"
|
||||
#include "ntgdi/NtGdiBitBlt.c"
|
||||
#include "ntgdi/NtGdiCreateBitmap.c"
|
||||
#include "ntgdi/NtGdiCreateCompatibleBitmap.c"
|
||||
#include "ntgdi/NtGdiDoPalette.c"
|
||||
#include "ntgdi/NtGdiEngCreatePalette.c"
|
||||
//#include "ntgdi/NtGdiEnumFontChunk.c"
|
||||
#include "ntgdi/NtGdiEnumFontOpen.c"
|
||||
#include "ntgdi/NtGdiGetBitmapBits.c"
|
||||
#include "ntgdi/NtGdiGetFontResourceInfoInternalW.c"
|
||||
#include "ntgdi/NtGdiGetRandomRgn.c"
|
||||
#include "ntgdi/NtGdiSelectBitmap.c"
|
||||
#include "ntgdi/NtGdiSelectBrush.c"
|
||||
#include "ntgdi/NtGdiSelectFont.c"
|
||||
#include "ntgdi/NtGdiSelectPen.c"
|
||||
#include "ntgdi/NtGdiSetBitmapBits.c"
|
||||
#include "ntgdi/NtGdiSetDIBitsToDeviceInternal.c"
|
||||
//#include "ntgdi/NtGdiSTROBJ_vEnumStart.c"
|
||||
#include "ntgdi/NtGdiGetDIBits.c"
|
||||
#include "ntgdi/NtGdiGetStockObject.c"
|
||||
|
||||
#include "ntuser/NtUserCallHwnd.c"
|
||||
#include "ntuser/NtUserCallHwndLock.c"
|
||||
#include "ntuser/NtUserCallHwndOpt.c"
|
||||
#include "ntuser/NtUserCallHwndParam.c"
|
||||
#include "ntuser/NtUserCallHwndParamLock.c"
|
||||
#include "ntuser/NtUserCallNoParam.c"
|
||||
#include "ntuser/NtUserCallOneParam.c"
|
||||
#include "ntuser/NtUserCountClipboardFormats.c"
|
||||
//#include "ntuser/NtUserCreateWindowEx.c"
|
||||
#include "ntuser/NtUserEnumDisplaySettings.c"
|
||||
#include "ntuser/NtUserFindExistingCursorIcon.c"
|
||||
#include "ntuser/NtUserRedrawWindow.c"
|
||||
#include "ntuser/NtUserScrollDC.c"
|
||||
#include "ntuser/NtUserSystemParametersInfo.c"
|
||||
#include "ntuser/NtUserToUnicodeEx.c"
|
||||
#include "ntuser/NtUserGetTitleBarInfo.c"
|
||||
|
||||
/* The List of tests */
|
||||
TESTENTRY TestList[] =
|
||||
{
|
||||
/* DirectDraw */
|
||||
{ L"NtGdiDdCreateDirectDrawObject", Test_NtGdiDdCreateDirectDrawObject },
|
||||
{ L"NtGdiDdQueryDirectDrawObject", Test_NtGdiDdQueryDirectDrawObject },
|
||||
{ L"NtGdiDdDeleteDirectDrawObject", Test_NtGdiDdDeleteDirectDrawObject },
|
||||
|
||||
/* ntgdi */
|
||||
{ L"NtGdiArcInternal", Test_NtGdiArcInternal },
|
||||
{ L"NtGdiBitBlt", Test_NtGdiBitBlt },
|
||||
{ L"NtGdiCreateBitmap", Test_NtGdiCreateBitmap },
|
||||
{ L"NtGdiCreateCompatibleBitmap", Test_NtGdiCreateCompatibleBitmap },
|
||||
{ L"NtGdiDoPalette", Test_NtGdiDoPalette },
|
||||
{ L"NtGdiEngCreatePalette", Test_NtGdiEngCreatePalette },
|
||||
// { L"NtGdiEnumFontChunk", Test_NtGdiEnumFontChunk },
|
||||
{ L"NtGdiEnumFontOpen", Test_NtGdiEnumFontOpen },
|
||||
{ L"NtGdiGetBitmapBits", Test_NtGdiGetBitmapBits },
|
||||
{ L"NtGdiGetFontResourceInfoInternalW", Test_NtGdiGetFontResourceInfoInternalW },
|
||||
{ L"NtGdiGetRandomRgn", Test_NtGdiGetRandomRgn },
|
||||
{ L"NtGdiSetBitmapBits", Test_NtGdiSetBitmapBits },
|
||||
{ L"NtGdiSetDIBitsToDeviceInternal", Test_NtGdiSetDIBitsToDeviceInternal },
|
||||
{ L"NtGdiSelectBitmap", Test_NtGdiSelectBitmap },
|
||||
{ L"NtGdiSelectBrush", Test_NtGdiSelectBrush },
|
||||
{ L"NtGdiSelectFont", Test_NtGdiSelectFont },
|
||||
{ L"NtGdiSelectPen", Test_NtGdiSelectPen },
|
||||
// { L"NtGdiSTROBJ_vEnumStart", Test_NtGdiSTROBJ_vEnumStart },
|
||||
{ L"NtGdiGetDIBitsInternal", Test_NtGdiGetDIBitsInternal },
|
||||
{ L"NtGdiGetStockObject", Test_NtGdiGetStockObject },
|
||||
|
||||
/* ntuser */
|
||||
{ L"NtUserCallHwnd", Test_NtUserCallHwnd },
|
||||
{ L"NtUserCallHwndLock", Test_NtUserCallHwndLock },
|
||||
{ L"NtUserCallHwndOpt", Test_NtUserCallHwndOpt },
|
||||
{ L"NtUserCallHwndParam", Test_NtUserCallHwndParam },
|
||||
{ L"NtUserCallHwndParamLock", Test_NtUserCallHwndParamLock },
|
||||
{ L"NtUserCallNoParam", Test_NtUserCallNoParam },
|
||||
{ L"NtUserCallOneParam", Test_NtUserCallOneParam },
|
||||
{ L"NtUserCountClipboardFormats", Test_NtUserCountClipboardFormats },
|
||||
// { L"NtUserCreateWindowEx", Test_NtUserCreateWindowEx },
|
||||
{ L"NtUserEnumDisplaySettings", TEST_NtUserEnumDisplaySettings },
|
||||
{ L"NtUserFindExistingCursorIcon", Test_NtUserFindExistingCursoricon },
|
||||
{ L"NtUserRedrawWindow", Test_NtUserRedrawWindow },
|
||||
{ L"NtUserScrollDC", Test_NtUserScrollDC },
|
||||
{ L"NtUserSystemParametersInfo", Test_NtUserSystemParametersInfo },
|
||||
{ L"NtUserToUnicodeEx", Test_NtUserToUnicodeEx },
|
||||
{ L"NtUserGetTitleBarInfo", Test_NtUserGetTitleBarInfo }
|
||||
};
|
||||
|
||||
/* The function that gives us the number of tests */
|
||||
INT NumTests(void)
|
||||
{
|
||||
return sizeof(TestList) / sizeof(TESTENTRY);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,98 +1,98 @@
|
||||
#include "w32knapi.h"
|
||||
|
||||
HINSTANCE g_hInstance;
|
||||
HMODULE g_hModule = NULL;
|
||||
PGDI_TABLE_ENTRY GdiHandleTable;
|
||||
|
||||
static
|
||||
PGDI_TABLE_ENTRY
|
||||
MyGdiQueryTable()
|
||||
{
|
||||
PTEB pTeb = NtCurrentTeb();
|
||||
PPEB pPeb = pTeb->ProcessEnvironmentBlock;
|
||||
return pPeb->GdiSharedHandleTable;
|
||||
}
|
||||
|
||||
static DWORD STDCALL
|
||||
IntSyscall(FARPROC proc, UINT cParams, PVOID pFirstParam)
|
||||
{
|
||||
DWORD ret;
|
||||
|
||||
asm volatile
|
||||
(
|
||||
"pushfl;" // Save flags
|
||||
"movl %%ecx, %%eax;"
|
||||
"shl $2, %%eax;" // Calculate param size
|
||||
"subl %%eax, %%esp;" // Calculate new stack pos
|
||||
"movl %%esp, %%edi;" // Destination is stackpointer
|
||||
"cld;" // Clear direction flag
|
||||
"rep movsd;" // Copy params to the stack
|
||||
"call *%%edx;" // Call function
|
||||
"popfl;" // Restore flags
|
||||
: "=a" (ret)
|
||||
: "S" (pFirstParam), "c" (cParams), "d"(proc)
|
||||
: "%edi"
|
||||
);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
DWORD
|
||||
Syscall(LPWSTR pszFunction, int cParams, void* pParams)
|
||||
{
|
||||
char szFunctionName[MAX_PATH];
|
||||
|
||||
sprintf(szFunctionName, "%ls", pszFunction);
|
||||
FARPROC proc = (FARPROC)GetProcAddress(g_hModule, szFunctionName);
|
||||
if (!proc)
|
||||
{
|
||||
printf("Couldn't find proc: %s\n", szFunctionName);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return IntSyscall(proc, cParams, pParams);
|
||||
}
|
||||
|
||||
BOOL
|
||||
IsFunctionPresent(LPWSTR lpszFunction)
|
||||
{
|
||||
char szFunctionName[MAX_PATH];
|
||||
sprintf(szFunctionName, "%ls", lpszFunction);
|
||||
return (GetProcAddress(g_hModule, szFunctionName) != NULL);
|
||||
}
|
||||
|
||||
int APIENTRY
|
||||
WinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
g_hInstance = hInstance;
|
||||
|
||||
printf("Win32k native API test\n");
|
||||
|
||||
/* Convert to gui thread */
|
||||
// IsGUIThread(TRUE); <- does not exists on win2k
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
GdiHandleTable = MyGdiQueryTable();
|
||||
if(!GdiHandleTable)
|
||||
{
|
||||
FreeLibrary(g_hModule);
|
||||
printf("GdiHandleTable not found!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
return TestMain(L"w32knapi", L"win32k.sys Nt-Api");
|
||||
}
|
||||
#include "w32knapi.h"
|
||||
|
||||
HINSTANCE g_hInstance;
|
||||
HMODULE g_hModule = NULL;
|
||||
PGDI_TABLE_ENTRY GdiHandleTable;
|
||||
|
||||
static
|
||||
PGDI_TABLE_ENTRY
|
||||
MyGdiQueryTable()
|
||||
{
|
||||
PTEB pTeb = NtCurrentTeb();
|
||||
PPEB pPeb = pTeb->ProcessEnvironmentBlock;
|
||||
return pPeb->GdiSharedHandleTable;
|
||||
}
|
||||
|
||||
static DWORD STDCALL
|
||||
IntSyscall(FARPROC proc, UINT cParams, PVOID pFirstParam)
|
||||
{
|
||||
DWORD ret;
|
||||
|
||||
asm volatile
|
||||
(
|
||||
"pushfl;" // Save flags
|
||||
"movl %%ecx, %%eax;"
|
||||
"shl $2, %%eax;" // Calculate param size
|
||||
"subl %%eax, %%esp;" // Calculate new stack pos
|
||||
"movl %%esp, %%edi;" // Destination is stackpointer
|
||||
"cld;" // Clear direction flag
|
||||
"rep movsd;" // Copy params to the stack
|
||||
"call *%%edx;" // Call function
|
||||
"popfl;" // Restore flags
|
||||
: "=a" (ret)
|
||||
: "S" (pFirstParam), "c" (cParams), "d"(proc)
|
||||
: "%edi"
|
||||
);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
DWORD
|
||||
Syscall(LPWSTR pszFunction, int cParams, void* pParams)
|
||||
{
|
||||
char szFunctionName[MAX_PATH];
|
||||
|
||||
sprintf(szFunctionName, "%ls", pszFunction);
|
||||
FARPROC proc = (FARPROC)GetProcAddress(g_hModule, szFunctionName);
|
||||
if (!proc)
|
||||
{
|
||||
printf("Couldn't find proc: %s\n", szFunctionName);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return IntSyscall(proc, cParams, pParams);
|
||||
}
|
||||
|
||||
BOOL
|
||||
IsFunctionPresent(LPWSTR lpszFunction)
|
||||
{
|
||||
char szFunctionName[MAX_PATH];
|
||||
sprintf(szFunctionName, "%ls", lpszFunction);
|
||||
return (GetProcAddress(g_hModule, szFunctionName) != NULL);
|
||||
}
|
||||
|
||||
int APIENTRY
|
||||
WinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
g_hInstance = hInstance;
|
||||
|
||||
printf("Win32k native API test\n");
|
||||
|
||||
/* Convert to gui thread */
|
||||
// IsGUIThread(TRUE); <- does not exists on win2k
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
GdiHandleTable = MyGdiQueryTable();
|
||||
if(!GdiHandleTable)
|
||||
{
|
||||
FreeLibrary(g_hModule);
|
||||
printf("GdiHandleTable not found!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
return TestMain(L"w32knapi", L"win32k.sys Nt-Api");
|
||||
}
|
||||
|
||||
@@ -1,65 +1,65 @@
|
||||
#ifndef _W32KNAPI_H
|
||||
#define _W32KNAPI_H
|
||||
|
||||
/* SDK/NDK Headers */
|
||||
#define NTOS_MODE_USER
|
||||
#define WIN32_NO_STATUS
|
||||
#include <windows.h>
|
||||
#include <winuser.h>
|
||||
#include <windowsx.h>
|
||||
#include <winnls32.h>
|
||||
#include <ndk/ntndk.h>
|
||||
#include <wingdi.h>
|
||||
#include <winddi.h>
|
||||
#include <ddrawi.h>
|
||||
#include <d3dnthal.h>
|
||||
#include <prntfont.h>
|
||||
|
||||
/* Public Win32K Headers */
|
||||
#include <win32k/ntusrtyp.h>
|
||||
#include <win32k/ntuser.h>
|
||||
#include <win32k/callback.h>
|
||||
#include <win32k/ntgdityp.h>
|
||||
#include <ntgdi.h>
|
||||
#include <win32k/ntgdihdl.h>
|
||||
|
||||
#include "../apitest.h"
|
||||
#include "resource.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LPWSTR lpszFunction;
|
||||
INT nSyscallNum;
|
||||
INT nParams;
|
||||
} SYCALL_ENTRY, *PSYSCALL_ENTRY;
|
||||
|
||||
extern HINSTANCE g_hInstance;
|
||||
extern HMODULE g_hModule;
|
||||
extern PGDI_TABLE_ENTRY GdiHandleTable;
|
||||
|
||||
DWORD Syscall(LPWSTR lpszFunction, int cParams, void* pParams);
|
||||
BOOL InitOsVersion();
|
||||
extern UINT g_OsIdx;
|
||||
|
||||
typedef UINT ASPI[5];
|
||||
extern ASPI gNOPARAM_ROUTINE_CREATEMENU;
|
||||
extern ASPI gNOPARAM_ROUTINE_CREATEMENUPOPUP;
|
||||
extern ASPI gNOPARAM_ROUTINE_LOADUSERAPIHOOK;
|
||||
extern ASPI gONEPARAM_ROUTINE_MAPDEKTOPOBJECT;
|
||||
extern ASPI gONEPARAM_ROUTINE_SWAPMOUSEBUTTON;
|
||||
extern ASPI gHWND_ROUTINE_DEREGISTERSHELLHOOKWINDOW;
|
||||
extern ASPI gHWND_ROUTINE_GETWNDCONTEXTHLPID;
|
||||
extern ASPI gHWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID;
|
||||
|
||||
#define _NOPARAM_ROUTINE_CREATEMENU gNOPARAM_ROUTINE_CREATEMENU[g_OsIdx]
|
||||
#define _NOPARAM_ROUTINE_CREATEMENUPOPUP gNOPARAM_ROUTINE_CREATEMENUPOPUP[g_OsIdx]
|
||||
#define _NOPARAM_ROUTINE_LOADUSERAPIHOOK gNOPARAM_ROUTINE_LOADUSERAPIHOOK[g_OsIdx]
|
||||
#define _ONEPARAM_ROUTINE_MAPDEKTOPOBJECT gONEPARAM_ROUTINE_MAPDEKTOPOBJECT[g_OsIdx]
|
||||
#define _ONEPARAM_ROUTINE_SWAPMOUSEBUTTON gONEPARAM_ROUTINE_SWAPMOUSEBUTTON[g_OsIdx]
|
||||
#define _HWND_ROUTINE_DEREGISTERSHELLHOOKWINDOW gHWND_ROUTINE_DEREGISTERSHELLHOOKWINDOW[g_OsIdx]
|
||||
#define _HWND_ROUTINE_GETWNDCONTEXTHLPID gHWND_ROUTINE_GETWNDCONTEXTHLPID[g_OsIdx]
|
||||
#define _HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID gHWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID[g_OsIdx]
|
||||
|
||||
|
||||
|
||||
#endif /* _W32KNAPI_H */
|
||||
#ifndef _W32KNAPI_H
|
||||
#define _W32KNAPI_H
|
||||
|
||||
/* SDK/NDK Headers */
|
||||
#define NTOS_MODE_USER
|
||||
#define WIN32_NO_STATUS
|
||||
#include <windows.h>
|
||||
#include <winuser.h>
|
||||
#include <windowsx.h>
|
||||
#include <winnls32.h>
|
||||
#include <ndk/ntndk.h>
|
||||
#include <wingdi.h>
|
||||
#include <winddi.h>
|
||||
#include <ddrawi.h>
|
||||
#include <d3dnthal.h>
|
||||
#include <prntfont.h>
|
||||
|
||||
/* Public Win32K Headers */
|
||||
#include <win32k/ntusrtyp.h>
|
||||
#include <win32k/ntuser.h>
|
||||
#include <win32k/callback.h>
|
||||
#include <win32k/ntgdityp.h>
|
||||
#include <ntgdi.h>
|
||||
#include <win32k/ntgdihdl.h>
|
||||
|
||||
#include "../apitest.h"
|
||||
#include "resource.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LPWSTR lpszFunction;
|
||||
INT nSyscallNum;
|
||||
INT nParams;
|
||||
} SYCALL_ENTRY, *PSYSCALL_ENTRY;
|
||||
|
||||
extern HINSTANCE g_hInstance;
|
||||
extern HMODULE g_hModule;
|
||||
extern PGDI_TABLE_ENTRY GdiHandleTable;
|
||||
|
||||
DWORD Syscall(LPWSTR lpszFunction, int cParams, void* pParams);
|
||||
BOOL InitOsVersion();
|
||||
extern UINT g_OsIdx;
|
||||
|
||||
typedef UINT ASPI[5];
|
||||
extern ASPI gNOPARAM_ROUTINE_CREATEMENU;
|
||||
extern ASPI gNOPARAM_ROUTINE_CREATEMENUPOPUP;
|
||||
extern ASPI gNOPARAM_ROUTINE_LOADUSERAPIHOOK;
|
||||
extern ASPI gONEPARAM_ROUTINE_MAPDEKTOPOBJECT;
|
||||
extern ASPI gONEPARAM_ROUTINE_SWAPMOUSEBUTTON;
|
||||
extern ASPI gHWND_ROUTINE_DEREGISTERSHELLHOOKWINDOW;
|
||||
extern ASPI gHWND_ROUTINE_GETWNDCONTEXTHLPID;
|
||||
extern ASPI gHWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID;
|
||||
|
||||
#define _NOPARAM_ROUTINE_CREATEMENU gNOPARAM_ROUTINE_CREATEMENU[g_OsIdx]
|
||||
#define _NOPARAM_ROUTINE_CREATEMENUPOPUP gNOPARAM_ROUTINE_CREATEMENUPOPUP[g_OsIdx]
|
||||
#define _NOPARAM_ROUTINE_LOADUSERAPIHOOK gNOPARAM_ROUTINE_LOADUSERAPIHOOK[g_OsIdx]
|
||||
#define _ONEPARAM_ROUTINE_MAPDEKTOPOBJECT gONEPARAM_ROUTINE_MAPDEKTOPOBJECT[g_OsIdx]
|
||||
#define _ONEPARAM_ROUTINE_SWAPMOUSEBUTTON gONEPARAM_ROUTINE_SWAPMOUSEBUTTON[g_OsIdx]
|
||||
#define _HWND_ROUTINE_DEREGISTERSHELLHOOKWINDOW gHWND_ROUTINE_DEREGISTERSHELLHOOKWINDOW[g_OsIdx]
|
||||
#define _HWND_ROUTINE_GETWNDCONTEXTHLPID gHWND_ROUTINE_GETWNDCONTEXTHLPID[g_OsIdx]
|
||||
#define _HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID gHWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID[g_OsIdx]
|
||||
|
||||
|
||||
|
||||
#endif /* _W32KNAPI_H */
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<module name="w32knapi" type="win32cui">
|
||||
<include base="w32knapi">.</include>
|
||||
<define name="__USE_W32API" />
|
||||
<define name="_WIN32_WINNT">0x0501</define>
|
||||
<define name="WINVER">0x501</define>
|
||||
<library>apitest</library>
|
||||
<library>ntdll</library>
|
||||
<library>kernel32</library>
|
||||
<library>user32</library>
|
||||
<library>gdi32</library>
|
||||
<library>shell32</library>
|
||||
<library>advapi32</library>
|
||||
<library>w32kdll</library>
|
||||
<library>dbghelp</library>
|
||||
<file>w32knapi.c</file>
|
||||
<file>osver.c</file>
|
||||
<file>testlist.c</file>
|
||||
<file>w32knapi.rc</file>
|
||||
</module>
|
||||
<module name="w32knapi" type="win32cui">
|
||||
<include base="w32knapi">.</include>
|
||||
<define name="__USE_W32API" />
|
||||
<define name="_WIN32_WINNT">0x0501</define>
|
||||
<define name="WINVER">0x501</define>
|
||||
<library>apitest</library>
|
||||
<library>ntdll</library>
|
||||
<library>kernel32</library>
|
||||
<library>user32</library>
|
||||
<library>gdi32</library>
|
||||
<library>shell32</library>
|
||||
<library>advapi32</library>
|
||||
<library>w32kdll</library>
|
||||
<library>dbghelp</library>
|
||||
<file>w32knapi.c</file>
|
||||
<file>osver.c</file>
|
||||
<file>testlist.c</file>
|
||||
<file>w32knapi.rc</file>
|
||||
</module>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <windows.h>
|
||||
#include "resource.h"
|
||||
|
||||
IDI_ICON ICON "resource/system.ico"
|
||||
|
||||
#include <windows.h>
|
||||
#include "resource.h"
|
||||
|
||||
IDI_ICON ICON "resource/system.ico"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user