sync rostests to r44455
svn path=/branches/ros-amd64-bringup/; revision=44456
|
@ -1,13 +1,12 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
|
@ -16,7 +15,7 @@ software--to make sure the software is free for all its users. This
|
|||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
|
@ -56,8 +55,8 @@ patent must be licensed for everyone's free use or not licensed at all.
|
|||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
|
@ -111,7 +110,7 @@ above, provided that you also meet all of these conditions:
|
|||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
|
@ -169,7 +168,7 @@ access to copy from a designated place, then offering equivalent
|
|||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
|
@ -226,7 +225,7 @@ impose that choice.
|
|||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
|
@ -256,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals
|
|||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
|
@ -278,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
|||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
|
@ -292,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least
|
|||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -304,16 +303,16 @@ the "copyright" line and a pointer to where the full notice is found.
|
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
@ -336,5 +335,5 @@ necessary. Here is a sample; alter the names:
|
|||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
|
@ -80,6 +80,36 @@ WriteRow(HANDLE hFile, LPDWORD lpdwBytesWritten, LPWSTR pszFunction, PTESTINFO p
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static CHAR
|
||||
GetDisplayChar(CHAR c)
|
||||
{
|
||||
if (c < 32) return '.';
|
||||
return c;
|
||||
}
|
||||
|
||||
VOID
|
||||
DumpMem(PVOID pData, ULONG cbSize, ULONG nWidth)
|
||||
{
|
||||
ULONG cLines = (cbSize + nWidth - 1) / nWidth;
|
||||
ULONG cbLastLine = cbSize % nWidth;
|
||||
INT i,j;
|
||||
|
||||
for (i = 0; i <= cLines; i++)
|
||||
{
|
||||
printf("%08lx: ", i*nWidth);
|
||||
for (j = 0; j < (i == cLines? cbLastLine : nWidth); j++)
|
||||
{
|
||||
printf("%02x ", ((BYTE*)pData)[i*nWidth + j]);
|
||||
}
|
||||
printf(" ");
|
||||
for (j = 0; j < (i == cLines? cbLastLine : nWidth); j++)
|
||||
{
|
||||
printf("%c", GetDisplayChar(((CHAR*)pData)[i*nWidth + j]));
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
TestMain(LPWSTR pszName, LPWSTR pszModule)
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ typedef struct tagTEST
|
|||
if (x)\
|
||||
{\
|
||||
(pti->passed)++;\
|
||||
printf("non-rtest succeeded in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
|
||||
printf("%s:%d: non-rtest succeeded (%s)\n", __FILE__, __LINE__, #x);\
|
||||
} else {\
|
||||
(pti->failed)++;\
|
||||
} \
|
||||
|
@ -52,7 +52,30 @@ typedef struct tagTEST
|
|||
(pti->passed)++;\
|
||||
} else {\
|
||||
(pti->failed)++;\
|
||||
printf("test failed in %s:%d (%s)\n", __FILE__, __LINE__, #x);\
|
||||
printf("%s:%d: test failed (%s)\n", __FILE__, __LINE__, #x);\
|
||||
} \
|
||||
}
|
||||
|
||||
#define TESTX(x, format, ...) \
|
||||
if (pti->bRegress) \
|
||||
{ \
|
||||
if (x)\
|
||||
{\
|
||||
(pti->passed)++;\
|
||||
printf("%s:%d: non-rtest succeeded (%s)\n", __FILE__, __LINE__, #x);\
|
||||
} else {\
|
||||
(pti->failed)++;\
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if (x)\
|
||||
{\
|
||||
(pti->passed)++;\
|
||||
} else {\
|
||||
(pti->failed)++;\
|
||||
printf("%s:%d: test failed (%s) ", __FILE__, __LINE__, #x);\
|
||||
printf(format, __VA_ARGS__); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
@ -91,5 +114,6 @@ int TestMain(LPWSTR pszExe, LPWSTR pszModule);
|
|||
extern TESTENTRY TestList[];
|
||||
INT NumTests(void);
|
||||
BOOL IsFunctionPresent(LPWSTR lpszFunction);
|
||||
VOID DumpMem(PVOID pData, ULONG cbSize, ULONG nWidth);
|
||||
|
||||
#endif /* _APITEST_H */
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
<module name="dciman32api" type="win32cui">
|
||||
<include base="dciman32api">.</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>
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
<group xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<module name="apitest" type="staticlibrary">
|
||||
<include base="apitest">.</include>
|
||||
<define name="__USE_W32API" />
|
||||
<define name="_WIN32_WINNT">0x0501</define>
|
||||
<file>apitest.c</file>
|
||||
</module>
|
||||
|
||||
|
|
|
@ -38,15 +38,6 @@ typedef PGDI_TABLE_ENTRY (CALLBACK * GDIQUERYPROC) (void);
|
|||
/** 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);
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
<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>
|
||||
|
|
|
@ -6,8 +6,10 @@
|
|||
/* include the tests */
|
||||
#include "tests/AddFontResource.c"
|
||||
#include "tests/AddFontResourceEx.c"
|
||||
#include "tests/BeginPath.c"
|
||||
#include "tests/CreateBitmapIndirect.c"
|
||||
#include "tests/CreateCompatibleDC.c"
|
||||
#include "tests/CreateFontIndirect.c"
|
||||
#include "tests/CreateFont.c"
|
||||
#include "tests/CreatePen.c"
|
||||
#include "tests/CreateRectRgn.c"
|
||||
|
@ -33,27 +35,24 @@
|
|||
#include "tests/GetDIBits.c"
|
||||
#include "tests/GetObject.c"
|
||||
#include "tests/GetStockObject.c"
|
||||
#include "tests/GetTextFace.c"
|
||||
#include "tests/SelectObject.c"
|
||||
#include "tests/SetDCPenColor.c"
|
||||
#include "tests/SetMapMode.c"
|
||||
#include "tests/SetSysColors.c"
|
||||
#include "tests/SetWindowExtEx.c"
|
||||
#include "tests/SetWorldTransform.c"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The List of tests */
|
||||
TESTENTRY TestList[] =
|
||||
{
|
||||
{ L"AddFontResourceA", Test_AddFontResourceA },
|
||||
{ L"AddFontResourceEx", Test_AddFontResourceEx },
|
||||
{ L"BeginPath", Test_BeginPath },
|
||||
{ L"CreateBitmapIndirect", Test_CreateBitmapIndirect },
|
||||
{ L"CreateCompatibleDC", Test_CreateCompatibleDC },
|
||||
{ L"CreateFontIndirect", Test_CreateFontIndirect },
|
||||
{ L"CreateFont", Test_CreateFont },
|
||||
{ L"CreatePen", Test_CreatePen },
|
||||
{ L"EngCreateSemaphore", Test_EngCreateSemaphore },
|
||||
|
@ -79,9 +78,12 @@ TESTENTRY TestList[] =
|
|||
{ L"GetDIBits", Test_GetDIBits },
|
||||
{ L"GetObject", Test_GetObject },
|
||||
{ L"GetStockObject", Test_GetStockObject },
|
||||
{ L"GetTextFace", Test_GetTextFace },
|
||||
{ L"SelectObject", Test_SelectObject },
|
||||
{ L"SetDCPenColor", Test_SetDCPenColor },
|
||||
{ L"SetMapMode", Test_SetMapMode },
|
||||
{ L"SetSysColors", Test_SetSysColors },
|
||||
{ L"SetWindowExtEx", Test_SetWindowExtEx },
|
||||
{ L"SetWorldTransform", Test_SetWorldTransform },
|
||||
};
|
||||
|
||||
|
|
24
rostests/apitests/gdi32api/tests/BeginPath.c
Normal file
|
@ -0,0 +1,24 @@
|
|||
|
||||
|
||||
INT
|
||||
Test_BeginPath(PTESTINFO pti)
|
||||
{
|
||||
HDC hDC;
|
||||
BOOL ret;
|
||||
|
||||
SetLastError(0);
|
||||
ret = BeginPath(0);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
hDC = CreateCompatibleDC(NULL);
|
||||
|
||||
SetLastError(0);
|
||||
ret = BeginPath(hDC);
|
||||
TEST(ret == 1);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
DeleteDC(hDC);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
|
@ -39,6 +39,12 @@ Test_CreateCompatibleDC(PTESTINFO pti)
|
|||
RTEST(hDC2 == NULL);
|
||||
if (hDC2 != NULL) DeleteDC(hDC2);
|
||||
|
||||
/* Check map mode */
|
||||
hDC = CreateCompatibleDC(hDCScreen);
|
||||
SetMapMode(hDC, MM_ISOTROPIC);
|
||||
hDC2 = CreateCompatibleDC(hDC);
|
||||
TEST(GetMapMode(hDC2) == MM_TEXT);
|
||||
|
||||
// cleanup
|
||||
DeleteDC(hDC);
|
||||
|
||||
|
|
180
rostests/apitests/gdi32api/tests/CreateFontIndirect.c
Normal file
|
@ -0,0 +1,180 @@
|
|||
|
||||
INT
|
||||
Test_CreateFontIndirectA(PTESTINFO pti)
|
||||
{
|
||||
LOGFONTA logfont;
|
||||
HFONT hFont;
|
||||
ULONG ret;
|
||||
ENUMLOGFONTEXDVW elfedv2;
|
||||
|
||||
logfont.lfHeight = 12;
|
||||
logfont.lfWidth = 0;
|
||||
logfont.lfEscapement = 0;
|
||||
logfont.lfOrientation = 0;
|
||||
logfont.lfWeight = FW_NORMAL;
|
||||
logfont.lfItalic = 0;
|
||||
logfont.lfUnderline = 0;
|
||||
logfont.lfStrikeOut = 0;
|
||||
logfont.lfCharSet = DEFAULT_CHARSET;
|
||||
logfont.lfOutPrecision = OUT_DEFAULT_PRECIS;
|
||||
logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
|
||||
logfont.lfQuality = PROOF_QUALITY;
|
||||
logfont.lfPitchAndFamily = DEFAULT_PITCH;
|
||||
memset(logfont.lfFaceName, 'A', LF_FACESIZE);
|
||||
hFont = CreateFontIndirectA(&logfont);
|
||||
TEST(hFont != 0);
|
||||
|
||||
memset(&elfedv2, 0, sizeof(elfedv2));
|
||||
ret = GetObjectW(hFont, sizeof(elfedv2), &elfedv2);
|
||||
TEST(ret == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD));
|
||||
TEST(elfedv2.elfEnumLogfontEx.elfLogFont.lfFaceName[LF_FACESIZE-1] == 0);
|
||||
TEST(elfedv2.elfEnumLogfontEx.elfFullName[0] == 0);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_CreateFontIndirectW(PTESTINFO pti)
|
||||
{
|
||||
LOGFONTW logfont;
|
||||
HFONT hFont;
|
||||
ULONG ret;
|
||||
ENUMLOGFONTEXDVW elfedv2;
|
||||
|
||||
logfont.lfHeight = 12;
|
||||
logfont.lfWidth = 0;
|
||||
logfont.lfEscapement = 0;
|
||||
logfont.lfOrientation = 0;
|
||||
logfont.lfWeight = FW_NORMAL;
|
||||
logfont.lfItalic = 0;
|
||||
logfont.lfUnderline = 0;
|
||||
logfont.lfStrikeOut = 0;
|
||||
logfont.lfCharSet = DEFAULT_CHARSET;
|
||||
logfont.lfOutPrecision = OUT_DEFAULT_PRECIS;
|
||||
logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
|
||||
logfont.lfQuality = PROOF_QUALITY;
|
||||
logfont.lfPitchAndFamily = DEFAULT_PITCH;
|
||||
memset(logfont.lfFaceName, 'A', LF_FACESIZE * 2);
|
||||
hFont = CreateFontIndirectW(&logfont);
|
||||
TEST(hFont != 0);
|
||||
|
||||
memset(&elfedv2, 0, sizeof(elfedv2));
|
||||
ret = GetObjectW(hFont, sizeof(elfedv2), &elfedv2);
|
||||
TEST(ret == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD));
|
||||
TEST(elfedv2.elfEnumLogfontEx.elfLogFont.lfFaceName[LF_FACESIZE-1] == ((WCHAR)'A' << 8) + 'A');
|
||||
TEST(elfedv2.elfEnumLogfontEx.elfFullName[0] == 0);
|
||||
/* Theres a bunch of data in elfFullName ... */
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_CreateFontIndirectExA(PTESTINFO pti)
|
||||
{
|
||||
ENUMLOGFONTEXDVA elfedva, elfedva2;
|
||||
ENUMLOGFONTEXDVW elfedvw;
|
||||
ENUMLOGFONTEXA *penumlfa;
|
||||
LOGFONTA *plogfonta;
|
||||
HFONT hFont;
|
||||
ULONG ret;
|
||||
|
||||
memset(&elfedva, 0, sizeof(elfedva));
|
||||
penumlfa = &elfedva.elfEnumLogfontEx;
|
||||
plogfonta = &elfedva.elfEnumLogfontEx.elfLogFont;
|
||||
|
||||
plogfonta->lfHeight = 12;
|
||||
plogfonta->lfWidth = 0;
|
||||
plogfonta->lfEscapement = 0;
|
||||
plogfonta->lfOrientation = 0;
|
||||
plogfonta->lfWeight = FW_NORMAL;
|
||||
plogfonta->lfItalic = 0;
|
||||
plogfonta->lfUnderline = 0;
|
||||
plogfonta->lfStrikeOut = 0;
|
||||
plogfonta->lfCharSet = DEFAULT_CHARSET;
|
||||
plogfonta->lfOutPrecision = OUT_DEFAULT_PRECIS;
|
||||
plogfonta->lfClipPrecision = CLIP_DEFAULT_PRECIS;
|
||||
plogfonta->lfQuality = PROOF_QUALITY;
|
||||
plogfonta->lfPitchAndFamily = DEFAULT_PITCH;
|
||||
|
||||
memset(plogfonta->lfFaceName, 'A', LF_FACESIZE * sizeof(WCHAR));
|
||||
memset(penumlfa->elfFullName, 'B', LF_FULLFACESIZE * sizeof(WCHAR));
|
||||
|
||||
hFont = CreateFontIndirectExA(&elfedva);
|
||||
TEST(hFont != 0);
|
||||
|
||||
ret = GetObjectW(hFont, sizeof(elfedvw), &elfedvw);
|
||||
TEST(ret == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD));
|
||||
TEST(elfedvw.elfEnumLogfontEx.elfLogFont.lfFaceName[LF_FACESIZE-1] == 0);
|
||||
TEST(elfedvw.elfEnumLogfontEx.elfFullName[LF_FULLFACESIZE-1] == 0);
|
||||
|
||||
memset(&elfedva2, 0, sizeof(elfedva2));
|
||||
ret = GetObjectA(hFont, sizeof(elfedva2), &elfedva2);
|
||||
TEST(ret == sizeof(ENUMLOGFONTEXDVA));
|
||||
TEST(elfedva2.elfEnumLogfontEx.elfLogFont.lfFaceName[LF_FACESIZE-1] == 0);
|
||||
TEST(elfedva2.elfEnumLogfontEx.elfFullName[LF_FULLFACESIZE-1] == 0);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_CreateFontIndirectExW(PTESTINFO pti)
|
||||
{
|
||||
ENUMLOGFONTEXDVW elfedv, elfedv2;
|
||||
ENUMLOGFONTEXDVA elfedva;
|
||||
ENUMLOGFONTEXW *penumlfw;
|
||||
LOGFONTW *plogfontw;
|
||||
HFONT hFont;
|
||||
ULONG ret;
|
||||
|
||||
memset(&elfedv, 0, sizeof(elfedv));
|
||||
penumlfw = &elfedv.elfEnumLogfontEx;
|
||||
plogfontw = &elfedv.elfEnumLogfontEx.elfLogFont;
|
||||
|
||||
plogfontw->lfHeight = 12;
|
||||
plogfontw->lfWidth = 0;
|
||||
plogfontw->lfEscapement = 0;
|
||||
plogfontw->lfOrientation = 0;
|
||||
plogfontw->lfWeight = FW_NORMAL;
|
||||
plogfontw->lfItalic = 0;
|
||||
plogfontw->lfUnderline = 0;
|
||||
plogfontw->lfStrikeOut = 0;
|
||||
plogfontw->lfCharSet = DEFAULT_CHARSET;
|
||||
plogfontw->lfOutPrecision = OUT_DEFAULT_PRECIS;
|
||||
plogfontw->lfClipPrecision = CLIP_DEFAULT_PRECIS;
|
||||
plogfontw->lfQuality = PROOF_QUALITY;
|
||||
plogfontw->lfPitchAndFamily = DEFAULT_PITCH;
|
||||
|
||||
memset(plogfontw->lfFaceName, 'A', LF_FACESIZE * sizeof(WCHAR));
|
||||
memset(penumlfw->elfFullName, 'B', LF_FULLFACESIZE * sizeof(WCHAR));
|
||||
|
||||
hFont = CreateFontIndirectExW(&elfedv);
|
||||
TEST(hFont != 0);
|
||||
|
||||
memset(&elfedv2, 0, sizeof(elfedv2));
|
||||
ret = GetObjectW(hFont, sizeof(elfedv2), &elfedv2);
|
||||
TEST(ret == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD));
|
||||
TEST(elfedv2.elfEnumLogfontEx.elfLogFont.lfFaceName[LF_FACESIZE-1] == ((WCHAR)'A' << 8) + 'A');
|
||||
TEST(elfedv2.elfEnumLogfontEx.elfFullName[LF_FULLFACESIZE-1] == ((WCHAR)'B' << 8) + 'B');
|
||||
|
||||
memset(&elfedva, 0, sizeof(elfedva));
|
||||
ret = GetObjectA(hFont, sizeof(elfedva), &elfedva);
|
||||
TEST(ret == sizeof(ENUMLOGFONTEXDVA));
|
||||
TEST(elfedva.elfEnumLogfontEx.elfLogFont.lfFaceName[LF_FACESIZE-1] == '?');
|
||||
TEST(elfedva.elfEnumLogfontEx.elfFullName[LF_FULLFACESIZE-1] == 0);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
INT
|
||||
Test_CreateFontIndirect(PTESTINFO pti)
|
||||
{
|
||||
|
||||
Test_CreateFontIndirectA(pti);
|
||||
Test_CreateFontIndirectW(pti);
|
||||
Test_CreateFontIndirectExA(pti);
|
||||
Test_CreateFontIndirectExW(pti);
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
LONG STDCALL GdiGetCharDimensions(HDC, LPTEXTMETRICW, LONG *);
|
||||
LONG WINAPI GdiGetCharDimensions(HDC, LPTEXTMETRICW, LONG *);
|
||||
|
||||
INT
|
||||
Test_GdiGetCharDimensions(PTESTINFO pti)
|
||||
|
|
|
@ -4,6 +4,7 @@ Test_GetCurrentObject(PTESTINFO pti)
|
|||
{
|
||||
HWND hWnd;
|
||||
HDC hDC;
|
||||
HBITMAP hBmp;
|
||||
|
||||
/* Create a window */
|
||||
hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
|
@ -70,7 +71,6 @@ Test_GetCurrentObject(PTESTINFO pti)
|
|||
|
||||
/* Default bitmap */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
HBITMAP hBmp;
|
||||
hBmp = GetCurrentObject(hDC, OBJ_BITMAP);
|
||||
RTEST(GDI_HANDLE_GET_TYPE(hBmp) == GDI_OBJECT_TYPE_BITMAP);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
|
|
@ -98,15 +98,17 @@ Test_Bitmap(PTESTINFO pti)
|
|||
static INT
|
||||
Test_Dibsection(PTESTINFO pti)
|
||||
{
|
||||
BITMAPINFO bmi = {{sizeof(BITMAPINFOHEADER), 10, 10, 1, 8, BI_RGB, 0, 10, 10, 0,0}};
|
||||
BITMAPINFO bmi = {{sizeof(BITMAPINFOHEADER), 10, 9, 1, 8, BI_RGB, 0, 10, 10, 0,0}};
|
||||
HBITMAP hBitmap;
|
||||
BITMAP bitmap;
|
||||
DIBSECTION dibsection;
|
||||
PVOID pData;
|
||||
HDC hDC;
|
||||
|
||||
FillMemory(&dibsection, sizeof(DIBSECTION), 0x77);
|
||||
HDC hDC = GetDC(0);
|
||||
hDC = GetDC(0);
|
||||
hBitmap = CreateDIBSection(hDC, &bmi, DIB_RGB_COLORS, &pData, NULL, 0);
|
||||
if(!hBitmap) return FALSE;
|
||||
ASSERT(hBitmap);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetObject(hBitmap, sizeof(DIBSECTION), NULL) == sizeof(BITMAP));
|
||||
|
@ -115,8 +117,15 @@ Test_Dibsection(PTESTINFO pti)
|
|||
RTEST(GetObject(hBitmap, -5, NULL) == sizeof(BITMAP));
|
||||
RTEST(GetObject(hBitmap, 0, &dibsection) == 0);
|
||||
RTEST(GetObject(hBitmap, 5, &dibsection) == 0);
|
||||
RTEST(GetObject(hBitmap, sizeof(BITMAP), &dibsection) == sizeof(BITMAP));
|
||||
RTEST(GetObject(hBitmap, sizeof(BITMAP)+2, &dibsection) == sizeof(BITMAP));
|
||||
RTEST(GetObject(hBitmap, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
RTEST(GetObject(hBitmap, sizeof(BITMAP)+2, &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmType == 0);
|
||||
TEST(bitmap.bmWidth == 10);
|
||||
TEST(bitmap.bmHeight == 9);
|
||||
TEST(bitmap.bmWidthBytes == 12);
|
||||
TEST(bitmap.bmPlanes == 1);
|
||||
TEST(bitmap.bmBitsPixel == 8);
|
||||
TEST(bitmap.bmBits == pData);
|
||||
RTEST(GetObject(hBitmap, sizeof(DIBSECTION), &dibsection) == sizeof(DIBSECTION));
|
||||
RTEST(GetObject(hBitmap, sizeof(DIBSECTION)+2, &dibsection) == sizeof(DIBSECTION));
|
||||
RTEST(GetObject(hBitmap, -5, &dibsection) == sizeof(DIBSECTION));
|
||||
|
|
68
rostests/apitests/gdi32api/tests/GetTextFace.c
Normal file
|
@ -0,0 +1,68 @@
|
|||
|
||||
INT
|
||||
Test_GetTextFace(PTESTINFO pti)
|
||||
{
|
||||
HDC hDC;
|
||||
INT ret;
|
||||
INT ret2;
|
||||
WCHAR Buffer[20];
|
||||
|
||||
hDC = CreateCompatibleDC(NULL);
|
||||
ASSERT(hDC);
|
||||
|
||||
/* Whether asking for the string size (NULL buffer) ignores the size argument */
|
||||
SetLastError(0xE000BEEF);
|
||||
ret = GetTextFaceW(hDC, 0, NULL);
|
||||
TEST(ret != 0);
|
||||
TEST(GetLastError() == 0xE000BEEF);
|
||||
ret2 = ret;
|
||||
|
||||
SetLastError(0xE000BEEF);
|
||||
ret = GetTextFaceW(hDC, -1, NULL);
|
||||
TEST(ret != 0);
|
||||
TEST(ret == ret2);
|
||||
TEST(GetLastError() == 0xE000BEEF);
|
||||
ret2 = ret;
|
||||
|
||||
SetLastError(0xE000BEEF);
|
||||
ret = GetTextFaceW(hDC, 10000, NULL);
|
||||
TEST(ret != 0);
|
||||
TEST(ret == ret2);
|
||||
TEST(GetLastError() == 0xE000BEEF);
|
||||
ret2 = ret;
|
||||
|
||||
/* Whether the buffer is correctly filled */
|
||||
SetLastError(0xE000BEEF);
|
||||
ret = GetTextFaceW(hDC, 20, Buffer);
|
||||
TEST(ret != 0);
|
||||
TEST(ret <= 20);
|
||||
TEST(Buffer[ret - 1] == 0);
|
||||
TEST(GetLastError() == 0xE000BEEF);
|
||||
|
||||
SetLastError(0xE000BEEF);
|
||||
ret = GetTextFaceW(hDC, 1, Buffer);
|
||||
TEST(ret == 1);
|
||||
TEST(Buffer[ret - 1] == 0);
|
||||
TEST(GetLastError() == 0xE000BEEF);
|
||||
|
||||
SetLastError(0xE000BEEF);
|
||||
ret = GetTextFaceW(hDC, 2, Buffer);
|
||||
TEST(ret == 2);
|
||||
TEST(Buffer[ret - 1] == 0);
|
||||
TEST(GetLastError() == 0xE000BEEF);
|
||||
|
||||
/* Whether invalid buffer sizes are correctly ignored */
|
||||
SetLastError(0xE000BEEF);
|
||||
ret = GetTextFaceW(hDC, 0, Buffer);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0xE000BEEF);
|
||||
|
||||
SetLastError(0xE000BEEF);
|
||||
ret = GetTextFaceW(hDC, -1, Buffer);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0xE000BEEF);
|
||||
|
||||
DeleteDC(hDC);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
|
@ -2,6 +2,7 @@ INT
|
|||
Test_SetDCPenColor(PTESTINFO pti)
|
||||
{
|
||||
HDC hScreenDC, hDC;
|
||||
HBITMAP hbmp;
|
||||
|
||||
// Test an incorrect DC
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
|
@ -33,6 +34,16 @@ Test_SetDCPenColor(PTESTINFO pti)
|
|||
SetDCPenColor(hDC, CLR_INVALID);
|
||||
RTEST(SetDCPenColor(hDC, RGB(0,0,0)) == CLR_INVALID);
|
||||
|
||||
hbmp = CreateBitmap(10, 10, 1, 32, NULL);
|
||||
ASSERT(hbmp);
|
||||
|
||||
SelectObject(hDC, hbmp);
|
||||
SelectObject(hDC, GetStockObject(DC_PEN));
|
||||
SetDCPenColor(hDC, 0x123456);
|
||||
MoveToEx(hDC, 0, 0, NULL);
|
||||
LineTo(hDC, 10, 0);
|
||||
TEST(GetPixel(hDC, 5, 0) == 0x123456);
|
||||
|
||||
// Delete the DC
|
||||
DeleteDC(hDC);
|
||||
|
||||
|
|
181
rostests/apitests/gdi32api/tests/SetMapMode.c
Normal file
|
@ -0,0 +1,181 @@
|
|||
|
||||
|
||||
|
||||
INT
|
||||
Test_SetMapMode(PTESTINFO pti)
|
||||
{
|
||||
HDC hDC;
|
||||
SIZE WindowExt, ViewportExt;
|
||||
ULONG ulMapMode;
|
||||
|
||||
hDC = CreateCompatibleDC(NULL);
|
||||
ASSERT(hDC);
|
||||
|
||||
GetWindowExtEx(hDC, &WindowExt);
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
|
||||
ulMapMode = SetMapMode(hDC, MM_ISOTROPIC);
|
||||
TEST(ulMapMode == MM_TEXT);
|
||||
TEST(WindowExt.cx == 1);
|
||||
TEST(WindowExt.cy == 1);
|
||||
TEST(ViewportExt.cx == 1);
|
||||
TEST(ViewportExt.cy == 1);
|
||||
|
||||
SetLastError(0);
|
||||
ulMapMode = SetMapMode(hDC, 0);
|
||||
TEST(GetLastError() == 0);
|
||||
TEST(ulMapMode == 0);
|
||||
|
||||
/* Go through all valid values */
|
||||
ulMapMode = SetMapMode(hDC, 1);
|
||||
TEST(ulMapMode == MM_ISOTROPIC);
|
||||
ulMapMode = SetMapMode(hDC, 2);
|
||||
TEST(ulMapMode == 1);
|
||||
ulMapMode = SetMapMode(hDC, 3);
|
||||
TEST(ulMapMode == 2);
|
||||
ulMapMode = SetMapMode(hDC, 4);
|
||||
TEST(ulMapMode == 3);
|
||||
ulMapMode = SetMapMode(hDC, 5);
|
||||
TEST(ulMapMode == 4);
|
||||
ulMapMode = SetMapMode(hDC, 6);
|
||||
TEST(ulMapMode == 5);
|
||||
ulMapMode = SetMapMode(hDC, 7);
|
||||
TEST(ulMapMode == 6);
|
||||
ulMapMode = SetMapMode(hDC, 8);
|
||||
TEST(ulMapMode == 7);
|
||||
|
||||
/* Test invalid value */
|
||||
ulMapMode = SetMapMode(hDC, 9);
|
||||
TEST(ulMapMode == 0);
|
||||
ulMapMode = SetMapMode(hDC, 10);
|
||||
TEST(ulMapMode == 0);
|
||||
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
/* Test NULL DC */
|
||||
ulMapMode = SetMapMode((HDC)0, 2);
|
||||
TEST(ulMapMode == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test NULL DC and invalid mode */
|
||||
ulMapMode = SetMapMode((HDC)0, 10);
|
||||
TEST(ulMapMode == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test invalid DC */
|
||||
ulMapMode = SetMapMode((HDC)0x12345, 2);
|
||||
TEST(ulMapMode == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test invalid DC and invalid mode */
|
||||
ulMapMode = SetMapMode((HDC)0x12345, 10);
|
||||
TEST(ulMapMode == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
DeleteDC(hDC);
|
||||
|
||||
/* Test a deleted DC */
|
||||
ulMapMode = SetMapMode(hDC, 2);
|
||||
TEST(ulMapMode == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test MM_TEXT */
|
||||
hDC = CreateCompatibleDC(NULL);
|
||||
SetMapMode(hDC, MM_TEXT);
|
||||
GetWindowExtEx(hDC, &WindowExt);
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(WindowExt.cx == 1);
|
||||
TEST(WindowExt.cy == 1);
|
||||
TEST(ViewportExt.cx == 1);
|
||||
TEST(ViewportExt.cy == 1);
|
||||
DeleteDC(hDC);
|
||||
|
||||
/* Test MM_ISOTROPIC */
|
||||
hDC = CreateCompatibleDC(NULL);
|
||||
SetMapMode(hDC, MM_ISOTROPIC);
|
||||
GetWindowExtEx(hDC, &WindowExt);
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(WindowExt.cx == 3600);
|
||||
TEST(WindowExt.cy == 2700);
|
||||
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
|
||||
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
|
||||
DeleteDC(hDC);
|
||||
|
||||
/* Test MM_ANISOTROPIC */
|
||||
hDC = CreateCompatibleDC(NULL);
|
||||
SetMapMode(hDC, MM_ANISOTROPIC);
|
||||
GetWindowExtEx(hDC, &WindowExt);
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(WindowExt.cx == 1);
|
||||
TEST(WindowExt.cy == 1);
|
||||
TEST(ViewportExt.cx == 1);
|
||||
TEST(ViewportExt.cy == 1);
|
||||
|
||||
/* set MM_ISOTROPIC first, the values will be kept */
|
||||
SetMapMode(hDC, MM_ISOTROPIC);
|
||||
SetMapMode(hDC, MM_ANISOTROPIC);
|
||||
GetWindowExtEx(hDC, &WindowExt);
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(WindowExt.cx == 3600);
|
||||
TEST(WindowExt.cy == 2700);
|
||||
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
|
||||
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
|
||||
DeleteDC(hDC);
|
||||
|
||||
/* Test MM_LOMETRIC */
|
||||
hDC = CreateCompatibleDC(NULL);
|
||||
SetMapMode(hDC, MM_LOMETRIC);
|
||||
GetWindowExtEx(hDC, &WindowExt);
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(WindowExt.cx == 3600);
|
||||
TEST(WindowExt.cy == 2700);
|
||||
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
|
||||
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
|
||||
DeleteDC(hDC);
|
||||
|
||||
/* Test MM_HIMETRIC */
|
||||
hDC = CreateCompatibleDC(NULL);
|
||||
SetMapMode(hDC, MM_HIMETRIC);
|
||||
GetWindowExtEx(hDC, &WindowExt);
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(WindowExt.cx == 36000);
|
||||
TEST(WindowExt.cy == 27000);
|
||||
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
|
||||
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
|
||||
DeleteDC(hDC);
|
||||
|
||||
/* Test MM_LOENGLISH */
|
||||
hDC = CreateCompatibleDC(NULL);
|
||||
SetMapMode(hDC, MM_LOENGLISH);
|
||||
GetWindowExtEx(hDC, &WindowExt);
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(WindowExt.cx == 1417);
|
||||
TEST(WindowExt.cy == 1063);
|
||||
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
|
||||
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
|
||||
DeleteDC(hDC);
|
||||
|
||||
/* Test MM_HIENGLISH */
|
||||
hDC = CreateCompatibleDC(NULL);
|
||||
SetMapMode(hDC, MM_HIENGLISH);
|
||||
GetWindowExtEx(hDC, &WindowExt);
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(WindowExt.cx == 14173);
|
||||
TEST(WindowExt.cy == 10630);
|
||||
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
|
||||
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
|
||||
DeleteDC(hDC);
|
||||
|
||||
/* Test MM_TWIPS */
|
||||
hDC = CreateCompatibleDC(NULL);
|
||||
SetMapMode(hDC, MM_TWIPS);
|
||||
GetWindowExtEx(hDC, &WindowExt);
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(WindowExt.cx == 20409);
|
||||
TEST(WindowExt.cy == 15307);
|
||||
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
|
||||
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
|
||||
DeleteDC(hDC);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
275
rostests/apitests/gdi32api/tests/SetWindowExtEx.c
Normal file
|
@ -0,0 +1,275 @@
|
|||
|
||||
|
||||
INT
|
||||
Test_SetWindowExtEx(PTESTINFO pti)
|
||||
{
|
||||
HDC hDC;
|
||||
BOOL ret;
|
||||
SIZE WindowExt, ViewportExt;
|
||||
PGDI_TABLE_ENTRY pEntry;
|
||||
DC_ATTR* pDC_Attr;
|
||||
|
||||
hDC = CreateCompatibleDC(0);
|
||||
ASSERT(hDC);
|
||||
|
||||
SetLastError(0);
|
||||
ret = SetWindowExtEx(0, 0, 0, NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
TEST(ret == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = SetWindowExtEx((HDC)0x1234, 0, 0, NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
TEST(ret == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = SetWindowExtEx(hDC, 0, 0, NULL);
|
||||
TEST(GetLastError() == 0);
|
||||
TEST(ret == 1);
|
||||
|
||||
WindowExt.cx = 1234;
|
||||
WindowExt.cy = 6789;
|
||||
SetLastError(0);
|
||||
ret = SetWindowExtEx(0, 0, 0, &WindowExt);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
TEST(ret == 0);
|
||||
TEST(WindowExt.cx == 1234);
|
||||
TEST(WindowExt.cy == 6789);
|
||||
|
||||
DeleteDC(hDC);
|
||||
|
||||
/* Test with a deleted DC */
|
||||
SetLastError(0);
|
||||
ret = SetWindowExtEx(hDC, 0, 0, NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
TEST(ret == 0);
|
||||
|
||||
hDC = CreateCompatibleDC(0);
|
||||
ASSERT(hDC);
|
||||
|
||||
pEntry = GdiHandleTable + GDI_HANDLE_GET_INDEX(hDC);
|
||||
ASSERT(pEntry);
|
||||
pDC_Attr = pEntry->UserData;
|
||||
ASSERT(pDC_Attr);
|
||||
|
||||
/* Test setting it without changing the map mode (MM_TEXT) */
|
||||
ret = SetWindowExtEx(hDC, 10, 20, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 1);
|
||||
TEST(WindowExt.cy == 1);
|
||||
|
||||
/* Values should not be changed */
|
||||
WindowExt.cx = WindowExt.cy = 0;
|
||||
ret = SetWindowExtEx(hDC, 40, 30, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 1);
|
||||
TEST(WindowExt.cy == 1);
|
||||
|
||||
/* Check the viewport */
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(ViewportExt.cx == 1);
|
||||
TEST(ViewportExt.cy == 1);
|
||||
|
||||
/* Test setting in isotropic mode with 0 extents */
|
||||
SetMapMode(hDC, MM_ISOTROPIC);
|
||||
WindowExt.cx = WindowExt.cy = 0;
|
||||
ret = SetWindowExtEx(hDC, 0, 0, &WindowExt);
|
||||
TEST(ret == 0);
|
||||
TEST(WindowExt.cx == 3600);
|
||||
TEST(WindowExt.cy == 2700);
|
||||
ret = SetWindowExtEx(hDC, 100, 0, &WindowExt);
|
||||
TEST(ret == 0);
|
||||
ret = SetWindowExtEx(hDC, 0, 100, &WindowExt);
|
||||
TEST(ret == 0);
|
||||
|
||||
/* Test setting in isotropic mode */
|
||||
ret = SetWindowExtEx(hDC, 21224, 35114, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 3600);
|
||||
TEST(WindowExt.cy == 2700);
|
||||
|
||||
/* Values should be changed */
|
||||
ret = SetWindowExtEx(hDC,
|
||||
4 * GetDeviceCaps(GetDC(0), HORZRES),
|
||||
-4 * GetDeviceCaps(GetDC(0), VERTRES),
|
||||
&WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 21224);
|
||||
TEST(WindowExt.cy == 35114);
|
||||
|
||||
/* Check the viewport, should be the same */
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
|
||||
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
|
||||
|
||||
/* again isotropic mode with 1:1 res */
|
||||
ret = SetWindowExtEx(hDC, 123, 123, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 4 * GetDeviceCaps(GetDC(0), HORZRES));
|
||||
TEST(WindowExt.cy == -4 * GetDeviceCaps(GetDC(0), VERTRES));
|
||||
|
||||
/* Test flXform */
|
||||
TEST(pDC_Attr->flXform & PAGE_EXTENTS_CHANGED);
|
||||
|
||||
/* Check the viewport from the dcattr, without going through gdi */
|
||||
TEST(pDC_Attr->szlViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
|
||||
TEST(pDC_Attr->szlViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
|
||||
|
||||
/* Check the viewport with gdi, should not be the same */
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), VERTRES));
|
||||
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
|
||||
|
||||
/* Test flXform */
|
||||
TEST(pDC_Attr->flXform & PAGE_EXTENTS_CHANGED);
|
||||
|
||||
/* again isotropic mode with 3:1 res */
|
||||
ret = SetWindowExtEx(hDC, 300, 100, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 123);
|
||||
TEST(WindowExt.cy == 123);
|
||||
|
||||
/* Check the viewport now, should not be the same */
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), VERTRES));
|
||||
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES) / 3);
|
||||
|
||||
/* again isotropic mode with 1:3 res */
|
||||
SetViewportExtEx(hDC, 6000, 3000, 0);
|
||||
ret = SetWindowExtEx(hDC, 200, 600, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 300);
|
||||
TEST(WindowExt.cy == 100);
|
||||
|
||||
/* Check the viewport now, should not be the same */
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(ViewportExt.cx == 1000);
|
||||
TEST(ViewportExt.cy == 3000);
|
||||
|
||||
/* Test setting in anisotropic mode */
|
||||
SetMapMode(hDC, MM_ANISOTROPIC);
|
||||
ret = SetWindowExtEx(hDC, 80, 60, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 200);
|
||||
TEST(WindowExt.cy == 600);
|
||||
|
||||
/* Values should be changed */
|
||||
ret = SetWindowExtEx(hDC, 500, 500, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 80);
|
||||
TEST(WindowExt.cy == 60);
|
||||
|
||||
/* Check the viewport */
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(ViewportExt.cx == 1000);
|
||||
TEST(ViewportExt.cy == 3000);
|
||||
|
||||
/* Test setting in low metric mode */
|
||||
SetMapMode(hDC, MM_LOMETRIC);
|
||||
ret = SetWindowExtEx(hDC, 120, 90, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 3600);
|
||||
TEST(WindowExt.cy == 2700);
|
||||
|
||||
/* Values should not be changed */
|
||||
WindowExt.cx = WindowExt.cy = 0;
|
||||
ret = SetWindowExtEx(hDC, 900, 700, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 3600);
|
||||
TEST(WindowExt.cy == 2700);
|
||||
|
||||
/* Check the viewport */
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
|
||||
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
|
||||
|
||||
/* Test setting in high metric mode */
|
||||
SetMapMode(hDC, MM_HIMETRIC);
|
||||
ret = SetWindowExtEx(hDC, 120, 90, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 36000);
|
||||
TEST(WindowExt.cy == 27000);
|
||||
|
||||
/* Values should not be changed */
|
||||
WindowExt.cx = WindowExt.cy = 0;
|
||||
ret = SetWindowExtEx(hDC, 500, 300, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 36000);
|
||||
TEST(WindowExt.cy == 27000);
|
||||
|
||||
/* Check the viewport */
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
|
||||
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
|
||||
|
||||
/* Test setting in low english mode */
|
||||
SetMapMode(hDC, MM_LOENGLISH);
|
||||
ret = SetWindowExtEx(hDC, 320, 290, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 1417);
|
||||
TEST(WindowExt.cy == 1063);
|
||||
|
||||
/* Values should not be changed */
|
||||
WindowExt.cx = WindowExt.cy = 0;
|
||||
ret = SetWindowExtEx(hDC, 560, 140, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 1417);
|
||||
TEST(WindowExt.cy == 1063);
|
||||
|
||||
/* Check the viewport */
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
|
||||
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
|
||||
|
||||
/* Test setting in high english mode */
|
||||
SetMapMode(hDC, MM_HIENGLISH);
|
||||
ret = SetWindowExtEx(hDC, 320, 290, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 14173);
|
||||
TEST(WindowExt.cy == 10630);
|
||||
|
||||
/* Values should not be changed */
|
||||
WindowExt.cx = WindowExt.cy = 0;
|
||||
ret = SetWindowExtEx(hDC, 1560, 1140, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 14173);
|
||||
TEST(WindowExt.cy == 10630);
|
||||
|
||||
/* Check the viewport */
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
|
||||
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
|
||||
|
||||
/* Test setting in twips mode */
|
||||
SetMapMode(hDC, MM_TWIPS);
|
||||
ret = SetWindowExtEx(hDC, 3320, 3290, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 20409);
|
||||
TEST(WindowExt.cy == 15307);
|
||||
|
||||
/* Values should not be changed */
|
||||
WindowExt.cx = WindowExt.cy = 0;
|
||||
ret = SetWindowExtEx(hDC, 4560, 4140, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 20409);
|
||||
TEST(WindowExt.cy == 15307);
|
||||
|
||||
/* Check the viewport */
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
|
||||
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
|
||||
|
||||
/* test manually modifying the dcattr, should go to tests for GetViewportExtEx */
|
||||
SetMapMode(hDC, MM_ISOTROPIC);
|
||||
ret = SetWindowExtEx(hDC, 420, 4140, &WindowExt);
|
||||
pDC_Attr->szlWindowExt.cx = 0;
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(pDC_Attr->szlWindowExt.cx == 0);
|
||||
TEST(ViewportExt.cx == 0);
|
||||
|
||||
DeleteDC(hDC);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
|
||||
|
||||
}
|
|
@ -6,6 +6,7 @@
|
|||
#include "user32api.h"
|
||||
|
||||
/* include the tests */
|
||||
#include "tests/GetSystemMetrics.c"
|
||||
#include "tests/InitializeLpkHooks.c"
|
||||
#include "tests/ScrollDC.c"
|
||||
#include "tests/ScrollWindowEx.c"
|
||||
|
@ -14,6 +15,7 @@
|
|||
/* The List of tests */
|
||||
TESTENTRY TestList[] =
|
||||
{
|
||||
{ L"GetSystemMetrics", Test_GetSystemMetrics },
|
||||
{ L"InitializeLpkHooks", Test_InitializeLpkHooks },
|
||||
{ L"ScrollDC", Test_ScrollDC },
|
||||
{ L"ScrollWindowEx", Test_ScrollWindowEx },
|
||||
|
|
396
rostests/apitests/user32api/tests/GetSystemMetrics.c
Normal file
|
@ -0,0 +1,396 @@
|
|||
|
||||
INT
|
||||
Test_GetSystemMetrics(PTESTINFO pti)
|
||||
{
|
||||
INT ret;
|
||||
HDC hDC;
|
||||
BOOL BoolVal;
|
||||
UINT UintVal;
|
||||
RECT rect;
|
||||
|
||||
SetLastError(0);
|
||||
hDC = GetDC(0);
|
||||
|
||||
ret = GetSystemMetrics(0);
|
||||
TEST(ret > 0);
|
||||
|
||||
ret = GetSystemMetrics(64);
|
||||
TEST(ret == 0);
|
||||
ret = GetSystemMetrics(65);
|
||||
TEST(ret == 0);
|
||||
ret = GetSystemMetrics(66);
|
||||
TEST(ret == 0);
|
||||
|
||||
|
||||
ret = GetSystemMetrics(SM_CXSCREEN);
|
||||
TEST(ret == GetDeviceCaps(hDC, HORZRES));
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYSCREEN);
|
||||
TEST(ret == GetDeviceCaps(hDC, VERTRES));
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CXVSCROLL);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYHSCROLL);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYCAPTION);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CXBORDER);
|
||||
SystemParametersInfoW(SPI_GETFOCUSBORDERWIDTH, 0, &UintVal, 0);
|
||||
TEST(ret == UintVal);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYBORDER);
|
||||
SystemParametersInfoW(SPI_GETFOCUSBORDERHEIGHT, 0, &UintVal, 0);
|
||||
TEST(ret == UintVal);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CXDLGFRAME);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYDLGFRAME);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYVTHUMB);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CXHTHUMB);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CXICON);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYICON);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CXCURSOR);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYCURSOR);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYMENU);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SystemParametersInfoW(SPI_GETWORKAREA, 0, &rect, 0);
|
||||
ret = GetSystemMetrics(SM_CXFULLSCREEN);
|
||||
TEST(ret == rect.right);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYFULLSCREEN);
|
||||
TEST(ret == rect.bottom - rect.top - GetSystemMetrics(SM_CYCAPTION));
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYKANJIWINDOW);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_MOUSEPRESENT);
|
||||
TEST(ret == 1);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYVSCROLL);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CXHSCROLL);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_DEBUG);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_SWAPBUTTON);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_RESERVED1);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_RESERVED2);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_RESERVED3);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_RESERVED4);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CXMIN);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYMIN);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CXSIZE);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYSIZE);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CXFRAME);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYFRAME);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CXMINTRACK);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYMINTRACK);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CXDOUBLECLK);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYDOUBLECLK);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CXICONSPACING);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYICONSPACING);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_MENUDROPALIGNMENT);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_PENWINDOWS);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_DBCSENABLED);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CMOUSEBUTTONS);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
#if(WINVER >= 0x0400)
|
||||
ret = GetSystemMetrics(SM_SECURE);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CXEDGE);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYEDGE);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CXMINSPACING);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYMINSPACING);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CXSMICON);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYSMICON);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYSMCAPTION);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CXSMSIZE);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYSMSIZE);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CXMENUSIZE);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYMENUSIZE);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_ARRANGE);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CXMINIMIZED);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYMINIMIZED);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CXMAXTRACK);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYMAXTRACK);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CXMAXIMIZED);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYMAXIMIZED);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_NETWORK);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CLEANBOOT);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CXDRAG);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYDRAG);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_SHOWSOUNDS);
|
||||
SystemParametersInfoW(SPI_GETSHOWSOUNDS, 0, &BoolVal, 0);
|
||||
TEST(ret == BoolVal);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CXMENUCHECK);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYMENUCHECK);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_SLOWMACHINE);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_MIDEASTENABLED);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
#endif
|
||||
|
||||
#if (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400)
|
||||
ret = GetSystemMetrics(SM_MOUSEWHEELPRESENT);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
#endif
|
||||
|
||||
#if(WINVER >= 0x0500)
|
||||
ret = GetSystemMetrics(SM_XVIRTUALSCREEN);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_YVIRTUALSCREEN);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CXVIRTUALSCREEN);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYVIRTUALSCREEN);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CMONITORS);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_SAMEDISPLAYFORMAT);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
#endif
|
||||
|
||||
#if(_WIN32_WINNT >= 0x0500)
|
||||
ret = GetSystemMetrics(SM_IMMENABLED);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
#endif
|
||||
|
||||
#if(_WIN32_WINNT >= 0x0501)
|
||||
ret = GetSystemMetrics(SM_CXFOCUSBORDER);
|
||||
SystemParametersInfoW(SPI_GETFOCUSBORDERWIDTH, 0, &UintVal, 0);
|
||||
TEST(ret == UintVal);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CYFOCUSBORDER);
|
||||
SystemParametersInfoW(SPI_GETFOCUSBORDERHEIGHT, 0, &UintVal, 0);
|
||||
TEST(ret == UintVal);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_TABLETPC);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_MEDIACENTER);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_STARTER);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_SERVERR2);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
#endif
|
||||
|
||||
#if(_WIN32_WINNT >= 0x0600)
|
||||
ret = GetSystemMetrics(SM_MOUSEHORIZONTALWHEELPRESENT);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
ret = GetSystemMetrics(SM_CXPADDEDBORDER);
|
||||
// TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
#endif
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
|
@ -27,7 +27,7 @@ int Count_myLpkTabbedTextOut = 0;
|
|||
int Count_myLpkPSMTextOut = 0;
|
||||
int Count_myLpkDrawTextEx = 0;
|
||||
|
||||
DWORD STDCALL myLpkTabbedTextOut (LPVOID x1,LPVOID x2,LPVOID x3, LPVOID x4, LPVOID x5, LPVOID x6, LPVOID x7, LPVOID x8,
|
||||
DWORD WINAPI myLpkTabbedTextOut (LPVOID x1,LPVOID x2,LPVOID x3, LPVOID x4, LPVOID x5, LPVOID x6, LPVOID x7, LPVOID x8,
|
||||
LPVOID x9, LPVOID x10, LPVOID x11, LPVOID x12)
|
||||
{
|
||||
Count_myLpkTabbedTextOut++;
|
||||
|
@ -55,7 +55,7 @@ typedef struct _USER32_INTERN_INITALIZEHOOKS
|
|||
PLPK_LPEDITCONTROL_LIST fpListLpkEditControl;
|
||||
} USER32_INTERN_INITALIZEHOOKS, *PUSER32_INTERN_INITALIZEHOOKS;
|
||||
|
||||
VOID STDCALL InitializeLpkHooks (PUSER32_INTERN_INITALIZEHOOKS);
|
||||
VOID WINAPI InitializeLpkHooks (PUSER32_INTERN_INITALIZEHOOKS);
|
||||
|
||||
INT
|
||||
Test_InitializeLpkHooks(PTESTINFO pti)
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
<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>
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<module name="w32kdll_2k3sp2" type="win32dll" entrypoint="0" installname="w32kdll_2k3sp2.dll">
|
||||
<importlibrary definition="w32kdll_2k3sp2.def" />
|
||||
<define name="__USE_W32API" />
|
||||
<define name="_WIN32_WINNT">0x0502</define>
|
||||
<file>w32kdll_2k3sp2.S</file>
|
||||
<file>main.c</file>
|
||||
</module>
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<module name="w32kdll_2ksp4" type="win32dll" entrypoint="0" installname="w32kdll_2ksp4.dll">
|
||||
<importlibrary definition="w32kdll_2ksp4.def" />
|
||||
<define name="__USE_W32API" />
|
||||
<define name="_WIN32_WINNT">0x0502</define>
|
||||
<file>w32kdll_2ksp4.S</file>
|
||||
<file>main.c</file>
|
||||
</module>
|
||||
|
|
|
@ -241,7 +241,7 @@ NtGdiMonoBitmap@4
|
|||
NtGdiMoveTo@16
|
||||
NtGdiOffsetClipRgn@12
|
||||
NtGdiOffsetRgn@12
|
||||
NtGdiOpenDCW@28
|
||||
NtGdiOpenDCW@32
|
||||
NtGdiPatBlt@24
|
||||
NtGdiPolyPatBlt@20
|
||||
NtGdiPathToRegion@4
|
||||
|
@ -497,7 +497,7 @@ NtUserRealInternalGetMessage@24
|
|||
NtUserRealWaitMessageEx@8
|
||||
NtUserRedrawWindow@16
|
||||
NtUserRegisterClassExWOW@28
|
||||
NtUserRegisterUserApiHook@8
|
||||
NtUserRegisterUserApiHook@16
|
||||
NtUserRegisterHotKey@16
|
||||
NtUserRegisterRawInputDevices@12
|
||||
NtUserRegisterTasklist@4
|
||||
|
@ -587,7 +587,7 @@ NtUserUnregisterUserApiHook@0
|
|||
NtUserUnregisterHotKey@8
|
||||
NtUserUpdateInputContext@12
|
||||
NtUserUpdateInstance@12
|
||||
NtUserUpdateLayeredWindow@36
|
||||
NtUserUpdateLayeredWindow@40
|
||||
NtUserGetLayeredWindowAttributes@16
|
||||
NtUserSetLayeredWindowAttributes@16
|
||||
NtUserUpdatePerUserSystemParameters@8
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<module name="w32kdll" type="win32dll" entrypoint="0" installname="w32kdll.dll">
|
||||
<importlibrary definition="w32kdll_ros.def" />
|
||||
<define name="__USE_W32API" />
|
||||
<define name="_WIN32_WINNT">0x0502</define>
|
||||
<library>win32ksys</library>
|
||||
<file>main.c</file>
|
||||
</module>
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<module name="w32kdll_vista" type="win32dll" entrypoint="0" installname="w32kdll_vista.dll">
|
||||
<importlibrary definition="w32kdll_vista.def" />
|
||||
<define name="__USE_W32API" />
|
||||
<define name="_WIN32_WINNT">0x0502</define>
|
||||
<file>w32kdll_vista.S</file>
|
||||
<file>main.c</file>
|
||||
</module>
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<module name="w32kdll_xpsp2" type="win32dll" entrypoint="0" installname="w32kdll_xpsp2.dll">
|
||||
<importlibrary definition="w32kdll_xpsp2.def" />
|
||||
<define name="__USE_W32API" />
|
||||
<define name="_WIN32_WINNT">0x0502</define>
|
||||
<file>w32kdll_xpsp2.S</file>
|
||||
<file>main.c</file>
|
||||
</module>
|
||||
|
|
49
rostests/apitests/w32knapi/ntgdi/NtGdiCombineRgn.c
Normal file
|
@ -0,0 +1,49 @@
|
|||
|
||||
INT
|
||||
Test_NtGdiCombineRgn(PTESTINFO pti)
|
||||
{
|
||||
HRGN hRgnDest, hRgn1, hRgn2;
|
||||
// test what params are accepted for what operations
|
||||
// 0? invalid? are params maybe ignored in some cases?
|
||||
// LastError
|
||||
|
||||
/* Preparation */
|
||||
hRgnDest = CreateRectRgn(0,0,1,1);
|
||||
hRgn1 = CreateRectRgn(1,1,4,4);
|
||||
hRgn2 = CreateRectRgn(2,2,6,3);
|
||||
|
||||
/* RGN_AND = 1, RGN_OR = 2, RGN_XOR = 3, RGN_DIFF = 4, RGN_COPY = 5 */
|
||||
|
||||
TEST(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, 0) == ERROR);
|
||||
TEST(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, 6) == ERROR);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCombineRgn(hRgnDest, 0, 0, RGN_AND) == ERROR);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCombineRgn(hRgnDest, hRgn1, 0, RGN_AND) == ERROR);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCombineRgn(hRgnDest, 0, hRgn1, RGN_AND) == ERROR);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCombineRgn(0, hRgn1, hRgn2, RGN_AND) == ERROR);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
/* Create intersection */
|
||||
TEST(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, RGN_AND) == SIMPLEREGION);
|
||||
SetRectRgn(hRgn1, 2, 2, 4, 3);
|
||||
TEST(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgn1, RGN_XOR) == NULLREGION);
|
||||
|
||||
/* Create intersection with itself */
|
||||
SetRectRgn(hRgnDest, 2, 2, 4, 3);
|
||||
TEST(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgnDest, RGN_AND) == SIMPLEREGION);
|
||||
SetRectRgn(hRgn1, 2, 2, 4, 3);
|
||||
TEST(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgn1, RGN_XOR) == NULLREGION);
|
||||
|
||||
|
||||
/* What if 2 regions are the same */
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
27
rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleDC.c
Normal file
|
@ -0,0 +1,27 @@
|
|||
|
||||
INT
|
||||
Test_NtGdiCreateCompatibleDC(PTESTINFO pti)
|
||||
{
|
||||
HDC hDC;
|
||||
HGDIOBJ hObj;
|
||||
|
||||
/* Test if aa NULL DC is accepted */
|
||||
hDC = NtGdiCreateCompatibleDC(NULL);
|
||||
TEST(hDC != NULL);
|
||||
|
||||
/* We select a nwe palette. Note: SelectObject doesn't work with palettes! */
|
||||
hObj = SelectPalette(hDC, GetStockObject(DEFAULT_PALETTE), 0);
|
||||
/* The old palette should be GetStockObject(DEFAULT_PALETTE) */
|
||||
TEST(hObj == GetStockObject(DEFAULT_PALETTE));
|
||||
|
||||
/* The default bitmap should be GetStockObject(21) */
|
||||
hObj = SelectObject(hDC, GetStockObject(21));
|
||||
TEST(hObj == GetStockObject(21));
|
||||
|
||||
/* The default pen should be GetStockObject(BLACK_PEN) */
|
||||
hObj = SelectObject(hDC, GetStockObject(WHITE_PEN));
|
||||
TEST(hObj == GetStockObject(BLACK_PEN));
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
475
rostests/apitests/w32knapi/ntgdi/NtGdiCreateDIBSection.c
Normal file
|
@ -0,0 +1,475 @@
|
|||
|
||||
/*
|
||||
HBITMAP
|
||||
APIENTRY
|
||||
NtGdiCreateDIBSection(
|
||||
IN HDC hDC,
|
||||
IN OPTIONAL HANDLE hSection,
|
||||
IN DWORD dwOffset,
|
||||
IN LPBITMAPINFO pbmi,
|
||||
IN DWORD iUsage,
|
||||
IN UINT cjHeader,
|
||||
IN FLONG fl,
|
||||
IN ULONG_PTR dwColorSpace,
|
||||
OUT PVOID *ppvBits)
|
||||
*/
|
||||
|
||||
ULONG
|
||||
GetBitmapSize(BITMAPINFOHEADER *pbih)
|
||||
{
|
||||
ULONG WidthBits, WidthBytes;
|
||||
|
||||
WidthBits = pbih->biWidth * pbih->biBitCount * pbih->biPlanes;
|
||||
WidthBytes = ((WidthBits + 31) & ~ 31) >> 3;
|
||||
|
||||
return pbih->biHeight * WidthBytes;
|
||||
}
|
||||
|
||||
|
||||
INT
|
||||
Test_NtGdiCreateDIBSection(PTESTINFO pti)
|
||||
{
|
||||
HBITMAP hbmp;
|
||||
HDC hDC;
|
||||
ULONG cjHeader;
|
||||
PVOID pvBits = NULL;
|
||||
ULONG cEntries;
|
||||
DIBSECTION dibsection;
|
||||
|
||||
struct
|
||||
{
|
||||
BITMAPINFOHEADER bmiHeader;
|
||||
RGBQUAD bmiColors[100];
|
||||
} bmi;
|
||||
PBITMAPINFO pbmi = (PBITMAPINFO)&bmi;
|
||||
PBITMAPINFOHEADER pbih = (PBITMAPINFOHEADER)&bmi.bmiHeader;
|
||||
PBITMAPV4HEADER pbV4h = (PBITMAPV4HEADER)&bmi.bmiHeader;
|
||||
PBITMAPV5HEADER pbV5h = (PBITMAPV5HEADER)&bmi.bmiHeader;
|
||||
|
||||
HANDLE hSection;
|
||||
NTSTATUS Status;
|
||||
LARGE_INTEGER MaximumSize;
|
||||
|
||||
hDC = GetDC(0);
|
||||
pbih->biSize = sizeof(BITMAPINFOHEADER);
|
||||
pbih->biWidth = 2;
|
||||
pbih->biHeight = 2;
|
||||
pbih->biPlanes = 1;
|
||||
pbih->biBitCount = 1;
|
||||
pbih->biCompression = BI_RGB;
|
||||
pbih->biSizeImage = 0;
|
||||
pbih->biXPelsPerMeter = 100;
|
||||
pbih->biYPelsPerMeter = 100;
|
||||
pbih->biClrUsed = 2;
|
||||
pbih->biClrImportant = 2;
|
||||
|
||||
cEntries = 0;
|
||||
|
||||
/** iUsage = 0 (DIB_RGB_COLORS) ***********************************************/
|
||||
|
||||
cjHeader = bmi.bmiHeader.biSize + cEntries * 4 + 8;
|
||||
|
||||
/* Test something simple */
|
||||
SetLastError(0);
|
||||
pvBits = 0;
|
||||
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, pbmi, 0, cjHeader, 0, 0, &pvBits);
|
||||
TEST(pvBits != NULL);
|
||||
TEST(hbmp != 0);
|
||||
// TEST(GetLastError() == 0);
|
||||
TEST(GetObject(hbmp, sizeof(DIBSECTION), &dibsection) == sizeof(DIBSECTION));
|
||||
TEST(dibsection.dsBitfields[0] == 0);
|
||||
TEST(dibsection.dsBitfields[1] == 0);
|
||||
TEST(dibsection.dsBitfields[2] == 0);
|
||||
TEST(dibsection.dshSection == 0);
|
||||
TEST(dibsection.dsOffset == 0);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
|
||||
/* Test a 0 HDC */
|
||||
SetLastError(0);
|
||||
pvBits = 0;
|
||||
hbmp = NtGdiCreateDIBSection(0, NULL, 0, pbmi, 0, cjHeader, 0, 0, &pvBits);
|
||||
TEST(pvBits != NULL);
|
||||
TEST(hbmp != 0);
|
||||
TEST(GetLastError() == ERROR_NOT_ENOUGH_MEMORY);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
/* Test a wrong HDC */
|
||||
SetLastError(0);
|
||||
pvBits = 0;
|
||||
hbmp = NtGdiCreateDIBSection((HDC)0xdeadbeef, NULL, 0, pbmi, 0, cjHeader, 0, 0, &pvBits);
|
||||
TEST(pvBits != 0);
|
||||
TEST(hbmp != 0);
|
||||
TEST(GetLastError() == 8);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
/* Test pbmi = NULL */
|
||||
SetLastError(0);
|
||||
pvBits = (PVOID)-1;
|
||||
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, NULL, 0, cjHeader, 0, 0, &pvBits);
|
||||
TEST(pvBits == (PVOID)-1);
|
||||
TEST(hbmp == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
/* Test invalid pbmi */
|
||||
SetLastError(0);
|
||||
pvBits = (PVOID)-1;
|
||||
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, (PVOID)0x80001234, 0, cjHeader, 0, 0, &pvBits);
|
||||
TEST(pvBits == (PVOID)-1);
|
||||
TEST(hbmp == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
/* Test invalid pbmi */
|
||||
SetLastError(0);
|
||||
pvBits = (PVOID)-1;
|
||||
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, (PVOID)1, 0, cjHeader, 0, 0, &pvBits);
|
||||
TEST(pvBits == (PVOID)-1);
|
||||
TEST(hbmp == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
/* Test ppvBits = NULL */
|
||||
SetLastError(0);
|
||||
hbmp = NtGdiCreateDIBSection(0, NULL, 0, pbmi, 0, cjHeader, 0, 0, NULL);
|
||||
TEST(hbmp == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
/* Test ppvBits = NULL and pbmi == 0*/
|
||||
SetLastError(0);
|
||||
hbmp = NtGdiCreateDIBSection(0, NULL, 0, NULL, 0, cjHeader, 0, 0, NULL);
|
||||
TEST(hbmp == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
/* Test ppvBits = NULL and wrong cjHeader */
|
||||
SetLastError(0);
|
||||
hbmp = NtGdiCreateDIBSection(0, NULL, 0, pbmi, 0, cjHeader+4, 0, 0, NULL);
|
||||
TEST(hbmp == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
/* Test ppvBits = NULL and cjHeader = 0 */
|
||||
SetLastError(0);
|
||||
hbmp = NtGdiCreateDIBSection(0, NULL, 0, pbmi, 0, 0, 0, 0, NULL);
|
||||
TEST(hbmp == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
/* Test wrong cjHeader */
|
||||
SetLastError(0);
|
||||
pvBits = (PVOID)-1;
|
||||
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, pbmi, 0, cjHeader+4, 0, 0, &pvBits);
|
||||
pvBits = (PVOID)-1;
|
||||
TEST(hbmp == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
/* Test different bitcount */
|
||||
pbih->biBitCount = 4;
|
||||
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, pbmi, 0, cjHeader, 0, 0, &pvBits);
|
||||
TEST(hbmp != 0);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
pbih->biBitCount = 8;
|
||||
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, pbmi, 0, cjHeader, 0, 0, &pvBits);
|
||||
TEST(hbmp != 0);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
cjHeader = pbih->biSize;
|
||||
pbih->biBitCount = 16;
|
||||
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, pbmi, 0, cjHeader, 0, 0, &pvBits);
|
||||
TEST(hbmp != 0);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
pbih->biBitCount = 24;
|
||||
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, pbmi, 0, cjHeader, 0, 0, &pvBits);
|
||||
TEST(hbmp != 0);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
pbih->biBitCount = 32;
|
||||
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, pbmi, 0, cjHeader, 0, 0, &pvBits);
|
||||
TEST(hbmp != 0);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
/* Test BI_BITFIELDS */
|
||||
cEntries = 3;
|
||||
cjHeader = pbih->biSize + cEntries * sizeof(DWORD);
|
||||
pbih->biBitCount = 16;
|
||||
pbih->biCompression = BI_BITFIELDS;
|
||||
((DWORD*)pbmi->bmiColors)[0] = 0x0007;
|
||||
((DWORD*)pbmi->bmiColors)[1] = 0x0038;
|
||||
((DWORD*)pbmi->bmiColors)[2] = 0x01C0;
|
||||
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, pbmi, 0, cjHeader, 0, 0, &pvBits);
|
||||
TEST(hbmp != 0);
|
||||
TEST(GetObject(hbmp, sizeof(DIBSECTION), &dibsection) == sizeof(DIBSECTION));
|
||||
TEST(dibsection.dsBm.bmType == 0);
|
||||
TEST(dibsection.dsBm.bmWidth == 2);
|
||||
TEST(dibsection.dsBm.bmHeight == 2);
|
||||
TEST(dibsection.dsBm.bmWidthBytes == 4);
|
||||
TEST(dibsection.dsBm.bmPlanes == 1);
|
||||
TEST(dibsection.dsBm.bmBitsPixel == 16);
|
||||
TEST(dibsection.dsBm.bmBits == pvBits);
|
||||
TEST(dibsection.dsBmih.biSize == sizeof(BITMAPINFOHEADER));
|
||||
TEST(dibsection.dsBmih.biWidth == 2);
|
||||
TEST(dibsection.dsBmih.biHeight == 2);
|
||||
TEST(dibsection.dsBmih.biPlanes == 1);
|
||||
TEST(dibsection.dsBmih.biBitCount == 16);
|
||||
TEST(dibsection.dsBmih.biCompression == BI_BITFIELDS);
|
||||
TEST(dibsection.dsBmih.biSizeImage == 8);
|
||||
TEST(dibsection.dsBmih.biXPelsPerMeter == 0);
|
||||
TEST(dibsection.dsBmih.biYPelsPerMeter == 0);
|
||||
TEST(dibsection.dsBmih.biClrUsed == 0);
|
||||
TEST(dibsection.dsBmih.biClrImportant == 0);
|
||||
TEST(dibsection.dsBitfields[0] == 0x0007);
|
||||
TEST(dibsection.dsBitfields[1] == 0x0038);
|
||||
TEST(dibsection.dsBitfields[2] == 0x01C0);
|
||||
TEST(dibsection.dshSection == 0);
|
||||
TEST(dibsection.dsOffset == 0);
|
||||
|
||||
printf("dib with bitfileds: %p\n", hbmp);
|
||||
//system("PAUSE");
|
||||
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
|
||||
/* Test BI_BITFIELDS */
|
||||
SetLastError(0);
|
||||
pvBits = 0;
|
||||
|
||||
pbih->biSize = sizeof(BITMAPINFOHEADER);
|
||||
pbih->biWidth = 2;
|
||||
pbih->biHeight = 2;
|
||||
pbih->biPlanes = 1;
|
||||
pbih->biBitCount = 4;
|
||||
pbih->biCompression = BI_RGB;
|
||||
pbih->biSizeImage = 0;
|
||||
pbih->biXPelsPerMeter = 100;
|
||||
pbih->biYPelsPerMeter = 100;
|
||||
pbih->biClrUsed = 0;
|
||||
pbih->biClrImportant = 0;
|
||||
((DWORD*)pbmi->bmiColors)[0] = 0xF800;
|
||||
((DWORD*)pbmi->bmiColors)[1] = 0x00ff00;
|
||||
((DWORD*)pbmi->bmiColors)[2] = 0x0000ff;
|
||||
cEntries = 0;
|
||||
cjHeader = bmi.bmiHeader.biSize + cEntries * 4 + 20;
|
||||
|
||||
|
||||
/** iUsage = 1 (DIB_PAL_COLORS) ***********************************************/
|
||||
|
||||
pbmi->bmiHeader.biClrUsed = 2;
|
||||
pbmi->bmiHeader.biClrImportant = 2;
|
||||
|
||||
cEntries = 2;
|
||||
cjHeader = bmi.bmiHeader.biSize + cEntries * 4 + 8;
|
||||
|
||||
/* Test iUsage = 1 */
|
||||
SetLastError(0);
|
||||
pvBits = (PVOID)-1;
|
||||
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, pbmi, 1, cjHeader, 0, 0, &pvBits);
|
||||
TEST(pvBits == (PVOID)-1);
|
||||
TEST(hbmp == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
|
||||
|
||||
/** iUsage = 2 (???) **********************************************************/
|
||||
|
||||
/* Test iUsage = 2 */
|
||||
SetLastError(0);
|
||||
pvBits = (PVOID)-1;
|
||||
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, pbmi, 2, cjHeader, 0, 0, &pvBits);
|
||||
TEST(pvBits == (PVOID)-1);
|
||||
TEST(hbmp == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
|
||||
/** wrong iUsage **************************************************************/
|
||||
|
||||
cEntries = 0;
|
||||
cjHeader = bmi.bmiHeader.biSize + cEntries * 4 + 8;
|
||||
|
||||
/* Test iUsage = 3 */
|
||||
SetLastError(0);
|
||||
pvBits = (PVOID)-1;
|
||||
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, pbmi, 3, cjHeader, 0, 0, &pvBits);
|
||||
TEST(pvBits == (PVOID)-1);
|
||||
TEST(hbmp == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
/* Test iUsage = 3 */
|
||||
SetLastError(0);
|
||||
pvBits = (PVOID)-1;
|
||||
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, pbmi, 3, cjHeader+4, 0, 0, &pvBits);
|
||||
TEST(pvBits == (PVOID)-1);
|
||||
TEST(hbmp == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
/* Test wrong iUsage */
|
||||
SetLastError(0);
|
||||
pvBits = (PVOID)-1;
|
||||
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, pbmi, -55, cjHeader, 0, 0, &pvBits);
|
||||
TEST(pvBits == (PVOID)-1);
|
||||
TEST(hbmp == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
/* Test wrong iUsage and wrong cjHeader */
|
||||
SetLastError(0);
|
||||
pvBits = (PVOID)-1;
|
||||
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, pbmi, -55, cjHeader+4, 0, 0, &pvBits);
|
||||
TEST(pvBits == (PVOID)-1);
|
||||
TEST(hbmp == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
/* increased header size */
|
||||
pbih->biSize = sizeof(BITMAPINFOHEADER) + 4;
|
||||
cjHeader = pbih->biSize + cEntries * 4 + 8;
|
||||
SetLastError(0);
|
||||
pvBits = 0;
|
||||
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, pbmi, 0, cjHeader, 0, 0, &pvBits);
|
||||
TEST(pvBits != NULL);
|
||||
TEST(hbmp != 0);
|
||||
TEST(GetLastError() == 8);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
/* increased header size */
|
||||
pbih->biSize = sizeof(BITMAPINFOHEADER) + 2;
|
||||
cjHeader = pbih->biSize + cEntries * 4 + 8;
|
||||
SetLastError(0);
|
||||
pvBits = (PVOID)-1;
|
||||
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, pbmi, 0, cjHeader, 0, 0, &pvBits);
|
||||
TEST(pvBits == (PVOID)-1);
|
||||
TEST(hbmp == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
/* decreased header size */
|
||||
pbih->biSize = sizeof(BITMAPINFOHEADER) - 4;
|
||||
cjHeader = pbih->biSize + cEntries * 4 + 8;
|
||||
SetLastError(0);
|
||||
pvBits = (PVOID)-1;
|
||||
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, pbmi, 0, cjHeader, 0, 0, &pvBits);
|
||||
TEST(pvBits == (PVOID)-1);
|
||||
TEST(hbmp == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
|
||||
/** BITMAPV4HEADER ************************************************************/
|
||||
|
||||
pbV4h->bV4Size = sizeof(BITMAPV4HEADER);
|
||||
pbV4h->bV4Width = 2;
|
||||
pbV4h->bV4Height = 3;
|
||||
pbV4h->bV4Planes = 1;
|
||||
pbV4h->bV4BitCount = 1;
|
||||
pbV4h->bV4V4Compression = BI_RGB;
|
||||
pbV4h->bV4SizeImage = 0;
|
||||
pbV4h->bV4XPelsPerMeter = 100;
|
||||
pbV4h->bV4YPelsPerMeter = 100;
|
||||
pbV4h->bV4ClrUsed = 0;
|
||||
pbV4h->bV4ClrImportant = 0;
|
||||
pbV4h->bV4RedMask = 0;
|
||||
pbV4h->bV4GreenMask = 0;
|
||||
pbV4h->bV4BlueMask = 0;
|
||||
pbV4h->bV4AlphaMask = 0;
|
||||
pbV4h->bV4CSType = 0;
|
||||
memset(&pbV4h->bV4Endpoints, sizeof(CIEXYZTRIPLE), 0);
|
||||
pbV4h->bV4GammaRed = 0;
|
||||
pbV4h->bV4GammaGreen = 0;
|
||||
pbV4h->bV4GammaBlue = 0;
|
||||
|
||||
cEntries = 0;
|
||||
cjHeader = bmi.bmiHeader.biSize + cEntries * 4 + 8;
|
||||
|
||||
/* Test something simple */
|
||||
SetLastError(0);
|
||||
pvBits = 0;
|
||||
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, pbmi, 0, cjHeader, 0, 0, &pvBits);
|
||||
TEST(pvBits != NULL);
|
||||
TEST(hbmp != 0);
|
||||
TEST(GetLastError() == 8);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
|
||||
/** BITMAPV5HEADER ************************************************************/
|
||||
|
||||
pbV5h->bV5Size = sizeof(BITMAPV5HEADER);
|
||||
pbV5h->bV5Width = 2;
|
||||
pbV5h->bV5Height = 3;
|
||||
pbV5h->bV5Planes = 1;
|
||||
pbV5h->bV5BitCount = 1;
|
||||
pbV5h->bV5Compression = BI_RGB;
|
||||
pbV5h->bV5SizeImage = 0;
|
||||
pbV5h->bV5XPelsPerMeter = 100;
|
||||
pbV5h->bV5YPelsPerMeter = 100;
|
||||
pbV5h->bV5ClrUsed = 2;
|
||||
pbV5h->bV5ClrImportant = 2;
|
||||
pbV5h->bV5RedMask = 0;
|
||||
pbV5h->bV5GreenMask = 0;
|
||||
pbV5h->bV5BlueMask = 0;
|
||||
pbV5h->bV5AlphaMask = 0;
|
||||
pbV5h->bV5CSType = 0;
|
||||
memset(&pbV5h->bV5Endpoints, sizeof(CIEXYZTRIPLE), 0);
|
||||
pbV5h->bV5GammaRed = 0;
|
||||
pbV5h->bV5GammaGreen = 0;
|
||||
pbV5h->bV5GammaBlue = 0;
|
||||
pbV5h->bV5Intent = 0;
|
||||
pbV5h->bV5ProfileData = 0;
|
||||
pbV5h->bV5ProfileSize = 0;
|
||||
pbV5h->bV5Reserved = 0;
|
||||
|
||||
cEntries = 0;
|
||||
cjHeader = pbV5h->bV5Size + cEntries * 4 + 8;
|
||||
|
||||
/* Test something simple */
|
||||
SetLastError(0);
|
||||
pvBits = 0;
|
||||
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, pbmi, 0, cjHeader, 0, 0, &pvBits);
|
||||
TEST(pvBits != NULL);
|
||||
TEST(hbmp != 0);
|
||||
TEST(GetLastError() == 8);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
/* increased header size */
|
||||
pbV5h->bV5Size = sizeof(BITMAPV5HEADER) + 64;
|
||||
cjHeader = pbV5h->bV5Size + cEntries * 4 + 8;
|
||||
SetLastError(0);
|
||||
pvBits = 0;
|
||||
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, pbmi, 0, cjHeader, 0, 0, &pvBits);
|
||||
TEST(pvBits != NULL);
|
||||
TEST(hbmp != 0);
|
||||
TEST(GetLastError() == 8);
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
/* Test section */
|
||||
MaximumSize.QuadPart = 4096;
|
||||
Status = ZwCreateSection(&hSection,
|
||||
SECTION_ALL_ACCESS,
|
||||
NULL,
|
||||
&MaximumSize,
|
||||
PAGE_READWRITE,
|
||||
SEC_COMMIT,
|
||||
NULL);
|
||||
ASSERT(NT_SUCCESS(Status));
|
||||
|
||||
SetLastError(0);
|
||||
pvBits = 0;
|
||||
hbmp = NtGdiCreateDIBSection(hDC, hSection, 0, pbmi, 0, cjHeader, 0, 0, &pvBits);
|
||||
TEST(pvBits != NULL);
|
||||
TEST(hbmp != 0);
|
||||
// TEST(GetLastError() == 0);
|
||||
printf("hbmp = %p, pvBits = %p, hSection = %p\n", hbmp, pvBits, hSection);
|
||||
//system("PAUSE");
|
||||
if (hbmp) DeleteObject(hbmp);
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
93
rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c
Normal file
|
@ -0,0 +1,93 @@
|
|||
|
||||
INT
|
||||
Test_NtGdiDeleteObjectApp(PTESTINFO pti)
|
||||
{
|
||||
HDC hdc;
|
||||
HBITMAP hbmp;
|
||||
HBRUSH hbrush;
|
||||
|
||||
/* Try to delete 0 */
|
||||
SetLastError(0);
|
||||
TEST(NtGdiDeleteObjectApp(0) == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
/* Try to delete something with a stockbit */
|
||||
SetLastError(0);
|
||||
TEST(NtGdiDeleteObjectApp((PVOID)(GDI_HANDLE_STOCK_MASK | 0x1234)) == 1);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
/* Delete a DC */
|
||||
SetLastError(0);
|
||||
hdc = CreateCompatibleDC(NULL);
|
||||
ASSERT(IsHandleValid(hdc) == 1);
|
||||
TEST(NtGdiDeleteObjectApp(hdc) == 1);
|
||||
TEST(GetLastError() == 0);
|
||||
TEST(IsHandleValid(hdc) == 0);
|
||||
|
||||
/* Delete a brush */
|
||||
SetLastError(0);
|
||||
hbrush = CreateSolidBrush(0x123456);
|
||||
ASSERT(IsHandleValid(hbrush) == 1);
|
||||
TEST(NtGdiDeleteObjectApp(hbrush) == 1);
|
||||
TEST(GetLastError() == 0);
|
||||
TEST(IsHandleValid(hbrush) == 0);
|
||||
|
||||
/* Try to delete a stock brush */
|
||||
SetLastError(0);
|
||||
hbrush = GetStockObject(BLACK_BRUSH);
|
||||
ASSERT(IsHandleValid(hbrush) == 1);
|
||||
TEST(NtGdiDeleteObjectApp(hbrush) == 1);
|
||||
TEST(GetLastError() == 0);
|
||||
TEST(IsHandleValid(hbrush) == 1);
|
||||
|
||||
/* Delete a bitmap */
|
||||
SetLastError(0);
|
||||
hbmp = CreateBitmap(10, 10, 1, 1, NULL);
|
||||
ASSERT(IsHandleValid(hbmp) == 1);
|
||||
TEST(NtGdiDeleteObjectApp(hbmp) == 1);
|
||||
TEST(GetLastError() == 0);
|
||||
TEST(IsHandleValid(hbmp) == 0);
|
||||
|
||||
/* Create a DC for further use */
|
||||
hdc = CreateCompatibleDC(NULL);
|
||||
ASSERT(hdc);
|
||||
|
||||
/* Try to delete a brush that is selected into a DC */
|
||||
SetLastError(0);
|
||||
hbrush = CreateSolidBrush(0x123456);
|
||||
ASSERT(IsHandleValid(hbrush) == 1);
|
||||
TEST(NtGdiSelectBrush(hdc, hbrush));
|
||||
TEST(NtGdiDeleteObjectApp(hbrush) == 1);
|
||||
TEST(GetLastError() == 0);
|
||||
TEST(IsHandleValid(hbrush) == 1);
|
||||
|
||||
/* Try to delete a bitmap that is selected into a DC */
|
||||
SetLastError(0);
|
||||
hbmp = CreateBitmap(10, 10, 1, 1, NULL);
|
||||
ASSERT(IsHandleValid(hbmp) == 1);
|
||||
TEST(NtGdiSelectBitmap(hdc, hbmp));
|
||||
|
||||
TEST(NtGdiDeleteObjectApp(hbmp) == 1);
|
||||
TEST(GetLastError() == 0);
|
||||
TEST(IsHandleValid(hbmp) == 1);
|
||||
|
||||
/* Bitmap get's deleted as soon as we dereference it */
|
||||
NtGdiSelectBitmap(hdc, GetStockObject(DEFAULT_BITMAP));
|
||||
TEST(IsHandleValid(hbmp) == 0);
|
||||
|
||||
TEST(NtGdiDeleteObjectApp(hbmp) == 1);
|
||||
TEST(GetLastError() == 0);
|
||||
TEST(IsHandleValid(hbmp) == 0);
|
||||
|
||||
/* Try to delete a brush that is selected into a DC */
|
||||
SetLastError(0);
|
||||
hbrush = CreateSolidBrush(123);
|
||||
ASSERT(IsHandleValid(hbrush) == 1);
|
||||
TEST(NtGdiSelectBrush(hdc, hbrush));
|
||||
|
||||
TEST(NtGdiDeleteObjectApp(hbrush) == 1);
|
||||
TEST(GetLastError() == 0);
|
||||
TEST(IsHandleValid(hbrush) == 1);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
|
@ -102,7 +102,8 @@ Test_NtGdiDoPalette_GdiPalAnimate(PTESTINFO pti)
|
|||
INT
|
||||
Test_NtGdiDoPalette_GdiPalSetEntries(PTESTINFO pti)
|
||||
{
|
||||
HPALETTE hPal;
|
||||
HDC hDC;
|
||||
HPALETTE hPal, hOldPal;
|
||||
PALETTEENTRY palEntries[5] = {
|
||||
{0,0,0,0},
|
||||
{0xff,0xff,0xff,0},
|
||||
|
@ -156,6 +157,13 @@ Test_NtGdiDoPalette_GdiPalSetEntries(PTESTINFO pti)
|
|||
|
||||
/* Test that the buffer was not changed */
|
||||
|
||||
|
||||
/* Test with palette selected into dc */
|
||||
hDC = CreateCompatibleDC(NULL);
|
||||
hOldPal = SelectPalette(hDC, hPal, 0);
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 4, palEntries, GdiPalSetEntries, TRUE) == 4);
|
||||
SelectPalette(hDC, hOldPal, 0);
|
||||
|
||||
/* Test pEntries = NULL */
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, TRUE) == 0);
|
||||
|
||||
|
@ -198,6 +206,69 @@ Test_NtGdiDoPalette_GetBIBColorTable(PTESTINFO pti)
|
|||
INT
|
||||
Test_NtGdiDoPalette_SetDIBColorTable(PTESTINFO pti)
|
||||
{
|
||||
HDC hdc;
|
||||
HBITMAP hbmp;
|
||||
BYTE *pjBits;
|
||||
|
||||
struct
|
||||
{
|
||||
BITMAPINFOHEADER bmiHeader;
|
||||
ULONG bmiColors[10];
|
||||
} bmi;
|
||||
|
||||
hdc = CreateCompatibleDC(0);
|
||||
ASSERT(hdc);
|
||||
|
||||
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bmi.bmiHeader.biWidth = 10;
|
||||
bmi.bmiHeader.biHeight = 10;
|
||||
bmi.bmiHeader.biPlanes = 1;
|
||||
bmi.bmiHeader.biBitCount = 8;
|
||||
bmi.bmiHeader.biCompression = BI_RGB;
|
||||
bmi.bmiHeader.biSizeImage = 0;
|
||||
bmi.bmiHeader.biXPelsPerMeter = 1;
|
||||
bmi.bmiHeader.biYPelsPerMeter = 1;
|
||||
bmi.bmiHeader.biClrUsed = 9;
|
||||
bmi.bmiHeader.biClrImportant = 9;
|
||||
bmi.bmiColors[0] = 0x000000;
|
||||
bmi.bmiColors[1] = 0x202020;
|
||||
bmi.bmiColors[2] = 0x404040;
|
||||
bmi.bmiColors[3] = 0x606060;
|
||||
bmi.bmiColors[4] = 0x808080;
|
||||
bmi.bmiColors[5] = 0xA0A0A0;
|
||||
bmi.bmiColors[6] = 0xC0C0C0;
|
||||
bmi.bmiColors[7] = 0xE0E0E0;
|
||||
bmi.bmiColors[8] = 0xffffff;
|
||||
hbmp = CreateDIBSection(hdc, (BITMAPINFO*)&bmi, DIB_PAL_COLORS, (PVOID*)&pjBits, NULL, 0);
|
||||
ASSERT(hbmp);
|
||||
ASSERT(pjBits);
|
||||
|
||||
SelectObject(hdc, hbmp);
|
||||
|
||||
|
||||
pjBits[0] = 8;
|
||||
pjBits[1] = 1;
|
||||
pjBits[2] = 2;
|
||||
pjBits[3] = 3;
|
||||
|
||||
bmi.bmiColors[8] = 0x000000;
|
||||
bmi.bmiColors[7] = 0x202020;
|
||||
bmi.bmiColors[6] = 0x404040;
|
||||
bmi.bmiColors[5] = 0x606060;
|
||||
bmi.bmiColors[4] = 0x808080;
|
||||
bmi.bmiColors[3] = 0xA0A0A0;
|
||||
bmi.bmiColors[2] = 0xC0C0C0;
|
||||
bmi.bmiColors[1] = 0xE0E0E0;
|
||||
bmi.bmiColors[0] = 0xffffff;
|
||||
TEST(NtGdiDoPalette(hdc, 0, 9, &bmi.bmiColors, GdiPalSetColorTable, FALSE) == 9);
|
||||
|
||||
SetDCPenColor(hdc, 0xE0E0E0);
|
||||
SetDCBrushColor(hdc, 0x202020);
|
||||
Rectangle(hdc, 0, 0, 10, 10);
|
||||
|
||||
DeleteDC(hdc);
|
||||
DeleteObject(hbmp);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
|
53
rostests/apitests/w32knapi/ntgdi/NtGdiExtTextOutW.c
Normal file
|
@ -0,0 +1,53 @@
|
|||
|
||||
/*
|
||||
BOOL
|
||||
APIENTRY
|
||||
NtGdiExtTextOutW(
|
||||
IN HDC hDC,
|
||||
IN INT XStart,
|
||||
IN INT YStart,
|
||||
IN UINT fuOptions,
|
||||
IN OPTIONAL LPRECT UnsafeRect,
|
||||
IN LPWSTR UnsafeString,
|
||||
IN INT Count,
|
||||
IN OPTIONAL LPINT UnsafeDx,
|
||||
IN DWORD dwCodePage)
|
||||
*/
|
||||
|
||||
INT
|
||||
Test_NtGdiExtTextOutW(PTESTINFO pti)
|
||||
{
|
||||
HWND hWnd;
|
||||
HDC hDC;
|
||||
RECT rect;
|
||||
LPWSTR lpstr;
|
||||
BOOL ret;
|
||||
ULONG len;
|
||||
INT Dx[10] = {10, -5, 10, 5, 10, -10, 10, 5, 10, 5};
|
||||
|
||||
/* Create a window */
|
||||
hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
|
||||
NULL, NULL, g_hInstance, 0);
|
||||
hDC = GetDC(hWnd);
|
||||
|
||||
lpstr = L"Hallo";
|
||||
len = wcslen(lpstr);
|
||||
|
||||
ret = NtGdiExtTextOutW(hDC, 0, 0, 0, &rect, lpstr, len, Dx, 0);
|
||||
TEST(ret == 1);
|
||||
|
||||
ret = NtGdiExtTextOutW(hDC, 0, 0, ETO_PDY, &rect, lpstr, len, Dx, 0);
|
||||
TEST(ret == 1);
|
||||
|
||||
/* Test invalid lpDx */
|
||||
ret = NtGdiExtTextOutW(hDC, 0, 0, 0, 0, lpstr, len, (INT*)((ULONG_PTR)-1), 0);
|
||||
TEST(ret == 0);
|
||||
|
||||
/* Test alignment requirement for lpDx */
|
||||
ret = NtGdiExtTextOutW(hDC, 0, 0, 0, 0, lpstr, len, (INT*)((ULONG_PTR)Dx + 1), 0);
|
||||
TEST(ret == 1);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
35
rostests/apitests/w32knapi/ntgdi/NtGdiFlushUserBatch.c
Normal file
|
@ -0,0 +1,35 @@
|
|||
|
||||
INT
|
||||
Test_NtGdiFlushUserBatch(PTESTINFO pti)
|
||||
{
|
||||
PVOID pRet;
|
||||
PTEB pTeb;
|
||||
|
||||
pTeb = NtCurrentTeb();
|
||||
ASSERT(pTeb);
|
||||
|
||||
pRet = (PVOID)NtGdiFlushUserBatch();
|
||||
|
||||
TEST(pRet != 0);
|
||||
TEST(pRet == &pTeb->RealClientId);
|
||||
|
||||
TEST(pTeb->GdiBatchCount == 0);
|
||||
TEST(pTeb->GdiTebBatch.Offset == 0);
|
||||
TEST(pTeb->GdiTebBatch.HDC == 0);
|
||||
|
||||
/* Set up some bullshit */
|
||||
pTeb->InDbgPrint = 1;
|
||||
pTeb->GdiBatchCount = 12;
|
||||
pTeb->GdiTebBatch.Offset = 21;
|
||||
pTeb->GdiTebBatch.HDC = (HDC)123;
|
||||
|
||||
pRet = (PVOID)NtGdiFlushUserBatch();
|
||||
TEST(pRet == &pTeb->RealClientId);
|
||||
|
||||
TEST(pTeb->InDbgPrint == 0);
|
||||
TEST(pTeb->GdiBatchCount == 12);
|
||||
TEST(pTeb->GdiTebBatch.Offset == 0);
|
||||
TEST(pTeb->GdiTebBatch.HDC == 0);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
|
@ -2,18 +2,12 @@
|
|||
INT
|
||||
Test_NtGdiGetFontResourceInfoInternalW(PTESTINFO pti)
|
||||
{
|
||||
WCHAR szFullFileName[MAX_PATH+1];
|
||||
BOOL bRet;
|
||||
DWORD dwBufSize;
|
||||
LOGFONTW logfont;
|
||||
UNICODE_STRING NtFileName;
|
||||
|
||||
GetCurrentDirectoryW(MAX_PATH, szFullFileName);
|
||||
wcscat(szFullFileName, L"\\test.otf");
|
||||
|
||||
ASSERT(AddFontResourceW(szFullFileName) != 0);
|
||||
|
||||
ASSERT(RtlDosPathNameToNtPathName_U(szFullFileName,
|
||||
ASSERT(RtlDosPathNameToNtPathName_U(L".\\test.otf",
|
||||
&NtFileName,
|
||||
NULL,
|
||||
NULL));
|
||||
|
@ -36,7 +30,7 @@ Test_NtGdiGetFontResourceInfoInternalW(PTESTINFO pti)
|
|||
printf("lfWidth = %ld\n", logfont.lfWidth);
|
||||
printf("lfFaceName = %ls\n", logfont.lfFaceName);
|
||||
|
||||
RemoveFontResourceW(szFullFileName);
|
||||
// RemoveFontResourceW(szFullFileName);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
|
208
rostests/apitests/w32knapi/ntgdi/NtGdiPolyPolyDraw.c
Normal file
|
@ -0,0 +1,208 @@
|
|||
|
||||
|
||||
static
|
||||
INT
|
||||
Test_Params(PTESTINFO pti)
|
||||
{
|
||||
ULONG_PTR ret;
|
||||
ULONG Count1[4] = {3, 2, 4, 3};
|
||||
ULONG Count2[2] = {0, 3};
|
||||
ULONG Count3[2] = {0, 0};
|
||||
ULONG Count4[2] = {1, 3};
|
||||
ULONG Count5[2] = {0x80000001, 0x80000001};
|
||||
POINT Points[6] = {{0,0}, {1,1}, {3,-3}, {-2,2}, {4,2}, {2,4}};
|
||||
HDC hDC;
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(NULL, NULL, NULL, 0, 0);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(NULL, NULL, NULL, 0, 1);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(NULL, NULL, NULL, 0, 2);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(NULL, NULL, NULL, 0, 3);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(NULL, NULL, NULL, 0, 4);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(NULL, NULL, NULL, 0, 5);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(NULL, NULL, NULL, 0, 6);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* Test with an invalid DC */
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(0, Points, Count1, 2, 1);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
hDC = (HDC)0x12345;
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 0);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 1);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 2);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 3);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 4);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 5);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 6);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw((HDC)1, Points, Count1, 1, 6);
|
||||
TEST((ret & GDI_HANDLE_BASETYPE_MASK) == GDI_OBJECT_TYPE_REGION);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw((HDC)0, Points, Count1, 1, 6);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 0, 1);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count2, 2, 1);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, NULL, 2, 1);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, (PVOID)0x81000000, 2, 1);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, NULL, Count1, 2, 1);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, (PVOID)0x81000000, Count1, 2, 1);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* Test with a valid DC */
|
||||
|
||||
hDC = CreateCompatibleDC(NULL);
|
||||
ASSERT(hDC);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 0);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 1);
|
||||
TEST(ret == 1);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 2);
|
||||
TEST(ret == 1);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
#if 0
|
||||
SetLastError(0);
|
||||
// better don't do this on win xp!!! (random crashes)
|
||||
// ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 3);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(0);
|
||||
// better don't do this on win xp!!! (random crashes)
|
||||
// ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 4);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
#endif
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count2, 2, 1);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count3, 2, 1);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count4, 2, 1);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count5, 2, 1);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 87);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
INT
|
||||
Test_NtGdiPolyPolyDraw(PTESTINFO pti)
|
||||
{
|
||||
Test_Params(pti);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
192
rostests/apitests/w32knapi/ntgdi/NtGdiRestoreDC.c
Normal file
|
@ -0,0 +1,192 @@
|
|||
|
||||
|
||||
static HBRUSH hbrush;
|
||||
static HBITMAP hbitmap;
|
||||
static HPEN hpen;
|
||||
static HFONT hfont;
|
||||
static HRGN hrgn, hrgn2;
|
||||
|
||||
static
|
||||
void
|
||||
SetSpecialDCState(HDC hdc)
|
||||
{
|
||||
/* Select spcial Objects */
|
||||
SelectObject(hdc, hbrush);
|
||||
SelectObject(hdc, hpen);
|
||||
SelectObject(hdc, hbitmap);
|
||||
SelectObject(hdc, hfont);
|
||||
SelectObject(hdc, hrgn);
|
||||
|
||||
/* Colors */
|
||||
SetDCBrushColor(hdc, RGB(12,34,56));
|
||||
SetDCPenColor(hdc, RGB(23,34,45));
|
||||
|
||||
/* Coordinates */
|
||||
SetMapMode(hdc, MM_ANISOTROPIC);
|
||||
SetGraphicsMode(hdc, GM_ADVANCED);
|
||||
SetWindowOrgEx(hdc, 12, 34, NULL);
|
||||
SetViewportOrgEx(hdc, 56, 78, NULL);
|
||||
SetWindowExtEx(hdc, 123, 456, NULL);
|
||||
SetViewportExtEx(hdc, 234, 567, NULL);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
SetSpecialDCState2(HDC hdc)
|
||||
{
|
||||
/* Select spcial Objects */
|
||||
SelectObject(hdc, GetStockObject(DC_BRUSH));
|
||||
SelectObject(hdc, GetStockObject(DC_PEN));
|
||||
SelectObject(hdc, GetStockObject(DEFAULT_BITMAP));
|
||||
SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT));
|
||||
SelectObject(hdc, hrgn2);
|
||||
|
||||
/* Colors */
|
||||
SetDCBrushColor(hdc, RGB(65,43,21));
|
||||
SetDCPenColor(hdc, RGB(54,43,32));
|
||||
|
||||
/* Coordinates */
|
||||
SetMapMode(hdc, MM_ISOTROPIC);
|
||||
SetGraphicsMode(hdc, GM_COMPATIBLE);
|
||||
SetWindowOrgEx(hdc, 43, 21, NULL);
|
||||
SetViewportOrgEx(hdc, 87, 65, NULL);
|
||||
SetWindowExtEx(hdc, 654, 321, NULL);
|
||||
SetViewportExtEx(hdc, 765, 432, NULL);
|
||||
|
||||
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
Test_IsSpecialState(PTESTINFO pti, HDC hdc, BOOL bMemDC)
|
||||
{
|
||||
POINT pt;
|
||||
SIZE sz;
|
||||
|
||||
/* Test Objects */
|
||||
TEST(SelectObject(hdc, GetStockObject(DC_BRUSH)) == hbrush);
|
||||
TEST(SelectObject(hdc, GetStockObject(DC_PEN)) == hpen);
|
||||
TEST(SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT)) == hfont);
|
||||
if (bMemDC)
|
||||
{
|
||||
TEST(SelectObject(hdc, GetStockObject(DEFAULT_BITMAP)) == hbitmap);
|
||||
TEST(SelectObject(hdc, hrgn2) == (PVOID)1);
|
||||
}
|
||||
else
|
||||
{
|
||||
TEST(SelectObject(hdc, GetStockObject(DEFAULT_BITMAP)) == 0);
|
||||
TEST(SelectObject(hdc, hrgn2) == (PVOID)2);
|
||||
}
|
||||
|
||||
/* Test colors */
|
||||
TEST(GetDCBrushColor(hdc) == RGB(12,34,56));
|
||||
TEST(GetDCPenColor(hdc) == RGB(23,34,45));
|
||||
|
||||
/* Test coordinates */
|
||||
TEST(GetMapMode(hdc) == MM_ANISOTROPIC);
|
||||
TEST(GetGraphicsMode(hdc) == GM_ADVANCED);
|
||||
GetWindowOrgEx(hdc, &pt);
|
||||
TEST(pt.x == 12);
|
||||
TEST(pt.y == 34);
|
||||
GetViewportOrgEx(hdc, &pt);
|
||||
TEST(pt.x == 56);
|
||||
TEST(pt.y == 78);
|
||||
GetWindowExtEx(hdc, &sz);
|
||||
TESTX(sz.cx == 123, "sz.cx == %ld\n", sz.cx);
|
||||
TESTX(sz.cy == 456, "sz.cy == %ld\n", sz.cy);
|
||||
GetViewportExtEx(hdc, &sz);
|
||||
TEST(sz.cx == 234);
|
||||
TEST(sz.cy == 567);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
void
|
||||
Test_SaveRestore(PTESTINFO pti, HDC hdc, BOOL bMemDC)
|
||||
{
|
||||
SetSpecialDCState(hdc);
|
||||
NtGdiSaveDC(hdc);
|
||||
SetSpecialDCState2(hdc);
|
||||
|
||||
SetLastError(0);
|
||||
TEST(NtGdiRestoreDC(hdc, 2) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(0);
|
||||
TEST(NtGdiRestoreDC(hdc, 0) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(0);
|
||||
TEST(NtGdiRestoreDC(hdc, -2) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(0);
|
||||
TEST(NtGdiRestoreDC(hdc, 1) == 1);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
Test_IsSpecialState(pti, hdc, bMemDC);
|
||||
}
|
||||
|
||||
|
||||
INT
|
||||
Test_NtGdiRestoreDC(PTESTINFO pti)
|
||||
{
|
||||
HDC hdc;
|
||||
|
||||
hdc = CreateCompatibleDC(0);
|
||||
ASSERT(IsHandleValid(hdc));
|
||||
|
||||
SetLastError(0);
|
||||
TEST(NtGdiRestoreDC(0, -10) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(0);
|
||||
TEST(NtGdiRestoreDC(hdc, 0) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(0);
|
||||
TEST(NtGdiRestoreDC(hdc, 1) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Initialize objects */
|
||||
hbrush = CreateSolidBrush(12345);
|
||||
ASSERT(IsHandleValid(hbrush));
|
||||
hpen = CreatePen(PS_SOLID, 4, RGB(10,12,32));
|
||||
ASSERT(IsHandleValid(hpen));
|
||||
hbitmap = CreateBitmap(10, 10, 1, 1, NULL);
|
||||
ASSERT(IsHandleValid(hbitmap));
|
||||
hfont = CreateFont(10, 0, 0, 0, FW_NORMAL, 0, 0, 0, ANSI_CHARSET,
|
||||
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
|
||||
DEFAULT_PITCH, "Arial");
|
||||
ASSERT(IsHandleValid(hfont));
|
||||
hrgn = CreateRectRgn(12, 14, 14, 17);
|
||||
ASSERT(IsHandleValid(hrgn));
|
||||
hrgn2 = CreateRectRgn(1, 1, 2, 2);
|
||||
ASSERT(IsHandleValid(hrgn2));
|
||||
|
||||
/* Test mem dc */
|
||||
Test_SaveRestore(pti, hdc, TRUE);
|
||||
DeleteDC(hdc);
|
||||
|
||||
/* Test screen DC */
|
||||
hdc = GetDC(0);
|
||||
ASSERT(IsHandleValid(hdc));
|
||||
Test_SaveRestore(pti, hdc, FALSE);
|
||||
ReleaseDC(0, hdc);
|
||||
|
||||
/* Test info dc */
|
||||
hdc = CreateICW(L"DISPLAY", NULL, NULL, NULL);
|
||||
ASSERT(IsHandleValid(hdc));
|
||||
Test_SaveRestore(pti, hdc, FALSE);
|
||||
DeleteDC(hdc);
|
||||
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
45
rostests/apitests/w32knapi/ntgdi/NtGdiSaveDC.c
Normal file
|
@ -0,0 +1,45 @@
|
|||
|
||||
INT
|
||||
Test_NtGdiSaveDC(PTESTINFO pti)
|
||||
{
|
||||
HDC hdc;
|
||||
HWND hwnd;
|
||||
|
||||
/* Test 0 hdc */
|
||||
TEST(NtGdiSaveDC(0) == 0);
|
||||
|
||||
/* Test info dc */
|
||||
hdc = CreateICW(L"DISPLAY",NULL,NULL,NULL);
|
||||
TEST(hdc);
|
||||
TEST(NtGdiSaveDC(hdc) == 1);
|
||||
TEST(NtGdiSaveDC(hdc) == 2);
|
||||
DeleteDC(hdc);
|
||||
|
||||
/* Test display dc */
|
||||
hdc = GetDC(0);
|
||||
TEST(hdc);
|
||||
TEST(NtGdiSaveDC(hdc) == 1);
|
||||
TEST(NtGdiSaveDC(hdc) == 2);
|
||||
ReleaseDC(0, hdc);
|
||||
|
||||
/* Test a mem DC */
|
||||
hdc = CreateCompatibleDC(0);
|
||||
TEST(hdc);
|
||||
TEST(NtGdiSaveDC(hdc) == 1);
|
||||
TEST(NtGdiSaveDC(hdc) == 2);
|
||||
DeleteDC(hdc);
|
||||
|
||||
/* Create a window */
|
||||
hwnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
10, 10, 100, 100,
|
||||
NULL, NULL, g_hInstance, 0);
|
||||
hdc = GetDC(hwnd);
|
||||
TEST(hdc);
|
||||
TEST(NtGdiSaveDC(hdc) == 1);
|
||||
NtGdiRestoreDC(hdc, 1);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
DestroyWindow(hwnd);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
|
@ -1,13 +1,65 @@
|
|||
|
||||
INT
|
||||
Test_SelectDIBSection(PTESTINFO pti)
|
||||
{
|
||||
HDC hdc;
|
||||
HBITMAP hbmp;
|
||||
struct
|
||||
{
|
||||
BITMAPINFOHEADER bmiHeader;
|
||||
RGBQUAD bmiColors[100];
|
||||
} bmi;
|
||||
PBITMAPINFO pbmi = (PBITMAPINFO)&bmi;
|
||||
PVOID pvBits;
|
||||
|
||||
hdc = CreateCompatibleDC(0);
|
||||
ASSERT(hdc);
|
||||
|
||||
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bmi.bmiHeader.biWidth = 2;
|
||||
bmi.bmiHeader.biHeight = 2;
|
||||
bmi.bmiHeader.biPlanes = 1;
|
||||
bmi.bmiHeader.biBitCount = 1;
|
||||
bmi.bmiHeader.biCompression = BI_RGB;
|
||||
bmi.bmiHeader.biSizeImage = 0;
|
||||
bmi.bmiHeader.biXPelsPerMeter = 100;
|
||||
bmi.bmiHeader.biYPelsPerMeter = 100;
|
||||
bmi.bmiHeader.biClrUsed = 2;
|
||||
bmi.bmiHeader.biClrImportant = 2;
|
||||
|
||||
hbmp = CreateDIBSection(hdc, pbmi, DIB_PAL_COLORS, &pvBits, NULL, 0);
|
||||
ASSERT(hbmp);
|
||||
|
||||
TEST(NtGdiSelectBitmap(hdc, hbmp) != 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
INT
|
||||
Test_NtGdiSelectBitmap(PTESTINFO pti)
|
||||
{
|
||||
HDC hDC;
|
||||
HBITMAP hBmp, hOldBmp;
|
||||
HPALETTE hOldPalette, hPalette;
|
||||
LOGPALETTE logpal = {0x300, 1, {{12,13,14,15}}};
|
||||
|
||||
hBmp = CreateBitmap(2,2,1,1,NULL);
|
||||
ASSERT(hBmp);
|
||||
|
||||
/* We cannot select a bitmap into a display DC */
|
||||
hDC = GetDC(NULL);
|
||||
ASSERT(hDC);
|
||||
hOldBmp = NtGdiSelectBitmap(hDC, hBmp);
|
||||
TEST(hOldBmp == NULL);
|
||||
|
||||
hDC = CreateCompatibleDC(GetDC(NULL));
|
||||
ASSERT(hDC);
|
||||
|
||||
hBmp = CreateBitmap(2,2,1,1,NULL);
|
||||
/* Check the palette before we mess it up*/
|
||||
hPalette = CreatePalette(&logpal);
|
||||
hOldPalette = SelectPalette(hDC, hPalette, 0);
|
||||
TEST(hOldPalette == GetStockObject(DEFAULT_PALETTE));
|
||||
|
||||
/* Test NULL DC */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
|
@ -27,23 +79,35 @@ Test_NtGdiSelectBitmap(PTESTINFO pti)
|
|||
TEST(hOldBmp == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test NULL bitmap */
|
||||
/* Test bitmap with only index */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldBmp = NtGdiSelectBitmap(hDC, (HBITMAP)((ULONG_PTR)hBmp & 0x0000ffff));
|
||||
TEST(hOldBmp == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test invalid bitmap */
|
||||
/* Test valid bitmap */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldBmp = NtGdiSelectBitmap(hDC, hBmp);
|
||||
TEST(hOldBmp != NULL);
|
||||
/* The default bitmap should be GetStockObject(21) */
|
||||
TEST(hOldBmp == GetStockObject(21));
|
||||
|
||||
/* Check the palette */
|
||||
hOldPalette = SelectPalette(hDC, hOldPalette, 0);
|
||||
TEST(hOldPalette == hPalette);
|
||||
DeleteObject(hPalette);
|
||||
|
||||
/* Select the old one again and check */
|
||||
hOldBmp = NtGdiSelectBitmap(hDC, hOldBmp);
|
||||
TEST(hOldBmp == hBmp);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* cleanup */
|
||||
DeleteObject(hBmp);
|
||||
DeleteDC(hDC);
|
||||
|
||||
Test_SelectDIBSection(pti);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ Test_NtGdiSelectBrush(PTESTINFO pti)
|
|||
{
|
||||
HDC hDC;
|
||||
HBRUSH hBrush, hOldBrush;
|
||||
DC_ATTR *pdcattr;
|
||||
|
||||
hDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL);
|
||||
|
||||
|
@ -39,6 +40,25 @@ Test_NtGdiSelectBrush(PTESTINFO pti)
|
|||
TEST(hOldBrush == hBrush);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Begin with a white brush */
|
||||
NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH));
|
||||
/* Select a brush in user mode */
|
||||
SelectObject(hDC, GetStockObject(BLACK_BRUSH));
|
||||
/* See what we get returned */
|
||||
hOldBrush = NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH));
|
||||
TEST(hOldBrush == GetStockObject(BLACK_BRUSH));
|
||||
|
||||
|
||||
/* Begin with a white brush */
|
||||
NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH));
|
||||
|
||||
pdcattr = GetHandleUserData(hDC);
|
||||
/* Change the brush in user mode, without setting flags */
|
||||
pdcattr->hbrush = (HBRUSH)12345;
|
||||
|
||||
hOldBrush = NtGdiSelectBrush(hDC, GetStockObject(BLACK_BRUSH));
|
||||
TEST(hOldBrush == (HBRUSH)12345);
|
||||
|
||||
|
||||
DeleteDC(hDC);
|
||||
|
||||
|
|
|
@ -3,8 +3,10 @@ Test_NtGdiSelectPen(PTESTINFO pti)
|
|||
{
|
||||
HDC hDC;
|
||||
HPEN hPen, hOldPen;
|
||||
LOGBRUSH logbrush;
|
||||
|
||||
hDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL);
|
||||
hDC = GetDC(NULL);
|
||||
ASSERT(hDC);
|
||||
|
||||
hPen = GetStockObject(WHITE_PEN);
|
||||
|
||||
|
@ -26,19 +28,42 @@ Test_NtGdiSelectPen(PTESTINFO pti)
|
|||
TEST(hOldPen == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test NULL pen */
|
||||
/* Test invalid pen */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldPen = NtGdiSelectPen(hDC, (HPEN)((ULONG_PTR)hPen & 0x0000ffff));
|
||||
TEST(hOldPen == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test valid pen */
|
||||
SelectObject(hDC, GetStockObject(BLACK_PEN));
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldPen = NtGdiSelectPen(hDC, hPen);
|
||||
TEST(hOldPen == GetStockObject(BLACK_PEN));
|
||||
hOldPen = NtGdiSelectPen(hDC, hOldPen);
|
||||
TEST(hOldPen == hPen);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test extpen */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
logbrush.lbStyle = BS_SOLID;
|
||||
logbrush.lbColor = RGB(0x12,0x34,0x56);
|
||||
hPen = ExtCreatePen(PS_COSMETIC|PS_ALTERNATE, 1, &logbrush, 0, NULL);
|
||||
ASSERT(hPen);
|
||||
hOldPen = NtGdiSelectPen(hDC, hPen);
|
||||
TEST(hOldPen != NULL);
|
||||
hOldPen = NtGdiSelectPen(hDC, hOldPen);
|
||||
TEST(hOldPen == hPen);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test deleting pen */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldPen = NtGdiSelectPen(hDC, hPen);
|
||||
TEST(DeleteObject(hPen) == 1);
|
||||
hOldPen = NtGdiSelectPen(hDC, hOldPen);
|
||||
TEST(hOldPen == hPen);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test that fallback pen is BLACK_PEN */
|
||||
|
||||
DeleteDC(hDC);
|
||||
|
||||
|
|
|
@ -1,8 +1,25 @@
|
|||
|
||||
void
|
||||
ReadBits(HDC hDC, PDWORD OutBits)
|
||||
{
|
||||
int x,y;
|
||||
|
||||
for (y = 0; y < 8; y++)
|
||||
{
|
||||
DWORD Row = 0;
|
||||
for (x = 0; x < 8; x++)
|
||||
Row |= (0x80 & GetPixel(hDC, 2 + x, 3 + y)) >> x;
|
||||
OutBits[y] = Row;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
INT
|
||||
Test_NtGdiSetDIBitsToDeviceInternal(PTESTINFO pti)
|
||||
{
|
||||
static const DWORD InBits[8] = { 0x81, 0x7E, 0x5A, 0x7E, 0x7E, 0x42, 0x7E, 0x81 };
|
||||
DWORD OutBits[8];
|
||||
XFORM xform;
|
||||
|
||||
HWND hWnd = CreateWindowW(L"Static", NULL, WS_VISIBLE,
|
||||
100, 100, 200, 200,
|
||||
|
@ -35,6 +52,27 @@ Test_NtGdiSetDIBitsToDeviceInternal(PTESTINFO pti)
|
|||
(PVOID)InBits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS,
|
||||
sizeof(InBits), sizeof(bmi), TRUE, NULL));
|
||||
|
||||
/* Now get the data from the screen, and see if it matches */
|
||||
ReadBits(hDC, OutBits);
|
||||
|
||||
TEST(memcmp(InBits, OutBits, sizeof(InBits)) == 0);
|
||||
|
||||
/* Change transformation */
|
||||
GetWorldTransform(hDC, &xform);
|
||||
xform.eM11 = 2;
|
||||
xform.eM22 = 2;
|
||||
xform.eDx = 10;
|
||||
SetWorldTransform(hDC, &xform);
|
||||
|
||||
TEST(NtGdiSetDIBitsToDeviceInternal(hDC, 2, 3, 8, 8, 0, 0, 0, 8,
|
||||
(PVOID)InBits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS,
|
||||
sizeof(InBits), sizeof(bmi), TRUE, NULL));
|
||||
|
||||
xform.eM11 = 1;
|
||||
xform.eM22 = 1;
|
||||
xform.eDx = 0;
|
||||
SetWorldTransform(hDC, &xform);
|
||||
|
||||
/* Now get the data from the screen, and see if it matches */
|
||||
for (y = 0; y < 8; y++)
|
||||
{
|
||||
|
@ -43,8 +81,10 @@ Test_NtGdiSetDIBitsToDeviceInternal(PTESTINFO pti)
|
|||
Row |= (0x80 & GetPixel(hDC, 2 + x, 3 + y)) >> x;
|
||||
OutBits[y] = Row;
|
||||
}
|
||||
|
||||
TEST(memcmp(InBits, OutBits, sizeof(InBits)) == 0);
|
||||
|
||||
|
||||
ReleaseDC(hWnd, hDC);
|
||||
DestroyWindow(hWnd);
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ Test_OneParamRoutine_MapDesktopObject(PTESTINFO pti) /* 0x30 */
|
|||
|
||||
hMenu = CreateMenu();
|
||||
pObject = NtUserCallOneParam((DWORD)hMenu, _ONEPARAM_ROUTINE_MAPDEKTOPOBJECT);
|
||||
DestroyMenu(hMenu);
|
||||
TEST(pObject > 0);
|
||||
TEST(pObject < 0x80000000);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* First the call stub */
|
||||
DWORD STDCALL
|
||||
DWORD WINAPI
|
||||
NtUserCountClipboardFormats(VOID)
|
||||
{
|
||||
DWORD p;
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
|
||||
ULONG gMonitorCount = 0;
|
||||
HDC ghdcMonitor = 0;
|
||||
RECT grcMonitor = {0};
|
||||
|
||||
BOOL
|
||||
NTAPI
|
||||
NtUserEnumDisplayMonitors1(
|
||||
HDC hDC,
|
||||
LPCRECT lprcClip,
|
||||
MONITORENUMPROC lpfnEnum,
|
||||
LPARAM dwData)
|
||||
{
|
||||
return (INT)Syscall(L"NtUserEnumDisplayMonitors", 4, &hDC);
|
||||
}
|
||||
|
||||
BOOL CALLBACK
|
||||
MonitorEnumProc(
|
||||
HMONITOR hMonitor,
|
||||
HDC hdcMonitor,
|
||||
LPRECT lprcMonitor,
|
||||
LPARAM dwData)
|
||||
{
|
||||
gMonitorCount++;
|
||||
if (gMonitorCount == 1)
|
||||
{
|
||||
ghdcMonitor = hdcMonitor;
|
||||
grcMonitor = *lprcMonitor;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtUserEnumDisplayMonitors(PTESTINFO pti)
|
||||
{
|
||||
BOOL ret;
|
||||
|
||||
// WILL crash!
|
||||
// TEST(NtUserEnumDisplayMonitors1(NULL, NULL, NULL, 0) == 0);
|
||||
|
||||
ret = NtUserEnumDisplayMonitors1(0, NULL, MonitorEnumProc, 0);
|
||||
TEST(ret == TRUE);
|
||||
TEST(gMonitorCount > 0);
|
||||
TEST(ghdcMonitor == 0);
|
||||
TEST(grcMonitor.left == 0);
|
||||
TEST(grcMonitor.right > 0);
|
||||
TEST(grcMonitor.top == 0);
|
||||
TEST(grcMonitor.bottom > 0);
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
58
rostests/apitests/w32knapi/ntuser/NtUserGetClassInfo.c
Normal file
|
@ -0,0 +1,58 @@
|
|||
BOOL
|
||||
NTAPI
|
||||
NtUserGetClassInfo2(
|
||||
HINSTANCE hInstance,
|
||||
PUNICODE_STRING ClassName,
|
||||
LPWNDCLASSEXW wcex,
|
||||
LPWSTR *ppwstr,
|
||||
BOOL Ansi)
|
||||
{
|
||||
return (BOOL)Syscall(L"NtUserGetClassInfo", 5, &hInstance);
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtUserGetClassInfo(PTESTINFO pti)
|
||||
{
|
||||
WNDCLASSEXW wclex, wclex2 = {0};
|
||||
UNICODE_STRING us;
|
||||
PWSTR pwstr;
|
||||
|
||||
us.Length = 8;
|
||||
us.MaximumLength = 8;
|
||||
us.Buffer = L"test";
|
||||
|
||||
wclex.cbSize = sizeof(WNDCLASSEXW);
|
||||
wclex.style = 0;
|
||||
wclex.lpfnWndProc = NULL;
|
||||
wclex.cbClsExtra = 2;
|
||||
wclex.cbWndExtra = 4;
|
||||
wclex.hInstance = g_hInstance;
|
||||
wclex.hIcon = NULL;
|
||||
wclex.hCursor = NULL;
|
||||
wclex.hbrBackground = CreateSolidBrush(RGB(4,7,5));
|
||||
wclex.lpszMenuName = L"MyMenu";
|
||||
wclex.lpszClassName = us.Buffer;
|
||||
wclex.hIconSm = NULL;
|
||||
|
||||
ASSERT(RegisterClassExW(&wclex) != 0);
|
||||
|
||||
TEST(GetClassInfoExW(g_hInstance, us.Buffer, &wclex) != 0);
|
||||
wclex2.cbSize = sizeof(WNDCLASSEXW);
|
||||
TEST(NtUserGetClassInfo2(g_hInstance, &us, &wclex2, &pwstr, 0) != 0);
|
||||
|
||||
TEST(pwstr == wclex.lpszMenuName);
|
||||
TEST(wclex2.cbSize == wclex.cbSize);
|
||||
TEST(wclex2.style == wclex.style);
|
||||
TEST(wclex2.lpfnWndProc == wclex.lpfnWndProc);
|
||||
TEST(wclex2.cbClsExtra == wclex.cbClsExtra);
|
||||
TEST(wclex2.cbWndExtra == wclex.cbWndExtra);
|
||||
TEST(wclex2.hInstance == wclex.hInstance);
|
||||
TEST(wclex2.hIcon == wclex.hIcon);
|
||||
TEST(wclex2.hCursor == wclex.hCursor);
|
||||
TEST(wclex2.hbrBackground == wclex.hbrBackground);
|
||||
TEST(wclex2.lpszMenuName == 0);
|
||||
TEST(wclex2.lpszClassName == 0);
|
||||
TEST(wclex2.hIconSm == wclex.hIconSm);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
24
rostests/apitests/w32knapi/ntuser/NtUserProcessConnect.c
Normal file
|
@ -0,0 +1,24 @@
|
|||
|
||||
INT
|
||||
Test_NtUserProcessConnect(PTESTINFO pti)
|
||||
{
|
||||
HANDLE hProcess;
|
||||
NTSTATUS Status;
|
||||
USERCONNECT UserConnect = {0};
|
||||
|
||||
hProcess = GetCurrentProcess();
|
||||
|
||||
UserConnect.ulVersion = MAKELONG(0, 5);
|
||||
Status = NtUserProcessConnect(hProcess, (USERCONNECT*)&UserConnect, sizeof(USERCONNECT));
|
||||
TEST(NT_SUCCESS(Status));
|
||||
|
||||
printf("UserConnect.ulVersion = 0x%lx\n", UserConnect.ulVersion);
|
||||
printf("UserConnect.ulCurrentVersion = 0x%lx\n", UserConnect.ulCurrentVersion);
|
||||
printf("UserConnect.dwDispatchCount = 0x%lx\n", UserConnect.dwDispatchCount);
|
||||
printf("UserConnect.siClient.psi = 0x%p\n", UserConnect.siClient.psi);
|
||||
printf("UserConnect.siClient.aheList = 0x%p\n", UserConnect.siClient.aheList);
|
||||
printf("UserConnect.siClient.pDispInfo = 0x%p\n", UserConnect.siClient.pDispInfo);
|
||||
printf("UserConnect.siClient.ulSharedDelta = 0x%lx\n", UserConnect.siClient.ulSharedDelta);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
148
rostests/apitests/w32knapi/ntuser/NtUserSelectPalette.c
Normal file
|
@ -0,0 +1,148 @@
|
|||
|
||||
|
||||
FORCEINLINE
|
||||
PALETTEENTRY
|
||||
PALENTRY(BYTE r, BYTE g, BYTE b)
|
||||
{
|
||||
PALETTEENTRY ret;
|
||||
|
||||
ret.peRed = r;
|
||||
ret.peGreen = g;
|
||||
ret.peBlue = b;
|
||||
ret.peFlags = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtUserSelectPalette(PTESTINFO pti)
|
||||
{
|
||||
HPALETTE hPal, hOldPal;
|
||||
HWND hWnd;
|
||||
HDC hDC, hCompDC;
|
||||
struct
|
||||
{
|
||||
LOGPALETTE logpal;
|
||||
PALETTEENTRY entry[20];
|
||||
} pal;
|
||||
|
||||
ZeroMemory(&pal, sizeof(pal));
|
||||
|
||||
pal.logpal.palVersion = 0x300;
|
||||
pal.logpal.palNumEntries = 6;
|
||||
pal.entry[0] = PALENTRY(0,0,0);
|
||||
pal.entry[1] = PALENTRY(255,255,255);
|
||||
pal.entry[2] = PALENTRY(128,128,128);
|
||||
pal.entry[3] = PALENTRY(128,0,0);
|
||||
pal.entry[4] = PALENTRY(0,128,0);
|
||||
pal.entry[5] = PALENTRY(0,0,128);
|
||||
|
||||
hPal = CreatePalette(&pal.logpal);
|
||||
ASSERT(hPal);
|
||||
TEST(DeletePalette(hPal) == 1);
|
||||
hPal = CreatePalette(&pal.logpal);
|
||||
ASSERT(hPal);
|
||||
|
||||
/* Create a window */
|
||||
hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
|
||||
NULL, NULL, g_hInstance, 0);
|
||||
hDC = GetDC(hWnd);
|
||||
ASSERT(hDC);
|
||||
hCompDC = CreateCompatibleDC(hDC);
|
||||
ASSERT(hCompDC);
|
||||
|
||||
/* Test NULL DC */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldPal = NtUserSelectPalette(NULL, hPal, 0);
|
||||
TEST(hOldPal == 0);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test invalid DC */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldPal = NtUserSelectPalette((HDC)-1, hPal, 0);
|
||||
TEST(hOldPal == 0);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test NULL palette */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldPal = NtUserSelectPalette(hDC, NULL, 0);
|
||||
TEST(hOldPal == 0);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test invalid palette */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldPal = NtUserSelectPalette(hDC, (HPALETTE)-1, 0);
|
||||
TEST(hOldPal == 0);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test valid palette */
|
||||
hOldPal = NtUserSelectPalette(hDC, hPal, 0);
|
||||
TEST(hOldPal != 0);
|
||||
TEST(hOldPal == GetStockObject(DEFAULT_PALETTE));
|
||||
|
||||
/* We cannot Delete the palette */
|
||||
TEST(DeletePalette(hPal) == 0);
|
||||
|
||||
/* We can still select the Palette into a compatible DC */
|
||||
hOldPal = NtUserSelectPalette(hCompDC, hPal, 0);
|
||||
TEST(hOldPal != 0);
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
RealizePalette(hDC);
|
||||
|
||||
GetClientRect(hWnd, &rect);
|
||||
FillRect(hDC, &rect, GetSysColorBrush(COLOR_BTNSHADOW));
|
||||
|
||||
TEST(GetNearestColor(hDC, RGB(0,0,0)) == RGB(0,0,0));
|
||||
TEST(GetNearestColor(hDC, RGB(0,0,1)) == RGB(0,0,1));
|
||||
|
||||
ReleaseDC(hWnd, hDC);
|
||||
DestroyWindow(hWnd);
|
||||
RECT rect;
|
||||
HBITMAP hBmp;
|
||||
|
||||
|
||||
BITMAPINFOHEADER bmih = {sizeof(BITMAPINFOHEADER), // biSize
|
||||
3, // biWidth
|
||||
3, // biHeight
|
||||
1, // biPlanes
|
||||
8, // biBitCount
|
||||
BI_RGB, // biCompression
|
||||
0, // biSizeImage
|
||||
92, // biXPelsPerMeter
|
||||
92, // biYPelsPerMeter
|
||||
6, // biClrUsed
|
||||
6}; // biClrImportant
|
||||
BYTE bits[3][3] = {{0,1,2},{3,4,5},{6,1,2}};
|
||||
|
||||
struct
|
||||
{
|
||||
BITMAPINFOHEADER bmih;
|
||||
RGBQUAD colors[6];
|
||||
} bmi = {{sizeof(BITMAPINFOHEADER),3,3,1,8,BI_RGB,0,92,92,6,6},
|
||||
{{0,0,0,0},{255,255,255,0},{255,0,0,0},
|
||||
{0,255,0,0},{0,0,255,0},{128,128,128,0}}};
|
||||
|
||||
hBmp = CreateDIBitmap(hCompDC, &bmih, CBM_INIT, &bits, (BITMAPINFO*)&bmi, DIB_RGB_COLORS);
|
||||
ASSERT(hBmp);
|
||||
|
||||
SetLastError(0);
|
||||
TEST(NtGdiSelectBitmap(hCompDC, hBmp));
|
||||
hOldPal = NtUserSelectPalette(hCompDC, hPal, 0);
|
||||
TEST(hOldPal != NULL);
|
||||
RealizePalette(hCompDC);
|
||||
|
||||
TEST(GetNearestColor(hCompDC, RGB(0,0,0)) == RGB(0,0,0));
|
||||
TEST(GetNearestColor(hCompDC, RGB(0,0,1)) == RGB(0,0,0));
|
||||
TEST(GetNearestColor(hCompDC, RGB(100,0,0)) == RGB(0,0,0));
|
||||
TEST(GetNearestColor(hCompDC, RGB(250,250,250)) == RGB(255,255,255));
|
||||
TEST(GetNearestColor(hCompDC, RGB(120,100,110)) == RGB(128,128,128));
|
||||
|
||||
printf("nearest = 0x%x\n", GetNearestColor(hCompDC, RGB(120,100,110)));
|
||||
#endif
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
15
rostests/apitests/w32knapi/ntuser/NtUserSetTimer.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
|
||||
|
||||
|
||||
INT
|
||||
Test_NtUserSetTimer(PTESTINFO pti)
|
||||
{
|
||||
|
||||
|
||||
// check valid argument
|
||||
// check for replacement / new timers
|
||||
// check when expiries are handled (msgs and calls)
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
|
@ -139,7 +139,7 @@ Test_NtUserToUnicodeEx(PTESTINFO pti)
|
|||
TEST(NtUserToUnicodeEx(52, 5, KeyState, Buffer, 10, 0, hkl) == 1);
|
||||
TEST(Buffer[0] == '$');
|
||||
TEST(NtUserToUnicodeEx(53, 6, KeyState, Buffer, 10, 0, hkl) == 1);
|
||||
TEST(Buffer[0] == '\%');
|
||||
TEST(Buffer[0] == '%');
|
||||
TEST(NtUserToUnicodeEx(54, 7, KeyState, Buffer, 10, 0, hkl) == 1);
|
||||
TEST(Buffer[0] == '^');
|
||||
TEST(NtUserToUnicodeEx(55, 8, KeyState, Buffer, 10, 0, hkl) == 1);
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
DWORD WINAPI
|
||||
UpdatePerUserSystemParameters(DWORD dw1, DWORD dw2);
|
||||
|
||||
INT
|
||||
Test_NtUserUpdatePerUserSystemParameters(PTESTINFO pti)
|
||||
{
|
||||
BOOL bScrRd;
|
||||
|
||||
TEST(NtUserUpdatePerUserSystemParameters(0, 0) == 0);
|
||||
TEST(NtUserUpdatePerUserSystemParameters(0, 1) == 0);
|
||||
TEST(NtUserUpdatePerUserSystemParameters(1, 0) == 0);
|
||||
TEST(NtUserUpdatePerUserSystemParameters(1, 1) == 0);
|
||||
TEST(NtUserUpdatePerUserSystemParameters(0, 2) == 0);
|
||||
TEST(NtUserUpdatePerUserSystemParameters(0, -1) == 0);
|
||||
|
||||
// NtUserSystemParametersInfo(SPI_SETSCREENREADER, 1, 0, 0);
|
||||
NtUserSystemParametersInfo(SPI_GETSCREENREADER, 0, &bScrRd, 0);
|
||||
printf("bScrRd = %d\n", bScrRd);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
|
@ -8,15 +8,25 @@
|
|||
|
||||
#include "ntgdi/NtGdiArcInternal.c"
|
||||
#include "ntgdi/NtGdiBitBlt.c"
|
||||
#include "ntgdi/NtGdiCombineRgn.c"
|
||||
#include "ntgdi/NtGdiCreateBitmap.c"
|
||||
#include "ntgdi/NtGdiCreateCompatibleBitmap.c"
|
||||
#include "ntgdi/NtGdiCreateCompatibleDC.c"
|
||||
#include "ntgdi/NtGdiCreateDIBSection.c"
|
||||
#include "ntgdi/NtGdiDeleteObjectApp.c"
|
||||
#include "ntgdi/NtGdiDoPalette.c"
|
||||
#include "ntgdi/NtGdiEngCreatePalette.c"
|
||||
//#include "ntgdi/NtGdiEnumFontChunk.c"
|
||||
#include "ntgdi/NtGdiEnumFontOpen.c"
|
||||
//#include "ntgdi/NtGdiExtCreatePen.c"
|
||||
#include "ntgdi/NtGdiExtTextOutW.c"
|
||||
#include "ntgdi/NtGdiFlushUserBatch.c"
|
||||
#include "ntgdi/NtGdiGetBitmapBits.c"
|
||||
#include "ntgdi/NtGdiGetFontResourceInfoInternalW.c"
|
||||
#include "ntgdi/NtGdiGetRandomRgn.c"
|
||||
#include "ntgdi/NtGdiPolyPolyDraw.c"
|
||||
#include "ntgdi/NtGdiRestoreDC.c"
|
||||
#include "ntgdi/NtGdiSaveDC.c"
|
||||
#include "ntgdi/NtGdiSelectBitmap.c"
|
||||
#include "ntgdi/NtGdiSelectBrush.c"
|
||||
#include "ntgdi/NtGdiSelectFont.c"
|
||||
|
@ -36,13 +46,19 @@
|
|||
#include "ntuser/NtUserCallOneParam.c"
|
||||
#include "ntuser/NtUserCountClipboardFormats.c"
|
||||
//#include "ntuser/NtUserCreateWindowEx.c"
|
||||
#include "ntuser/NtUserEnumDisplayMonitors.c"
|
||||
#include "ntuser/NtUserEnumDisplaySettings.c"
|
||||
#include "ntuser/NtUserFindExistingCursorIcon.c"
|
||||
#include "ntuser/NtUserGetClassInfo.c"
|
||||
#include "ntuser/NtUserGetTitleBarInfo.c"
|
||||
#include "ntuser/NtUserProcessConnect.c"
|
||||
#include "ntuser/NtUserRedrawWindow.c"
|
||||
#include "ntuser/NtUserScrollDC.c"
|
||||
#include "ntuser/NtUserSelectPalette.c"
|
||||
#include "ntuser/NtUserSetTimer.c"
|
||||
#include "ntuser/NtUserSystemParametersInfo.c"
|
||||
#include "ntuser/NtUserToUnicodeEx.c"
|
||||
#include "ntuser/NtUserGetTitleBarInfo.c"
|
||||
#include "ntuser/NtUserUpdatePerUserSystemParameters.c"
|
||||
|
||||
/* The List of tests */
|
||||
TESTENTRY TestList[] =
|
||||
|
@ -55,15 +71,25 @@ TESTENTRY TestList[] =
|
|||
/* ntgdi */
|
||||
{ L"NtGdiArcInternal", Test_NtGdiArcInternal },
|
||||
{ L"NtGdiBitBlt", Test_NtGdiBitBlt },
|
||||
{ L"NtGdiCombineRgn", Test_NtGdiCombineRgn },
|
||||
{ L"NtGdiCreateBitmap", Test_NtGdiCreateBitmap },
|
||||
{ L"NtGdiCreateCompatibleBitmap", Test_NtGdiCreateCompatibleBitmap },
|
||||
{ L"NtGdiCreateCompatibleDC", Test_NtGdiCreateCompatibleDC },
|
||||
{ L"NtGdiCreateDIBSection", Test_NtGdiCreateDIBSection },
|
||||
{ L"NtGdiDeleteObjectApp", Test_NtGdiDeleteObjectApp },
|
||||
{ L"NtGdiDoPalette", Test_NtGdiDoPalette },
|
||||
{ L"NtGdiEngCreatePalette", Test_NtGdiEngCreatePalette },
|
||||
// { L"NtGdiEnumFontChunk", Test_NtGdiEnumFontChunk },
|
||||
{ L"NtGdiEnumFontOpen", Test_NtGdiEnumFontOpen },
|
||||
// { L"NtGdiExtCreatePen", Test_NtGdiExtCreatePen },
|
||||
{ L"NtGdiExtTextOutW", Test_NtGdiExtTextOutW },
|
||||
{ L"NtGdiFlushUserBatch", Test_NtGdiFlushUserBatch },
|
||||
{ L"NtGdiGetBitmapBits", Test_NtGdiGetBitmapBits },
|
||||
{ L"NtGdiGetFontResourceInfoInternalW", Test_NtGdiGetFontResourceInfoInternalW },
|
||||
{ L"NtGdiGetRandomRgn", Test_NtGdiGetRandomRgn },
|
||||
{ L"NtGdiPolyPolyDraw", Test_NtGdiPolyPolyDraw },
|
||||
{ L"NtGdiRestoreDC", Test_NtGdiRestoreDC },
|
||||
{ L"NtGdiSaveDC", Test_NtGdiSaveDC },
|
||||
{ L"NtGdiSetBitmapBits", Test_NtGdiSetBitmapBits },
|
||||
{ L"NtGdiSetDIBitsToDeviceInternal", Test_NtGdiSetDIBitsToDeviceInternal },
|
||||
{ L"NtGdiSelectBitmap", Test_NtGdiSelectBitmap },
|
||||
|
@ -84,13 +110,19 @@ TESTENTRY TestList[] =
|
|||
{ L"NtUserCallOneParam", Test_NtUserCallOneParam },
|
||||
{ L"NtUserCountClipboardFormats", Test_NtUserCountClipboardFormats },
|
||||
// { L"NtUserCreateWindowEx", Test_NtUserCreateWindowEx },
|
||||
{ L"NtUserEnumDisplayMonitors", Test_NtUserEnumDisplayMonitors },
|
||||
{ L"NtUserEnumDisplaySettings", TEST_NtUserEnumDisplaySettings },
|
||||
{ L"NtUserFindExistingCursorIcon", Test_NtUserFindExistingCursoricon },
|
||||
{ L"NtUserGetClassInfo", Test_NtUserGetClassInfo },
|
||||
{ L"NtUserGetTitleBarInfo", Test_NtUserGetTitleBarInfo },
|
||||
{ L"NtUserProcessConnect", Test_NtUserProcessConnect },
|
||||
{ L"NtUserRedrawWindow", Test_NtUserRedrawWindow },
|
||||
{ L"NtUserScrollDC", Test_NtUserScrollDC },
|
||||
{ L"NtUserSelectPalette", Test_NtUserSelectPalette },
|
||||
{ L"NtUserSetTimer", Test_NtUserSetTimer },
|
||||
{ L"NtUserSystemParametersInfo", Test_NtUserSystemParametersInfo },
|
||||
{ L"NtUserToUnicodeEx", Test_NtUserToUnicodeEx },
|
||||
{ L"NtUserGetTitleBarInfo", Test_NtUserGetTitleBarInfo }
|
||||
{ L"NtUserUpdatePerUserSystemParameters", Test_NtUserUpdatePerUserSystemParameters },
|
||||
};
|
||||
|
||||
/* The function that gives us the number of tests */
|
||||
|
|
|
@ -13,11 +13,45 @@ MyGdiQueryTable()
|
|||
return pPeb->GdiSharedHandleTable;
|
||||
}
|
||||
|
||||
static DWORD STDCALL
|
||||
BOOL
|
||||
IsHandleValid(HGDIOBJ hobj)
|
||||
{
|
||||
USHORT Index = (ULONG_PTR)hobj;
|
||||
PGDI_TABLE_ENTRY pentry = &GdiHandleTable[Index];
|
||||
|
||||
if (pentry->KernelData == NULL ||
|
||||
pentry->KernelData < (PVOID)0x80000000 ||
|
||||
(USHORT)pentry->FullUnique != (USHORT)((ULONG_PTR)hobj >> 16))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
PVOID
|
||||
GetHandleUserData(HGDIOBJ hobj)
|
||||
{
|
||||
USHORT Index = (ULONG_PTR)hobj;
|
||||
PGDI_TABLE_ENTRY pentry = &GdiHandleTable[Index];
|
||||
|
||||
if (pentry->KernelData == NULL ||
|
||||
pentry->KernelData < (PVOID)0x80000000 ||
|
||||
(USHORT)pentry->FullUnique != (USHORT)((ULONG_PTR)hobj >> 16))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pentry->UserData;
|
||||
}
|
||||
|
||||
|
||||
static DWORD WINAPI
|
||||
IntSyscall(FARPROC proc, UINT cParams, PVOID pFirstParam)
|
||||
{
|
||||
DWORD ret;
|
||||
DWORD retval;
|
||||
|
||||
#ifdef __GNUC__
|
||||
asm volatile
|
||||
(
|
||||
"pushfl;" // Save flags
|
||||
|
@ -29,21 +63,37 @@ IntSyscall(FARPROC proc, UINT cParams, PVOID pFirstParam)
|
|||
"rep movsd;" // Copy params to the stack
|
||||
"call *%%edx;" // Call function
|
||||
"popfl;" // Restore flags
|
||||
: "=a" (ret)
|
||||
: "=a" (retval)
|
||||
: "S" (pFirstParam), "c" (cParams), "d"(proc)
|
||||
: "%edi"
|
||||
);
|
||||
#else
|
||||
__asm
|
||||
{
|
||||
pushf
|
||||
mov eax, cParams
|
||||
shl eax, 2
|
||||
sub esp, eax
|
||||
mov edi, esp
|
||||
cld
|
||||
rep movsd
|
||||
call proc
|
||||
mov retval, eax
|
||||
popf
|
||||
};
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
return retval;
|
||||
}
|
||||
|
||||
DWORD
|
||||
Syscall(LPWSTR pszFunction, int cParams, void* pParams)
|
||||
{
|
||||
char szFunctionName[MAX_PATH];
|
||||
FARPROC proc;
|
||||
|
||||
sprintf(szFunctionName, "%ls", pszFunction);
|
||||
FARPROC proc = (FARPROC)GetProcAddress(g_hModule, szFunctionName);
|
||||
proc = (FARPROC)GetProcAddress(g_hModule, szFunctionName);
|
||||
if (!proc)
|
||||
{
|
||||
printf("Couldn't find proc: %s\n", szFunctionName);
|
||||
|
|
|
@ -37,6 +37,8 @@ extern HINSTANCE g_hInstance;
|
|||
extern HMODULE g_hModule;
|
||||
extern PGDI_TABLE_ENTRY GdiHandleTable;
|
||||
|
||||
BOOL IsHandleValid(HGDIOBJ hobj);
|
||||
PVOID GetHandleUserData(HGDIOBJ hobj);
|
||||
DWORD Syscall(LPWSTR lpszFunction, int cParams, void* pParams);
|
||||
BOOL InitOsVersion();
|
||||
extern UINT g_OsIdx;
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
<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>
|
||||
<compilerflag compilerset="gcc">-fms-extensions</compilerflag>
|
||||
<file>w32knapi.c</file>
|
||||
<file>osver.c</file>
|
||||
<file>testlist.c</file>
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<module name="ws2_32_apitests" type="win32cui" unicode="yes">
|
||||
<define name="_WIN32_WINNT">0x0501</define>
|
||||
<library>apitest</library>
|
||||
<library>kernel32</library>
|
||||
<library>user32</library>
|
||||
<library>shell32</library>
|
||||
<library>ws2_32</library>
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
<module name="alphablend" type="win32gui" installbase="bin" installname="alphablend.exe">
|
||||
<define name="_WIN32_IE">0x0501</define>
|
||||
<define name="_WIN32_WINNT">0x0501</define>
|
||||
<define name="__USE_W32API" />
|
||||
<include base="alphablend">.</include>
|
||||
<library>kernel32</library>
|
||||
<library>user32</library>
|
||||
<library>gdi32</library>
|
||||
<file>alphablend.c</file>
|
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 87 KiB |
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 87 KiB |
|
@ -1,9 +1,5 @@
|
|||
<module name="bitblt" type="win32gui" installbase="bin" installname="bitblt.exe">
|
||||
<define name="_WIN32_IE">0x0501</define>
|
||||
<define name="_WIN32_WINNT">0x0501</define>
|
||||
<define name="__USE_W32API" />
|
||||
<include base="bitblt">.</include>
|
||||
<library>kernel32</library>
|
||||
<library>user32</library>
|
||||
<library>gdi32</library>
|
||||
<file>bitblt.c</file>
|
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 87 KiB |
221
rostests/dibtests/bltrop/bltrop.c
Normal file
|
@ -0,0 +1,221 @@
|
|||
/*
|
||||
* Shows the 15 well known BitBlt raster operations
|
||||
* using src, dest, pattern, a background brush and color.
|
||||
*
|
||||
* Created by Gregor Schneider <grschneider AT gmail DOT com>, November 2008
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
|
||||
HINSTANCE hInst;
|
||||
TCHAR szWindowClass[] = _T("testclass");
|
||||
|
||||
static LRESULT CALLBACK
|
||||
WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static HBITMAP hBmpTest;
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_CREATE:
|
||||
{
|
||||
hBmpTest = (HBITMAP)LoadImage(hInst, MAKEINTRESOURCE(100), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_PAINT:
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
HDC hdc, hdcMem;
|
||||
BITMAP bitmap;
|
||||
HBRUSH brush, brush2;
|
||||
INT l;
|
||||
|
||||
hdc = BeginPaint(hWnd, &ps);
|
||||
hdcMem = CreateCompatibleDC(hdc);
|
||||
|
||||
GetObject(hBmpTest, sizeof(BITMAP), &bitmap);
|
||||
|
||||
/* fill destination with brush */
|
||||
brush = CreateHatchBrush(HS_DIAGCROSS, RGB(255,0,0));
|
||||
SelectObject(hdc, brush);
|
||||
PatBlt(hdc, 30, 0, 4*bitmap.bmWidth*2, 4*bitmap.bmHeight, PATCOPY);
|
||||
|
||||
/* hatched brushes */
|
||||
l = 66;
|
||||
brush = CreateHatchBrush(HS_DIAGCROSS, RGB(255,0,0));
|
||||
SelectObject(hdc, brush);
|
||||
PatBlt(hdc, 0, 0, 30, l, PATCOPY);
|
||||
DeleteObject(brush);
|
||||
|
||||
brush = CreateHatchBrush(HS_CROSS, RGB(255,0,0));
|
||||
SelectObject(hdc, brush);
|
||||
PatBlt(hdc, 0, 1*l, 30, l, PATCOPY);
|
||||
DeleteObject(brush);
|
||||
|
||||
brush = CreateHatchBrush(HS_FDIAGONAL, RGB(255,0,0));
|
||||
SelectObject(hdc, brush);
|
||||
PatBlt(hdc, 0, 2*l, 30, l, PATCOPY);
|
||||
DeleteObject(brush);
|
||||
|
||||
brush = CreateHatchBrush(HS_BDIAGONAL, RGB(255,0,0));
|
||||
SelectObject(hdc, brush);
|
||||
PatBlt(hdc, 0, 3*l, 30, l, PATCOPY);
|
||||
DeleteObject(brush);
|
||||
|
||||
brush = CreateHatchBrush(HS_VERTICAL, RGB(255,0,0));
|
||||
SelectObject(hdc, brush);
|
||||
PatBlt(hdc, 0, 4*l, 30, l, PATCOPY);
|
||||
DeleteObject(brush);
|
||||
|
||||
brush = CreateHatchBrush(HS_HORIZONTAL, RGB(255,0,0));
|
||||
SelectObject(hdc, brush);
|
||||
PatBlt(hdc, 0, 5*l, 30, l, PATCOPY);
|
||||
DeleteObject(brush);
|
||||
|
||||
/* set up a second brush */
|
||||
brush2 = CreateHatchBrush(HS_VERTICAL, RGB(127,127,127));
|
||||
|
||||
/* first select brush, then set bk color */
|
||||
SelectObject(hdc, brush2);
|
||||
SetBkColor(hdc, RGB(0, 255, 0));
|
||||
|
||||
/* 15 blt op's with bitblt */
|
||||
SelectObject(hdcMem, hBmpTest);
|
||||
/* offset coordinates */
|
||||
SetWindowOrgEx(hdc, -10, -10, NULL);
|
||||
BitBlt(hdc, 30, 0, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, SRCCOPY);
|
||||
BitBlt(hdc, 130, 0, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, DSTINVERT);
|
||||
BitBlt(hdc, 230, 0, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, MERGECOPY);
|
||||
BitBlt(hdc, 330, 0, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, MERGEPAINT);
|
||||
|
||||
BitBlt(hdc, 30, 100, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, NOTSRCCOPY);
|
||||
BitBlt(hdc, 130, 100, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, NOTSRCERASE);
|
||||
BitBlt(hdc, 230, 100, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, PATCOPY);
|
||||
BitBlt(hdc, 330, 100, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, PATINVERT);
|
||||
|
||||
BitBlt(hdc, 30, 200, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, PATPAINT);
|
||||
BitBlt(hdc, 130, 200, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, SRCAND);
|
||||
BitBlt(hdc, 230, 200, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, SRCERASE);
|
||||
BitBlt(hdc, 330, 200, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, SRCINVERT);
|
||||
|
||||
BitBlt(hdc, 30, 300, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, BLACKNESS);
|
||||
BitBlt(hdc, 130, 300, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, SRCPAINT);
|
||||
BitBlt(hdc, 230, 300, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, WHITENESS);
|
||||
|
||||
/* 15 blt op's with stretchblt */
|
||||
StretchBlt(hdc, 30+400, 0, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, SRCCOPY);
|
||||
StretchBlt(hdc, 130+400, 0, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, DSTINVERT);
|
||||
StretchBlt(hdc, 230+400, 0, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, MERGECOPY);
|
||||
StretchBlt(hdc, 330+400, 0, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, MERGEPAINT);
|
||||
|
||||
StretchBlt(hdc, 30+400, 100, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, NOTSRCCOPY);
|
||||
StretchBlt(hdc, 130+400, 100, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, NOTSRCERASE);
|
||||
StretchBlt(hdc, 230+400, 100, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, PATCOPY);
|
||||
StretchBlt(hdc, 330+400, 100, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, PATINVERT);
|
||||
|
||||
StretchBlt(hdc, 30+400, 200, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, PATPAINT);
|
||||
StretchBlt(hdc, 130+400, 200, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, SRCAND);
|
||||
StretchBlt(hdc, 230+400, 200, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, SRCERASE);
|
||||
StretchBlt(hdc, 330+400, 200, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, SRCINVERT);
|
||||
|
||||
StretchBlt(hdc, 30+400, 300, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, BLACKNESS);
|
||||
StretchBlt(hdc, 130+400, 300, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, SRCPAINT);
|
||||
StretchBlt(hdc, 230+400, 300, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, WHITENESS);
|
||||
|
||||
DeleteObject(brush);
|
||||
DeleteObject(brush2);
|
||||
DeleteDC(hdcMem);
|
||||
EndPaint(hWnd, &ps);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
default:
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static ATOM
|
||||
MyRegisterClass(HINSTANCE hInstance)
|
||||
{
|
||||
WNDCLASSEX wcex;
|
||||
|
||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||
|
||||
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wcex.lpfnWndProc = WndProc;
|
||||
wcex.cbClsExtra = 0;
|
||||
wcex.cbWndExtra = 0;
|
||||
wcex.hInstance = hInstance;
|
||||
wcex.hIcon = NULL;
|
||||
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
||||
wcex.lpszMenuName = NULL;
|
||||
wcex.lpszClassName = szWindowClass;
|
||||
wcex.hIconSm = NULL;
|
||||
|
||||
return RegisterClassEx(&wcex);
|
||||
}
|
||||
|
||||
|
||||
static BOOL
|
||||
InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||
{
|
||||
HWND hWnd;
|
||||
|
||||
hInst = hInstance;
|
||||
|
||||
hWnd = CreateWindowEx(0,
|
||||
szWindowClass,
|
||||
_T("BitBlt raster operation test"),
|
||||
WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
840,
|
||||
440,
|
||||
NULL,
|
||||
NULL,
|
||||
hInstance,
|
||||
NULL);
|
||||
|
||||
if (!hWnd)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ShowWindow(hWnd, nCmdShow);
|
||||
UpdateWindow(hWnd);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
int WINAPI
|
||||
_tWinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPTSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
MyRegisterClass(hInstance);
|
||||
|
||||
if (!InitInstance(hInstance, nCmdShow))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
return (int)msg.wParam;
|
||||
}
|
6
rostests/dibtests/bltrop/bltrop.rbuild
Normal file
|
@ -0,0 +1,6 @@
|
|||
<module name="bltrop" type="win32gui" installbase="bin" installname="bltrop.exe">
|
||||
<include base="bltrop">.</include>
|
||||
<library>gdi32</library>
|
||||
<library>user32</library>
|
||||
<file>bltrop.c</file>
|
||||
<file>bltrop.rc</file>
|
1
rostests/dibtests/bltrop/bltrop.rc
Normal file
|
@ -0,0 +1 @@
|
|||
100 BITMAP "mars.bmp"
|
BIN
rostests/dibtests/bltrop/mars.bmp
Normal file
After Width: | Height: | Size: 29 KiB |
|
@ -1,8 +1,4 @@
|
|||
<module name="dibtest" type="win32gui" installbase="bin" installname="dibtest.exe">
|
||||
<define name="_WIN32_IE">0x0501</define>
|
||||
<define name="_WIN32_WINNT">0x0501</define>
|
||||
<define name="__USE_W32API" />
|
||||
<library>kernel32</library>
|
||||
<library>user32</library>
|
||||
<library>gdi32</library>
|
||||
<file>dibtest.c</file>
|
31
rostests/dibtests/directory.rbuild
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE group SYSTEM "../../../tools/rbuild/project.dtd">
|
||||
<group xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<directory name="alphablend">
|
||||
<xi:include href="alphablend/alphablend.rbuild" />
|
||||
</directory>
|
||||
<directory name="bitblt">
|
||||
<xi:include href="bitblt/bitblt.rbuild" />
|
||||
</directory>
|
||||
<directory name="bltrop">
|
||||
<xi:include href="bltrop/bltrop.rbuild" />
|
||||
</directory>
|
||||
<directory name="dibtest">
|
||||
<xi:include href="dibtest/dibtest.rbuild" />
|
||||
</directory>
|
||||
<directory name="icontest">
|
||||
<xi:include href="icontest/icontest.rbuild" />
|
||||
</directory>
|
||||
<directory name="palbitblt">
|
||||
<xi:include href="palbitblt/palbitblt.rbuild" />
|
||||
</directory>
|
||||
<directory name="patblt">
|
||||
<xi:include href="patblt/patblt.rbuild" />
|
||||
</directory>
|
||||
<directory name="stretchblt">
|
||||
<xi:include href="stretchblt/stretchblt.rbuild" />
|
||||
</directory>
|
||||
<directory name="vbltest">
|
||||
<xi:include href="vbltest/vbltest.rbuild" />
|
||||
</directory>
|
||||
</group>
|
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 766 B |
|
@ -9,7 +9,7 @@ const char titleDrwIco[] = "DrawIcon Output";
|
|||
const char titleMask[] = "Mask(AND image)";
|
||||
const char titleXor[] = "XOR(color image)";
|
||||
const char file[] = "Icon from file:";
|
||||
const char res[] = "Icon from Resorce:";
|
||||
const char res[] = "Icon from Resource:";
|
||||
const char cursor[] = "Current Cursor:";
|
||||
const char cursormask[] = "Cursor Mask Bitmap";
|
||||
const char cursorcolor[] = "Cursor Color Bitmap";
|
|
@ -1,9 +1,5 @@
|
|||
<module name="icontest" type="win32gui" installbase="bin" installname="icontest.exe">
|
||||
<define name="_WIN32_IE">0x0501</define>
|
||||
<define name="_WIN32_WINNT">0x0501</define>
|
||||
<define name="__USE_W32API" />
|
||||
<include base="icontest">.</include>
|
||||
<library>kernel32</library>
|
||||
<library>user32</library>
|
||||
<library>gdi32</library>
|
||||
<library>ntdll</library>
|
|
@ -77,7 +77,7 @@ void UpdatePalette(HBITMAP hBM){
|
|||
DoBlt(hBM);
|
||||
}
|
||||
|
||||
void InitBitmap(HANDLE *hBM){
|
||||
void InitBitmap(HBITMAP *hBM){
|
||||
HPALETTE PalHan;
|
||||
HWND ActiveWindow;
|
||||
HDC hDC;
|
5
rostests/dibtests/palbitblt/palbitblt.rbuild
Normal file
|
@ -0,0 +1,5 @@
|
|||
<module name="palbitblt" type="win32gui" installbase="bin" installname="palbitblt.exe" stdlib="host">
|
||||
<library>user32</library>
|
||||
<library>gdi32</library>
|
||||
<file>pal.c</file>
|
||||
</module>
|
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 104 KiB |
|
@ -1,8 +1,4 @@
|
|||
<module name="patblt" type="win32gui" installbase="bin" installname="patblt.exe" allowwarnings="true" stdlib="host">
|
||||
<define name="_WIN32_IE">0x0501</define>
|
||||
<define name="_WIN32_WINNT">0x0501</define>
|
||||
<define name="__USE_W32API" />
|
||||
<library>kernel32</library>
|
||||
<library>user32</library>
|
||||
<library>gdi32</library>
|
||||
<file>patblt.cpp</file>
|
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 87 KiB |
|
@ -1,8 +1,4 @@
|
|||
<module name="stretchblt" type="win32gui" installbase="bin" installname="stretchblt.exe" stdlib="host">
|
||||
<define name="_WIN32_IE">0x0501</define>
|
||||
<define name="_WIN32_WINNT">0x0501</define>
|
||||
<define name="__USE_W32API" />
|
||||
<library>kernel32</library>
|
||||
<library>user32</library>
|
||||
<library>gdi32</library>
|
||||
<file>stretchblt.cpp</file>
|
BIN
rostests/dibtests/vbltest/test_inv01.bmp
Normal file
After Width: | Height: | Size: 462 B |
BIN
rostests/dibtests/vbltest/test_inv04.bmp
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
rostests/dibtests/vbltest/test_inv08.bmp
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
rostests/dibtests/vbltest/test_inv24.bmp
Normal file
After Width: | Height: | Size: 7.5 KiB |
BIN
rostests/dibtests/vbltest/test_inv32.ico
Normal file
After Width: | Height: | Size: 22 KiB |
219
rostests/dibtests/vbltest/vbltest.c
Normal file
|
@ -0,0 +1,219 @@
|
|||
/*
|
||||
* Tests various blit and blend operations with different src
|
||||
* bit depths and scaling where possbile.
|
||||
*
|
||||
* Created by Gregor Schneider <grschneider AT gmail DOT com>, November 2008
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
|
||||
BOOL WINAPI GdiAlphaBlend(
|
||||
HDC hdcDst, int xDst, int yDst, int wDst, int hDst,
|
||||
HDC hdcSrc, int xSrc, int ySrc, int wSrc, int hSrc,
|
||||
BLENDFUNCTION blendFunction);
|
||||
|
||||
BOOL WINAPI GdiTransparentBlt(
|
||||
HDC hdcDst, int xDst, int yDst, int wDst, int hDst,
|
||||
HDC hdcSrc, int xSrc, int ySrc, int wSrc, int hSrc,
|
||||
UINT crTransparent);
|
||||
|
||||
#define CURRENT_BMPS 4
|
||||
#define CURRENT_ICONS 1
|
||||
#define SCALE 1.5
|
||||
#define OFFSET 5
|
||||
|
||||
HINSTANCE hInst;
|
||||
TCHAR szWindowClass[] = _T("testclass");
|
||||
|
||||
static LRESULT CALLBACK
|
||||
WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static HBITMAP hbmList[CURRENT_BMPS];
|
||||
static HICON hicList[CURRENT_ICONS];
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_CREATE:
|
||||
{
|
||||
hbmList[0] = (HBITMAP)LoadImage(hInst, MAKEINTRESOURCE(100), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
|
||||
hbmList[1] = (HBITMAP)LoadImage(hInst, MAKEINTRESOURCE(400), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
|
||||
hbmList[2] = (HBITMAP)LoadImage(hInst, MAKEINTRESOURCE(800), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
|
||||
hbmList[3] = (HBITMAP)LoadImage(hInst, MAKEINTRESOURCE(2400), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
|
||||
hicList[0] = (HICON)LoadIcon(hInst, MAKEINTRESOURCE(3200));
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_PAINT:
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
HDC hdc, hdcMem;
|
||||
BITMAP bitmap;
|
||||
BLENDFUNCTION bfunc;
|
||||
int x = 0, y = 0, i;
|
||||
hdc = BeginPaint(hWnd, &ps);
|
||||
hdcMem = CreateCompatibleDC(hdc);
|
||||
|
||||
bfunc.AlphaFormat = AC_SRC_ALPHA;
|
||||
bfunc.BlendFlags = 0;
|
||||
bfunc.BlendOp = AC_SRC_OVER;
|
||||
bfunc.SourceConstantAlpha = 128;
|
||||
|
||||
/* bitmaps */
|
||||
for(i = 0; i < CURRENT_BMPS; i++)
|
||||
{
|
||||
y = 0;
|
||||
SelectObject(hdcMem, hbmList[i]);
|
||||
GetObject(hbmList[i], sizeof(BITMAP), &bitmap);
|
||||
|
||||
/* bit blt */
|
||||
BitBlt(hdc, x, y, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, SRCCOPY);
|
||||
y += bitmap.bmHeight + OFFSET;
|
||||
|
||||
/* stretch blt, org size */
|
||||
StretchBlt(hdc, x, y, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, SRCCOPY);
|
||||
y += bitmap.bmHeight + OFFSET;
|
||||
|
||||
/* stretch blt, scaled */
|
||||
StretchBlt(hdc, x, y, bitmap.bmWidth*SCALE, bitmap.bmHeight*SCALE, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, SRCCOPY);
|
||||
y += bitmap.bmHeight*SCALE + OFFSET;
|
||||
|
||||
/* transparent blt, transparency: grey */
|
||||
GdiTransparentBlt(hdc, x, y, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, 128*256*256+128*256+128);
|
||||
y += bitmap.bmHeight + OFFSET;
|
||||
|
||||
/* transparent blt, transparency: grey, scaled */
|
||||
GdiTransparentBlt(hdc, x, y, bitmap.bmWidth*SCALE, bitmap.bmHeight*SCALE, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, 128*256*256+128*256+128);
|
||||
y += bitmap.bmHeight*SCALE + OFFSET;
|
||||
|
||||
/* alpha blend, org size */
|
||||
GdiAlphaBlend(hdc, x, y, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, bfunc);
|
||||
y += bitmap.bmHeight + OFFSET;
|
||||
|
||||
/* alpha blend, scaled */
|
||||
GdiAlphaBlend(hdc, x, y, bitmap.bmWidth*SCALE, bitmap.bmHeight*SCALE, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, bfunc);
|
||||
y += bitmap.bmHeight*SCALE + OFFSET;
|
||||
|
||||
x += bitmap.bmWidth*SCALE + OFFSET;
|
||||
}
|
||||
|
||||
/* icons */
|
||||
for(i = 0; i < CURRENT_ICONS; i++)
|
||||
{
|
||||
y = 0;
|
||||
/* pure icon */
|
||||
DrawIcon(hdc, x, y, hicList[i]);
|
||||
y += bitmap.bmHeight + OFFSET;
|
||||
|
||||
/* normal icon using Ex */
|
||||
DrawIconEx(hdc, x, y, hicList[i], 0, 0, 0, NULL, DI_NORMAL);
|
||||
y += bitmap.bmHeight + OFFSET;
|
||||
|
||||
/* normal icon using Ex with bigger size */
|
||||
DrawIconEx(hdc, x, y, hicList[i], bitmap.bmWidth, bitmap.bmHeight, 0, NULL, DI_NORMAL);
|
||||
y += bitmap.bmHeight + OFFSET;
|
||||
|
||||
/* only icon using Ex */
|
||||
DrawIconEx(hdc, x, y, hicList[i], 0, 0, 0, NULL, DI_IMAGE);
|
||||
y += bitmap.bmHeight + OFFSET;
|
||||
|
||||
/* mask using Ex */
|
||||
DrawIconEx(hdc, x, y, hicList[i], 0, 0, 0, NULL, DI_MASK);
|
||||
y += bitmap.bmHeight + OFFSET;
|
||||
|
||||
x += bitmap.bmWidth*SCALE + OFFSET;
|
||||
}
|
||||
|
||||
DeleteDC(hdcMem);
|
||||
EndPaint(hWnd, &ps);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
default:
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static ATOM
|
||||
MyRegisterClass(HINSTANCE hInstance)
|
||||
{
|
||||
WNDCLASSEX wcex;
|
||||
|
||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||
|
||||
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wcex.lpfnWndProc = WndProc;
|
||||
wcex.cbClsExtra = 0;
|
||||
wcex.cbWndExtra = 0;
|
||||
wcex.hInstance = hInstance;
|
||||
wcex.hIcon = NULL;
|
||||
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
||||
wcex.lpszMenuName = NULL;
|
||||
wcex.lpszClassName = szWindowClass;
|
||||
wcex.hIconSm = NULL;
|
||||
|
||||
return RegisterClassEx(&wcex);
|
||||
}
|
||||
|
||||
|
||||
static BOOL
|
||||
InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||
{
|
||||
HWND hWnd;
|
||||
|
||||
hInst = hInstance;
|
||||
|
||||
hWnd = CreateWindowEx(0,
|
||||
szWindowClass,
|
||||
_T("Various blit and blend operations"),
|
||||
WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
640,
|
||||
640,
|
||||
NULL,
|
||||
NULL,
|
||||
hInstance,
|
||||
NULL);
|
||||
|
||||
if (!hWnd)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ShowWindow(hWnd, nCmdShow);
|
||||
UpdateWindow(hWnd);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
int WINAPI
|
||||
_tWinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPTSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
MyRegisterClass(hInstance);
|
||||
|
||||
if (!InitInstance(hInstance, nCmdShow))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
return (int)msg.wParam;
|
||||
}
|
6
rostests/dibtests/vbltest/vbltest.rbuild
Normal file
|
@ -0,0 +1,6 @@
|
|||
<module name="vbltest" type="win32gui" installbase="bin" installname="vbltest.exe">
|
||||
<include base="vbltest">.</include>
|
||||
<library>user32</library>
|
||||
<library>gdi32</library>
|
||||
<file>vbltest.c</file>
|
||||
<file>vbltest.rc</file>
|
6
rostests/dibtests/vbltest/vbltest.rc
Normal file
|
@ -0,0 +1,6 @@
|
|||
100 BITMAP "test_inv01.bmp"
|
||||
400 BITMAP "test_inv04.bmp"
|
||||
800 BITMAP "test_inv08.bmp"
|
||||
2400 BITMAP "test_inv24.bmp"
|
||||
3200 ICON "test_inv32.ico"
|
||||
|
|
@ -4,11 +4,17 @@
|
|||
<directory name="drivers">
|
||||
<xi:include href="drivers/directory.rbuild" />
|
||||
</directory>
|
||||
<directory name="dibtests">
|
||||
<xi:include href="dibtests/directory.rbuild" />
|
||||
</directory>
|
||||
<directory name="dxtest">
|
||||
<xi:include href="dxtest/directory.rbuild" />
|
||||
</directory>
|
||||
<directory name="regtests_by_casper">
|
||||
<xi:include href="regtests_by_casper/directory.rbuild" />
|
||||
<directory name="regtests">
|
||||
<xi:include href="regtests/directory.rbuild" />
|
||||
</directory>
|
||||
<directory name="rosautotest">
|
||||
<xi:include href="rosautotest/rosautotest.rbuild" />
|
||||
</directory>
|
||||
<directory name="tests">
|
||||
<xi:include href="tests/directory.rbuild" />
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<module name="csqtest" type="kernelmodedriver" installbase="system32/drivers" installname="csqtest.sys">
|
||||
<bootstrap base="$(CDOUTPUT)" />
|
||||
<define name="__USE_W32API" />
|
||||
<include base="ReactOS">include/reactos/drivers</include>
|
||||
<library>ntoskrnl</library>
|
||||
<library>hal</library>
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
<directory name="kmtest">
|
||||
<xi:include href="kmtest/kmtest.rbuild" />
|
||||
</directory>
|
||||
<directory name="kmtest">
|
||||
<xi:include href="kmtest/kmtestassist.rbuild" />
|
||||
</directory>
|
||||
<directory name="memtest">
|
||||
<xi:include href="memtest/memtest.rbuild" />
|
||||
</directory>
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
|
||||
/* PRIVATE FUNCTIONS **********************************************************/
|
||||
|
||||
NTSTATUS NTAPI
|
||||
(*IoGetDeviceInterfaces_Func)(
|
||||
NTSTATUS
|
||||
(NTAPI *IoGetDeviceInterfaces_Func)(
|
||||
IN CONST GUID *InterfaceClassGuid,
|
||||
IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL,
|
||||
IN ULONG Flags,
|
||||
|
|
266
rostests/drivers/kmtest/devobj_test.c
Normal file
|
@ -0,0 +1,266 @@
|
|||
/*
|
||||
* Driver Regression Tests
|
||||
*
|
||||
* Copyright 2009 Michael Martin <martinmnet@hotmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; see the file COPYING.LIB.
|
||||
* If not, write to the Free Software Foundation,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include "kmtest.h"
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ddk/ntifs.h>
|
||||
#include "ntddser.h"
|
||||
#include "ntndk.h"
|
||||
|
||||
VOID LowerDeviceKernelAPITest(PDEVICE_OBJECT DeviceObject, BOOLEAN UnLoading)
|
||||
{
|
||||
PDEVICE_OBJECT RetObject;
|
||||
|
||||
RetObject = IoGetLowerDeviceObject(DeviceObject);
|
||||
|
||||
if (UnLoading)
|
||||
{
|
||||
ok(RetObject == 0,
|
||||
"Expected no Lower DeviceObject, got %p", RetObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
ok(RetObject == AttachDeviceObject,
|
||||
"Expected an Attached DeviceObject %p, got %p", AttachDeviceObject, RetObject);
|
||||
}
|
||||
|
||||
if (RetObject)
|
||||
{
|
||||
ObDereferenceObject(RetObject);
|
||||
}
|
||||
|
||||
RetObject = IoGetDeviceAttachmentBaseRef(DeviceObject);
|
||||
ok(RetObject == DeviceObject,
|
||||
"Expected an Attached DeviceObject %p, got %p", DeviceObject, RetObject);
|
||||
|
||||
if (RetObject)
|
||||
{
|
||||
ObDereferenceObject(RetObject);
|
||||
}
|
||||
|
||||
}
|
||||
VOID DeviceCreatedTest(PDEVICE_OBJECT DeviceObject, BOOLEAN ExclusiveAccess)
|
||||
{
|
||||
PEXTENDED_DEVOBJ_EXTENSION extdev;
|
||||
|
||||
/*Check the device object members */
|
||||
ok(DeviceObject->Type==3, "Expected Type = 3, got %x", DeviceObject->Type);
|
||||
ok(DeviceObject->Size = 0xb8, "Expected Size = 0xba, got %x", DeviceObject->Size);
|
||||
ok(DeviceObject->ReferenceCount == 0, "Expected ReferenceCount = 0, got %lu",
|
||||
DeviceObject->ReferenceCount);
|
||||
ok(DeviceObject->DriverObject == ThisDriverObject,
|
||||
"Expected DriverObject member to match this DriverObject %p, got %p",
|
||||
ThisDriverObject, DeviceObject->DriverObject);
|
||||
ok(DeviceObject->NextDevice == NULL, "Expected NextDevice to be NULL, got %p", DeviceObject->NextDevice);
|
||||
ok(DeviceObject->AttachedDevice == NULL, "Expected AttachDevice to be NULL, got %p", DeviceObject->AttachedDevice);
|
||||
ok(DeviceObject->Characteristics == 0, "Expected Characteristics to be 0");
|
||||
if (ExclusiveAccess)
|
||||
{
|
||||
ok((DeviceObject->Flags == (DO_DEVICE_HAS_NAME | DO_DEVICE_INITIALIZING | DO_EXCLUSIVE)),
|
||||
"Expected Flags DO_DEVICE_HAS_NAME | DO_DEVICE_INITIALIZING | DO_EXCLUSIVE, got %lu", DeviceObject->Flags);
|
||||
}
|
||||
else
|
||||
{
|
||||
ok((DeviceObject->Flags == (DO_DEVICE_HAS_NAME | DO_DEVICE_INITIALIZING)),
|
||||
"Expected Flags DO_DEVICE_HAS_NAME | DO_DEVICE_INITIALIZING, got %lu", DeviceObject->Flags);
|
||||
}
|
||||
ok(DeviceObject->DeviceType == FILE_DEVICE_UNKNOWN,
|
||||
"Expected DeviceType to match creation parameter FILE_DEVICE_UNKNWOWN, got %lu",
|
||||
DeviceObject->DeviceType);
|
||||
ok(DeviceObject->ActiveThreadCount == 0, "Expected ActiveThreadCount = 0, got %lu\n", DeviceObject->ActiveThreadCount);
|
||||
|
||||
/*Check the extended extension */
|
||||
extdev = (PEXTENDED_DEVOBJ_EXTENSION)DeviceObject->DeviceObjectExtension;
|
||||
ok(extdev->ExtensionFlags == 0, "Expected Extended ExtensionFlags to be 0, got %lu", extdev->ExtensionFlags);
|
||||
ok (extdev->Type == 13, "Expected Type of 13, got %d", extdev->Type);
|
||||
ok (extdev->Size == 0, "Expected Size of 0, got %d", extdev->Size);
|
||||
ok (extdev->DeviceObject == DeviceObject, "Expected DeviceOject to match newly created device %p, got %p",
|
||||
DeviceObject, extdev->DeviceObject);
|
||||
ok(extdev->AttachedTo == NULL, "Expected AttachTo to be NULL, got %p", extdev->AttachedTo);
|
||||
ok(extdev->StartIoCount == 0, "Expected StartIoCount = 0, got %lu", extdev->StartIoCount);
|
||||
ok(extdev->StartIoKey == 0, "Expected StartIoKey = 0, got %lu", extdev->StartIoKey);
|
||||
ok(extdev->StartIoFlags == 0, "Expected StartIoFlags = 0, got %lu", extdev->StartIoFlags);
|
||||
}
|
||||
|
||||
VOID DeviceDeletionTest(PDEVICE_OBJECT DeviceObject, BOOLEAN Lower)
|
||||
{
|
||||
PEXTENDED_DEVOBJ_EXTENSION extdev;
|
||||
|
||||
/*Check the device object members */
|
||||
ok(DeviceObject->Type==3, "Expected Type = 3, got %d", DeviceObject->Type);
|
||||
ok(DeviceObject->Size = 0xb8, "Expected Size = 0xba, got %d", DeviceObject->Size);
|
||||
ok(DeviceObject->ReferenceCount == 0, "Expected ReferenceCount = 0, got %lu",
|
||||
DeviceObject->ReferenceCount);
|
||||
if (!Lower)
|
||||
{
|
||||
ok(DeviceObject->DriverObject == ThisDriverObject,
|
||||
"Expected DriverObject member to match this DriverObject %p, got %p",
|
||||
ThisDriverObject, DeviceObject->DriverObject);
|
||||
}
|
||||
ok(DeviceObject->NextDevice == NULL, "Expected NextDevice to be NULL, got %p", DeviceObject->NextDevice);
|
||||
|
||||
if (Lower)
|
||||
{
|
||||
ok(DeviceObject->AttachedDevice == MainDeviceObject,
|
||||
"Expected AttachDevice to be %p, got %p", MainDeviceObject, DeviceObject->AttachedDevice);
|
||||
}
|
||||
else
|
||||
{
|
||||
ok(DeviceObject->AttachedDevice == NULL, "Expected AttachDevice to be NULL, got %p", DeviceObject->AttachedDevice);
|
||||
}
|
||||
|
||||
ok(DeviceObject->Flags ==FILE_VIRTUAL_VOLUME,
|
||||
"Expected Flags FILE_VIRTUAL_VOLUME, got %lu", DeviceObject->Flags);
|
||||
ok(DeviceObject->DeviceType == FILE_DEVICE_UNKNOWN,
|
||||
"Expected DeviceType to match creation parameter FILE_DEVICE_UNKNWOWN, got %lu",
|
||||
DeviceObject->DeviceType);
|
||||
ok(DeviceObject->ActiveThreadCount == 0, "Expected ActiveThreadCount = 0, got %lu\n", DeviceObject->ActiveThreadCount);
|
||||
|
||||
/*Check the extended extension */
|
||||
extdev = (PEXTENDED_DEVOBJ_EXTENSION)DeviceObject->DeviceObjectExtension;
|
||||
ok(extdev->ExtensionFlags == DOE_UNLOAD_PENDING,
|
||||
"Expected Extended ExtensionFlags to be DOE_UNLOAD_PENDING, got %lu", extdev->ExtensionFlags);
|
||||
ok (extdev->Type == 13, "Expected Type of 13, got %d", extdev->Type);
|
||||
ok (extdev->Size == 0, "Expected Size of 0, got %d", extdev->Size);
|
||||
ok (extdev->DeviceObject == DeviceObject, "Expected DeviceOject to match newly created device %p, got %p",
|
||||
DeviceObject, extdev->DeviceObject);
|
||||
if (Lower)
|
||||
{
|
||||
/* Skip this for now */
|
||||
//ok(extdev->AttachedTo == MainDeviceObject, "Expected AttachTo to %p, got %p", MainDeviceObject, extdev->AttachedTo);
|
||||
}
|
||||
else
|
||||
{
|
||||
ok(extdev->AttachedTo == NULL, "Expected AttachTo to be NULL, got %p", extdev->AttachedTo);
|
||||
}
|
||||
ok(extdev->StartIoCount == 0, "Expected StartIoCount = 0, got %lu", extdev->StartIoCount);
|
||||
ok(extdev->StartIoKey == 0, "Expected StartIoKey = 0, got %lu", extdev->StartIoKey);
|
||||
ok(extdev->StartIoFlags == 0, "Expected StartIoFlags = 0, got %lu", extdev->StartIoFlags);
|
||||
}
|
||||
|
||||
VOID DeviceCreateDeleteTest(PDRIVER_OBJECT DriverObject)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
UNICODE_STRING DeviceString;
|
||||
UNICODE_STRING DosDeviceString;
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
|
||||
/* Create using wrong directory */
|
||||
RtlInitUnicodeString(&DeviceString, L"\\Device1\\Kmtest");
|
||||
Status = IoCreateDevice(DriverObject,
|
||||
0,
|
||||
&DeviceString,
|
||||
FILE_DEVICE_UNKNOWN,
|
||||
0,
|
||||
FALSE,
|
||||
&DeviceObject);
|
||||
ok(Status == STATUS_OBJECT_PATH_NOT_FOUND, "Expected STATUS_OBJECT_PATH_NOT_FOUND, got 0x%lX", Status);
|
||||
|
||||
/* Create using correct params with exlusice access */
|
||||
RtlInitUnicodeString(&DeviceString, L"\\Device\\Kmtest");
|
||||
Status = IoCreateDevice(DriverObject,
|
||||
0,
|
||||
&DeviceString,
|
||||
FILE_DEVICE_UNKNOWN,
|
||||
0,
|
||||
TRUE,
|
||||
&DeviceObject);
|
||||
ok(Status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got 0x%lX", Status);
|
||||
|
||||
DeviceCreatedTest(DeviceObject, TRUE);
|
||||
|
||||
/* Delete the device */
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
IoDeleteDevice(DeviceObject);
|
||||
ok(DriverObject->DeviceObject == 0, "Expected DriverObject->DeviceObject to be NULL, got %p",
|
||||
DriverObject->DeviceObject);
|
||||
}
|
||||
|
||||
/* Create using correct params with exlusice access */
|
||||
Status = IoCreateDevice(DriverObject,
|
||||
0,
|
||||
&DeviceString,
|
||||
FILE_DEVICE_UNKNOWN,
|
||||
0,
|
||||
FALSE,
|
||||
&DeviceObject);
|
||||
ok(Status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got 0x%lX", Status);
|
||||
|
||||
DeviceCreatedTest(DeviceObject, FALSE);
|
||||
|
||||
/* Delete the device */
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
IoDeleteDevice(DeviceObject);
|
||||
ok(DriverObject->DeviceObject == 0, "Expected DriverObject->DeviceObject to be NULL, got %p",
|
||||
DriverObject->DeviceObject);
|
||||
}
|
||||
|
||||
/* Recreate device */
|
||||
Status = IoCreateDevice(DriverObject,
|
||||
0,
|
||||
&DeviceString,
|
||||
FILE_DEVICE_UNKNOWN,
|
||||
0,
|
||||
FALSE,
|
||||
&DeviceObject);
|
||||
ok(Status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got 0x%lX", Status);
|
||||
|
||||
RtlInitUnicodeString(&DosDeviceString, L"\\DosDevices\\kmtest");
|
||||
Status = IoCreateSymbolicLink(&DosDeviceString, &DeviceString);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* Delete device object if not successful */
|
||||
IoDeleteDevice(DeviceObject);
|
||||
return;
|
||||
}
|
||||
|
||||
MainDeviceObject = DeviceObject;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
BOOLEAN AttachDeviceTest(PDEVICE_OBJECT DeviceObject, PWCHAR NewDriverRegPath)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
UNICODE_STRING LowerDeviceName;
|
||||
|
||||
RtlInitUnicodeString(&LowerDeviceName, NewDriverRegPath);
|
||||
Status = IoAttachDevice(DeviceObject, &LowerDeviceName, &AttachDeviceObject);
|
||||
|
||||
/* TODO: Add more tests */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN DetachDeviceTest(PDEVICE_OBJECT AttachedDevice)
|
||||
{
|
||||
|
||||
IoDetachDevice(AttachedDevice);
|
||||
|
||||
/* TODO: Add more tests */
|
||||
|
||||
return TRUE;
|
||||
}
|