ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
July 2012
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
14 participants
193 discussions
Start a n
N
ew thread
[tkreuzer] 57010: [WIN32K] Temporarily comment out some ASSERTs that fail
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Jul 31 21:33:34 2012 New Revision: 57010 URL:
http://svn.reactos.org/svn/reactos?rev=57010&view=rev
Log: [WIN32K] Temporarily comment out some ASSERTs that fail Modified: trunk/reactos/win32ss/gdi/eng/stretchblt.c Modified: trunk/reactos/win32ss/gdi/eng/stretchblt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/stretchblt…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/stretchblt.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/stretchblt.c [iso-8859-1] Tue Jul 31 21:33:34 2012 @@ -384,10 +384,10 @@ LONG InputClWidth, InputClHeight, InputWidth, InputHeight; ASSERT(psoDest); - ASSERT(psoSource); + //ASSERT(psoSource); // FIXME! ASSERT(DestRect); - ASSERT(SourceRect); - ASSERT(!RECTL_bIsEmptyRect(SourceRect)); + //ASSERT(SourceRect); // FIXME! + //ASSERT(!RECTL_bIsEmptyRect(SourceRect)); // FIXME! /* If no clip object is given, use trivial one */ if (!ClipRegion) ClipRegion = &gxcoTrivial.ClipObj;
12 years, 4 months
1
0
0
0
[tkreuzer] 57009: [NTOSKRNL] Try to fix crash detection in sysreg
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Jul 31 20:58:37 2012 New Revision: 57009 URL:
http://svn.reactos.org/svn/reactos?rev=57009&view=rev
Log: [NTOSKRNL] Try to fix crash detection in sysreg Modified: trunk/reactos/ntoskrnl/kdbg/kdb.c Modified: trunk/reactos/ntoskrnl/kdbg/kdb.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kdbg/kdb.c?rev=57…
============================================================================== --- trunk/reactos/ntoskrnl/kdbg/kdb.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/kdbg/kdb.c [iso-8859-1] Tue Jul 31 20:58:37 2012 @@ -1472,12 +1472,12 @@ if (BreakPoint->Type == KdbBreakPointSoftware) { - KdbpPrint("Entered debugger on breakpoint #%d: EXEC 0x%04x:0x%08x\n", + KdbpPrint("\nEntered debugger on breakpoint #%d: EXEC 0x%04x:0x%08x\n", KdbLastBreakPointNr, TrapFrame->SegCs & 0xffff, TrapFrame->Eip); } else if (BreakPoint->Type == KdbBreakPointHardware) { - KdbpPrint("Entered debugger on breakpoint #%d: %s 0x%08x\n", + KdbpPrint("\nEntered debugger on breakpoint #%d: %s 0x%08x\n", KdbLastBreakPointNr, (BreakPoint->Data.Hw.AccessType == KdbAccessRead) ? "READ" : ((BreakPoint->Data.Hw.AccessType == KdbAccessWrite) ? "WRITE" : @@ -1545,7 +1545,7 @@ return kdHandleException; } - KdbpPrint("Entered debugger on unexpected debug trap!\n"); + KdbpPrint("\nEntered debugger on unexpected debug trap!\n"); } } else if (ExceptionCode == STATUS_BREAKPOINT) @@ -1560,7 +1560,7 @@ return kdHandleException; } - KdbpPrint("Entered debugger on embedded INT3 at 0x%04x:0x%08x.\n", + KdbpPrint("\nEntered debugger on embedded INT3 at 0x%04x:0x%08x.\n", TrapFrame->SegCs & 0xffff, TrapFrame->Eip - 1); } else @@ -1574,7 +1574,7 @@ return ContinueType; } - KdbpPrint("Entered debugger on %s-chance exception (Exception Code: 0x%x) (%s)\n", + KdbpPrint("\nEntered debugger on %s-chance exception (Exception Code: 0x%x) (%s)\n", FirstChance ? "first" : "last", ExceptionCode, ExceptionString); if (ExceptionCode == STATUS_ACCESS_VIOLATION &&
12 years, 4 months
1
0
0
0
[tkreuzer] 57008: [WIN32K] - pass COLORADJUSTMENT to IntEngStretchBlt - IntEngStretchBlt, EngStretchBltROP, DrvStretchBltROP always use a source, ASSERT that - annotate pbrDefaultBrush and psurfDef...
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Jul 31 20:44:56 2012 New Revision: 57008 URL:
http://svn.reactos.org/svn/reactos?rev=57008&view=rev
Log: [WIN32K] - pass COLORADJUSTMENT to IntEngStretchBlt - IntEngStretchBlt, EngStretchBltROP, DrvStretchBltROP always use a source, ASSERT that - annotate pbrDefaultBrush and psurfDefaultBitmap as _Notnull_ - Don't use uninitialized psoInput in EngStretchBltROP - Use trivial CLIPOBJ instead of NULL in IntEngStretchBlt - Always pass a source surface to EngStretchBltROP Modified: trunk/reactos/win32ss/gdi/eng/inteng.h trunk/reactos/win32ss/gdi/eng/stretchblt.c trunk/reactos/win32ss/gdi/ntgdi/bitblt.c trunk/reactos/win32ss/gdi/ntgdi/dc.h trunk/reactos/win32ss/gdi/ntgdi/dibobj.c trunk/reactos/win32ss/user/ntuser/winsta.c Modified: trunk/reactos/win32ss/gdi/eng/inteng.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/inteng.h?r…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/inteng.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/inteng.h [iso-8859-1] Tue Jul 31 20:44:56 2012 @@ -86,6 +86,7 @@ SURFOBJ *Mask, CLIPOBJ *ClipRegion, XLATEOBJ *ColorTranslation, + COLORADJUSTMENT *pca, RECTL *DestRect, RECTL *SourceRect, POINTL *pMaskOrigin, @@ -152,14 +153,16 @@ IN RECTL *prcl, IN FLONG fl); -BOOL APIENTRY -IntEngAlphaBlend(IN SURFOBJ *Dest, - IN SURFOBJ *Source, - IN CLIPOBJ *ClipRegion, - IN XLATEOBJ *ColorTranslation, - IN PRECTL DestRect, - IN PRECTL SourceRect, - IN BLENDOBJ *BlendObj); +BOOL +APIENTRY +IntEngAlphaBlend( + _Inout_ SURFOBJ *psoDest, + _In_ SURFOBJ *psoSource, + _In_opt_ CLIPOBJ *pco, + _In_opt_ XLATEOBJ *pxlo, + _In_ RECTL *prclDest, + _In_ RECTL *prclSrc, + _In_ BLENDOBJ *pBlendObj); BOOL APIENTRY IntEngCopyBits(SURFOBJ *psoDest, Modified: trunk/reactos/win32ss/gdi/eng/stretchblt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/stretchblt…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/stretchblt.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/stretchblt.c [iso-8859-1] Tue Jul 31 20:44:56 2012 @@ -169,6 +169,7 @@ InputRect.right = OutputRect.right - OutputRect.left; InputRect.top = 0; InputRect.bottom = OutputRect.bottom - OutputRect.top; + psoInput = NULL; } if (NULL != ClipRegion) @@ -364,6 +365,7 @@ SURFOBJ *MaskSurf, CLIPOBJ *ClipRegion, XLATEOBJ *ColorTranslation, + COLORADJUSTMENT *pca, RECTL *DestRect, RECTL *SourceRect, POINTL *pMaskOrigin, @@ -372,7 +374,6 @@ DWORD Rop4) { BOOLEAN ret; - COLORADJUSTMENT ca; POINTL MaskOrigin = {0, 0}; SURFACE *psurfDest; //SURFACE *psurfSource = NULL; @@ -383,9 +384,15 @@ LONG InputClWidth, InputClHeight, InputWidth, InputHeight; ASSERT(psoDest); + ASSERT(psoSource); + ASSERT(DestRect); + ASSERT(SourceRect); + ASSERT(!RECTL_bIsEmptyRect(SourceRect)); + + /* If no clip object is given, use trivial one */ + if (!ClipRegion) ClipRegion = &gxcoTrivial.ClipObj; + psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj); - ASSERT(psurfDest); - ASSERT(DestRect); /* Sanity check */ ASSERT(IS_VALID_ROP4(Rop4)); @@ -420,20 +427,17 @@ InputClippedRect.bottom = DestRect->top; } - if (UsesSource) - { - if (NULL == SourceRect || NULL == psoSource) - { - return FALSE; - } - InputRect = *SourceRect; - - if (InputRect.right < InputRect.left || - InputRect.bottom < InputRect.top) - { - /* Everything clipped away, nothing to do */ - return TRUE; - } + if (NULL == SourceRect || NULL == psoSource) + { + return FALSE; + } + InputRect = *SourceRect; + + if (InputRect.right < InputRect.left || + InputRect.bottom < InputRect.top) + { + /* Everything clipped away, nothing to do */ + return TRUE; } if (ClipRegion) @@ -473,18 +477,17 @@ //psurfSource = CONTAINING_RECORD(psoSource, SURFACE, SurfObj); } - /* Prepare color adjustment */ - /* Call the driver's DrvStretchBlt if available */ if (psurfDest->flags & HOOK_STRETCHBLTROP) { /* Drv->StretchBltROP (look at
http://www.osronline.com/ddkx/graphics/ddifncs_0z3b.htm
) */ ret = GDIDEVFUNCS(psoDest).StretchBltROP(psoDest, - (UsesSource) ? psoSource : NULL, + psoSource, MaskSurf, ClipRegion, ColorTranslation, - &ca, BrushOrigin, + pca, + BrushOrigin, &OutputRect, &InputRect, &MaskOrigin, @@ -496,11 +499,11 @@ if (! ret) { ret = EngStretchBltROP(psoDest, - (UsesSource) ? psoSource : NULL, + psoSource, MaskSurf, ClipRegion, ColorTranslation, - &ca, + pca, BrushOrigin, &OutputRect, &InputRect, @@ -536,8 +539,12 @@ _SEH2_TRY { - ProbeForRead(pca, sizeof(COLORADJUSTMENT), 1); - RtlCopyMemory(&ca,pca, sizeof(COLORADJUSTMENT)); + if (pca) + { + ProbeForRead(pca, sizeof(COLORADJUSTMENT), 1); + RtlCopyMemory(&ca,pca, sizeof(COLORADJUSTMENT)); + pca = &ca; + } ProbeForRead(BrushOrigin, sizeof(POINTL), 1); RtlCopyMemory(&lBrushOrigin, BrushOrigin, sizeof(POINTL)); @@ -558,7 +565,7 @@ } _SEH2_END; - return EngStretchBlt(psoDest, psoSource, Mask, ClipRegion, ColorTranslation, &ca, &lBrushOrigin, &rclDest, &rclSrc, &lMaskOrigin, Mode); + return EngStretchBlt(psoDest, psoSource, Mask, ClipRegion, ColorTranslation, pca, &lBrushOrigin, &rclDest, &rclSrc, &lMaskOrigin, Mode); } /* EOF */ Modified: trunk/reactos/win32ss/gdi/ntgdi/bitblt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/bitblt.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] Tue Jul 31 20:44:56 2012 @@ -67,7 +67,7 @@ return index; default: - DPRINT("Unsupported color type %d passed\n", crColor >> 24); + DPRINT("Unsupported color type %u passed\n", crColor >> 24); crColor &= 0xFFFFFF; } @@ -122,7 +122,7 @@ ahDC[1] = hDCSrc ; if (!GDIOBJ_bLockMultipleObjects(2, (HGDIOBJ*)ahDC, apObj, GDIObjType_DC_TYPE)) { - DPRINT1("Invalid dc handle (dest=0x%08x, src=0x%08x) passed to NtGdiAlphaBlend\n", hDCDest, hDCSrc); + DPRINT1("Invalid dc handle (dest=0x%p, src=0x%p) passed to NtGdiAlphaBlend\n", hDCDest, hDCSrc); EngSetLastError(ERROR_INVALID_HANDLE); return FALSE; } @@ -270,7 +270,7 @@ ahDC[1] = hdcSrc ; if (!GDIOBJ_bLockMultipleObjects(2, (HGDIOBJ*)ahDC, apObj, GDIObjType_DC_TYPE)) { - DPRINT1("Invalid dc handle (dest=0x%08x, src=0x%08x) passed to NtGdiAlphaBlend\n", hdcDst, hdcSrc); + DPRINT1("Invalid dc handle (dest=0x%p, src=0x%p) passed to NtGdiAlphaBlend\n", hdcDst, hdcSrc); EngSetLastError(ERROR_INVALID_HANDLE); return FALSE; } @@ -424,7 +424,7 @@ ahDC[1] = UsesSource ? hdcSrc : NULL; if (!GDIOBJ_bLockMultipleObjects(2, (HGDIOBJ*)ahDC, apObj, GDIObjType_DC_TYPE)) { - DPRINT1("Invalid dc handle (dest=0x%08x, src=0x%08x) passed to NtGdiAlphaBlend\n", hdcDest, hdcSrc); + DPRINT1("Invalid dc handle (dest=0x%p, src=0x%p) passed to NtGdiAlphaBlend\n", hdcDest, hdcSrc); EngSetLastError(ERROR_INVALID_HANDLE); return FALSE; } @@ -435,7 +435,7 @@ if (NULL == DCDest) { if(DCSrc) DC_UnlockDc(DCSrc); - DPRINT("Invalid destination dc handle (0x%08x) passed to NtGdiBitBlt\n", hdcDest); + DPRINT("Invalid destination dc handle (0x%p) passed to NtGdiBitBlt\n", hdcDest); return FALSE; } @@ -486,6 +486,13 @@ SourceRect.top = SourcePoint.y; SourceRect.right = SourcePoint.x + DestRect.right - DestRect.left; SourceRect.bottom = SourcePoint.y + DestRect.bottom - DestRect.top ; + } + else + { + SourceRect.left = 0; + SourceRect.top = 0; + SourceRect.right = 0; + SourceRect.bottom = 0; } /* Prepare blit */ @@ -619,7 +626,7 @@ ahDC[2] = UsesMask ? hDCMask : NULL; if (!GDIOBJ_bLockMultipleObjects(3, (HGDIOBJ*)ahDC, apObj, GDIObjType_DC_TYPE)) { - DPRINT1("Invalid dc handle (dest=0x%08x, src=0x%08x) passed to NtGdiAlphaBlend\n", hDCDest, hDCSrc); + DPRINT1("Invalid dc handle (dest=0x%p, src=0x%p) passed to NtGdiAlphaBlend\n", hDCDest, hDCSrc); EngSetLastError(ERROR_INVALID_HANDLE); return FALSE; } @@ -728,10 +735,11 @@ /* Perform the bitblt operation */ Status = IntEngStretchBlt(&BitmapDest->SurfObj, - &BitmapSrc->SurfObj, + BitmapSrc ? &BitmapSrc->SurfObj : NULL, BitmapMask ? &BitmapMask->SurfObj : NULL, DCDest->rosdc.CombinedClip, XlateObj, + &DCDest->dclevel.ca, &DestRect, &SourceRect, BitmapMask ? &MaskPoint : NULL, Modified: trunk/reactos/win32ss/gdi/ntgdi/dc.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dc.h?rev…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dc.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dc.h [iso-8859-1] Tue Jul 31 20:44:56 2012 @@ -265,7 +265,7 @@ pdc->dclevel.ppal = ppal; } -extern PBRUSH pbrDefaultBrush ; -extern PSURFACE psurfDefaultBitmap; +extern _Notnull_ PBRUSH pbrDefaultBrush; +extern _Notnull_ PSURFACE psurfDefaultBitmap; #endif /* not __WIN32K_DC_H */ Modified: trunk/reactos/win32ss/gdi/ntgdi/dibobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dibobj.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dibobj.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dibobj.c [iso-8859-1] Tue Jul 31 20:44:56 2012 @@ -439,16 +439,15 @@ EngSetLastError(ERROR_INVALID_HANDLE); goto Exit2; } - if (pDC->dctype == DC_TYPE_INFO) + + pSurf = pDC->dclevel.pSurface; + if ((pDC->dctype == DC_TYPE_INFO) || !pSurf) { DC_UnlockDc(pDC); goto Exit2; } - pSurf = pDC->dclevel.pSurface; - if(!pSurf) pSurf = psurfDefaultBitmap; - - pDestSurf = pSurf ? &pSurf->SurfObj : NULL; + pDestSurf = &pSurf->SurfObj; ScanLines = min(ScanLines, abs(bmi->bmiHeader.biHeight) - StartScan); @@ -1175,6 +1174,7 @@ NULL, pdc->rosdc.CombinedClip, &exlo.xlo, + &pdc->dclevel.ca, &rcDst, &rcSrc, NULL, @@ -1474,7 +1474,7 @@ //SIZEL Size; HANDLE hSecure; - DPRINT("format (%ld,%ld), planes %d, bpp %d, size %ld, colors %ld (%s)\n", + DPRINT("format (%ld,%ld), planes %u, bpp %u, size %lu, colors %lu (%s)\n", bi->biWidth, bi->biHeight, bi->biPlanes, bi->biBitCount, bi->biSizeImage, bi->biClrUsed, usage == DIB_PAL_COLORS? "PAL" : "RGB"); @@ -1608,7 +1608,7 @@ cleanup: if (!res || !bmp || !bm.bmBits) { - DPRINT("Got an error res=%08x, bmp=%p, bm.bmBits=%p\n", res, bmp, bm.bmBits); + DPRINT("Got an error res=%p, bmp=%p, bm.bmBits=%p\n", res, bmp, bm.bmBits); if (bm.bmBits) { // MmUnsecureVirtualMemory(hSecure); // FIXME: Implement this! @@ -1677,7 +1677,7 @@ *size = header->biSizeImage; return 1; } - DPRINT1("(%d): unknown/wrong size for header\n", header->biSize ); + DPRINT1("(%u): unknown/wrong size for header\n", header->biSize ); return -1; } Modified: trunk/reactos/win32ss/user/ntuser/winsta.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/winsta…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/winsta.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/winsta.c [iso-8859-1] Tue Jul 31 20:44:56 2012 @@ -61,19 +61,19 @@ } else { - swprintf(wstrWindowStationsDir, - L"%ws\\%ld%ws", - SESSION_DIR, - Peb->SessionId, + swprintf(wstrWindowStationsDir, + L"%ws\\%ld%ws", + SESSION_DIR, + Peb->SessionId, WINSTA_OBJ_DIR); RtlCreateUnicodeString( &gustrWindowStationsDir, wstrWindowStationsDir); } - InitializeObjectAttributes(&ObjectAttributes, - &gustrWindowStationsDir, - 0, - NULL, + InitializeObjectAttributes(&ObjectAttributes, + &gustrWindowStationsDir, + 0, + NULL, NULL); Status = ZwCreateDirectoryObject(&hWinstaDir, 0, &ObjectAttributes); if (!NT_SUCCESS(Status)) @@ -433,7 +433,7 @@ InitCursorImpl(); } - TRACE("NtUserCreateWindowStation created object 0x%x with name %wZ handle 0x%x\n", + TRACE("NtUserCreateWindowStation created object 0x%x with name %wZ handle 0x%x\n", WindowStation, &WindowStationObject->Name, WindowStation); return WindowStation; } @@ -631,7 +631,7 @@ Status = IntValidateDesktopHandle( hObject, UserMode, - 0, + 0, &DesktopObject); if (!NT_SUCCESS(Status)) {
12 years, 4 months
1
0
0
0
[tkreuzer] 57007: [WIN32K] - Use a global trivial CLIPOBJ if a NULL one is passed - Don't pass a pointer to uninitialized memory to DrvBitBlt
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Jul 31 18:53:17 2012 New Revision: 57007 URL:
http://svn.reactos.org/svn/reactos?rev=57007&view=rev
Log: [WIN32K] - Use a global trivial CLIPOBJ if a NULL one is passed - Don't pass a pointer to uninitialized memory to DrvBitBlt Modified: trunk/reactos/win32ss/gdi/eng/bitblt.c trunk/reactos/win32ss/gdi/eng/bitblt_new.c trunk/reactos/win32ss/gdi/eng/engobjects.h trunk/reactos/win32ss/gdi/eng/transblt.c Modified: trunk/reactos/win32ss/gdi/eng/bitblt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/bitblt.c?r…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/bitblt.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/bitblt.c [iso-8859-1] Tue Jul 31 18:53:17 2012 @@ -11,6 +11,12 @@ #define NDEBUG #include <debug.h> + +XCLIPOBJ gxcoTrivial = +{ + {0, {LONG_MIN, LONG_MIN, LONG_MAX, LONG_MAX}, DC_TRIVIAL, FC_RECT, TC_RECTANGLES, 0}, + 0, 0, 0 +}; typedef BOOLEAN (APIENTRY *PBLTRECTFUNC)(SURFOBJ* OutputObj, SURFOBJ* InputObj, @@ -590,6 +596,8 @@ if (pco->iDComplexity == DC_RECT) pco = NULL; } + else + pco = &gxcoTrivial.ClipObj; if (ROP4_USES_SOURCE(Rop4)) { @@ -601,6 +609,7 @@ rclSrc.top = pptlSrc->y + rclClipped.top - prclTrg->top; rclSrc.right = rclSrc.left + rclClipped.right - rclClipped.left; rclSrc.bottom = rclSrc.top + rclClipped.bottom - rclClipped.top; + pptlSrc = (PPOINTL)&rclSrc; } else { @@ -647,7 +656,7 @@ pco, pxlo, &rclClipped, - (POINTL*)&rclSrc, + pptlSrc, pptlMask, pbo, pptlBrush ? &ptlBrush : NULL, Modified: trunk/reactos/win32ss/gdi/eng/bitblt_new.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/bitblt_new…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/bitblt_new.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/bitblt_new.c [iso-8859-1] Tue Jul 31 18:53:17 2012 @@ -5,9 +5,12 @@ #define SURFOBJ_flags(pso) (CONTAINING_RECORD(pso, SURFACE, SurfObj)->flags) -#define XCLIPOBJ CLIPGDI - -XCLIPOBJ gxcoTrivial; +// FIXME this needs to be updated, once we use the new structure +XCLIPOBJ gxcoTrivial = +{ + {0, {LONG_MIN, LONG_MIN, LONG_MAX, LONG_MAX}, DC_TRIVIAL, FC_RECT, TC_RECTANGLES, 0}, + 0, 0, 0 +}; static Modified: trunk/reactos/win32ss/gdi/eng/engobjects.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/engobjects…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/engobjects.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/engobjects.h [iso-8859-1] Tue Jul 31 18:53:17 2012 @@ -75,6 +75,11 @@ ENUMRECTS EnumRects; } CLIPGDI, *PCLIPGDI; +// HACK, until we use the original structure +#define XCLIPOBJ CLIPGDI + +extern XCLIPOBJ gxcoTrivial; + /*ei What is this for? */ typedef struct _DRVFUNCTIONSGDI { HDEV hdev; Modified: trunk/reactos/win32ss/gdi/eng/transblt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/transblt.c…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/transblt.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/transblt.c [iso-8859-1] Tue Jul 31 18:53:17 2012 @@ -1,4 +1,4 @@ -/* +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * PURPOSE: GDI TransparentBlt Function @@ -226,6 +226,9 @@ ASSERT(psurfDest); ASSERT(psurfSource); + /* If no clip object is given, use trivial one */ + if (!Clip) Clip = &gxcoTrivial.ClipObj; + InputClippedRect = *DestRect; if(InputClippedRect.right < InputClippedRect.left) { @@ -241,7 +244,7 @@ InputRect = *SourceRect; /* Clip against the bounds of the clipping region so we won't try to write * outside the surface */ - if(Clip) + if (Clip->iDComplexity != DC_TRIVIAL) { if(!RECTL_bIntersectRect(&OutputRect, &InputClippedRect, &Clip->rclBounds)) {
12 years, 4 months
1
0
0
0
[tkreuzer] 57006: [WIN32K] trigraphs ...
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Jul 31 18:43:56 2012 New Revision: 57006 URL:
http://svn.reactos.org/svn/reactos?rev=57006&view=rev
Log: [WIN32K] trigraphs ... Modified: trunk/reactos/win32ss/user/ntuser/desktop.c Modified: trunk/reactos/win32ss/user/ntuser/desktop.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/deskto…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/desktop.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/desktop.c [iso-8859-1] Tue Jul 31 18:43:56 2012 @@ -305,7 +305,7 @@ if(!NT_SUCCESS(Status)) { SetLastNtError(Status); - ERR("Failed to reference window station %wZ PID: ??!\n", &ObjectName ); + ERR("Failed to reference window station %wZ PID: --!\n", &ObjectName ); return Status; } } @@ -337,7 +337,7 @@ NtClose(*hWinSta); *hWinSta = NULL; SetLastNtError(Status); - ERR("Failed to reference desktop %wZ PID: ??!\n", &ObjectName); + ERR("Failed to reference desktop %wZ PID: --!\n", &ObjectName); return Status; } }
12 years, 4 months
1
0
0
0
[tkreuzer] 57005: [WIN32K] - Fix PREFAST warnings related to printf format strings, empty SEH handler, some possible NULL pointer dereferences, some unchecked return values
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Jul 31 18:40:52 2012 New Revision: 57005 URL:
http://svn.reactos.org/svn/reactos?rev=57005&view=rev
Log: [WIN32K] - Fix PREFAST warnings related to printf format strings, empty SEH handler, some possible NULL pointer dereferences, some unchecked return values Modified: trunk/reactos/win32ss/gdi/eng/clip.c trunk/reactos/win32ss/gdi/eng/device.c trunk/reactos/win32ss/gdi/eng/engwindow.c trunk/reactos/win32ss/gdi/eng/ldevobj.c trunk/reactos/win32ss/gdi/eng/mapping.c trunk/reactos/win32ss/gdi/eng/paint.c trunk/reactos/win32ss/gdi/eng/stubs.c trunk/reactos/win32ss/gdi/eng/surface.c trunk/reactos/win32ss/gdi/eng/xlateobj.c trunk/reactos/win32ss/gdi/ntgdi/bezier.c trunk/reactos/win32ss/gdi/ntgdi/bitmaps.c trunk/reactos/win32ss/gdi/ntgdi/cliprgn.c trunk/reactos/win32ss/gdi/ntgdi/dclife.c trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c trunk/reactos/win32ss/gdi/ntgdi/fillshap.c trunk/reactos/win32ss/gdi/ntgdi/gdidbg.c trunk/reactos/win32ss/gdi/ntgdi/gdidebug.h trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c trunk/reactos/win32ss/gdi/ntgdi/gdipool.c trunk/reactos/win32ss/gdi/ntgdi/line.c trunk/reactos/win32ss/gdi/ntgdi/palette.c trunk/reactos/win32ss/gdi/ntgdi/palette.h trunk/reactos/win32ss/gdi/ntgdi/path.c trunk/reactos/win32ss/gdi/ntgdi/print.c trunk/reactos/win32ss/gdi/ntgdi/region.c trunk/reactos/win32ss/reactx/ntddraw/ddraw.c trunk/reactos/win32ss/user/ntuser/accelerator.c trunk/reactos/win32ss/user/ntuser/callback.c trunk/reactos/win32ss/user/ntuser/cursoricon.c trunk/reactos/win32ss/user/ntuser/desktop.c trunk/reactos/win32ss/user/ntuser/main.c trunk/reactos/win32ss/user/ntuser/misc/file.c trunk/reactos/win32ss/user/ntuser/misc/registry.c trunk/reactos/win32ss/user/ntuser/misc/usrheap.c trunk/reactos/win32ss/user/ntuser/msgqueue.h trunk/reactos/win32ss/user/ntuser/ntstubs.c trunk/reactos/win32ss/user/ntuser/simplecall.c trunk/reactos/win32ss/user/ntuser/userfuncs.h [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/reactos/win32ss/gdi/eng/clip.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/clip.c?rev…
Modified: trunk/reactos/win32ss/gdi/eng/device.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/device.c?r…
Modified: trunk/reactos/win32ss/gdi/eng/engwindow.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/engwindow.…
Modified: trunk/reactos/win32ss/gdi/eng/ldevobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/ldevobj.c?…
Modified: trunk/reactos/win32ss/gdi/eng/mapping.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/mapping.c?…
Modified: trunk/reactos/win32ss/gdi/eng/paint.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/paint.c?re…
Modified: trunk/reactos/win32ss/gdi/eng/stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/stubs.c?re…
Modified: trunk/reactos/win32ss/gdi/eng/surface.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/surface.c?…
Modified: trunk/reactos/win32ss/gdi/eng/xlateobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/xlateobj.c…
Modified: trunk/reactos/win32ss/gdi/ntgdi/bezier.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/bezier.c…
Modified: trunk/reactos/win32ss/gdi/ntgdi/bitmaps.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/bitmaps.…
Modified: trunk/reactos/win32ss/gdi/ntgdi/cliprgn.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/cliprgn.…
Modified: trunk/reactos/win32ss/gdi/ntgdi/dclife.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dclife.c…
Modified: trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c…
Modified: trunk/reactos/win32ss/gdi/ntgdi/fillshap.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/fillshap…
Modified: trunk/reactos/win32ss/gdi/ntgdi/gdidbg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/gdidbg.c…
Modified: trunk/reactos/win32ss/gdi/ntgdi/gdidebug.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/gdidebug…
Modified: trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c…
Modified: trunk/reactos/win32ss/gdi/ntgdi/gdipool.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/gdipool.…
Modified: trunk/reactos/win32ss/gdi/ntgdi/line.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/line.c?r…
Modified: trunk/reactos/win32ss/gdi/ntgdi/palette.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/palette.…
Modified: trunk/reactos/win32ss/gdi/ntgdi/palette.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/palette.…
Modified: trunk/reactos/win32ss/gdi/ntgdi/path.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/path.c?r…
Modified: trunk/reactos/win32ss/gdi/ntgdi/print.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/print.c?…
Modified: trunk/reactos/win32ss/gdi/ntgdi/region.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/region.c…
Modified: trunk/reactos/win32ss/reactx/ntddraw/ddraw.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/reactx/ntddraw/ddr…
Modified: trunk/reactos/win32ss/user/ntuser/accelerator.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/accele…
Modified: trunk/reactos/win32ss/user/ntuser/callback.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/callba…
Modified: trunk/reactos/win32ss/user/ntuser/cursoricon.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/cursor…
Modified: trunk/reactos/win32ss/user/ntuser/desktop.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/deskto…
Modified: trunk/reactos/win32ss/user/ntuser/main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/main.c…
Modified: trunk/reactos/win32ss/user/ntuser/misc/file.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/misc/f…
Modified: trunk/reactos/win32ss/user/ntuser/misc/registry.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/misc/r…
Modified: trunk/reactos/win32ss/user/ntuser/misc/usrheap.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/misc/u…
Modified: trunk/reactos/win32ss/user/ntuser/msgqueue.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/msgque…
Modified: trunk/reactos/win32ss/user/ntuser/ntstubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/ntstub…
Modified: trunk/reactos/win32ss/user/ntuser/simplecall.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/simple…
Modified: trunk/reactos/win32ss/user/ntuser/userfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/userfu…
12 years, 4 months
1
0
0
0
[tkreuzer] 57004: [DDK/XDK] - Fix some annotations in wdm.h [PSDK] - Fix some annotations in winddi.h - Add annotations to ntgdi.h (incomplete)
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Jul 31 18:20:09 2012 New Revision: 57004 URL:
http://svn.reactos.org/svn/reactos?rev=57004&view=rev
Log: [DDK/XDK] - Fix some annotations in wdm.h [PSDK] - Fix some annotations in winddi.h - Add annotations to ntgdi.h (incomplete) Modified: trunk/reactos/include/ddk/wdm.h trunk/reactos/include/psdk/ntgdi.h trunk/reactos/include/psdk/winddi.h trunk/reactos/include/xdk/kefuncs.h Modified: trunk/reactos/include/ddk/wdm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/wdm.h?rev=5700…
============================================================================== --- trunk/reactos/include/ddk/wdm.h [iso-8859-1] (original) +++ trunk/reactos/include/ddk/wdm.h [iso-8859-1] Tue Jul 31 18:20:09 2012 @@ -10102,7 +10102,7 @@ VOID NTAPI ProbeForWrite( - __in_data_source(USER_MODE) _Inout_updates_bytes_(Length) PVOID Address, + __in_data_source(USER_MODE) _Out_writes_bytes_(Length) PVOID Address, _In_ SIZE_T Length, _In_ ULONG Alignment); @@ -10504,8 +10504,8 @@ _In_opt_ __drv_aliasesMem PVOID SynchronizeContext); _IRQL_requires_min_(PASSIVE_LEVEL) -_When_((Timeout==NULL || *Timeout!=0), _IRQL_requires_max_(APC_LEVEL)) -_When_((Timeout!=NULL && *Timeout==0), _IRQL_requires_max_(DISPATCH_LEVEL)) +_When_((Timeout==NULL || Timeout->QuadPart!=0), _IRQL_requires_max_(APC_LEVEL)) +_When_((Timeout!=NULL && Timeout->QuadPart==0), _IRQL_requires_max_(DISPATCH_LEVEL)) NTKERNELAPI NTSTATUS NTAPI @@ -10522,8 +10522,8 @@ #define KeWaitForMutexObject KeWaitForSingleObject _IRQL_requires_min_(PASSIVE_LEVEL) -_When_((Timeout==NULL || *Timeout!=0), _IRQL_requires_max_(APC_LEVEL)) -_When_((Timeout!=NULL && *Timeout==0), _IRQL_requires_max_(DISPATCH_LEVEL)) +_When_((Timeout==NULL || Timeout->QuadPart!=0), _IRQL_requires_max_(APC_LEVEL)) +_When_((Timeout!=NULL && Timeout->QuadPart==0), _IRQL_requires_max_(DISPATCH_LEVEL)) NTKERNELAPI NTSTATUS NTAPI Modified: trunk/reactos/include/psdk/ntgdi.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ntgdi.h?rev=5…
============================================================================== --- trunk/reactos/include/psdk/ntgdi.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/ntgdi.h [iso-8859-1] Tue Jul 31 18:20:09 2012 @@ -86,22 +86,22 @@ INT APIENTRY NtGdiSetDIBitsToDeviceInternal( - IN HDC hdcDest, - IN INT xDst, - IN INT yDst, - IN DWORD cx, - IN DWORD cy, - IN INT xSrc, - IN INT ySrc, - IN DWORD iStartScan, - IN DWORD cNumScan, + _In_ HDC hdcDest, + _In_ INT xDst, + _In_ INT yDst, + _In_ DWORD cx, + _In_ DWORD cy, + _In_ INT xSrc, + _In_ INT ySrc, + _In_ DWORD iStartScan, + _In_ DWORD cNumScan, IN LPBYTE pInitBits, IN LPBITMAPINFO pbmi, - IN DWORD iUsage, - IN UINT cjMaxBits, - IN UINT cjMaxInfo, - IN BOOL bTransformCoordinates, - IN OPTIONAL HANDLE hcmXform + _In_ DWORD iUsage, + _In_ UINT cjMaxBits, + _In_ UINT cjMaxInfo, + _In_ BOOL bTransformCoordinates, + _In_opt_ HANDLE hcmXform ); W32KAPI @@ -109,35 +109,35 @@ APIENTRY NtGdiGetFontResourceInfoInternalW( IN LPWSTR pwszFiles, - IN ULONG cwc, - IN ULONG cFiles, - IN UINT cjIn, + _In_ ULONG cwc, + _In_ ULONG cFiles, + _In_ UINT cjIn, OUT LPDWORD pdwBytes, OUT LPVOID pvBuf, - IN DWORD iType + _In_ DWORD iType ); W32KAPI DWORD APIENTRY NtGdiGetGlyphIndicesW( - IN HDC hdc, + _In_ HDC hdc, IN OPTIONAL LPWSTR pwc, - IN INT cwc, + _In_ INT cwc, OUT OPTIONAL LPWORD pgi, - IN DWORD iMode + _In_ DWORD iMode ); W32KAPI DWORD APIENTRY NtGdiGetGlyphIndicesWInternal( - IN HDC hdc, + _In_ HDC hdc, IN OPTIONAL LPWSTR pwc, - IN INT cwc, + _In_ INT cwc, OUT OPTIONAL LPWORD pgi, - IN DWORD iMode, - IN BOOL bSubset + _In_ DWORD iMode, + _In_ BOOL bSubset ); W32KAPI @@ -145,114 +145,107 @@ APIENTRY NtGdiCreatePaletteInternal( IN LPLOGPALETTE pLogPal, - IN UINT cEntries + _In_ UINT cEntries ); W32KAPI BOOL APIENTRY NtGdiArcInternal( - IN ARCTYPE arctype, - IN HDC hdc, - IN INT x1, - IN INT y1, - IN INT x2, - IN INT y2, - IN INT x3, - IN INT y3, - IN INT x4, - IN INT y4 -); + _In_ ARCTYPE arctype, + _In_ HDC hdc, + _In_ INT x1, + _In_ INT y1, + _In_ INT x2, + _In_ INT y2, + _In_ INT x3, + _In_ INT y3, + _In_ INT x4, + _In_ INT y4); W32KAPI INT APIENTRY NtGdiStretchDIBitsInternal( - IN HDC hdc, - IN INT xDst, - IN INT yDst, - IN INT cxDst, - IN INT cyDst, - IN INT xSrc, - IN INT ySrc, - IN INT cxSrc, - IN INT cySrc, - IN OPTIONAL LPBYTE pjInit, - IN LPBITMAPINFO pbmi, - IN DWORD dwUsage, - IN DWORD dwRop4, - IN UINT cjMaxInfo, - IN UINT cjMaxBits, - IN HANDLE hcmXform -); + _In_ HDC hdc, + _In_ INT xDst, + _In_ INT yDst, + _In_ INT cxDst, + _In_ INT cyDst, + _In_ INT xSrc, + _In_ INT ySrc, + _In_ INT cxSrc, + _In_ INT cySrc, + _In_opt_ LPBYTE pjInit, + _In_ LPBITMAPINFO pbmi, + _In_ DWORD dwUsage, + _In_ DWORD dwRop4, + _In_ UINT cjMaxInfo, + _In_ UINT cjMaxBits, + _In_opt_ HANDLE hcmXform); W32KAPI ULONG APIENTRY NtGdiGetOutlineTextMetricsInternalW( - IN HDC hdc, - IN ULONG cjotm, - OUT OPTIONAL OUTLINETEXTMETRICW *potmw, - OUT TMDIFF *ptmd -); - -W32KAPI -BOOL + _In_ HDC hdc, + _In_ ULONG cjotm, + _Out_opt_ OUTLINETEXTMETRICW *potmw, + _Out_ TMDIFF *ptmd); + +W32KAPI +BOOL _Success_(return != FALSE) APIENTRY NtGdiGetAndSetDCDword( - IN HDC hdc, - IN UINT u, - IN DWORD dwIn, - OUT DWORD *pdwResult -); + _In_ HDC hdc, + _In_ UINT u, + _In_ DWORD dwIn, + _Out_ DWORD *pdwResult); W32KAPI HANDLE APIENTRY NtGdiGetDCObject( - IN HDC hdc, - IN INT itype -); + _In_ HDC hdc, + _In_ INT itype); W32KAPI HDC APIENTRY NtGdiGetDCforBitmap( - IN HBITMAP hsurf -); + _In_ HBITMAP hsurf); W32KAPI BOOL APIENTRY NtGdiGetMonitorID( - IN HDC hdc, - IN DWORD dwSize, - OUT LPWSTR pszMonitorID -); + _In_ HDC hdc, + _In_ DWORD dwSize, + _Out_ LPWSTR pszMonitorID); W32KAPI INT APIENTRY NtGdiGetLinkedUFIs( - IN HDC hdc, + _In_ HDC hdc, OUT OPTIONAL PUNIVERSAL_FONT_ID pufiLinkedUFIs, - IN INT BufferSize + _In_ INT BufferSize ); W32KAPI BOOL APIENTRY NtGdiSetLinkedUFIs( - IN HDC hdc, + _In_ HDC hdc, IN PUNIVERSAL_FONT_ID pufiLinks, - IN ULONG uNumUFIs + _In_ ULONG uNumUFIs ); W32KAPI BOOL APIENTRY NtGdiGetUFI( - IN HDC hdc, + _In_ HDC hdc, OUT PUNIVERSAL_FONT_ID pufi, OUT OPTIONAL DESIGNVECTOR *pdv, OUT ULONG *pcjDV, @@ -264,7 +257,7 @@ BOOL APIENTRY NtGdiForceUFIMapping( - IN HDC hdc, + _In_ HDC hdc, IN PUNIVERSAL_FONT_ID pufi ); @@ -276,7 +269,7 @@ OUT OPTIONAL ULONG* pcwc, OUT OPTIONAL LPWSTR pwszPathname, OUT OPTIONAL ULONG* pcNumFiles, - IN FLONG fl, + _In_ FLONG fl, OUT OPTIONAL BOOL *pbMemFont, OUT OPTIONAL ULONG *pcjView, OUT OPTIONAL PVOID pvView, @@ -288,9 +281,9 @@ BOOL APIENTRY NtGdiAddRemoteFontToDC( - IN HDC hdc, - IN PVOID pvBuffer, - IN ULONG cjBuffer, + _In_ HDC hdc, + _In_ PVOID pvBuffer, + _In_ ULONG cjBuffer, IN OPTIONAL PUNIVERSAL_FONT_ID pufi ); @@ -298,10 +291,10 @@ HANDLE APIENTRY NtGdiAddFontMemResourceEx( - IN PVOID pvBuffer, - IN DWORD cjBuffer, + _In_ PVOID pvBuffer, + _In_ DWORD cjBuffer, IN DESIGNVECTOR *pdv, - IN ULONG cjDV, + _In_ ULONG cjDV, OUT DWORD *pNumFonts ); @@ -309,36 +302,32 @@ BOOL APIENTRY NtGdiRemoveFontMemResourceEx( - IN HANDLE hMMFont -); + _In_ HANDLE hMMFont); W32KAPI BOOL APIENTRY NtGdiUnmapMemFont( - IN PVOID pvView -); + _In_ PVOID pvView); W32KAPI BOOL APIENTRY NtGdiRemoveMergeFont( - IN HDC hdc, + _In_ HDC hdc, IN UNIVERSAL_FONT_ID *pufi ); W32KAPI BOOL APIENTRY -NtGdiAnyLinkedFonts( - VOID -); +NtGdiAnyLinkedFonts(VOID); W32KAPI BOOL APIENTRY NtGdiGetEmbUFI( - IN HDC hdc, + _In_ HDC hdc, OUT PUNIVERSAL_FONT_ID pufi, OUT OPTIONAL DESIGNVECTOR *pdv, OUT ULONG *pcjDV, @@ -350,23 +339,21 @@ W32KAPI ULONG APIENTRY -NtGdiGetEmbedFonts( - VOID -); +NtGdiGetEmbedFonts(VOID); W32KAPI BOOL APIENTRY NtGdiChangeGhostFont( IN KERNEL_PVOID *pfontID, - IN BOOL bLoad + _In_ BOOL bLoad ); W32KAPI BOOL APIENTRY NtGdiAddEmbFontToDC( - IN HDC hdc, + _In_ HDC hdc, IN VOID **pFontID ); @@ -374,92 +361,86 @@ BOOL APIENTRY NtGdiFontIsLinked( - IN HDC hdc -); + _In_ HDC hdc); W32KAPI ULONG_PTR APIENTRY NtGdiPolyPolyDraw( - IN HDC hdc, - IN PPOINT ppt, - IN PULONG pcpt, - IN ULONG ccpt, - IN INT iFunc -); + _In_ HDC hdc, + _In_ PPOINT ppt, + _In_ PULONG pcpt, + _In_ ULONG ccpt, + _In_ INT iFunc); W32KAPI LONG APIENTRY NtGdiDoPalette( - IN HGDIOBJ hObj, - IN WORD iStart, - IN WORD cEntries, - IN LPVOID pEntries, - IN DWORD iFunc, - IN BOOL bInbound -); + _In_ HGDIOBJ hObj, + _In_ WORD iStart, + _In_ WORD cEntries, + _When_((iFunc == GdiPalGetEntries) || (iFunc == GdiPalGetSystemEntries), _Out_writes_bytes_(cEntries*sizeof(PALETTEENTRY))) + _When_((iFunc != GdiPalGetEntries) && (iFunc != GdiPalGetSystemEntries), _In_reads_bytes_(cEntries*sizeof(PALETTEENTRY))) LPVOID pEntries, + _In_ DWORD iFunc, + _In_ BOOL bInbound); W32KAPI BOOL APIENTRY NtGdiComputeXformCoefficients( - IN HDC hdc -); + _In_ HDC hdc); W32KAPI BOOL APIENTRY NtGdiGetWidthTable( - IN HDC hdc, - IN ULONG cSpecial, + _In_ HDC hdc, + _In_ ULONG cSpecial, IN WCHAR *pwc, - IN ULONG cwc, + _In_ ULONG cwc, OUT USHORT *psWidth, OUT OPTIONAL WIDTHDATA *pwd, OUT FLONG *pflInfo ); W32KAPI +INT _Success_(return != 0) +APIENTRY +NtGdiDescribePixelFormat( + _In_ HDC hdc, + _In_ INT ipfd, + _In_ UINT cjpfd, + _When_(cjpfd != 0, _Out_) PPIXELFORMATDESCRIPTOR ppfd); + +W32KAPI +BOOL +APIENTRY +NtGdiSetPixelFormat( + _In_ HDC hdc, + _In_ INT ipfd); + +W32KAPI +BOOL +APIENTRY +NtGdiSwapBuffers( + _In_ HDC hdc); + +W32KAPI INT APIENTRY -NtGdiDescribePixelFormat( - IN HDC hdc, - IN INT ipfd, - IN UINT cjpfd, - OUT PPIXELFORMATDESCRIPTOR ppfd -); - -W32KAPI -BOOL -APIENTRY -NtGdiSetPixelFormat( - IN HDC hdc, - IN INT ipfd -); - -W32KAPI -BOOL -APIENTRY -NtGdiSwapBuffers( - IN HDC hdc -); - -W32KAPI -INT -APIENTRY NtGdiSetupPublicCFONT( - IN HDC hdc, + _In_ HDC hdc, IN OPTIONAL HFONT hf, - IN ULONG ulAve + _In_ ULONG ulAve ); W32KAPI DWORD APIENTRY NtGdiDxgGenericThunk( - IN ULONG_PTR ulIndex, - IN ULONG_PTR ulHandle, + _In_ ULONG_PTR ulIndex, + _In_ ULONG_PTR ulHandle, IN OUT SIZE_T *pdwSizeOfPtr1, IN OUT PVOID pvPtr1, IN OUT SIZE_T *pdwSizeOfPtr2, @@ -470,8 +451,8 @@ DWORD APIENTRY NtGdiDdAddAttachedSurface( - IN HANDLE hSurface, - IN HANDLE hSurfaceAttached, + _In_ HANDLE hSurface, + _In_ HANDLE hSurfaceAttached, IN OUT PDD_ADDATTACHEDSURFACEDATA puAddAttachedSurfaceData ); @@ -479,16 +460,15 @@ BOOL APIENTRY NtGdiDdAttachSurface( - IN HANDLE hSurfaceFrom, - IN HANDLE hSurfaceTo -); + _In_ HANDLE hSurfaceFrom, + _In_ HANDLE hSurfaceTo); W32KAPI DWORD APIENTRY NtGdiDdBlt( - IN HANDLE hSurfaceDest, - IN HANDLE hSurfaceSrc, + _In_ HANDLE hSurfaceDest, + _In_ HANDLE hSurfaceSrc, IN OUT PDD_BLTDATA puBltData ); @@ -496,7 +476,7 @@ DWORD APIENTRY NtGdiDdCanCreateSurface( - IN HANDLE hDirectDraw, + _In_ HANDLE hDirectDraw, IN OUT PDD_CANCREATESURFACEDATA puCanCreateSurfaceData ); @@ -504,7 +484,7 @@ DWORD APIENTRY NtGdiDdColorControl( - IN HANDLE hSurface, + _In_ HANDLE hSurface, IN OUT PDD_COLORCONTROLDATA puColorControlData ); @@ -512,14 +492,13 @@ HANDLE APIENTRY NtGdiDdCreateDirectDrawObject( - IN HDC hdc -); + _In_ HDC hdc); W32KAPI DWORD APIENTRY NtGdiDdCreateSurface( - IN HANDLE hDirectDraw, + _In_ HANDLE hDirectDraw, IN HANDLE* hSurface, IN OUT DDSURFACEDESC* puSurfaceDescription, IN OUT DD_SURFACE_GLOBAL* puSurfaceGlobalData, @@ -533,44 +512,41 @@ HANDLE APIENTRY NtGdiDdCreateSurfaceObject( - IN HANDLE hDirectDrawLocal, - IN HANDLE hSurface, + _In_ HANDLE hDirectDrawLocal, + _In_ HANDLE hSurface, IN PDD_SURFACE_LOCAL puSurfaceLocal, IN PDD_SURFACE_MORE puSurfaceMore, IN PDD_SURFACE_GLOBAL puSurfaceGlobal, - IN BOOL bComplete + _In_ BOOL bComplete ); W32KAPI BOOL APIENTRY NtGdiDdDeleteSurfaceObject( - IN HANDLE hSurface -); + _In_ HANDLE hSurface); W32KAPI BOOL APIENTRY NtGdiDdDeleteDirectDrawObject( - IN HANDLE hDirectDrawLocal -); + _In_ HANDLE hDirectDrawLocal); W32KAPI DWORD APIENTRY NtGdiDdDestroySurface( - IN HANDLE hSurface, - IN BOOL bRealDestroy -); + _In_ HANDLE hSurface, + _In_ BOOL bRealDestroy); W32KAPI DWORD APIENTRY NtGdiDdFlip( - IN HANDLE hSurfaceCurrent, - IN HANDLE hSurfaceTarget, - IN HANDLE hSurfaceCurrentLeft, - IN HANDLE hSurfaceTargetLeft, + _In_ HANDLE hSurfaceCurrent, + _In_ HANDLE hSurfaceTarget, + _In_ HANDLE hSurfaceCurrentLeft, + _In_ HANDLE hSurfaceTargetLeft, IN OUT PDD_FLIPDATA puFlipData ); @@ -578,7 +554,7 @@ DWORD APIENTRY NtGdiDdGetAvailDriverMemory( - IN HANDLE hDirectDraw, + _In_ HANDLE hDirectDraw, IN OUT PDD_GETAVAILDRIVERMEMORYDATA puGetAvailDriverMemoryData ); @@ -586,7 +562,7 @@ DWORD APIENTRY NtGdiDdGetBltStatus( - IN HANDLE hSurface, + _In_ HANDLE hSurface, IN OUT PDD_GETBLTSTATUSDATA puGetBltStatusData ); @@ -594,7 +570,7 @@ HDC APIENTRY NtGdiDdGetDC( - IN HANDLE hSurface, + _In_ HANDLE hSurface, IN PALETTEENTRY* puColorTable ); @@ -602,7 +578,7 @@ DWORD APIENTRY NtGdiDdGetDriverInfo( - IN HANDLE hDirectDraw, + _In_ HANDLE hDirectDraw, IN OUT PDD_GETDRIVERINFODATA puGetDriverInfoData ); @@ -610,7 +586,7 @@ DWORD APIENTRY NtGdiDdGetFlipStatus( - IN HANDLE hSurface, + _In_ HANDLE hSurface, IN OUT PDD_GETFLIPSTATUSDATA puGetFlipStatusData ); @@ -618,7 +594,7 @@ DWORD APIENTRY NtGdiDdGetScanLine( - IN HANDLE hDirectDraw, + _In_ HANDLE hDirectDraw, IN OUT PDD_GETSCANLINEDATA puGetScanLineData ); @@ -626,7 +602,7 @@ DWORD APIENTRY NtGdiDdSetExclusiveMode( - IN HANDLE hDirectDraw, + _In_ HANDLE hDirectDraw, IN OUT PDD_SETEXCLUSIVEMODEDATA puSetExclusiveModeData ); @@ -634,7 +610,7 @@ DWORD APIENTRY NtGdiDdFlipToGDISurface( - IN HANDLE hDirectDraw, + _In_ HANDLE hDirectDraw, IN OUT PDD_FLIPTOGDISURFACEDATA puFlipToGDISurfaceData ); @@ -642,16 +618,16 @@ DWORD APIENTRY NtGdiDdLock( - IN HANDLE hSurface, + _In_ HANDLE hSurface, IN OUT PDD_LOCKDATA puLockData, - IN HDC hdcClip + _In_ HDC hdcClip ); W32KAPI BOOL APIENTRY NtGdiDdQueryDirectDrawObject( - IN HANDLE hDirectDrawLocal, + _In_ HANDLE hDirectDrawLocal, OUT PDD_HALINFO pHalInfo, OUT DWORD* pCallBackFlags, OUT OPTIONAL LPD3DNTHAL_CALLBACKS puD3dCallbacks, @@ -668,7 +644,7 @@ BOOL APIENTRY NtGdiDdReenableDirectDrawObject( - IN HANDLE hDirectDrawLocal, + _In_ HANDLE hDirectDrawLocal, IN OUT BOOL* pubNewMode ); @@ -676,22 +652,20 @@ BOOL APIENTRY NtGdiDdReleaseDC( - IN HANDLE hSurface -); + _In_ HANDLE hSurface); W32KAPI BOOL APIENTRY NtGdiDdResetVisrgn( - IN HANDLE hSurface, - IN HWND hwnd -); + _In_ HANDLE hSurface, + _In_ HWND hwnd); W32KAPI DWORD APIENTRY NtGdiDdSetColorKey( - IN HANDLE hSurface, + _In_ HANDLE hSurface, IN OUT PDD_SETCOLORKEYDATA puSetColorKeyData ); @@ -699,8 +673,8 @@ DWORD APIENTRY NtGdiDdSetOverlayPosition( - IN HANDLE hSurfaceSource, - IN HANDLE hSurfaceDestination, + _In_ HANDLE hSurfaceSource, + _In_ HANDLE hSurfaceDestination, IN OUT PDD_SETOVERLAYPOSITIONDATA puSetOverlayPositionData ); @@ -708,15 +682,15 @@ DWORD APIENTRY NtGdiDdUnattachSurface( - IN HANDLE hSurface, - IN HANDLE hSurfaceAttached + _In_ HANDLE hSurface, + _In_ HANDLE hSurfaceAttached ); W32KAPI DWORD APIENTRY NtGdiDdUnlock( - IN HANDLE hSurface, + _In_ HANDLE hSurface, IN OUT PDD_UNLOCKDATA puUnlockData ); @@ -724,8 +698,8 @@ DWORD APIENTRY NtGdiDdUpdateOverlay( - IN HANDLE hSurfaceDestination, - IN HANDLE hSurfaceSource, + _In_ HANDLE hSurfaceDestination, + _In_ HANDLE hSurfaceSource, IN OUT PDD_UPDATEOVERLAYDATA puUpdateOverlayData ); @@ -733,7 +707,7 @@ DWORD APIENTRY NtGdiDdWaitForVerticalBlank( - IN HANDLE hDirectDraw, + _In_ HANDLE hDirectDraw, IN OUT PDD_WAITFORVERTICALBLANKDATA puWaitForVerticalBlankData ); @@ -741,25 +715,23 @@ HANDLE APIENTRY NtGdiDdGetDxHandle( - IN OPTIONAL HANDLE hDirectDraw, - IN OPTIONAL HANDLE hSurface, - IN BOOL bRelease -); + _In_opt_ HANDLE hDirectDraw, + _In_opt_ HANDLE hSurface, + _In_ BOOL bRelease); W32KAPI BOOL APIENTRY NtGdiDdSetGammaRamp( - IN HANDLE hDirectDraw, - IN HDC hdc, - IN LPVOID lpGammaRamp -); + _In_ HANDLE hDirectDraw, + _In_ HDC hdc, + _In_ LPVOID lpGammaRamp); W32KAPI DWORD APIENTRY NtGdiDdLockD3D( - IN HANDLE hSurface, + _In_ HANDLE hSurface, IN OUT PDD_LOCKDATA puLockData ); @@ -767,7 +739,7 @@ DWORD APIENTRY NtGdiDdUnlockD3D( - IN HANDLE hSurface, + _In_ HANDLE hSurface, IN OUT PDD_UNLOCKDATA puUnlockData ); @@ -775,7 +747,7 @@ DWORD APIENTRY NtGdiDdCreateD3DBuffer( - IN HANDLE hDirectDraw, + _In_ HANDLE hDirectDraw, IN OUT HANDLE* hSurface, IN OUT DDSURFACEDESC* puSurfaceDescription, IN OUT DD_SURFACE_GLOBAL* puSurfaceGlobalData, @@ -789,7 +761,7 @@ DWORD APIENTRY NtGdiDdCanCreateD3DBuffer( - IN HANDLE hDirectDraw, + _In_ HANDLE hDirectDraw, IN OUT PDD_CANCREATESURFACEDATA puCanCreateSurfaceData ); @@ -797,16 +769,15 @@ DWORD APIENTRY NtGdiDdDestroyD3DBuffer( - IN HANDLE hSurface -); + _In_ HANDLE hSurface); W32KAPI BOOL APIENTRY NtGdiD3dContextCreate( - IN HANDLE hDirectDrawLocal, - IN HANDLE hSurfColor, - IN HANDLE hSurfZ, + _In_ HANDLE hDirectDrawLocal, + _In_ HANDLE hSurfColor, + _In_ HANDLE hSurfZ, IN OUT D3DNTHAL_CONTEXTCREATEI *pdcci ); @@ -835,8 +806,8 @@ DWORD APIENTRY NtGdiD3dDrawPrimitives2( - IN HANDLE hCmdBuf, - IN HANDLE hVBuf, + _In_ HANDLE hCmdBuf, + _In_ HANDLE hVBuf, IN OUT LPD3DNTHAL_DRAWPRIMITIVES2DATA pded, IN OUT FLATPTR* pfpVidMemCmd, IN OUT DWORD* pdwSizeCmd, @@ -855,16 +826,16 @@ DWORD APIENTRY NtGdiDdCreateSurfaceEx( - IN HANDLE hDirectDraw, - IN HANDLE hSurface, - IN DWORD dwSurfaceHandle + _In_ HANDLE hDirectDraw, + _In_ HANDLE hSurface, + _In_ DWORD dwSurfaceHandle ); W32KAPI DWORD APIENTRY NtGdiDvpCanCreateVideoPort( - IN HANDLE hDirectDraw, + _In_ HANDLE hDirectDraw, IN OUT PDD_CANCREATEVPORTDATA puCanCreateVPortData ); @@ -872,7 +843,7 @@ DWORD APIENTRY NtGdiDvpColorControl( - IN HANDLE hVideoPort, + _In_ HANDLE hVideoPort, IN OUT PDD_VPORTCOLORDATA puVPortColorData ); @@ -880,7 +851,7 @@ HANDLE APIENTRY NtGdiDvpCreateVideoPort( - IN HANDLE hDirectDraw, + _In_ HANDLE hDirectDraw, IN OUT PDD_CREATEVPORTDATA puCreateVPortData ); @@ -888,7 +859,7 @@ DWORD APIENTRY NtGdiDvpDestroyVideoPort( - IN HANDLE hVideoPort, + _In_ HANDLE hVideoPort, IN OUT PDD_DESTROYVPORTDATA puDestroyVPortData ); @@ -896,9 +867,9 @@ DWORD APIENTRY NtGdiDvpFlipVideoPort( - IN HANDLE hVideoPort, - IN HANDLE hDDSurfaceCurrent, - IN HANDLE hDDSurfaceTarget, + _In_ HANDLE hVideoPort, + _In_ HANDLE hDDSurfaceCurrent, + _In_ HANDLE hDDSurfaceTarget, IN OUT PDD_FLIPVPORTDATA puFlipVPortData ); @@ -906,7 +877,7 @@ DWORD APIENTRY NtGdiDvpGetVideoPortBandwidth( - IN HANDLE hVideoPort, + _In_ HANDLE hVideoPort, IN OUT PDD_GETVPORTBANDWIDTHDATA puGetVPortBandwidthData ); @@ -914,7 +885,7 @@ DWORD APIENTRY NtGdiDvpGetVideoPortField( - IN HANDLE hVideoPort, + _In_ HANDLE hVideoPort, IN OUT PDD_GETVPORTFIELDDATA puGetVPortFieldData ); @@ -922,7 +893,7 @@ DWORD APIENTRY NtGdiDvpGetVideoPortFlipStatus( - IN HANDLE hDirectDraw, + _In_ HANDLE hDirectDraw, IN OUT PDD_GETVPORTFLIPSTATUSDATA puGetVPortFlipStatusData ); @@ -930,7 +901,7 @@ DWORD APIENTRY NtGdiDvpGetVideoPortInputFormats( - IN HANDLE hVideoPort, + _In_ HANDLE hVideoPort, IN OUT PDD_GETVPORTINPUTFORMATDATA puGetVPortInputFormatData ); @@ -938,7 +909,7 @@ DWORD APIENTRY NtGdiDvpGetVideoPortLine( - IN HANDLE hVideoPort, + _In_ HANDLE hVideoPort, IN OUT PDD_GETVPORTLINEDATA puGetVPortLineData ); @@ -946,7 +917,7 @@ DWORD APIENTRY NtGdiDvpGetVideoPortOutputFormats( - IN HANDLE hVideoPort, + _In_ HANDLE hVideoPort, IN OUT PDD_GETVPORTOUTPUTFORMATDATA puGetVPortOutputFormatData ); @@ -954,7 +925,7 @@ DWORD APIENTRY NtGdiDvpGetVideoPortConnectInfo( - IN HANDLE hDirectDraw, + _In_ HANDLE hDirectDraw, IN OUT PDD_GETVPORTCONNECTDATA puGetVPortConnectData ); @@ -962,7 +933,7 @@ DWORD APIENTRY NtGdiDvpGetVideoSignalStatus( - IN HANDLE hVideoPort, + _In_ HANDLE hVideoPort, IN OUT PDD_GETVPORTSIGNALDATA puGetVPortSignalData ); @@ -970,7 +941,7 @@ DWORD APIENTRY NtGdiDvpUpdateVideoPort( - IN HANDLE hVideoPort, + _In_ HANDLE hVideoPort, IN HANDLE* phSurfaceVideo, IN HANDLE* phSurfaceVbi, IN OUT PDD_UPDATEVPORTDATA puUpdateVPortData @@ -980,7 +951,7 @@ DWORD APIENTRY NtGdiDvpWaitForVideoPortSync( - IN HANDLE hVideoPort, + _In_ HANDLE hVideoPort, IN OUT PDD_WAITFORVPORTSYNCDATA puWaitForVPortSyncData ); @@ -988,7 +959,7 @@ DWORD APIENTRY NtGdiDvpAcquireNotification( - IN HANDLE hVideoPort, + _In_ HANDLE hVideoPort, IN OUT HANDLE* hEvent, IN LPDDVIDEOPORTNOTIFY pNotify ); @@ -997,15 +968,14 @@ DWORD APIENTRY NtGdiDvpReleaseNotification( - IN HANDLE hVideoPort, - IN HANDLE hEvent -); + _In_ HANDLE hVideoPort, + _In_ HANDLE hEvent); W32KAPI DWORD APIENTRY NtGdiDdGetMoCompGuids( - IN HANDLE hDirectDraw, + _In_ HANDLE hDirectDraw, IN OUT PDD_GETMOCOMPGUIDSDATA puGetMoCompGuidsData ); @@ -1013,7 +983,7 @@ DWORD APIENTRY NtGdiDdGetMoCompFormats( - IN HANDLE hDirectDraw, + _In_ HANDLE hDirectDraw, IN OUT PDD_GETMOCOMPFORMATSDATA puGetMoCompFormatsData ); @@ -1021,7 +991,7 @@ DWORD APIENTRY NtGdiDdGetMoCompBuffInfo( - IN HANDLE hDirectDraw, + _In_ HANDLE hDirectDraw, IN OUT PDD_GETMOCOMPCOMPBUFFDATA puGetBuffData ); @@ -1029,7 +999,7 @@ DWORD APIENTRY NtGdiDdGetInternalMoCompInfo( - IN HANDLE hDirectDraw, + _In_ HANDLE hDirectDraw, IN OUT PDD_GETINTERNALMOCOMPDATA puGetInternalData ); @@ -1037,7 +1007,7 @@ HANDLE APIENTRY NtGdiDdCreateMoComp( - IN HANDLE hDirectDraw, + _In_ HANDLE hDirectDraw, IN OUT PDD_CREATEMOCOMPDATA puCreateMoCompData ); @@ -1045,7 +1015,7 @@ DWORD APIENTRY NtGdiDdDestroyMoComp( - IN HANDLE hMoComp, + _In_ HANDLE hMoComp, IN OUT PDD_DESTROYMOCOMPDATA puDestroyMoCompData ); @@ -1053,7 +1023,7 @@ DWORD APIENTRY NtGdiDdBeginMoCompFrame( - IN HANDLE hMoComp, + _In_ HANDLE hMoComp, IN OUT PDD_BEGINMOCOMPFRAMEDATA puBeginFrameData ); @@ -1061,7 +1031,7 @@ DWORD APIENTRY NtGdiDdEndMoCompFrame( - IN HANDLE hMoComp, + _In_ HANDLE hMoComp, IN OUT PDD_ENDMOCOMPFRAMEDATA puEndFrameData ); @@ -1069,7 +1039,7 @@ DWORD APIENTRY NtGdiDdRenderMoComp( - IN HANDLE hMoComp, + _In_ HANDLE hMoComp, IN OUT PDD_RENDERMOCOMPDATA puRenderMoCompData ); @@ -1077,7 +1047,7 @@ DWORD APIENTRY NtGdiDdQueryMoCompStatus( - IN HANDLE hMoComp, + _In_ HANDLE hMoComp, IN OUT PDD_QUERYMOCOMPSTATUSDATA puQueryMoCompStatusData ); @@ -1085,8 +1055,8 @@ DWORD APIENTRY NtGdiDdAlphaBlt( - IN HANDLE hSurfaceDest, - IN OPTIONAL HANDLE hSurfaceSrc, + _In_ HANDLE hSurfaceDest, + _In_opt_ HANDLE hSurfaceSrc, IN OUT PDD_BLTDATA puBltData ); @@ -1094,96 +1064,88 @@ BOOL APIENTRY NtGdiAlphaBlend( - IN HDC hdcDst, - IN LONG DstX, - IN LONG DstY, - IN LONG DstCx, - IN LONG DstCy, - IN HDC hdcSrc, - IN LONG SrcX, - IN LONG SrcY, - IN LONG SrcCx, - IN LONG SrcCy, - IN BLENDFUNCTION BlendFunction, - IN HANDLE hcmXform -); + _In_ HDC hdcDst, + _In_ LONG DstX, + _In_ LONG DstY, + _In_ LONG DstCx, + _In_ LONG DstCy, + _In_ HDC hdcSrc, + _In_ LONG SrcX, + _In_ LONG SrcY, + _In_ LONG SrcCx, + _In_ LONG SrcCy, + _In_ BLENDFUNCTION BlendFunction, + _In_ HANDLE hcmXform); W32KAPI BOOL APIENTRY NtGdiGradientFill( - IN HDC hdc, - IN PTRIVERTEX pVertex, - IN ULONG nVertex, - IN PVOID pMesh, - IN ULONG nMesh, - IN ULONG ulMode -); + _In_ HDC hdc, + _In_ PTRIVERTEX pVertex, + _In_ ULONG nVertex, + _In_ PVOID pMesh, + _In_ ULONG nMesh, + _In_ ULONG ulMode); W32KAPI BOOL APIENTRY NtGdiSetIcmMode( - IN HDC hdc, - IN ULONG nCommand, - IN ULONG ulMode -); + _In_ HDC hdc, + _In_ ULONG nCommand, + _In_ ULONG ulMode); W32KAPI HANDLE APIENTRY NtGdiCreateColorSpace( - IN PLOGCOLORSPACEEXW pLogColorSpace -); + _In_ PLOGCOLORSPACEEXW pLogColorSpace); W32KAPI BOOL APIENTRY NtGdiDeleteColorSpace( - IN HANDLE hColorSpace -); + _In_ HANDLE hColorSpace); W32KAPI BOOL APIENTRY NtGdiSetColorSpace( - IN HDC hdc, - IN HCOLORSPACE hColorSpace -); + _In_ HDC hdc, + _In_ HCOLORSPACE hColorSpace); W32KAPI HANDLE APIENTRY NtGdiCreateColorTransform( - IN HDC hdc, - IN LPLOGCOLORSPACEW pLogColorSpaceW, - IN OPTIONAL PVOID pvSrcProfile, - IN ULONG cjSrcProfile, - IN OPTIONAL PVOID pvDestProfile, - IN ULONG cjDestProfile, - IN OPTIONAL PVOID pvTargetProfile, - IN ULONG cjTargetProfile -); + _In_ HDC hdc, + _In_ LPLOGCOLORSPACEW pLogColorSpaceW, + _In_reads_bytes_opt_(cjSrcProfile) PVOID pvSrcProfile, + _In_ ULONG cjSrcProfile, + _In_reads_bytes_opt_(cjDestProfile) PVOID pvDestProfile, + _In_ ULONG cjDestProfile, + _In_reads_bytes_opt_(cjTargetProfile) PVOID pvTargetProfile, + _In_ ULONG cjTargetProfile); W32KAPI BOOL APIENTRY NtGdiDeleteColorTransform( - IN HDC hdc, - IN HANDLE hColorTransform -); + _In_ HDC hdc, + _In_ HANDLE hColorTransform); W32KAPI BOOL APIENTRY NtGdiCheckBitmapBits( - IN HDC hdc, - IN HANDLE hColorTransform, - IN PVOID pvBits, - IN ULONG bmFormat, - IN DWORD dwWidth, - IN DWORD dwHeight, - IN DWORD dwStride, + _In_ HDC hdc, + _In_ HANDLE hColorTransform, + _In_ PVOID pvBits, + _In_ ULONG bmFormat, + _In_ DWORD dwWidth, + _In_ DWORD dwHeight, + _In_ DWORD dwStride, OUT PBYTE paResults ); @@ -1191,49 +1153,46 @@ ULONG APIENTRY NtGdiColorCorrectPalette( - IN HDC hdc, - IN HPALETTE hpal, - IN ULONG FirstEntry, - IN ULONG NumberOfEntries, + _In_ HDC hdc, + _In_ HPALETTE hpal, + _In_ ULONG FirstEntry, + _In_ ULONG NumberOfEntries, IN OUT PALETTEENTRY *ppalEntry, - IN ULONG Command + _In_ ULONG Command ); W32KAPI ULONG_PTR APIENTRY NtGdiGetColorSpaceforBitmap( - IN HBITMAP hsurf -); + _In_ HBITMAP hsurf); W32KAPI BOOL APIENTRY NtGdiGetDeviceGammaRamp( - IN HDC hdc, - OUT LPVOID lpGammaRamp -); + _In_ HDC hdc, + _Out_writes_bytes_(sizeof(GAMMARAMP)) LPVOID lpGammaRamp); W32KAPI BOOL APIENTRY NtGdiSetDeviceGammaRamp( - IN HDC hdc, - IN LPVOID lpGammaRamp -); + _In_ HDC hdc, + _In_reads_bytes_(sizeof(GAMMARAMP)) LPVOID lpGammaRamp); W32KAPI BOOL APIENTRY NtGdiIcmBrushInfo( - IN HDC hdc, - IN HBRUSH hbrush, + _In_ HDC hdc, + _In_ HBRUSH hbrush, IN OUT PBITMAPINFO pbmiDIB, IN OUT PVOID pvBits, IN OUT ULONG *pulBits, OUT OPTIONAL DWORD *piUsage, OUT OPTIONAL BOOL *pbAlreadyTran, - IN ULONG Command + _In_ ULONG Command ); W32KAPI @@ -1245,37 +1204,33 @@ HDC APIENTRY NtGdiCreateMetafileDC( - IN HDC hdc -); + _In_ HDC hdc); W32KAPI BOOL APIENTRY NtGdiMakeInfoDC( - IN HDC hdc, - IN BOOL bSet -); + _In_ HDC hdc, + _In_ BOOL bSet); W32KAPI HANDLE APIENTRY NtGdiCreateClientObj( - IN ULONG ulType -); + _In_ ULONG ulType); W32KAPI BOOL APIENTRY NtGdiDeleteClientObj( - IN HANDLE h -); + _In_ HANDLE h); W32KAPI LONG APIENTRY NtGdiGetBitmapBits( - IN HBITMAP hbm, - IN ULONG cjMax, + _In_ HBITMAP hbm, + _In_ ULONG cjMax, OUT OPTIONAL PBYTE pjOut ); @@ -1283,193 +1238,177 @@ BOOL APIENTRY NtGdiDeleteObjectApp( - IN HANDLE hobj -); + _In_ HANDLE hobj); W32KAPI INT APIENTRY NtGdiGetPath( - IN HDC hdc, + _In_ HDC hdc, OUT OPTIONAL LPPOINT pptlBuf, OUT OPTIONAL LPBYTE pjTypes, - IN INT cptBuf + _In_ INT cptBuf ); W32KAPI HDC APIENTRY NtGdiCreateCompatibleDC( - IN HDC hdc -); + _In_opt_ HDC hdc); W32KAPI HBITMAP APIENTRY NtGdiCreateDIBitmapInternal( - IN HDC hdc, - IN INT cx, - IN INT cy, - IN DWORD fInit, - IN OPTIONAL LPBYTE pjInit, - IN OPTIONAL LPBITMAPINFO pbmi, - IN DWORD iUsage, - IN UINT cjMaxInitInfo, - IN UINT cjMaxBits, - IN FLONG f, - IN HANDLE hcmXform -); + _In_ HDC hdc, + _In_ INT cx, + _In_ INT cy, + _In_ DWORD fInit, + _In_opt_ LPBYTE pjInit, + _In_opt_ LPBITMAPINFO pbmi, + _In_ DWORD iUsage, + _In_ UINT cjMaxInitInfo, + _In_ UINT cjMaxBits, + _In_ FLONG f, + _In_ HANDLE hcmXform); W32KAPI HBITMAP APIENTRY NtGdiCreateDIBSection( - IN HDC hdc, - IN OPTIONAL HANDLE hSectionApp, - IN DWORD dwOffset, - IN LPBITMAPINFO pbmi, - IN DWORD iUsage, - IN UINT cjHeader, - IN FLONG fl, - IN ULONG_PTR dwColorSpace, - OUT PVOID *ppvBits -); + _In_ HDC hdc, + _In_opt_ HANDLE hSectionApp, + _In_ DWORD dwOffset, + _In_ LPBITMAPINFO pbmi, + _In_ DWORD iUsage, + _In_ UINT cjHeader, + _In_ FLONG fl, + _In_ ULONG_PTR dwColorSpace, + _Out_opt_ PVOID *ppvBits); W32KAPI HBRUSH APIENTRY NtGdiCreateSolidBrush( - IN COLORREF cr, - IN OPTIONAL HBRUSH hbr -); + _In_ COLORREF cr, + _In_opt_ HBRUSH hbr); W32KAPI HBRUSH APIENTRY NtGdiCreateDIBBrush( - IN PVOID pv, - IN FLONG fl, - IN UINT cj, - IN BOOL b8X8, - IN BOOL bPen, - IN PVOID pClient -); + _In_ PVOID pv, + _In_ FLONG fl, + _In_ UINT cj, + _In_ BOOL b8X8, + _In_ BOOL bPen, + _In_ PVOID pClient); W32KAPI HBRUSH APIENTRY NtGdiCreatePatternBrushInternal( - IN HBITMAP hbm, - IN BOOL bPen, - IN BOOL b8X8 -); + _In_ HBITMAP hbm, + _In_ BOOL bPen, + _In_ BOOL b8X8); W32KAPI HBRUSH APIENTRY NtGdiCreateHatchBrushInternal( - IN ULONG ulStyle, - IN COLORREF clrr, - IN BOOL bPen -); + _In_ ULONG ulStyle, + _In_ COLORREF clrr, + _In_ BOOL bPen); W32KAPI HPEN APIENTRY NtGdiExtCreatePen( - IN ULONG flPenStyle, - IN ULONG ulWidth, - IN ULONG iBrushStyle, - IN ULONG ulColor, - IN ULONG_PTR lClientHatch, - IN ULONG_PTR lHatch, - IN ULONG cstyle, - IN OPTIONAL PULONG pulStyle, - IN ULONG cjDIB, - IN BOOL bOldStylePen, - IN OPTIONAL HBRUSH hbrush -); + _In_ ULONG flPenStyle, + _In_ ULONG ulWidth, + _In_ ULONG iBrushStyle, + _In_ ULONG ulColor, + _In_ ULONG_PTR lClientHatch, + _In_ ULONG_PTR lHatch, + _In_ ULONG cstyle, + _In_opt_ PULONG pulStyle, + _In_ ULONG cjDIB, + _In_ BOOL bOldStylePen, + _In_opt_ HBRUSH hbrush); W32KAPI HRGN APIENTRY NtGdiCreateEllipticRgn( - IN INT xLeft, - IN INT yTop, - IN INT xRight, - IN INT yBottom -); + _In_ INT xLeft, + _In_ INT yTop, + _In_ INT xRight, + _In_ INT yBottom); W32KAPI HRGN APIENTRY NtGdiCreateRoundRectRgn( - IN INT xLeft, - IN INT yTop, - IN INT xRight, - IN INT yBottom, - IN INT xWidth, - IN INT yHeight -); + _In_ INT xLeft, + _In_ INT yTop, + _In_ INT xRight, + _In_ INT yBottom, + _In_ INT xWidth, + _In_ INT yHeight); W32KAPI HANDLE APIENTRY NtGdiCreateServerMetaFile( - IN DWORD iType, - IN ULONG cjData, - IN LPBYTE pjData, - IN DWORD mm, - IN DWORD xExt, - IN DWORD yExt -); + _In_ DWORD iType, + _In_ ULONG cjData, + _In_reads_bytes_(cjData) LPBYTE pjData, + _In_ DWORD mm, + _In_ DWORD xExt, + _In_ DWORD yExt); W32KAPI HRGN APIENTRY NtGdiExtCreateRegion( - IN OPTIONAL LPXFORM px, - IN DWORD cj, - IN LPRGNDATA prgn -); + _In_opt_ LPXFORM px, + _In_ DWORD cj, + _In_ LPRGNDATA prgn); W32KAPI ULONG APIENTRY NtGdiMakeFontDir( - IN FLONG flEmbed, - OUT PBYTE pjFontDir, - IN unsigned cjFontDir, - IN LPWSTR pwszPathname, - IN unsigned cjPathname -); + _In_ FLONG flEmbed, + _Out_writes_bytes_(cjFontDir) PBYTE pjFontDir, + _In_ unsigned cjFontDir, + _In_z_bytecount_(cjPathname) LPWSTR pwszPathname, + _In_ unsigned cjPathname); W32KAPI BOOL APIENTRY NtGdiPolyDraw( - IN HDC hdc, - IN LPPOINT ppt, - IN LPBYTE pjAttr, - IN ULONG cpt -); + _In_ HDC hdc, + _In_count_(cpt) LPPOINT ppt, + _In_count_(cpt) LPBYTE pjAttr, + _In_ ULONG cpt); W32KAPI BOOL APIENTRY NtGdiPolyTextOutW( - IN HDC hdc, - IN POLYTEXTW *pptw, - IN UINT cStr, - IN DWORD dwCodePage -); + _In_ HDC hdc, + _In_ POLYTEXTW *pptw, + _In_ UINT cStr, + _In_ DWORD dwCodePage); W32KAPI ULONG APIENTRY NtGdiGetServerMetaFileBits( - IN HANDLE hmo, - IN ULONG cjData, + _In_ HANDLE hmo, + _In_ ULONG cjData, OUT OPTIONAL LPBYTE pjData, OUT PDWORD piType, OUT PDWORD pmm, @@ -1481,129 +1420,118 @@ BOOL APIENTRY NtGdiEqualRgn( - IN HRGN hrgn1, - IN HRGN hrgn2 -); - + _In_ HRGN hrgn1, + _In_ HRGN hrgn2); + +_Must_inspect_result_ W32KAPI BOOL APIENTRY NtGdiGetBitmapDimension( - IN HBITMAP hbm, - OUT LPSIZE psize -); + _In_ HBITMAP hbm, + _When_(return != FALSE, _Out_) LPSIZE psize); W32KAPI UINT APIENTRY NtGdiGetNearestPaletteIndex( - IN HPALETTE hpal, - IN COLORREF crColor -); + _In_ HPALETTE hpal, + _In_ COLORREF crColor); W32KAPI BOOL APIENTRY NtGdiPtVisible( - IN HDC hdc, - IN INT x, - IN INT y -); + _In_ HDC hdc, + _In_ INT x, + _In_ INT y); W32KAPI BOOL APIENTRY NtGdiRectVisible( - IN HDC hdc, - IN LPRECT prc -); + _In_ HDC hdc, + _In_ LPRECT prc); W32KAPI BOOL APIENTRY NtGdiRemoveFontResourceW( - IN WCHAR *pwszFiles, - IN ULONG cwc, - IN ULONG cFiles, - IN ULONG fl, - IN DWORD dwPidTid, - IN OPTIONAL DESIGNVECTOR *pdv -); + _In_z_count_(cwc) WCHAR *pwszFiles, + _In_ ULONG cwc, + _In_ ULONG cFiles, + _In_ ULONG fl, + _In_ DWORD dwPidTid, + _In_opt_ DESIGNVECTOR *pdv); W32KAPI BOOL APIENTRY NtGdiResizePalette( - IN HPALETTE hpal, - IN UINT cEntry -); + _In_ HPALETTE hpal, + _In_ UINT cEntry); W32KAPI BOOL APIENTRY NtGdiSetBitmapDimension( - IN HBITMAP hbm, - IN INT cx, - IN INT cy, - OUT OPTIONAL LPSIZE psizeOut -); + _In_ HBITMAP hbm, + _In_ INT cx, + _In_ INT cy, + _In_opt_ LPSIZE psizeOut); W32KAPI INT APIENTRY NtGdiOffsetClipRgn( - IN HDC hdc, - IN INT x, - IN INT y -); + _In_ HDC hdc, + _In_ INT x, + _In_ INT y); W32KAPI INT APIENTRY NtGdiSetMetaRgn( - IN HDC hdc -); + _In_ HDC hdc); W32KAPI BOOL APIENTRY NtGdiSetTextJustification( - IN HDC hdc, - IN INT lBreakExtra, - IN INT cBreak -); + _In_ HDC hdc, + _In_ INT lBreakExtra, + _In_ INT cBreak); W32KAPI INT APIENTRY NtGdiGetAppClipBox( - IN HDC hdc, - OUT LPRECT prc -); + _In_ HDC hdc, + _Out_ LPRECT prc); W32KAPI BOOL APIENTRY NtGdiGetTextExtentExW( - IN HDC hdc, + _In_ HDC hdc, IN OPTIONAL LPWSTR lpwsz, - IN ULONG cwc, - IN ULONG dxMax, + _In_ ULONG cwc, + _In_ ULONG dxMax, OUT OPTIONAL ULONG *pcCh, OUT OPTIONAL PULONG pdxOut, OUT LPSIZE psize, - IN FLONG fl + _In_ FLONG fl ); W32KAPI BOOL APIENTRY NtGdiGetCharABCWidthsW( - IN HDC hdc, - IN UINT wchFirst, - IN ULONG cwch, + _In_ HDC hdc, + _In_ UINT wchFirst, + _In_ ULONG cwch, IN OPTIONAL PWCHAR pwch, - IN FLONG fl, + _In_ FLONG fl, OUT PVOID pvBuf ); @@ -1611,96 +1539,85 @@ DWORD APIENTRY NtGdiGetCharacterPlacementW( - IN HDC hdc, + _In_ HDC hdc, IN LPWSTR pwsz, - IN INT nCount, - IN INT nMaxExtent, + _In_ INT nCount, + _In_ INT nMaxExtent, IN OUT LPGCP_RESULTSW pgcpw, - IN DWORD dwFlags + _In_ DWORD dwFlags ); W32KAPI BOOL APIENTRY NtGdiAngleArc( - IN HDC hdc, - IN INT x, - IN INT y, - IN DWORD dwRadius, - IN DWORD dwStartAngle, - IN DWORD dwSweepAngle -); + _In_ HDC hdc, + _In_ INT x, + _In_ INT y, + _In_ DWORD dwRadius, + _In_ DWORD dwStartAngle, + _In_ DWORD dwSweepAngle); W32KAPI BOOL APIENTRY NtGdiBeginPath( - IN HDC hdc -); + _In_ HDC hdc); W32KAPI BOOL APIENTRY NtGdiSelectClipPath( - IN HDC hdc, - IN INT iMode -); + _In_ HDC hdc, + _In_ INT iMode); W32KAPI BOOL APIENTRY NtGdiCloseFigure( - IN HDC hdc -); + _In_ HDC hdc); W32KAPI BOOL APIENTRY NtGdiEndPath( - IN HDC hdc -); + _In_ HDC hdc); W32KAPI BOOL APIENTRY NtGdiAbortPath( - IN HDC hdc -); + _In_ HDC hdc); W32KAPI BOOL APIENTRY NtGdiFillPath( - IN HDC hdc -); + _In_ HDC hdc); W32KAPI BOOL APIENTRY NtGdiStrokeAndFillPath( - IN HDC hdc -); + _In_ HDC hdc); W32KAPI BOOL APIENTRY NtGdiStrokePath( - IN HDC hdc -); + _In_ HDC hdc); W32KAPI BOOL APIENTRY NtGdiWidenPath( - IN HDC hdc -); + _In_ HDC hdc); W32KAPI BOOL APIENTRY NtGdiFlattenPath( - IN HDC hdc -); + _In_ HDC hdc); W32KAPI NTSTATUS @@ -1711,210 +1628,191 @@ HRGN APIENTRY NtGdiPathToRegion( - IN HDC hdc -); + _In_ HDC hdc); W32KAPI BOOL APIENTRY NtGdiSetMiterLimit( - IN HDC hdc, - IN DWORD dwNew, - IN OUT OPTIONAL PDWORD pdwOut -); + _In_ HDC hdc, + _In_ DWORD dwNew, + _Out_opt_ PDWORD pdwOut); W32KAPI BOOL APIENTRY NtGdiSetFontXform( - IN HDC hdc, - IN DWORD dwxScale, - IN DWORD dwyScale -); - -W32KAPI -BOOL + _In_ HDC hdc, + _In_ DWORD dwxScale, + _In_ DWORD dwyScale); + +W32KAPI +BOOL _Success_(return != FALSE) APIENTRY NtGdiGetMiterLimit( - IN HDC hdc, - OUT PDWORD pdwOut -); + _In_ HDC hdc, + _Out_ PDWORD pdwOut); W32KAPI BOOL APIENTRY NtGdiEllipse( - IN HDC hdc, - IN INT xLeft, - IN INT yTop, - IN INT xRight, - IN INT yBottom -); + _In_ HDC hdc, + _In_ INT xLeft, + _In_ INT yTop, + _In_ INT xRight, + _In_ INT yBottom); W32KAPI BOOL APIENTRY NtGdiRectangle( - IN HDC hdc, - IN INT xLeft, - IN INT yTop, - IN INT xRight, - IN INT yBottom -); + _In_ HDC hdc, + _In_ INT xLeft, + _In_ INT yTop, + _In_ INT xRight, + _In_ INT yBottom); W32KAPI BOOL APIENTRY NtGdiRoundRect( - IN HDC hdc, - IN INT x1, - IN INT y1, - IN INT x2, - IN INT y2, - IN INT x3, - IN INT y3 -); + _In_ HDC hdc, + _In_ INT x1, + _In_ INT y1, + _In_ INT x2, + _In_ INT y2, + _In_ INT x3, + _In_ INT y3); W32KAPI BOOL APIENTRY NtGdiPlgBlt( - IN HDC hdcTrg, - IN LPPOINT pptlTrg, - IN HDC hdcSrc, - IN INT xSrc, - IN INT ySrc, - IN INT cxSrc, - IN INT cySrc, - IN HBITMAP hbmMask, - IN INT xMask, - IN INT yMask, - IN DWORD crBackColor -); + _In_ HDC hdcTrg, + _In_ LPPOINT pptlTrg, + _In_ HDC hdcSrc, + _In_ INT xSrc, + _In_ INT ySrc, + _In_ INT cxSrc, + _In_ INT cySrc, + _In_ HBITMAP hbmMask, + _In_ INT xMask, + _In_ INT yMask, + _In_ DWORD crBackColor); W32KAPI BOOL APIENTRY NtGdiMaskBlt( - IN HDC hdc, - IN INT xDst, - IN INT yDst, - IN INT cx, - IN INT cy, - IN HDC hdcSrc, - IN INT xSrc, - IN INT ySrc, - IN HBITMAP hbmMask, - IN INT xMask, - IN INT yMask, - IN DWORD dwRop4, - IN DWORD crBackColor -); + _In_ HDC hdc, + _In_ INT xDst, + _In_ INT yDst, + _In_ INT cx, + _In_ INT cy, + _In_ HDC hdcSrc, + _In_ INT xSrc, + _In_ INT ySrc, + _In_opt_ HBITMAP hbmMask, + _In_ INT xMask, + _In_ INT yMask, + _In_ DWORD dwRop4, + _In_ DWORD crBackColor); W32KAPI BOOL APIENTRY NtGdiExtFloodFill( - IN HDC hdc, - IN INT x, - IN INT y, - IN COLORREF crColor, - IN UINT iFillType -); + _In_ HDC hdc, + _In_ INT x, + _In_ INT y, + _In_ COLORREF crColor, + _In_ UINT iFillType); W32KAPI BOOL APIENTRY NtGdiFillRgn( - IN HDC hdc, - IN HRGN hrgn, - IN HBRUSH hbrush -); + _In_ HDC hdc, + _In_ HRGN hrgn, + _In_ HBRUSH hbrush); W32KAPI BOOL APIENTRY NtGdiFrameRgn( - IN HDC hdc, - IN HRGN hrgn, - IN HBRUSH hbrush, - IN INT xWidth, - IN INT yHeight -); + _In_ HDC hdc, + _In_ HRGN hrgn, + _In_ HBRUSH hbrush, + _In_ INT xWidth, + _In_ INT yHeight); W32KAPI COLORREF APIENTRY NtGdiSetPixel( - IN HDC hdcDst, - IN INT x, - IN INT y, - IN COLORREF crColor -); + _In_ HDC hdcDst, + _In_ INT x, + _In_ INT y, + _In_ COLORREF crColor); W32KAPI DWORD APIENTRY NtGdiGetPixel( - IN HDC hdc, - IN INT x, - IN INT y -); + _In_ HDC hdc, + _In_ INT x, + _In_ INT y); W32KAPI BOOL APIENTRY NtGdiStartPage( - IN HDC hdc -); + _In_ HDC hdc); W32KAPI BOOL APIENTRY NtGdiEndPage( - IN HDC hdc -); + _In_ HDC hdc); W32KAPI INT APIENTRY NtGdiStartDoc( - IN HDC hdc, + _In_ HDC hdc, IN DOCINFOW *pdi, OUT BOOL *pbBanding, - IN INT iJob + _In_ INT iJob ); W32KAPI BOOL APIENTRY NtGdiEndDoc( - IN HDC hdc -); + _In_ HDC hdc); W32KAPI BOOL APIENTRY NtGdiAbortDoc( - IN HDC hdc -); + _In_ HDC hdc); W32KAPI BOOL APIENTRY NtGdiUpdateColors( - IN HDC hdc -); + _In_ HDC hdc); W32KAPI BOOL APIENTRY NtGdiGetCharWidthW( - IN HDC hdc, - IN UINT wcFirst, - IN UINT cwc, + _In_ HDC hdc, + _In_ UINT wcFirst, + _In_ UINT cwc, IN OPTIONAL PWCHAR pwc, - IN FLONG fl, + _In_ FLONG fl, OUT PVOID pvBuf ); @@ -1922,7 +1820,7 @@ BOOL APIENTRY NtGdiGetCharWidthInfo( - IN HDC hdc, + _In_ HDC hdc, OUT PCHWIDTHINFO pChWidthInfo ); @@ -1930,9 +1828,9 @@ INT APIENTRY NtGdiDrawEscape( - IN HDC hdc, - IN INT iEsc, - IN INT cjIn, + _In_ HDC hdc, + _In_ INT iEsc, + _In_ INT cjIn, IN OPTIONAL LPSTR pjIn ); @@ -1940,13 +1838,13 @@ INT APIENTRY NtGdiExtEscape( - IN HDC hdc, + _In_ HDC hdc, IN OPTIONAL PWCHAR pDriver, - IN INT nDriver, - IN INT iEsc, - IN INT cjIn, + _In_ INT nDriver, + _In_ INT iEsc, + _In_ INT cjIn, IN OPTIONAL LPSTR pjIn, - IN INT cjOut, + _In_ INT cjOut, OUT OPTIONAL LPSTR pjOut ); @@ -1954,32 +1852,32 @@ ULONG APIENTRY NtGdiGetFontData( - IN HDC hdc, - IN DWORD dwTable, - IN DWORD dwOffset, + _In_ HDC hdc, + _In_ DWORD dwTable, + _In_ DWORD dwOffset, OUT OPTIONAL PVOID pvBuf, - IN ULONG cjBuf + _In_ ULONG cjBuf ); W32KAPI ULONG APIENTRY NtGdiGetGlyphOutline( - IN HDC hdc, + _In_ HDC hdc, IN WCHAR wch, - IN UINT iFormat, + _In_ UINT iFormat, OUT LPGLYPHMETRICS pgm, - IN ULONG cjBuf, + _In_ ULONG cjBuf, OUT OPTIONAL PVOID pvBuf, IN LPMAT2 pmat2, - IN BOOL bIgnoreRotation + _In_ BOOL bIgnoreRotation ); W32KAPI BOOL APIENTRY NtGdiGetETM( - IN HDC hdc, + _In_ HDC hdc, OUT EXTTEXTMETRIC *petm ); @@ -1988,15 +1886,15 @@ APIENTRY NtGdiGetRasterizerCaps( OUT LPRASTERIZER_STATUS praststat, - IN ULONG cjBytes + _In_ ULONG cjBytes ); W32KAPI ULONG APIENTRY NtGdiGetKerningPairs( - IN HDC hdc, - IN ULONG cPairs, + _In_ HDC hdc, + _In_ ULONG cPairs, OUT OPTIONAL KERNINGPAIR *pkpDst ); @@ -2004,14 +1902,13 @@ BOOL APIENTRY NtGdiMonoBitmap( - IN HBITMAP hbm -); + _In_ HBITMAP hbm); W32KAPI HBITMAP APIENTRY NtGdiGetObjectBitmapHandle( - IN HBRUSH hbr, + _In_ HBRUSH hbr, OUT UINT *piUsage ); @@ -2019,9 +1916,9 @@ ULONG APIENTRY NtGdiEnumObjects( - IN HDC hdc, - IN INT iObjectType, - IN ULONG cjBuf, + _In_ HDC hdc, + _In_ INT iObjectType, + _In_ ULONG cjBuf, OUT OPTIONAL PVOID pvBuf ); @@ -2038,8 +1935,8 @@ BOOL APIENTRY NtGdiResetDC( - IN HDC hdc, - IN LPDEVMODEW pdm, + _In_ HDC hdc, + _In_ LPDEVMODEW pdm, OUT PBOOL pbBanding, IN OPTIONAL VOID *pDriverInfo2, // this is "typedef struct _DRIVER_INFO_2W DRIVER_INFO_2W;" OUT VOID *ppUMdhpdev @@ -2049,33 +1946,29 @@ DWORD APIENTRY NtGdiSetBoundsRect( - IN HDC hdc, - IN LPRECT prc, - IN DWORD f -); + _In_ HDC hdc, + _In_ LPRECT prc, + _In_ DWORD f); W32KAPI BOOL APIENTRY NtGdiGetColorAdjustment( - IN HDC hdc, - OUT PCOLORADJUSTMENT pcaOut -); + _In_ HDC hdc, + _Out_ PCOLORADJUSTMENT pcaOut); W32KAPI BOOL APIENTRY NtGdiSetColorAdjustment( - IN HDC hdc, - IN PCOLORADJUSTMENT pca -); + _In_ HDC hdc, + _In_ PCOLORADJUSTMENT pca); W32KAPI BOOL APIENTRY NtGdiCancelDC( - IN HDC hdc -); + _In_ HDC hdc); W32KAPI HDC @@ -2084,8 +1977,8 @@ IN OPTIONAL PUNICODE_STRING pustrDevice, IN DEVMODEW *pdm, // See note for NtGdiResetDC IN PUNICODE_STRING pustrLogAddr, - IN ULONG iType, - IN BOOL bDisplay, + _In_ ULONG iType, + _In_ BOOL bDisplay, IN OPTIONAL HANDLE hspool, IN OPTIONAL VOID *pDriverInfo2, // this is "typedef struct _DRIVER_INFO_2W DRIVER_INFO_2W;" OUT VOID *pUMdhpdev @@ -2095,8 +1988,8 @@ BOOL APIENTRY NtGdiGetDCDword( - IN HDC hdc, - IN UINT u, + _In_ HDC hdc, + _In_ UINT u, OUT DWORD *Result ); @@ -2104,20 +1997,19 @@ BOOL APIENTRY NtGdiGetDCPoint( - IN HDC hdc, - IN UINT iPoint, - OUT PPOINTL pptOut -); + _In_ HDC hdc, + _In_ UINT iPoint, + _Out_ PPOINTL pptOut); W32KAPI BOOL APIENTRY NtGdiScaleViewportExtEx( - IN HDC hdc, - IN INT xNum, - IN INT xDenom, - IN INT yNum, - IN INT yDenom, + _In_ HDC hdc, + _In_ INT xNum, + _In_ INT xDenom, + _In_ INT yNum, + _In_ INT yDenom, OUT OPTIONAL LPSIZE pszOut ); @@ -2125,11 +2017,11 @@ BOOL APIENTRY NtGdiScaleWindowExtEx( - IN HDC hdc, - IN INT xNum, - IN INT xDenom, - IN INT yNum, - IN INT yDenom, + _In_ HDC hdc, + _In_ INT xNum, + _In_ INT xDenom, + _In_ INT yNum, + _In_ INT yDenom, OUT OPTIONAL LPSIZE pszOut ); @@ -2137,83 +2029,76 @@ BOOL APIENTRY NtGdiSetVirtualResolution( - IN HDC hdc, - IN INT cxVirtualDevicePixel, - IN INT cyVirtualDevicePixel, - IN INT cxVirtualDeviceMm, - IN INT cyVirtualDeviceMm -); + _In_ HDC hdc, + _In_ INT cxVirtualDevicePixel, + _In_ INT cyVirtualDevicePixel, + _In_ INT cxVirtualDeviceMm, + _In_ INT cyVirtualDeviceMm); W32KAPI BOOL APIENTRY NtGdiSetSizeDevice( - IN HDC hdc, - IN INT cxVirtualDevice, - IN INT cyVirtualDevice -); + _In_ HDC hdc, + _In_ INT cxVirtualDevice, + _In_ INT cyVirtualDevice); W32KAPI BOOL APIENTRY NtGdiGetTransform( - IN HDC hdc, - IN DWORD iXform, - OUT LPXFORM pxf -); + _In_ HDC hdc, + _In_ DWORD iXform, + _Out_ LPXFORM pxf); W32KAPI BOOL APIENTRY NtGdiModifyWorldTransform( - IN HDC hdc, - IN OPTIONAL LPXFORM pxf, - IN DWORD iXform -); + _In_ HDC hdc, + _In_opt_ LPXFORM pxf, + _In_ DWORD iXform); W32KAPI BOOL APIENTRY NtGdiCombineTransform( - OUT LPXFORM pxfDst, - IN LPXFORM pxfSrc1, - IN LPXFORM pxfSrc2 -); + _Out_ LPXFORM pxfDst, + _In_ LPXFORM pxfSrc1, + _In_ LPXFORM pxfSrc2); W32KAPI BOOL APIENTRY NtGdiTransformPoints( - IN HDC hdc, - IN PPOINT pptIn, - OUT PPOINT pptOut, - IN INT c, - IN INT iMode -); + _In_ HDC hdc, + _In_reads_(c) PPOINT pptIn, + _Out_writes_(c) PPOINT pptOut, + _In_ INT c, + _In_ INT iMode); W32KAPI LONG APIENTRY NtGdiConvertMetafileRect( - IN HDC hdc, - IN OUT PRECTL prect -); + _In_ HDC hdc, + _Inout_ PRECTL prect); W32KAPI INT APIENTRY NtGdiGetTextCharsetInfo( - IN HDC hdc, + _In_ HDC hdc, OUT OPTIONAL LPFONTSIGNATURE lpSig, - IN DWORD dwFlags + _In_ DWORD dwFlags ); W32KAPI BOOL APIENTRY NtGdiDoBanding( - IN HDC hdc, - IN BOOL bStart, + _In_ HDC hdc, + _In_ BOOL bStart, OUT POINTL *pptl, OUT PSIZE pSize ); @@ -2222,7 +2107,7 @@ ULONG APIENTRY NtGdiGetPerBandInfo( - IN HDC hdc, + _In_ HDC hdc, IN OUT PERBANDINFO *ppbi ); @@ -2230,545 +2115,490 @@ NTSTATUS APIENTRY NtGdiGetStats( - IN HANDLE hProcess, - IN INT iIndex, - IN INT iPidType, + _In_ HANDLE hProcess, + _In_ INT iIndex, + _In_ INT iPidType, OUT PVOID pResults, - IN UINT cjResultSize + _In_ UINT cjResultSize ); W32KAPI BOOL APIENTRY NtGdiSetMagicColors( - IN HDC hdc, + _In_ HDC hdc, IN PALETTEENTRY peMagic, - IN ULONG Index + _In_ ULONG Index ); W32KAPI HBRUSH APIENTRY NtGdiSelectBrush( - IN HDC hdc, - IN HBRUSH hbrush + _In_ HDC hdc, + _In_ HBRUSH hbrush ); W32KAPI HPEN APIENTRY NtGdiSelectPen( - IN HDC hdc, - IN HPEN hpen -); + _In_ HDC hdc, + _In_ HPEN hpen); W32KAPI HBITMAP APIENTRY NtGdiSelectBitmap( - IN HDC hdc, - IN HBITMAP hbm -); + _In_ HDC hdc, + _In_ HBITMAP hbm); W32KAPI HFONT APIENTRY NtGdiSelectFont( - IN HDC hdc, - IN HFONT hf -); + _In_ HDC hdc, + _In_ HFONT hf); W32KAPI INT APIENTRY NtGdiExtSelectClipRgn( - IN HDC hdc, - IN HRGN hrgn, - IN INT iMode -); + _In_ HDC hdc, + _In_ HRGN hrgn, + _In_ INT iMode); W32KAPI HPEN APIENTRY NtGdiCreatePen( - IN INT iPenStyle, - IN INT iPenWidth, - IN COLORREF cr, - IN HBRUSH hbr -); + _In_ INT iPenStyle, + _In_ INT iPenWidth, + _In_ COLORREF cr, + _In_ HBRUSH hbr); #ifdef _WINDOWBLT_NOTIFICATION_ W32KAPI BOOL APIENTRY NtGdiBitBlt( - IN HDC hdcDst, - IN INT x, - IN INT y, - IN INT cx, - IN INT cy, - IN HDC hdcSrc, - IN INT xSrc, - IN INT ySrc, - IN DWORD rop4, - IN DWORD crBackColor, - IN FLONG fl -); + _In_ HDC hdcDst, + _In_ INT x, + _In_ INT y, + _In_ INT cx, + _In_ INT cy, + _In_ HDC hdcSrc, + _In_ INT xSrc, + _In_ INT ySrc, + _In_ DWORD rop4, + _In_ DWORD crBackColor, + _In_ FLONG fl); #else W32KAPI BOOL APIENTRY NtGdiBitBlt( - IN HDC hdcDst, - IN INT x, - IN INT y, - IN INT cx, - IN INT cy, - IN HDC hdcSrc, - IN INT xSrc, - IN INT ySrc, - IN DWORD rop4, - IN DWORD crBackColor -); + _In_ HDC hdcDst, + _In_ INT x, + _In_ INT y, + _In_ INT cx, + _In_ INT cy, + _In_ HDC hdcSrc, + _In_ INT xSrc, + _In_ INT ySrc, + _In_ DWORD rop4, + _In_ DWORD crBackColor); #endif W32KAPI BOOL APIENTRY NtGdiTileBitBlt( - IN HDC hdcDst, - IN RECTL * prectDst, - IN HDC hdcSrc, - IN RECTL * prectSrc, - IN POINTL * pptlOrigin, - IN DWORD rop4, - IN DWORD crBackColor -); + _In_ HDC hdcDst, + _In_ RECTL *prectDst, + _In_ HDC hdcSrc, + _In_ RECTL *prectSrc, + _In_ POINTL *pptlOrigin, + _In_ DWORD rop4, + _In_ DWORD crBackColor); W32KAPI BOOL APIENTRY NtGdiTransparentBlt( - IN HDC hdcDst, - IN INT xDst, - IN INT yDst, - IN INT cxDst, - IN INT cyDst, - IN HDC hdcSrc, - IN INT xSrc, - IN INT ySrc, - IN INT cxSrc, - IN INT cySrc, - IN COLORREF TransColor -); + _In_ HDC hdcDst, + _In_ INT xDst, + _In_ INT yDst, + _In_ INT cxDst, + _In_ INT cyDst, + _In_ HDC hdcSrc, + _In_ INT xSrc, + _In_ INT ySrc, + _In_ INT cxSrc, + _In_ INT cySrc, + _In_ COLORREF TransColor); W32KAPI BOOL APIENTRY NtGdiGetTextExtent( - IN HDC hdc, - IN LPWSTR lpwsz, - IN INT cwc, - OUT LPSIZE psize, - IN UINT flOpts -); + _In_ HDC hdc, + _In_z_count_(cwc) LPWSTR lpwsz, + _In_ INT cwc, + _Out_ LPSIZE psize, + _In_ UINT flOpts); W32KAPI BOOL APIENTRY NtGdiGetTextMetricsW( - IN HDC hdc, - OUT TMW_INTERNAL * ptm, - IN ULONG cj -); + _In_ HDC hdc, + _Out_bytecap_(cj) TMW_INTERNAL * ptm, + _In_ ULONG cj); W32KAPI INT APIENTRY NtGdiGetTextFaceW( - IN HDC hdc, - IN INT cChar, + _In_ HDC hdc, + _In_ INT cChar, OUT OPTIONAL LPWSTR pszOut, - IN BOOL bAliasName + _In_ BOOL bAliasName ); W32KAPI INT APIENTRY NtGdiGetRandomRgn( - IN HDC hdc, - IN HRGN hrgn, - IN INT iRgn -); + _In_ HDC hdc, + _In_ HRGN hrgn, + _In_ INT iRgn); W32KAPI BOOL APIENTRY NtGdiExtTextOutW( - IN HDC hdc, - IN INT x, - IN INT y, - IN UINT flOpts, + _In_ HDC hdc, + _In_ INT x, + _In_ INT y, + _In_ UINT flOpts, IN OPTIONAL LPRECT prcl, - IN LPWSTR pwsz, - IN INT cwc, + _In_z_count_(cwc) LPWSTR pwsz, + _In_ INT cwc, IN OPTIONAL LPINT pdx, - IN DWORD dwCodePage + _In_ DWORD dwCodePage ); W32KAPI INT APIENTRY NtGdiIntersectClipRect( - IN HDC hdc, - IN INT xLeft, - IN INT yTop, - IN INT xRight, - IN INT yBottom -); + _In_ HDC hdc, + _In_ INT xLeft, + _In_ INT yTop, + _In_ INT xRight, + _In_ INT yBottom); W32KAPI HRGN APIENTRY NtGdiCreateRectRgn( - IN INT xLeft, - IN INT yTop, - IN INT xRight, - IN INT yBottom -); + _In_ INT xLeft, + _In_ INT yTop, + _In_ INT xRight, + _In_ INT yBottom); W32KAPI BOOL APIENTRY NtGdiPatBlt( - IN HDC hdcDst, - IN INT x, - IN INT y, - IN INT cx, - IN INT cy, - IN DWORD rop4 -); + _In_ HDC hdcDest, + _In_ INT x, + _In_ INT y, + _In_ INT cx, + _In_ INT cy, + _In_ DWORD dwRop); W32KAPI BOOL APIENTRY NtGdiPolyPatBlt( - IN HDC hdc, - IN DWORD rop4, - IN PPOLYPATBLT pPoly, - IN DWORD Count, - IN DWORD Mode -); + _In_ HDC hdc, + _In_ DWORD rop4, + _In_ PPOLYPATBLT pPoly, + _In_ DWORD Count, + _In_ DWORD Mode); W32KAPI BOOL APIENTRY NtGdiUnrealizeObject( - IN HANDLE h -); + _In_ HANDLE h); W32KAPI HANDLE APIENTRY NtGdiGetStockObject( - IN INT iObject -); + _In_ INT iObject); W32KAPI HBITMAP APIENTRY NtGdiCreateCompatibleBitmap( - IN HDC hdc, - IN INT cx, - IN INT cy -); + _In_ HDC hdc, + _In_ INT cx, + _In_ INT cy); W32KAPI BOOL APIENTRY NtGdiLineTo( - IN HDC hdc, - IN INT x, - IN INT y -); - -W32KAPI -BOOL + _In_ HDC hdc, + _In_ INT x, + _In_ INT y); + +W32KAPI +BOOL _Success_(return != FALSE) APIENTRY NtGdiMoveTo( - IN HDC hdc, - IN INT x, - IN INT y, - OUT OPTIONAL LPPOINT pptOut -); + _In_ HDC hdc, + _In_ INT x, + _In_ INT y, + _Out_opt_ LPPOINT pptOut); W32KAPI INT APIENTRY NtGdiExtGetObjectW( - IN HANDLE h, - IN INT cj, - OUT OPTIONAL LPVOID pvOut -); + _In_ HANDLE h, + _In_ INT cj, + _Out_opt_bytecap_(cj) LPVOID pvOut); W32KAPI INT APIENTRY NtGdiGetDeviceCaps( - IN HDC hdc, - IN INT i -); + _In_ HDC hdc, + _In_ INT i); W32KAPI BOOL APIENTRY NtGdiGetDeviceCapsAll ( - IN HDC hdc, - OUT PDEVCAPS pDevCaps -); + _In_ HDC hdc, + _Out_ PDEVCAPS pDevCaps); W32KAPI BOOL APIENTRY NtGdiStretchBlt( - IN HDC hdcDst, - IN INT xDst, - IN INT yDst, - IN INT cxDst, - IN INT cyDst, - IN HDC hdcSrc, - IN INT xSrc, - IN INT ySrc, - IN INT cxSrc, - IN INT cySrc, - IN DWORD dwRop, - IN DWORD dwBackColor -); - -W32KAPI -BOOL + _In_ HDC hdcDst, + _In_ INT xDst, + _In_ INT yDst, + _In_ INT cxDst, + _In_ INT cyDst, + _In_ HDC hdcSrc, + _In_ INT xSrc, + _In_ INT ySrc, + _In_ INT cxSrc, + _In_ INT cySrc, + _In_ DWORD dwRop, + _In_ DWORD dwBackColor); + +W32KAPI +BOOL _Success_(return != FALSE) APIENTRY NtGdiSetBrushOrg( - IN HDC hdc, - IN INT x, - IN INT y, - OUT LPPOINT pptOut -); + _In_ HDC hdc, + _In_ INT x, + _In_ INT y, + _Out_opt_ LPPOINT pptOut); W32KAPI HBITMAP APIENTRY NtGdiCreateBitmap( - IN INT cx, - IN INT cy, - IN UINT cPlanes, - IN UINT cBPP, - IN OPTIONAL LPBYTE pjInit -); + _In_ INT cx, + _In_ INT cy, + _In_ UINT cPlanes, + _In_ UINT cBPP, + _In_opt_ LPBYTE pjInit); W32KAPI HPALETTE APIENTRY NtGdiCreateHalftonePalette( - IN HDC hdc -); + _In_ HDC hdc); W32KAPI BOOL APIENTRY NtGdiRestoreDC( - IN HDC hdc, - IN INT iLevel -); + _In_ HDC hdc, + _In_ INT iLevel); W32KAPI INT APIENTRY NtGdiExcludeClipRect( - IN HDC hdc, - IN INT xLeft, - IN INT yTop, - IN INT xRight, - IN INT yBottom -); + _In_ HDC hdc, + _In_ INT xLeft, + _In_ INT yTop, + _In_ INT xRight, + _In_ INT yBottom); W32KAPI INT APIENTRY NtGdiSaveDC( - IN HDC hdc -); + _In_ HDC hdc); W32KAPI INT APIENTRY NtGdiCombineRgn( - IN HRGN hrgnDst, - IN HRGN hrgnSrc1, - IN HRGN hrgnSrc2, - IN INT iMode -); + _In_ HRGN hrgnDst, + _In_ HRGN hrgnSrc1, + _In_opt_ HRGN hrgnSrc2, + _In_ INT iMode); W32KAPI BOOL APIENTRY NtGdiSetRectRgn( - IN HRGN hrgn, - IN INT xLeft, - IN INT yTop, - IN INT xRight, - IN INT yBottom -); + _In_ HRGN hrgn, + _In_ INT xLeft, + _In_ INT yTop, + _In_ INT xRight, + _In_ INT yBottom); W32KAPI LONG APIENTRY NtGdiSetBitmapBits( - IN HBITMAP hbm, - IN ULONG cj, - IN PBYTE pjInit -); + _In_ HBITMAP hbm, + _In_ ULONG cj, + _In_bytecount_(cj) PBYTE pjInit); W32KAPI INT APIENTRY NtGdiGetDIBitsInternal( - IN HDC hdc, - IN HBITMAP hbm, - IN UINT iStartScan, - IN UINT cScans, - OUT OPTIONAL LPBYTE pBits, - IN OUT LPBITMAPINFO pbmi, - IN UINT iUsage, - IN UINT cjMaxBits, - IN UINT cjMaxInfo -); + _In_ HDC hdc, + _In_ HBITMAP hbm, + _In_ UINT iStartScan, + _In_ UINT cScans, + _Out_opt_ LPBYTE pBits, + _Inout_ LPBITMAPINFO pbmi, + _In_ UINT iUsage, + _In_ UINT cjMaxBits, + _In_ UINT cjMaxInfo); W32KAPI INT APIENTRY NtGdiOffsetRgn( - IN HRGN hrgn, - IN INT cx, - IN INT cy -); + _In_ HRGN hrgn, + _In_ INT cx, + _In_ INT cy); W32KAPI INT APIENTRY -NtGdiGetRandomRgn( - IN HDC hDC, - OUT HRGN hDest, - IN INT iCode -); - -W32KAPI +NtGdiGetRgnBox( + _In_ HRGN hrgn, + _Out_ LPRECT prcOut); + +W32KAPI +BOOL +APIENTRY +NtGdiRectInRegion( + _In_ HRGN hrgn, + IN OUT LPRECT prcl +); + +W32KAPI +DWORD +APIENTRY +NtGdiGetBoundsRect( + _In_ HDC hdc, + _Out_ LPRECT prc, + _In_ DWORD f); + +W32KAPI +BOOL +APIENTRY +NtGdiPtInRegion( + _In_ HRGN hrgn, + _In_ INT x, + _In_ INT y); + +W32KAPI +COLORREF +APIENTRY +NtGdiGetNearestColor( + _In_ HDC hdc, + _In_ COLORREF cr); + +W32KAPI +UINT +APIENTRY +NtGdiGetSystemPaletteUse( + _In_ HDC hdc); + +W32KAPI +UINT +APIENTRY +NtGdiSetSystemPaletteUse( + _In_ HDC hdc, + _In_ UINT ui); + +W32KAPI +DWORD +APIENTRY +NtGdiGetRegionData( + _In_ HRGN hrgn, + _In_ DWORD nCount, + _Out_opt_ LPRGNDATA lpRgnData); + +W32KAPI +BOOL +APIENTRY +NtGdiInvertRgn( + _In_ HDC hdc, + _In_ HRGN hrgn); + INT -APIENTRY -NtGdiGetRgnBox( - IN HRGN hrgn, - OUT LPRECT prcOut -); - -W32KAPI -BOOL -APIENTRY -NtGdiRectInRegion( - IN HRGN hrgn, - IN OUT LPRECT prcl -); - -W32KAPI -DWORD -APIENTRY -NtGdiGetBoundsRect( - IN HDC hdc, - OUT LPRECT prc, - IN DWORD f -); - -W32KAPI -BOOL -APIENTRY -NtGdiPtInRegion( - IN HRGN hrgn, - IN INT x, - IN INT y -); - -W32KAPI -COLORREF -APIENTRY -NtGdiGetNearestColor( - IN HDC hdc, - IN COLORREF cr -); - -W32KAPI -UINT -APIENTRY -NtGdiGetSystemPaletteUse( - IN HDC hdc -); - -W32KAPI -UINT -APIENTRY -NtGdiSetSystemPaletteUse( - IN HDC hdc, - IN UINT ui -); - -W32KAPI -DWORD -APIENTRY -NtGdiGetRegionData( - IN HRGN hrgn, - IN DWORD nCount, - OUT OPTIONAL LPRGNDATA lpRgnData -); - -W32KAPI -BOOL -APIENTRY -NtGdiInvertRgn( - IN HDC hdc, - IN HRGN hrgn -); - -INT W32KAPI APIENTRY NtGdiAddFontResourceW( - IN WCHAR *pwszFiles, - IN ULONG cwc, - IN ULONG cFiles, - IN FLONG f, - IN DWORD dwPidTid, - IN OPTIONAL DESIGNVECTOR *pdv -); + _In_z_count_(cwc) WCHAR *pwszFiles, + _In_ ULONG cwc, + _In_ ULONG cFiles, + _In_ FLONG f, + _In_ DWORD dwPidTid, + _In_opt_ DESIGNVECTOR *pdv); #if (_WIN32_WINNT >= 0x0500) W32KAPI HFONT APIENTRY NtGdiHfontCreate( - IN ENUMLOGFONTEXDVW *pelfw, - IN ULONG cjElfw, - IN LFTYPE lft, - IN FLONG fl, - IN PVOID pvCliData -); + _In_bytecount_(cjElfw) ENUMLOGFONTEXDVW *pelfw, + _In_ ULONG cjElfw, + _In_ LFTYPE lft, + _In_ FLONG fl, + _In_ PVOID pvCliData); #else W32KAPI HFONT APIENTRY NtGdiHfontCreate( - IN LPEXTLOGFONTW pelfw, - IN ULONG cjElfw, - IN LFTYPE lft, - IN FLONG fl, - IN PVOID pvCliData + _In_bytecount_(cjElfw) LPEXTLOGFONTW pelfw, + _In_ ULONG cjElfw, + _In_ LFTYPE lft, + _In_ FLONG fl, + _In_ PVOID pvCliData ); #endif @@ -2776,24 +2606,22 @@ ULONG APIENTRY NtGdiSetFontEnumeration( - IN ULONG ulType -); + _In_ ULONG ulType); W32KAPI BOOL APIENTRY NtGdiEnumFontClose( - IN ULONG_PTR idEnum -); + _In_ ULONG_PTR idEnum); #if (_WIN32_WINNT >= 0x0500) W32KAPI BOOL APIENTRY NtGdiEnumFontChunk( - IN HDC hdc, - IN ULONG_PTR idEnum, - IN ULONG cjEfdw, + _In_ HDC hdc, + _In_ ULONG_PTR idEnum, + _In_ ULONG cjEfdw, OUT ULONG *pcjEfdw, OUT PENUMFONTDATAW pefdw ); @@ -2803,12 +2631,12 @@ ULONG_PTR APIENTRY NtGdiEnumFontOpen( - IN HDC hdc, - IN ULONG iEnumType, - IN FLONG flWin31Compat, - IN ULONG cwchMax, + _In_ HDC hdc, + _In_ ULONG iEnumType, + _In_ FLONG flWin31Compat, + _In_ ULONG cwchMax, IN OPTIONAL LPWSTR pwszFaceName, - IN ULONG lfCharSet, + _In_ ULONG lfCharSet, OUT ULONG *pulCount ); @@ -2817,7 +2645,7 @@ APIENTRY NtGdiQueryFonts( OUT PUNIVERSAL_FONT_ID pufiFontList, - IN ULONG nBufferSize, + _In_ ULONG nBufferSize, OUT PLARGE_INTEGER pTimeStamp ); @@ -2825,11 +2653,10 @@ BOOL APIENTRY NtGdiConsoleTextOut( - IN HDC hdc, - IN POLYTEXTW *lpto, - IN UINT nStrings, - IN RECTL *prclBounds -); + _In_ HDC hdc, + _In_ POLYTEXTW *lpto, + _In_ UINT nStrings, + _In_ RECTL *prclBounds); W32KAPI NTSTATUS @@ -2837,7 +2664,7 @@ NtGdiFullscreenControl( IN FULLSCREENCONTROL FullscreenCommand, IN PVOID FullscreenInput, - IN DWORD FullscreenInputLength, + _In_ DWORD FullscreenInputLength, OUT PVOID FullscreenOutput, IN OUT PULONG FullscreenOutputLength ); @@ -2846,64 +2673,59 @@ DWORD APIENTRY NtGdiGetCharSet( - IN HDC hdc -); + _In_ HDC hdc); W32KAPI BOOL APIENTRY NtGdiEnableEudc( - IN BOOL -); + _In_ BOOL b); W32KAPI BOOL APIENTRY NtGdiEudcLoadUnloadLink( IN OPTIONAL LPCWSTR pBaseFaceName, - IN UINT cwcBaseFaceName, + _In_ UINT cwcBaseFaceName, IN LPCWSTR pEudcFontPath, - IN UINT cwcEudcFontPath, - IN INT iPriority, - IN INT iFontLinkType, - IN BOOL bLoadLin + _In_ UINT cwcEudcFontPath, + _In_ INT iPriority, + _In_ INT iFontLinkType, + _In_ BOOL bLoadLin ); W32KAPI UINT APIENTRY NtGdiGetStringBitmapW( - IN HDC hdc, + _In_ HDC hdc, IN LPWSTR pwsz, - IN UINT cwc, + _In_ UINT cwc, OUT BYTE *lpSB, - IN UINT cj + _In_ UINT cj ); W32KAPI ULONG APIENTRY NtGdiGetEudcTimeStampEx( - IN OPTIONAL LPWSTR lpBaseFaceName, - IN ULONG cwcBaseFaceName, - IN BOOL bSystemTimeStamp -); + _In_opt_z_count_(cwcBaseFaceName) LPWSTR lpBaseFaceName, + _In_ ULONG cwcBaseFaceName, + _In_ BOOL bSystemTimeStamp); W32KAPI ULONG APIENTRY NtGdiQueryFontAssocInfo( - IN HDC hdc -); + _In_ HDC hdc); #if (_WIN32_WINNT >= 0x0500) W32KAPI DWORD APIENTRY NtGdiGetFontUnicodeRanges( - IN HDC hdc, - OUT OPTIONAL LPGLYPHSET pgs -); + _In_ HDC hdc, + _Out_opt_ LPGLYPHSET pgs); #endif #ifdef LANGPACK @@ -2911,185 +2733,167 @@ BOOL APIENTRY NtGdiGetRealizationInfo( - IN HDC hdc, - OUT PREALIZATION_INFO pri, - IN HFONT hf -); + _In_ HDC hdc, + _Out_ PREALIZATION_INFO pri, + _In_ HFONT hf); #endif W32KAPI BOOL APIENTRY NtGdiAddRemoteMMInstanceToDC( - IN HDC hdc, - IN DOWNLOADDESIGNVECTOR *pddv, - IN ULONG cjDDV -); + _In_ HDC hdc, + _In_ DOWNLOADDESIGNVECTOR *pddv, + _In_ ULONG cjDDV); W32KAPI BOOL APIENTRY NtGdiUnloadPrinterDriver( - IN LPWSTR pDriverName, - IN ULONG cbDriverName -); + _In_z_bytecount_(cbDriverName) LPWSTR pDriverName, + _In_ ULONG cbDriverName); W32KAPI BOOL APIENTRY NtGdiEngAssociateSurface( - IN HSURF hsurf, - IN HDEV hdev, - IN FLONG flHooks -); + _In_ HSURF hsurf, + _In_ HDEV hdev, + _In_ FLONG flHooks); W32KAPI BOOL APIENTRY NtGdiEngEraseSurface( - IN SURFOBJ *pso, - IN RECTL *prcl, - IN ULONG iColor -); + _In_ SURFOBJ *pso, + _In_ RECTL *prcl, + _In_ ULONG iColor); W32KAPI HBITMAP APIENTRY NtGdiEngCreateBitmap( - IN SIZEL sizl, - IN LONG lWidth, - IN ULONG iFormat, - IN FLONG fl, - IN OPTIONAL PVOID pvBits -); + _In_ SIZEL sizl, + _In_ LONG lWidth, + _In_ ULONG iFormat, + _In_ FLONG fl, + _In_opt_ PVOID pvBits); W32KAPI BOOL APIENTRY NtGdiEngDeleteSurface( - IN HSURF hsurf -); + _In_ HSURF hsurf); W32KAPI SURFOBJ* APIENTRY NtGdiEngLockSurface( - IN HSURF hsurf -); + _In_ HSURF hsurf); W32KAPI VOID APIENTRY NtGdiEngUnlockSurface( - IN SURFOBJ * -); + _In_ SURFOBJ *pso); W32KAPI BOOL APIENTRY NtGdiEngMarkBandingSurface( - IN HSURF hsurf -); + _In_ HSURF hsurf); W32KAPI HSURF APIENTRY NtGdiEngCreateDeviceSurface( - IN DHSURF dhsurf, - IN SIZEL sizl, - IN ULONG iFormatCompat -); + _In_ DHSURF dhsurf, + _In_ SIZEL sizl, + _In_ ULONG iFormatCompat); W32KAPI HBITMAP APIENTRY NtGdiEngCreateDeviceBitmap( - IN DHSURF dhsurf, - IN SIZEL sizl, - IN ULONG iFormatCompat -); + _In_ DHSURF dhsurf, + _In_ SIZEL sizl, + _In_ ULONG iFormatCompat); W32KAPI BOOL APIENTRY NtGdiEngCopyBits( - IN SURFOBJ *psoDst, - IN SURFOBJ *psoSrc, - IN OPTIONAL CLIPOBJ *pco, - IN XLATEOBJ *pxlo, - IN RECTL *prclDst, - IN POINTL *pptlSrc -); + _In_ SURFOBJ *psoDst, + _In_ SURFOBJ *psoSrc, + _In_opt_ CLIPOBJ *pco, + _In_opt_ XLATEOBJ *pxlo, + _In_ RECTL *prclDst, + _In_ POINTL *pptlSrc); W32KAPI BOOL APIENTRY NtGdiEngStretchBlt( - IN SURFOBJ *psoDest, - IN SURFOBJ *psoSrc, - IN SURFOBJ *psoMask, - IN CLIPOBJ *pco, - IN XLATEOBJ *pxlo, - IN COLORADJUSTMENT *pca, - IN POINTL *pptlHTOrg, - IN RECTL *prclDest, - IN RECTL *prclSrc, - IN POINTL *pptlMask, - IN ULONG iMode -); + _In_ SURFOBJ *psoDest, + _In_ SURFOBJ *psoSrc, + _In_opt_ SURFOBJ *psoMask, + _In_opt_ CLIPOBJ *pco, + _In_opt_ XLATEOBJ *pxlo, + _In_opt_ COLORADJUSTMENT *pca, + _In_ POINTL *pptlHTOrg, + _In_ RECTL *prclDest, + _In_ RECTL *prclSrc, + _When_(psoMask, _In_) POINTL *pptlMask, + _In_ ULONG iMode); W32KAPI BOOL APIENTRY NtGdiEngBitBlt( - IN SURFOBJ *psoDst, - IN SURFOBJ *psoSrc, - IN SURFOBJ *psoMask, - IN CLIPOBJ *pco, - IN XLATEOBJ *pxlo, - IN RECTL *prclDst, - IN POINTL *pptlSrc, - IN POINTL *pptlMask, - IN BRUSHOBJ *pbo, - IN POINTL *pptlBrush, - IN ROP4 rop4 -); + _In_ SURFOBJ *psoTrg, + _In_opt_ SURFOBJ *psoSrc, + _In_opt_ SURFOBJ *psoMask, + _In_opt_ CLIPOBJ *pco, + _In_opt_ XLATEOBJ *pxlo, + _In_ RECTL *prclTrg, + _When_(psoSrc, _In_) POINTL *pptlSrc, + _When_(psoMask, _In_) POINTL *pptlMask, + _In_opt_ BRUSHOBJ *pbo, + _When_(pbo, _In_) POINTL *pptlBrush, + _In_ ROP4 rop4); W32KAPI BOOL APIENTRY NtGdiEngPlgBlt( - IN SURFOBJ *psoTrg, - IN SURFOBJ *psoSrc, - IN OPTIONAL SURFOBJ *psoMsk, - IN CLIPOBJ *pco, - IN XLATEOBJ *pxlo, - IN COLORADJUSTMENT *pca, - IN POINTL *pptlBrushOrg, - IN POINTFIX *pptfxDest, - IN RECTL *prclSrc, - IN OPTIONAL POINTL *pptlMask, - IN ULONG iMode -); + _In_ SURFOBJ *psoTrg, + _In_ SURFOBJ *psoSrc, + _In_opt_ SURFOBJ *psoMsk, + _In_ CLIPOBJ *pco, + _In_opt_ XLATEOBJ *pxlo, + _In_ COLORADJUSTMENT *pca, + _In_ POINTL *pptlBrushOrg, + _In_ POINTFIX *pptfx, + _In_ RECTL *prcl, + _When_(psoMsk, _In_) POINTL *pptl, + _In_ ULONG iMode); W32KAPI HPALETTE APIENTRY NtGdiEngCreatePalette( - IN ULONG iMode, - IN ULONG cColors, - IN ULONG *pulColors, - IN FLONG flRed, - IN FLONG flGreen, - IN FLONG flBlue -); + _In_ ULONG iMode, + _In_ ULONG cColors, + _In_ ULONG *pulColors, + _In_ FLONG flRed, + _In_ FLONG flGreen, + _In_ FLONG flBlue); W32KAPI BOOL APIENTRY NtGdiEngDeletePalette( - IN HPALETTE hPal -); + _In_ HPALETTE hPal); W32KAPI BOOL @@ -3151,10 +2955,10 @@ IN SURFOBJ *pso, IN CLIPOBJ *pco, IN BRUSHOBJ *pbo, - IN LONG x1, - IN LONG y1, - IN LONG x2, - IN LONG y2, + _In_ LONG x1, + _In_ LONG y1, + _In_ LONG x2, + _In_ LONG y2, IN RECTL *prclBounds, IN MIX mix ); @@ -3180,12 +2984,12 @@ IN CLIPOBJ *pco, IN XLATEOBJ *pxlo, IN TRIVERTEX *pVertex, - IN ULONG nVertex, + _In_ ULONG nVertex, IN PVOID pMesh, - IN ULONG nMesh, + _In_ ULONG nMesh, IN RECTL *prclExtents, IN POINTL *pptlDitherOrg, - IN ULONG ulMode + _In_ ULONG ulMode ); W32KAPI @@ -3198,8 +3002,8 @@ IN XLATEOBJ *pxlo, IN RECTL *prclDst, IN RECTL *prclSrc, - IN ULONG iTransColor, - IN ULONG ulReserved + _In_ ULONG iTransColor, + _In_ ULONG ulReserved ); W32KAPI @@ -3232,7 +3036,7 @@ IN RECTL *prclTrg, IN RECTL *prclSrc, IN POINTL *pptlMask, - IN ULONG iMode, + _In_ ULONG iMode, IN BRUSHOBJ *pbo, IN ROP4 rop4 ); @@ -3242,8 +3046,8 @@ APIENTRY NtGdiXLATEOBJ_cGetPalette( IN XLATEOBJ *pxlo, - IN ULONG iPal, - IN ULONG cPal, + _In_ ULONG iPal, + _In_ ULONG cPal, OUT ULONG *pPal ); @@ -3252,10 +3056,10 @@ APIENTRY NtGdiCLIPOBJ_cEnumStart( IN CLIPOBJ *pco, - IN BOOL bAll, - IN ULONG iType, - IN ULONG iDirection, - IN ULONG cLimit + _In_ BOOL bAll, + _In_ ULONG iType, + _In_ ULONG iDirection, + _In_ ULONG cLimit ); W32KAPI @@ -3263,7 +3067,7 @@ APIENTRY NtGdiCLIPOBJ_bEnum( IN CLIPOBJ *pco, - IN ULONG cj, + _In_ ULONG cj, OUT ULONG *pul ); @@ -3291,7 +3095,7 @@ APIENTRY NtGdiBRUSHOBJ_pvAllocRbrush( IN BRUSHOBJ *pbo, - IN ULONG cj + _In_ ULONG cj ); W32KAPI @@ -3320,8 +3124,8 @@ APIENTRY NtGdiXFORMOBJ_bApplyXform( IN XFORMOBJ *pxo, - IN ULONG iMode, - IN ULONG cPoints, + _In_ ULONG iMode, + _In_ ULONG cPoints, IN PVOID pvIn, OUT PVOID pvOut ); @@ -3339,7 +3143,7 @@ APIENTRY NtGdiFONTOBJ_vGetInfo( IN FONTOBJ *pfo, - IN ULONG cjSize, + _In_ ULONG cjSize, OUT FONTINFO *pfi ); @@ -3348,8 +3152,8 @@ APIENTRY NtGdiFONTOBJ_cGetGlyphs( IN FONTOBJ *pfo, - IN ULONG iMode, - IN ULONG cGlyph, + _In_ ULONG iMode, + _In_ ULONG cGlyph, IN HGLYPH *phg, OUT PVOID *ppvGlyph ); @@ -3396,7 +3200,7 @@ APIENTRY NtGdiFONTOBJ_pQueryGlyphAttrs( IN FONTOBJ *pfo, - IN ULONG iMode + _In_ ULONG iMode ); W32KAPI @@ -3421,8 +3225,7 @@ VOID APIENTRY NtGdiSTROBJ_vEnumStart( - IN STROBJ *pstro -); + _Inout_ STROBJ *pstro); W32KAPI DWORD @@ -3436,8 +3239,8 @@ APIENTRY NtGdiSTROBJ_bGetAdvanceWidths( IN STROBJ*pstro, - IN ULONG iFirst, - IN ULONG c, + _In_ ULONG iFirst, + _In_ ULONG c, OUT POINTQF*pptqD ); @@ -3445,9 +3248,9 @@ FD_GLYPHSET* APIENTRY NtGdiEngComputeGlyphSet( - IN INT nCodePage, - IN INT nFirstChar, - IN INT cChars + _In_ INT nCodePage, + _In_ INT nFirstChar, + _In_ INT cChars ); W32KAPI @@ -3455,7 +3258,7 @@ APIENTRY NtGdiXLATEOBJ_iXlate( IN XLATEOBJ *pxlo, - IN ULONG iColor + _In_ ULONG iColor ); W32KAPI @@ -3510,7 +3313,7 @@ APIENTRY NtGdiPATHOBJ_bEnumClipLines( IN PATHOBJ *ppo, - IN ULONG cb, + _In_ ULONG cb, OUT CLIPLINE *pcl ); @@ -3543,7 +3346,7 @@ APIENTRY NtGdiHT_Get8BPPMaskPalette( OUT OPTIONAL LPPALETTEENTRY pPaletteEntry, - IN BOOL Use8BPPMaskPal, + _In_ BOOL Use8BPPMaskPal, IN BYTE CMYMask, IN USHORT RedGamma, IN USHORT GreenGamma, @@ -3554,30 +3357,30 @@ BOOL APIENTRY NtGdiUpdateTransform( - IN HDC hdc + _In_ HDC hdc ); W32KAPI DWORD APIENTRY NtGdiSetLayout( - IN HDC hdc, - IN LONG wox, - IN DWORD dwLayout + _In_ HDC hdc, + _In_ LONG wox, + _In_ DWORD dwLayout ); W32KAPI BOOL APIENTRY NtGdiMirrorWindowOrg( - IN HDC hdc + _In_ HDC hdc ); W32KAPI LONG APIENTRY NtGdiGetDeviceWidth( - IN HDC hdc + _In_ HDC hdc ); W32KAPI @@ -3585,7 +3388,7 @@ APIENTRY NtGdiSetPUMPDOBJ( IN HUMPD humpd, - IN BOOL bStoreID, + _In_ BOOL bStoreID, OUT HUMPD *phumpd, OUT BOOL *pbWOW64 ); @@ -3610,7 +3413,7 @@ APIENTRY NtGdiSetBitmapAttributes( IN HBITMAP hbm, - IN DWORD dwFlags + _In_ DWORD dwFlags ); W32KAPI @@ -3618,31 +3421,31 @@ APIENTRY NtGdiClearBitmapAttributes( IN HBITMAP hbm, - IN DWORD dwFlags + _In_ DWORD dwFlags ); W32KAPI HBRUSH APIENTRY NtGdiSetBrushAttributes( - IN HBRUSH hbm, - IN DWORD dwFlags + _In_ HBRUSH hbm, + _In_ DWORD dwFlags ); W32KAPI HBRUSH APIENTRY NtGdiClearBrushAttributes( - IN HBRUSH hbm, - IN DWORD dwFlags + _In_ HBRUSH hbm, + _In_ DWORD dwFlags ); W32KAPI BOOL APIENTRY NtGdiDrawStream( - IN HDC hdcDst, - IN ULONG cjIn, + _In_ HDC hdcDst, + _In_ ULONG cjIn, IN VOID *pvIn ); @@ -3650,15 +3453,15 @@ BOOL APIENTRY NtGdiMakeObjectXferable( - IN HANDLE h, - IN DWORD dwProcessId + _In_ HANDLE h, + _In_ DWORD dwProcessId ); W32KAPI BOOL APIENTRY NtGdiMakeObjectUnXferable( - IN HANDLE h + _In_ HANDLE h ); W32KAPI Modified: trunk/reactos/include/psdk/winddi.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winddi.h?rev=…
============================================================================== --- trunk/reactos/include/psdk/winddi.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/winddi.h [iso-8859-1] Tue Jul 31 18:20:09 2012 @@ -1324,16 +1324,16 @@ BOOL APIENTRY EngBitBlt( - _Inout_ SURFOBJ *psoTrg, + _In_ SURFOBJ *psoTrg, _In_opt_ SURFOBJ *psoSrc, _In_opt_ SURFOBJ *psoMask, _In_opt_ CLIPOBJ *pco, _In_opt_ XLATEOBJ *pxlo, _In_ RECTL *prclTrg, - _When_(psoSrc, _In_) POINTL *pptlSrc, - _When_(psoMask, _In_) POINTL *pptlMask, + _In_opt_ POINTL *pptlSrc, + _In_opt_ POINTL *pptlMask, _In_opt_ BRUSHOBJ *pbo, - _When_(pbo, _In_) POINTL *pptlBrush, + _In_opt_ POINTL *pptlBrush, _In_ ROP4 rop4); WIN32KAPI @@ -1420,11 +1420,13 @@ _In_opt_ FREEOBJPROC pFreeObjProc, _In_ HDEV hdev); +_Must_inspect_result_ +_Success_(return != FALSE) WIN32KAPI BOOL APIENTRY EngCreateEvent( - _Deref_out_opt_ PEVENT *ppEvent); + _When_(return != FALSE, _Outptr_) PEVENT *ppEvent); /* EngCreatePalette.iMode constants */ #define PAL_INDEXED 0x00000001 @@ -2126,7 +2128,7 @@ APIENTRY EngQuerySystemAttribute( _In_ ENG_SYSTEM_ATTRIBUTE CapNum, - _Out_ PDWORD pCapability); + _When_(return != FALSE, _Out_) PDWORD pCapability); WIN32KAPI LONG @@ -2150,7 +2152,7 @@ ULONG APIENTRY EngSaveFloatingPointState( - _Out_ VOID *pBuffer, + _Inout_ VOID *pBuffer, _In_ ULONG cjBufferSize); WIN32KAPI @@ -2253,7 +2255,7 @@ _In_ RECTL *prclSrc, _When_(psoMask, _In_) POINTL *pptlMask, _In_ ULONG iMode, - _In_ BRUSHOBJ *pbo, + _In_opt_ BRUSHOBJ *pbo, _In_ DWORD rop4); WIN32KAPI @@ -2594,7 +2596,7 @@ APIENTRY FONTOBJ_cGetAllGlyphHandles( _In_ FONTOBJ *pfo, - _Out_opt_bytecap_(return) HGLYPH *phg); + _Out_opt_ HGLYPH *phg); WIN32KAPI ULONG @@ -2830,7 +2832,7 @@ VOID APIENTRY STROBJ_vEnumStart( - _In_ STROBJ *pstro); + _Inout_ STROBJ *pstro); WIN32KAPI BOOL @@ -2955,10 +2957,10 @@ _In_ CLIPOBJ *pco, _In_opt_ XLATEOBJ *pxlo, _In_ RECTL *prclTrg, - _When_(psoSrc, _In_) POINTL *pptlSrc, - _When_(psoMask, _In_) POINTL *pptlMask, + _In_opt_ POINTL *pptlSrc, + _In_opt_ POINTL *pptlMask, _In_opt_ BRUSHOBJ *pbo, - _When_(pbo, _In_) POINTL *pptlBrush, + _In_opt_ POINTL *pptlBrush, _In_ ROP4 rop4); typedef FN_DrvBitBlt *PFN_DrvBitBlt; extern FN_DrvBitBlt DrvBitBlt; @@ -3007,7 +3009,7 @@ _In_ DHPDEV dhpdev, _In_ LONG iPixelFormat, _In_ ULONG cjpfd, - _Out_ PIXELFORMATDESCRIPTOR *ppfd); + _Out_opt_ PIXELFORMATDESCRIPTOR *ppfd); typedef FN_DrvDescribePixelFormat *PFN_DrvDescribePixelFormat; extern FN_DrvDescribePixelFormat DrvDescribePixelFormat; Modified: trunk/reactos/include/xdk/kefuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/kefuncs.h?rev=…
============================================================================== --- trunk/reactos/include/xdk/kefuncs.h [iso-8859-1] (original) +++ trunk/reactos/include/xdk/kefuncs.h [iso-8859-1] Tue Jul 31 18:20:09 2012 @@ -79,7 +79,7 @@ VOID NTAPI ProbeForWrite( - __in_data_source(USER_MODE) _Inout_updates_bytes_(Length) PVOID Address, + __in_data_source(USER_MODE) _Out_writes_bytes_(Length) PVOID Address, _In_ SIZE_T Length, _In_ ULONG Alignment); @@ -550,8 +550,8 @@ _In_opt_ __drv_aliasesMem PVOID SynchronizeContext); _IRQL_requires_min_(PASSIVE_LEVEL) -_When_((Timeout==NULL || *Timeout!=0), _IRQL_requires_max_(APC_LEVEL)) -_When_((Timeout!=NULL && *Timeout==0), _IRQL_requires_max_(DISPATCH_LEVEL)) +_When_((Timeout==NULL || Timeout->QuadPart!=0), _IRQL_requires_max_(APC_LEVEL)) +_When_((Timeout!=NULL && Timeout->QuadPart==0), _IRQL_requires_max_(DISPATCH_LEVEL)) NTKERNELAPI NTSTATUS NTAPI @@ -568,8 +568,8 @@ #define KeWaitForMutexObject KeWaitForSingleObject _IRQL_requires_min_(PASSIVE_LEVEL) -_When_((Timeout==NULL || *Timeout!=0), _IRQL_requires_max_(APC_LEVEL)) -_When_((Timeout!=NULL && *Timeout==0), _IRQL_requires_max_(DISPATCH_LEVEL)) +_When_((Timeout==NULL || Timeout->QuadPart!=0), _IRQL_requires_max_(APC_LEVEL)) +_When_((Timeout!=NULL && Timeout->QuadPart==0), _IRQL_requires_max_(DISPATCH_LEVEL)) NTKERNELAPI NTSTATUS NTAPI
12 years, 4 months
1
0
0
0
[akhaldi] 57003: [ATACTL] * Add atactl from the Uniata suite. It should be useful for troubleshooting uniata.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Tue Jul 31 17:18:47 2012 New Revision: 57003 URL:
http://svn.reactos.org/svn/reactos?rev=57003&view=rev
Log: [ATACTL] * Add atactl from the Uniata suite. It should be useful for troubleshooting uniata. Added: trunk/reactos/base/applications/atactl/ (with props) trunk/reactos/base/applications/atactl/CMakeLists.txt (with props) trunk/reactos/base/applications/atactl/atactl.cpp (with props) trunk/reactos/base/applications/atactl/helper.h (with props) Modified: trunk/reactos/base/applications/CMakeLists.txt Modified: trunk/reactos/base/applications/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/CMakeLis…
============================================================================== --- trunk/reactos/base/applications/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/base/applications/CMakeLists.txt [iso-8859-1] Tue Jul 31 17:18:47 2012 @@ -1,4 +1,5 @@ +add_subdirectory(atactl) add_subdirectory(cacls) add_subdirectory(calc) add_subdirectory(charmap) Propchange: trunk/reactos/base/applications/atactl/ ------------------------------------------------------------------------------ --- bugtraq:logregex (added) +++ bugtraq:logregex Tue Jul 31 17:18:47 2012 @@ -1,0 +1,2 @@ +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+) Propchange: trunk/reactos/base/applications/atactl/ ------------------------------------------------------------------------------ bugtraq:message = See issue #%BUGID% for more details. Propchange: trunk/reactos/base/applications/atactl/ ------------------------------------------------------------------------------ bugtraq:url =
http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: trunk/reactos/base/applications/atactl/ ------------------------------------------------------------------------------ tsvn:logminsize = 10 Added: trunk/reactos/base/applications/atactl/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/atactl/C…
============================================================================== --- trunk/reactos/base/applications/atactl/CMakeLists.txt (added) +++ trunk/reactos/base/applications/atactl/CMakeLists.txt [iso-8859-1] Tue Jul 31 17:18:47 2012 @@ -1,0 +1,16 @@ + +add_definitions(-DUSER_MODE) +include_directories(${REACTOS_SOURCE_DIR}/drivers/storage/ide/uniata) + +add_executable(atactl atactl.cpp) + +set_module_type(atactl win32cui) +add_importlibs(atactl advapi32 msvcrt kernel32 ntdll) + +if(NOT MSVC) + # FIXME:
http://www.cmake.org/Bug/view.php?id=12998
+ #allow_warnings(atactl) + set_source_files_properties(atactl.cpp PROPERTIES COMPILE_FLAGS "-Wno-error") + target_link_libraries(atactl gcc) +endif() +add_cd_file(TARGET atactl DESTINATION reactos/system32 FOR all) Propchange: trunk/reactos/base/applications/atactl/CMakeLists.txt ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/base/applications/atactl/atactl.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/atactl/a…
============================================================================== --- trunk/reactos/base/applications/atactl/atactl.cpp (added) +++ trunk/reactos/base/applications/atactl/atactl.cpp [iso-8859-1] Tue Jul 31 17:18:47 2012 @@ -1,0 +1,1710 @@ +#include <windows.h> +#include <WinIoCtl.h> +#include <stdio.h> +//#include <ntdddisk.h> +//#include <ntddscsi.h> +#include <ntddscsi.h> +#include <atapi.h> +#include <bm_devs.h> +#include <uata_ctl.h> +#include <tools.h> +#include <uniata_ver.h> + +#include "helper.h" + +#define DEFAULT_REMOVAL_LOCK_TIMEOUT 20 + +#define MOV_DW_SWP(a,b) \ +do \ +{ \ + *(unsigned short *)&(a) = _byteswap_ushort(*(unsigned short *)&(b)); \ +} \ +while (0) + +#define MOV_DD_SWP(a,b) \ +{ \ + PFOUR_BYTE _from_, _to_; \ + _from_ = ((PFOUR_BYTE)&(b)); \ + _to_ = ((PFOUR_BYTE)&(a)); \ + __asm mov ebx,_from_ \ + __asm mov eax,[ebx] \ + __asm bswap eax \ + __asm mov ebx,_to_ \ + __asm mov [ebx],eax \ +} + +int g_extended = 0; +int g_adapter_info = 0; +char* g_bb_list = NULL; +int gRadix = 16; + +void print_help() { + printf("Usage:\n" + " atactl -<switches> c|s<controller id>:b<bus id>:d<device id>[:l<lun>]\n" + "Switches:\n" + " l (L)ist devices on SCSI and ATA controllers bus(es)\n" + " Note: ATA Pri/Sec controller are usually represented\n" + " as Scsi0/Scsi1 under NT-family OSes\n" + " x show e(X)tended info\n" + " a show (A)dapter info\n" + " s (S)can for new devices on ATA/SATA bus(es) (experimental)\n" + " S (S)can for new devices on ATA/SATA bus(es) (experimental)\n" + " device, hidden with 'H' can be redetected\n" + " h (H)ide device on ATA/SATA bus for removal (experimental)\n" + " device can be redetected\n" + " H (H)ide device on ATA/SATA bus (experimental)\n" + " device can not be redetected until 'h' or 'S' is issued\n" + " m [MODE] set i/o (M)ode for device or revert to default\n" + " available MODEs are PIO, PIO0-PIO5, DMA, WDMA0-WDMA2,\n" + " UDMA33/44/66/100/133, UDMA0-UDMA5\n" + " d [XXX] lock ATA/SATA bus for device removal for XXX seconds or\n" + " for %d seconds if no lock timeout specified.\n" + " can be used with -h, -m or standalone.\n" + " r (R)eset device\n" + " ba (A)ssign (B)ad-block list\n" + " bl get assigned (B)ad-block (L)ist\n" + " br (R)eset assigned (B)ad-block list\n" + " f specify (F)ile for bad-block list\n" + " n XXX block (n)ubmering radix. XXX can be hex or dec\n" + "------\n" + "Examples:\n" + " atactl -l\n" + " will list all scsi buses and all connected devices\n" + " atactl -m udma0 s2:b1:d1\n" + " will switch device at Scsi2, bus 1, taget_id 1 to UDMA0 mode\n" + " atactl -h -d 30 c1:b0:d0:l0 \n" + " will hide Master (d0:l0) device on secondary (c1:b0) IDE channel\n" + " and lock i/o on this channel for 30 seconds to ensure safity\n" + " of removal process" + "------\n" + "Device address format:\n" + "\n" + "s<controller id> number of controller in system. Is assigned during hardware\n" + " detection. Usually s0/s1 are ATA Pri/Sec.\n" + " Note, due do NT internal desing ATA controllers are represented\n" + " as SCSI controllers.\n" + "b<bus id> For ATA controllers it is channel number.\n" + " Note, usually onboard controller is represented as 2 legacy\n" + " ISA-compatible single-channel controllers (Scsi9/Scsi1). Additional\n" + " ATA, ATA-RAID and some specific onboard controllers are represented\n" + " as multichannel controllers.\n" + "d<device id> For ATA controllers d0 is Master, d1 is Slave.\n" + "l<lun> Not used in ATA controller drivers, alway 0\n" + "------\n" + "Bad-block list format:\n" + "\n" + "# Comment\n" + "; Still one comment\n" + "hex: switch to hexadecimal mode\n" + "<Bad Area 1 Start LBA, e.g. FD50> <Block count 1, e.g. 60>\n" + "<Bad Area 2 Start LBA> <Block count 2>\n" + "...\n" + "dec: switch to decimal mode\n" + "<Bad Area N Start LBA, e.g. 16384> <Block count N, e.g. 48>\n" + "...\n" + "------\n" + "", + DEFAULT_REMOVAL_LOCK_TIMEOUT + ); + exit(0); +} + +#define CMD_ATA_LIST 0x01 +#define CMD_ATA_FIND 0x02 +#define CMD_ATA_HIDE 0x03 +#define CMD_ATA_MODE 0x04 +#define CMD_ATA_RESET 0x05 +#define CMD_ATA_BBLK 0x06 + +HANDLE +ata_open_dev( + char* Name + ) +{ + ULONG i; + HANDLE h; + + for(i=0; i<4; i++) { + h = CreateFile(Name, + READ_CONTROL | GENERIC_READ | GENERIC_WRITE , + ((i & 1) ? 0 : FILE_SHARE_READ) | ((i & 2) ? 0 : FILE_SHARE_WRITE), + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL); + if(h && (h != ((HANDLE)(-1))) ) { + return h; + } + } + + for(i=0; i<4; i++) { + h = CreateFile(Name, + GENERIC_READ | GENERIC_WRITE , + ((i & 1) ? 0 : FILE_SHARE_READ) | ((i & 2) ? 0 : FILE_SHARE_WRITE), + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL); + if(h && (h != ((HANDLE)(-1))) ) { + return h; + } + } + + for(i=0; i<4; i++) { + h = CreateFile(Name, + GENERIC_READ, + ((i & 1) ? 0 : FILE_SHARE_READ) | ((i & 2) ? 0 : FILE_SHARE_WRITE), + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL); + if(h && (h != ((HANDLE)(-1))) ) { + return h; + } + } + + for(i=0; i<4; i++) { + h = CreateFile(Name, + READ_CONTROL, + ((i & 1) ? 0 : FILE_SHARE_READ) | ((i & 2) ? 0 : FILE_SHARE_WRITE), + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL); + if(h && (h != ((HANDLE)(-1))) ) { + return h; + } + } + + return NULL; +} // end ata_open_dev() + +HANDLE +ata_open_file( + char* Name, + BOOLEAN create + ) +{ + ULONG i; + HANDLE h; + + if(!Name) { + if(create) { + return GetStdHandle(STD_OUTPUT_HANDLE); + } else { + return GetStdHandle(STD_INPUT_HANDLE); + } + } + + for(i=0; i<4; i++) { + h = CreateFile(Name, + create ? GENERIC_WRITE : GENERIC_READ , + ((i & 1) ? 0 : FILE_SHARE_READ) | ((i & 2) ? 0 : FILE_SHARE_WRITE), + NULL, + create ? CREATE_NEW : OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL); + if(h && (h != ((HANDLE)(-1))) ) { + return h; + } + } + + return NULL; +} // end ata_open_file() + +void +ata_close_dev( + HANDLE h + ) +{ + CloseHandle(h); +} // end ata_close_dev() + +int +ata_send_ioctl( + HANDLE h, + PSCSI_ADDRESS addr, + PCHAR Signature, + ULONG Ioctl, + PVOID inBuffer, + ULONG inBufferLength, + PVOID outBuffer, + ULONG outBufferLength, + PULONG returned + ) +{ + ULONG status; + PUNIATA_CTL AtaCtl; + ULONG data_len = max(inBufferLength, outBufferLength); + ULONG len; + + if(addr) { + len = data_len + offsetof(UNIATA_CTL, RawData); + } else { + len = data_len + sizeof(AtaCtl->hdr); + } + AtaCtl = (PUNIATA_CTL)GlobalAlloc(GMEM_FIXED, len); + AtaCtl->hdr.HeaderLength = sizeof(SRB_IO_CONTROL); + if(addr) { + AtaCtl->hdr.Length = data_len + offsetof(UNIATA_CTL, RawData) - sizeof(AtaCtl->hdr); + } else { + AtaCtl->hdr.Length = data_len; + } + + memcpy(&AtaCtl->hdr.Signature, Signature, 8); + + AtaCtl->hdr.Timeout = 10000; + AtaCtl->hdr.ControlCode = Ioctl; + AtaCtl->hdr.ReturnCode = 0; + + if(addr) { + AtaCtl->addr = *addr; + AtaCtl->addr.Length = sizeof(AtaCtl->addr); + } + + if(inBuffer && inBufferLength) { + if(addr) { + memcpy(&AtaCtl->RawData, inBuffer, inBufferLength); + } else { + memcpy(&AtaCtl->addr, inBuffer, inBufferLength); + } + } + + status = DeviceIoControl(h, + IOCTL_SCSI_MINIPORT, + AtaCtl, + len, + AtaCtl, + len, + returned, + FALSE); + + if(outBuffer && outBufferLength) { + if(addr) { + memcpy(outBuffer, &AtaCtl->RawData, outBufferLength); + } else { + memcpy(outBuffer, &AtaCtl->addr, outBufferLength); + } + } + GlobalFree(AtaCtl); + + if(!status) { + status = GetLastError(); + return FALSE; + } + return TRUE; +} // end ata_send_ioctl() + +IO_SCSI_CAPABILITIES g_capabilities; +UCHAR g_inquiry_buffer[2048]; + +int +ata_is_sata( + PIDENTIFY_DATA ident + ) +{ + return (ident->SataEnable && ident->SataEnable != 0xffff); +} + +int +ata_cur_mode_from_ident( + PIDENTIFY_DATA ident + ) +{ + if(ata_is_sata(ident)) { + return ATA_SA150-1; + } + + if (ident->UdmaModesValid) { + if (ident->UltraDMAActive & 0x40) + return ATA_UDMA0+6; + if (ident->UltraDMAActive & 0x20) + return ATA_UDMA0+5; + if (ident->UltraDMAActive & 0x10) + return ATA_UDMA0+4; + if (ident->UltraDMAActive & 0x08) + return ATA_UDMA0+3; + if (ident->UltraDMAActive & 0x04) + return ATA_UDMA0+2; + if (ident->UltraDMAActive & 0x02) + return ATA_UDMA0+1; + if (ident->UltraDMAActive & 0x01) + return ATA_UDMA0+0; + } + + if (ident->MultiWordDMAActive & 0x04) + return ATA_WDMA0+2; + if (ident->MultiWordDMAActive & 0x02) + return ATA_WDMA0+1; + if (ident->MultiWordDMAActive & 0x01) + return ATA_WDMA0+0; + + if (ident->SingleWordDMAActive & 0x04) + return ATA_SDMA0+2; + if (ident->SingleWordDMAActive & 0x02) + return ATA_SDMA0+1; + if (ident->SingleWordDMAActive & 0x01) + return ATA_SDMA0+0; + + if (ident->PioTimingsValid) { + if (ident->AdvancedPIOModes & AdvancedPIOModes_5) + return ATA_PIO0+5; + if (ident->AdvancedPIOModes & AdvancedPIOModes_4) + return ATA_PIO0+4; + if (ident->AdvancedPIOModes & AdvancedPIOModes_3) + return ATA_PIO0+3; + } + if (ident->PioCycleTimingMode == 2) + return ATA_PIO0+2; + if (ident->PioCycleTimingMode == 1) + return ATA_PIO0+1; + if (ident->PioCycleTimingMode == 0) + return ATA_PIO0+0; + + return ATA_PIO; +} // end ata_cur_mode_from_ident() + +void +ata_mode_to_str( + char* str, + int mode + ) +{ + if(mode == ATA_SA150-1) { + sprintf(str, "SATA"); + } else + if(mode >= ATA_SA300) { + sprintf(str, "SATA-300"); + } else + if(mode >= ATA_SA150) { + sprintf(str, "SATA-150"); + } else + if(mode >= ATA_UDMA0) { + sprintf(str, "UDMA%d", mode-ATA_UDMA0); + } else + if(mode >= ATA_WDMA0) { + sprintf(str, "WDMA%d", mode-ATA_WDMA0); + } else + if(mode >= ATA_SDMA0) { + sprintf(str, "SDMA%d", mode-ATA_SDMA0); + } else + if(mode >= ATA_PIO0) { + sprintf(str, "PIO%d", mode-ATA_PIO0); + } else + if(mode == ATA_PIO_NRDY) { + sprintf(str, "PIO nRDY"); + } else + { + sprintf(str, "PIO"); + } +} // end ata_mode_to_str() + +#define check_atamode_str(str, mode) \ + (!_stricmp(str, "UDMA" #mode) || \ + !_stricmp(str, "UDMA-" #mode) || \ + !_stricmp(str, "ATA-" #mode) || \ + !_stricmp(str, "ATA#" #mode)) + +int +ata_str_to_mode( + char* str + ) +{ + int mode; + int len; + + if(!_stricmp(str, "SATA")) + return ATA_SA150; + + if(check_atamode_str(str, 16)) + return ATA_UDMA0; + if(check_atamode_str(str, 25)) + return ATA_UDMA1; + if(check_atamode_str(str, 33)) + return ATA_UDMA2; + if(check_atamode_str(str, 44)) + return ATA_UDMA3; + if(check_atamode_str(str, 66)) + return ATA_UDMA4; + if(check_atamode_str(str, 100)) + return ATA_UDMA5; + if(check_atamode_str(str, 122)) + return ATA_UDMA6; + + len = strlen(str); + + if(len >= 4 && !_memicmp(str, "UDMA", 4)) { + if(len == 4) + return ATA_UDMA0; + if(len > 5) + return -1; + mode = str[4] - '0'; + if(mode < 0 || mode > 7) + return -1; + return ATA_UDMA0+mode; + } + if(len >= 4 && !_memicmp(str, "WDMA", 4)) { + if(len == 4) + return ATA_WDMA0; + if(len > 5) + return -1; + mode = str[4] - '0'; + if(mode < 0 || mode > 2) + return -1; + return ATA_WDMA0+mode; + } + if(len >= 4 && !_memicmp(str, "SDMA", 4)) { + if(len == 4) + return ATA_SDMA0; + if(len > 5) + return -1; + mode = str[4] - '0'; + if(mode < 0 || mode > 2) + return -1; + return ATA_SDMA0+mode; + } + if(len == 4 && !_memicmp(str, "DMA", 4)) { + return ATA_SDMA0; + } + if(len >= 3 && !_memicmp(str, "PIO", 3)) { + if(len == 3) + return ATA_PIO; + if(len > 4) + return -1; + mode = str[3] - '0'; + if(mode < 0 || mode > 5) + return -1; + return ATA_PIO0+mode; + } + + return -1; +} // end ata_str_to_mode() + +ULONG +EncodeVendorStr( + OUT char* Buffer, + IN PUCHAR Str, + IN ULONG Length, + IN ULONG Xorer + ) +{ + ULONG i,j; + UCHAR a; + + for(i=0, j=0; i<Length; i++, j++) { + a = Str[i ^ Xorer]; + if(!a) { + Buffer[j] = 0; + return j; + } else + if(a == ' ') { + Buffer[j] = '_'; + } else + if((a == '_') || + (a == '#') || + (a == '\\') || + (a == '\"') || + (a == '\'') || + (a < ' ') || + (a >= 127)) { + Buffer[j] = '#'; + j++; + sprintf(Buffer+j, "%2.2x", a); + j++; + } else { + Buffer[j] = a; + } + } + Buffer[j] = 0; + return j; +} // end EncodeVendorStr() + +HKEY +ata_get_bblist_regh( + IN PIDENTIFY_DATA ident, + OUT char* DevSerial, + BOOLEAN read_only + ) +{ + HKEY hKey = NULL; + HKEY hKey2 = NULL; + ULONG Length; + REGSAM access = read_only ? KEY_READ : KEY_ALL_ACCESS; + + Length = EncodeVendorStr(DevSerial, (PUCHAR)ident->ModelNumber, sizeof(ident->ModelNumber), 0x01); + DevSerial[Length] = '-'; + Length++; + Length += EncodeVendorStr(DevSerial+Length, ident->SerialNumber, sizeof(ident->SerialNumber), 0x01); + + if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\UniATA", NULL, access, &hKey) != ERROR_SUCCESS) { + hKey = NULL; + goto exit; + } + if(RegOpenKey(hKey, "Parameters", &hKey2) != ERROR_SUCCESS) { + hKey2 = NULL; + if(read_only || (RegCreateKey(hKey, "Parameters", &hKey2) != ERROR_SUCCESS)) { + hKey2 = NULL; + goto exit; + } + } + RegCloseKey(hKey2); + if(RegOpenKey(hKey, "Parameters\\BadBlocks", &hKey2) != ERROR_SUCCESS) { + hKey2 = NULL; + if(read_only || (RegCreateKey(hKey, "Parameters\\BadBlocks", &hKey2) != ERROR_SUCCESS)) { + hKey2 = NULL; + goto exit; + } + } + +exit: + if(hKey) + RegCloseKey(hKey); + + return hKey2; +} // end ata_get_bblist_regh() + +IDENTIFY_DATA g_ident; + +int +ata_check_unit( + HANDLE h, // handle to ScsiXXX: + int dev_id + ) +{ + ULONG status; + ULONG returned; + + PSCSI_ADAPTER_BUS_INFO adapterInfo; + PSCSI_INQUIRY_DATA inquiryData; + SCSI_ADDRESS addr; + ULONG i, j; + int l_dev_id; + ULONG len; + GETTRANSFERMODE IoMode; + PSENDCMDOUTPARAMS pout; + PIDENTIFY_DATA ident; + char buff[sizeof(SENDCMDOUTPARAMS)+/*sizeof(IDENTIFY_DATA)*/2048]; + char mode_str[12]; + ULONG bus_id = (dev_id >> 24) & 0xff; + BOOLEAN found = FALSE; + SENDCMDINPARAMS pin; + int io_mode = -1; + char SerNum[128]; + char DevSerial[128]; + char lun_str[10]; + HKEY hKey2; + ULONGLONG max_lba = -1; + USHORT chs[3]; + + if(dev_id != -1) { + dev_id &= 0x00ffffff; + } + if(dev_id == 0x007f7f7f) { + return TRUE; + } + + pout = (PSENDCMDOUTPARAMS)buff; + ident = (PIDENTIFY_DATA)&(pout->bBuffer); + + status = DeviceIoControl(h, + IOCTL_SCSI_GET_INQUIRY_DATA, + NULL, + 0, + g_inquiry_buffer, + sizeof(g_inquiry_buffer), + &returned, + FALSE); + + if(!status) { + printf("Can't get device info\n"); + return FALSE; + } + + adapterInfo = (PSCSI_ADAPTER_BUS_INFO)g_inquiry_buffer; + for (i = 0; i < adapterInfo->NumberOfBuses; i++) { + inquiryData = (PSCSI_INQUIRY_DATA) (g_inquiry_buffer + + adapterInfo->BusData[i].InquiryDataOffset); + while (adapterInfo->BusData[i].InquiryDataOffset) { + /* + if(dev_id/adapterInfo->BusData[i].NumberOfLogicalUnits == + inquiryData->TargetId && + dev_id%adapterInfo->BusData[i].NumberOfLogicalUnits == + inquiryData->Lun) { + printf(" %d %d %3d %s %.28s ", + i, + inquiryData->TargetId, + inquiryData->Lun, + (inquiryData->DeviceClaimed) ? "Y" : "N", + &inquiryData->InquiryData[8]); + }*/ + l_dev_id = (i << 16) | ((ULONG)(inquiryData->TargetId) << 8) | inquiryData->Lun; + + if(l_dev_id == dev_id || dev_id == -1) { + + if(!memcmp(&inquiryData->InquiryData[8], UNIATA_COMM_PORT_VENDOR_STR, 24)) { + // skip communication port + goto next_dev; + } + + found = TRUE; + + if(inquiryData->Lun) { + sprintf(lun_str, ":l%d", inquiryData->Lun); + } else { + sprintf(lun_str, " ", inquiryData->Lun); + } + + + /* + for (j = 0; j < 8; j++) { + printf("%02X ", inquiryData->InquiryData[j]); + } + */ + + addr.PortNumber = -1; + addr.PathId = inquiryData->PathId; + addr.TargetId = inquiryData->TargetId; + addr.Lun = inquiryData->Lun; + status = ata_send_ioctl(h, &addr, "-UNIATA-", + IOCTL_SCSI_MINIPORT_UNIATA_GET_MODE, + NULL, 0, + &IoMode, sizeof(IoMode), + &returned); + if(status) { + //io_mode = min(IoMode.CurrentMode, IoMode.MaxMode); + io_mode = min(max(IoMode.CurrentMode,IoMode.OrigMode),IoMode.MaxMode); + } else { + io_mode = -1; + } + + memset(&pin, 0, sizeof(pin)); + memset(buff, 0, sizeof(buff)); + pin.irDriveRegs.bCommandReg = ID_CMD; + // this is valid for IDE/ATA, where only 2 devices can be attached to the bus. + // probably, we shall change this in future to support SATA splitters + pin.bDriveNumber = inquiryData->PathId*2+inquiryData->TargetId; + + status = ata_send_ioctl(h, NULL, "SCSIDISK", + IOCTL_SCSI_MINIPORT_IDENTIFY, + &pin, sizeof(pin), + buff, sizeof(buff), + &returned); + + if(!status) { + memset(&pin, 0, sizeof(pin)); + memset(buff, 0, sizeof(buff)); + pin.irDriveRegs.bCommandReg = ATAPI_ID_CMD; + // this is valid for IDE/ATA, where only 2 devices can be attached to the bus. + // probably, we shall change this in future to support SATA splitters + pin.bDriveNumber = inquiryData->PathId*2+inquiryData->TargetId; + + status = ata_send_ioctl(h, NULL, "SCSIDISK", + IOCTL_SCSI_MINIPORT_IDENTIFY, + &pin, sizeof(pin), + buff, sizeof(buff), + &returned); + + } + + if(status) { + if(!g_extended) { + printf(" b%d:d%d%s %24.24s %4.4s ", + i, + inquiryData->TargetId, + lun_str, + /*(inquiryData->DeviceClaimed) ? "Y" : "N",*/ + (g_extended ? (PUCHAR)"" : &inquiryData->InquiryData[8]), + (g_extended ? (PUCHAR)"" : &inquiryData->InquiryData[8+24]) + ); + } else { + printf(" b%d:d%d%s ", + i, + inquiryData->TargetId, + lun_str + ); + } + if(io_mode == -1) { + io_mode = ata_cur_mode_from_ident(ident); + } + } else { + goto next_dev; + + } + if(io_mode != -1) { + ata_mode_to_str(mode_str, io_mode); + } + if(!g_extended || !status) { + if(g_extended) { + printf(" %24.24s %4.4s ", + (&inquiryData->InquiryData[8]), + (&inquiryData->InquiryData[8+24]) + ); + } + if(io_mode != -1) { + printf(" %.12s ", mode_str); + } + } + printf("\n"); + + if(status && g_extended) { + + BOOLEAN BlockMode_valid = TRUE; + BOOLEAN print_geom = FALSE; + + switch(ident->DeviceType) { + case ATAPI_TYPE_DIRECT: + if(ident->Removable) { + printf(" Floppy "); + } else { + printf(" Hard Drive "); + } + break; + case ATAPI_TYPE_TAPE: + printf(" Tape Drive "); + break; + case ATAPI_TYPE_CDROM: + printf(" CD/DVD Drive "); + BlockMode_valid = FALSE; + break; + case ATAPI_TYPE_OPTICAL: + printf(" Optical Drive "); + BlockMode_valid = FALSE; + break; + default: + printf(" Hard Drive "); + print_geom = 1; + //MOV_DD_SWP(max_lba, ident->UserAddressableSectors); + max_lba = ident->UserAddressableSectors; + if(ident->FeaturesSupport.Address48) { + max_lba = ident->UserAddressableSectors48; + } + //MOV_DW_SWP(chs[0], ident->NumberOfCylinders); + //MOV_DW_SWP(chs[1], ident->NumberOfHeads); + //MOV_DW_SWP(chs[2], ident->SectorsPerTrack); + chs[0] = ident->NumberOfCylinders; + chs[1] = ident->NumberOfHeads; + chs[2] = ident->SectorsPerTrack; + } + if(io_mode != -1) { + printf(" %.12s\n", mode_str); + } + for (j = 0; j < 40; j += 2) { + MOV_DW_SWP(SerNum[j], ((PUCHAR)ident->ModelNumber)[j]); + } + printf(" Mod: %40.40s\n", SerNum); + for (j = 0; j < 8; j += 2) { + MOV_DW_SWP(SerNum[j], ((PUCHAR)ident->FirmwareRevision)[j]); + } + printf(" Rev: %8.8s\n", SerNum); + for (j = 0; j < 20; j += 2) { + MOV_DW_SWP(SerNum[j], ((PUCHAR)ident->SerialNumber)[j]); + } + printf(" S/N: %20.20s\n", SerNum); + + if(BlockMode_valid) { + if(ident->MaximumBlockTransfer) { + printf(" Multi-block mode: %d block%s\n", ident->MaximumBlockTransfer, ident->MaximumBlockTransfer == 1 ? "" : "s"); + } else { + printf(" Multi-block mode: N/A\n"); + } + } + if(print_geom) { + printf(" C/H/S: %d/%d/%d \n", chs[0], chs[1], chs[2]); + printf(" LBA: %d \n", max_lba); + if(max_lba < 2) { + printf(" Size: %d kb\n", max_lba/2); + } else + if(max_lba < 2*1024*1024) { + printf(" Size: %d Mb\n", max_lba/2048); + } else + if(max_lba < (ULONG)2*1024*1024*1024) { + printf(" Size: %d.%d (%d) Gb\n", (ULONG)(max_lba/2048/1024), + (ULONG)(((max_lba/2048)%1024)/10), + (ULONG)(max_lba*512/1000/1000/1000) + ); + } else { + printf(" Size: %d.%d (%d) Tb\n", (ULONG)(max_lba/2048/1024/1024), + (ULONG)((max_lba/2048/1024)%1024)/10, + (ULONG)(max_lba*512/1000/1000/1000) + ); + } + } + len = 0; + if(hKey2 = ata_get_bblist_regh(ident, DevSerial, TRUE)) { + if(RegQueryValueEx(hKey2, DevSerial, NULL, NULL, NULL, &len) == ERROR_SUCCESS) { + printf(" !!! Assigned bad-block list !!!\n"); + } + RegCloseKey(hKey2); + } + + } + memcpy(&g_ident, ident, sizeof(IDENTIFY_DATA)); + } +next_dev: + if (inquiryData->NextInquiryDataOffset == 0) { + break; + } + + inquiryData = (PSCSI_INQUIRY_DATA) (g_inquiry_buffer + + inquiryData->NextInquiryDataOffset); + } + } + if(!found) { + printf(" No device(s) found.\n"); + return FALSE; + } + + return TRUE; +} // end ata_check_unit() + +BOOLEAN +ata_adapter_info( + int bus_id, + int print_info + ) +{ + char dev_name[64]; + HANDLE h; + ADAPTERINFO AdapterInfo; + ULONG status; + ULONG returned; + SCSI_ADDRESS addr; + PCI_SLOT_NUMBER slotData; + + sprintf(dev_name, "\\\\.\\Scsi%d:", bus_id); + h = ata_open_dev(dev_name); + if(!h) + return FALSE; + addr.PortNumber = bus_id; + + memset(&AdapterInfo, 0, sizeof(AdapterInfo)); + + status = ata_send_ioctl(h, &addr, "-UNIATA-", + IOCTL_SCSI_MINIPORT_UNIATA_ADAPTER_INFO, + &AdapterInfo, sizeof(AdapterInfo), + &AdapterInfo, sizeof(AdapterInfo), + &returned); + printf("Scsi%d: %s\n", bus_id, status ? "[UniATA]" : ""); + if(print_info) { + if(!status) { + printf("Can't get adapter info\n"); + } else { + if(AdapterInfo.AdapterInterfaceType == PCIBus) { + slotData.u.AsULONG = AdapterInfo.slotNumber; + printf(" PCI Bus/Dev/Func: %d/%d/%d%s\n", + AdapterInfo.SystemIoBusNumber, slotData.u.bits.DeviceNumber, slotData.u.bits.FunctionNumber, + AdapterInfo.AdapterInterfaceType == AdapterInfo.OrigAdapterInterfaceType ? "" : " (ISA-Bridged)"); + printf(" VendorId/DevId/Rev: %#04x/%#04x/%#02x\n", AdapterInfo.DevID >> 16, AdapterInfo.DevID & 0xffff, AdapterInfo.RevID); + if(AdapterInfo.DeviceName[0]) { + printf(" Name: %s\n", AdapterInfo.DeviceName); + } + } else + if(AdapterInfo.AdapterInterfaceType == Isa) { + printf(" ISA Bus\n"); + } + printf(" IRQ: %d\n", AdapterInfo.BusInterruptLevel); + } + } + ata_close_dev(h); + return status ? TRUE : FALSE; +} // end ata_adapter_info() + +int +ata_check_controller( + HANDLE h, // handle to ScsiXXX: + PIO_SCSI_CAPABILITIES capabilities + ) +{ + ULONG status; + ULONG returned; + + status = DeviceIoControl(h, + IOCTL_SCSI_GET_CAPABILITIES, + NULL, + 0, + capabilities, + sizeof(IO_SCSI_CAPABILITIES), + &returned, + FALSE); + return status; +} // end ata_check_controller() + +BOOLEAN +ata_list( + int bus_id, + int dev_id + ) +{ + char dev_name[64]; + HANDLE h; + BOOLEAN uniata_driven; + + if(bus_id == -1) { + for(bus_id=0; TRUE; bus_id++) { + if(!ata_list(bus_id, dev_id)) + break; + } + return TRUE; + } + uniata_driven = ata_adapter_info(bus_id, g_adapter_info); + sprintf(dev_name, "\\\\.\\Scsi%d:", bus_id); + h = ata_open_dev(dev_name); + if(!h) + return FALSE; + if(dev_id == -1) { + ata_check_controller(h, &g_capabilities); + ata_check_unit(h, -1); + ata_close_dev(h); + return TRUE; + } + ata_check_unit(h, dev_id | (bus_id << 24)); + ata_close_dev(h); + return TRUE; +} // end ata_list() + +BOOLEAN +ata_mode( + int bus_id, + int dev_id, + int mode + ) +{ + char dev_name[64]; + HANDLE h; + SETTRANSFERMODE IoMode; + ULONG status; + ULONG returned; + SCSI_ADDRESS addr; + + if(dev_id == -1) { + return FALSE; + } + sprintf(dev_name, "\\\\.\\Scsi%d:", bus_id); + h = ata_open_dev(dev_name); + if(!h) + return FALSE; + addr.PortNumber = bus_id; + addr.PathId = (UCHAR)(dev_id >> 16); + addr.TargetId = (UCHAR)(dev_id >> 8); + addr.Lun = (UCHAR)(dev_id); + + IoMode.MaxMode = mode; + IoMode.ApplyImmediately = FALSE; +// IoMode.ApplyImmediately = TRUE; + IoMode.OrigMode = mode; + + status = ata_send_ioctl(h, &addr, "-UNIATA-", + IOCTL_SCSI_MINIPORT_UNIATA_SET_MAX_MODE, + &IoMode, sizeof(IoMode), + NULL, 0, + &returned); + if(!status) { + printf("Can't apply specified transfer mode\n"); + } else { + ata_mode_to_str(dev_name, mode); + printf("Transfer rate switched to %s\n", dev_name); + } + ata_close_dev(h); + return status ? TRUE : FALSE; +} // end ata_mode() + +BOOLEAN +ata_reset( + int bus_id, + int dev_id + ) +{ + char dev_name[64]; + HANDLE h; + ULONG status; + ULONG returned; + SCSI_ADDRESS addr; + + if(dev_id == -1) { + return FALSE; + } + sprintf(dev_name, "\\\\.\\Scsi%d:", bus_id); + h = ata_open_dev(dev_name); + if(!h) + return FALSE; + addr.PortNumber = bus_id; + addr.PathId = (UCHAR)(dev_id >> 16); + addr.TargetId = (UCHAR)(dev_id >> 8); + addr.Lun = (UCHAR)(dev_id); + + if(addr.TargetId == 0x7f && addr.Lun == 0x7f) { + addr.TargetId = (UCHAR)0xff; + addr.Lun = 0; + printf("Resetting channel...\n"); + } else { + printf("Resetting device...\n"); + } + + status = ata_send_ioctl(h, &addr, "-UNIATA-", + IOCTL_SCSI_MINIPORT_UNIATA_RESET_DEVICE, + NULL, 0, + NULL, 0, + &returned); + if(!status) { + printf("Reset failed\n"); + } else { + printf("Channel reset done\n"); + } + ata_close_dev(h); + return TRUE; +} // end ata_reset() + +BOOLEAN +ata_hide( + int bus_id, + int dev_id, + int lock, + int persistent_hide + ) +{ + char dev_name[64]; + HANDLE h; + ULONG status; + ULONG returned; + SCSI_ADDRESS addr; + ADDREMOVEDEV to; + + if(dev_id == -1) { + return FALSE; + } + if(lock < 0) { + lock = DEFAULT_REMOVAL_LOCK_TIMEOUT; + } + sprintf(dev_name, "\\\\.\\Scsi%d:", bus_id); + h = ata_open_dev(dev_name); + if(!h) + return FALSE; + addr.PortNumber = bus_id; + addr.PathId = (UCHAR)(dev_id >> 16); + addr.TargetId = (UCHAR)(dev_id >> 8); + addr.Lun = (UCHAR)(dev_id); + + to.WaitForPhysicalLink = lock; + to.Flags = persistent_hide ? UNIATA_REMOVE_FLAGS_HIDE : 0; + + printf("Deleting device.\n"); + if(lock) { + printf("ATTENTION: you have %d seconds to disconnect cable\n", lock); + } + status = ata_send_ioctl(h, &addr, "-UNIATA-", + IOCTL_SCSI_MINIPORT_UNIATA_DELETE_DEVICE, + &to, sizeof(to), + NULL, 0, + &returned); + ata_close_dev(h); + return TRUE; +} // end ata_hide() + +BOOLEAN +ata_scan( + int bus_id, + int dev_id, + int lock, + int unhide + ) +{ + char dev_name[64]; + HANDLE h; + ULONG status; + ULONG returned; + SCSI_ADDRESS addr; + ADDREMOVEDEV to; + + if(dev_id == -1) { + return FALSE; + } + if(lock < 0) { + lock = DEFAULT_REMOVAL_LOCK_TIMEOUT; + } + sprintf(dev_name, "\\\\.\\Scsi%d:", bus_id); + h = ata_open_dev(dev_name); + if(!h) + return FALSE; + + if((UCHAR)(dev_id) != 0xff && + (UCHAR)(dev_id >> 8) != 0xff) { + + addr.PortNumber = bus_id; + addr.PathId = (UCHAR)(dev_id >> 16); + addr.TargetId = 0; + addr.Lun = 0; + + to.WaitForPhysicalLink = lock; + to.Flags = unhide ? UNIATA_ADD_FLAGS_UNHIDE : 0; + + printf("Scaning bus for new devices.\n"); + if(lock) { + printf("You have %d seconds to connect device.\n", lock); + } + status = ata_send_ioctl(h, &addr, "-UNIATA-", + IOCTL_SCSI_MINIPORT_UNIATA_FIND_DEVICES, + &to, sizeof(to), + NULL, 0, + &returned); + } else { + status = DeviceIoControl(h, + IOCTL_SCSI_RESCAN_BUS, + NULL, 0, + NULL, 0, + &returned, + FALSE); + } + ata_close_dev(h); + return TRUE; +} // end ata_scan() + +CHAR* +_fgets( + CHAR *string, + int count, + HANDLE stream + ) +{ + CHAR *pointer = string; + ULONG read_bytes; + + CHAR *retval = string; + int ch = 0; + + if (count <= 0) + return(NULL); + + while (--count) + { + if(!ReadFile(stream, &ch, 1, &read_bytes, NULL) || + !read_bytes) + { + if (pointer == string) { + retval=NULL; + goto done; + } + break; + } + + if ((*pointer++ = (CHAR)ch) == '\n') { + break; + } + } + + *pointer = '\0'; + +/* Common return */ +done: + return(retval); +} // end _fgets() + +BOOLEAN +ata_bblk( + int bus_id, + int dev_id, + int list_bb + ) +{ + char dev_name[64]; + char tmp[64]; + char DevSerial[128]; + HANDLE h = NULL; + HANDLE hf = NULL; + ULONG status; + ULONG returned; + SCSI_ADDRESS addr; + ULONG len; + ULONG Length; + BOOLEAN retval = FALSE; + HKEY hKey2 = NULL; + char* bblist = NULL; + LONGLONG tmp_bb_lba; + LONGLONG tmp_bb_len; + char BB_Msg[256]; + int radix=gRadix; + int i, j; + ULONG b; + + if(dev_id == -1) { + printf("\nERROR: Target device/bus ID must be specified\n\n"); + print_help(); + return FALSE; + } + if((dev_id >> 16) & 0xff == 0xff) { + printf("\nERROR: Target device bus number (channel) must be specified with b:<bus id>\n\n"); + print_help(); + return FALSE; + } + if((dev_id >> 8) & 0xff == 0xff) { + printf("\nERROR: Target device ID must be specified with d:<device id>\n\n"); + print_help(); + return FALSE; + } + sprintf(dev_name, "\\\\.\\Scsi%d:", bus_id); + h = ata_open_dev(dev_name); + if(!h) { + if(bus_id == -1) { + printf("Controller number must be specified\n"); + } else { + printf("Can't open Controller %d\n", bus_id); + } + return FALSE; + } + + if(list_bb == 0) { + hf = ata_open_file(g_bb_list, FALSE); + if(!hf) { + printf("Can't open bad block list file:\n %s\n", g_bb_list); + ata_close_dev(h); + return FALSE; + } + + len = GetFileSize(hf, NULL); + if(!len || len == -1) + goto exit; + bblist = (char*)GlobalAlloc(GMEM_FIXED, len*8); + } + + if(!ata_check_unit(h, dev_id | (bus_id << 24))) { + goto exit; + } + + hKey2 = ata_get_bblist_regh(&g_ident, DevSerial, list_bb==1); + if(!hKey2) { + printf("Can't open registry key:\n HKLM\\SYSTEM\\CurrentControlSet\\Services\\UniATA\\Parameters\\BadBlocks\n"); + goto exit; + } + + if(list_bb == -1) { + if(RegDeleteValue(hKey2, DevSerial) != ERROR_SUCCESS) { + printf("Can't delete registry value:\n %s\n", DevSerial); + goto exit; + } + + addr.PortNumber = bus_id; + addr.PathId = (UCHAR)(dev_id >> 16); + addr.TargetId = (UCHAR)(dev_id >> 8); + addr.Lun = (UCHAR)(dev_id); + + status = ata_send_ioctl(h, &addr, "-UNIATA-", + IOCTL_SCSI_MINIPORT_UNIATA_RESETBB, + NULL, 0, + NULL, 0, + &returned); + if(!status) { + printf("Bad block list shall be cleared after reboot.\n"); + } else { + printf("Bad block list cleared\n"); + } + } else + if(list_bb == 0) { + LONGLONG* pData = ((LONGLONG*)bblist); + char a; + int k, k0; + Length=0; + i=0; + j=0; + k=0; + while(_fgets(BB_Msg, sizeof(BB_Msg), hf)) { + j++; + BB_Msg[sizeof(BB_Msg)-1] = 0; + k=0; + while(a = BB_Msg[k]) { + if(a == ' ' || a == '\t' || a == '\r') { + k++; + continue; + } + break; + } + if(!a || a == ';' || a == '#') { + continue; + } + if(!strncmp(BB_Msg+k, "hex:", 4)) { + radix=16; + continue; + } + if(!strncmp(BB_Msg+k, "dec:", 4)) { + radix=10; + continue; + } + k0 = k; + while(a = BB_Msg[k]) { + if(a == ' ' || a == '\t' || a == '\r') { + BB_Msg[k] = '\t'; + } + k++; + if(a == ';' || a == '#') { + break; + } + if(a >= '0' && a <= '9') { + continue; + } + if(radix == 16 && ((a >= 'A' && a <= 'F') || (a >= 'a' && a <= 'f'))) { + continue; + } + printf("Bad input BB list file:\n %s\n", g_bb_list); + printf("Illegal character '%1.1s' in line %d:\n%s\n", BB_Msg+k-1, j, BB_Msg); + k0=-1; + break; + } + if(k0 == -1) { + continue; + } + k = k0; + if(radix == 10) { + b = sscanf(BB_Msg+k, "%I64d\t%I64d", &tmp_bb_lba, &tmp_bb_len); + } else { + b = sscanf(BB_Msg+k, "%I64x\t%I64x", &tmp_bb_lba, &tmp_bb_len); + } + if(b == 1) { + tmp_bb_len = 1; + } else + if(b != 2) { + printf("Bad input BB list file:\n %s\n", g_bb_list); + printf("Can't parse line %d:\n%s\n", j, BB_Msg); + continue; + } + if(!tmp_bb_len) { + printf("Bad input BB list file:\n %s\n", g_bb_list); + printf("BlockCount evaluated to 0 in line %d:\n%s\n", j, BB_Msg); + continue; + } + if(tmp_bb_lba < 0) { + printf("Bad input BB list file:\n %s\n", g_bb_list); + printf("Start LBA evaluated to negative in line %d:\n%s\n", j, BB_Msg); + continue; + } + if(tmp_bb_len < 0) { + printf("Bad input BB list file:\n %s\n", g_bb_list); + printf("BlockCount evaluated to negative in line %d:\n%s\n", j, BB_Msg); + continue; + } + + if(i && + (pData[(i-1)*2+1] == tmp_bb_lba)) { + pData[(i-1)*2+1]+=tmp_bb_len; + } else { + pData[i*2+0]=tmp_bb_lba; + pData[i*2+1]=tmp_bb_lba+tmp_bb_len; + i++; + Length += sizeof(LONGLONG)*2; + } + } + + if(RegSetValueEx(hKey2, DevSerial, NULL, REG_BINARY, (const UCHAR*)bblist, Length) != ERROR_SUCCESS) { + printf("Can't set registry value:\n %s\n", DevSerial); + goto exit; + } +/* + addr.PortNumber = bus_id; + addr.PathId = (UCHAR)(dev_id >> 16); + addr.TargetId = (UCHAR)(dev_id >> 8); + addr.Lun = (UCHAR)(dev_id); + + status = ata_send_ioctl(h, &addr, "-UNIATA-", + IOCTL_SCSI_MINIPORT_UNIATA_SETBB, + NULL, 0, + NULL, 0, + &returned); +*/ + printf("Bad block list shall be applied after reboot\n"); + } else { + len = 0; + returned = RegQueryValueEx(hKey2, DevSerial, NULL, NULL, NULL, &len); + if(returned == 2) { + printf("No bad block list assigned\n"); + goto exit; + } else + if(returned != ERROR_SUCCESS) { + printf("Can't get registry value:\n %s\n", DevSerial); + goto exit; + } + + hf = ata_open_file(g_bb_list, TRUE); + if(!hf) { + printf("Can't create bad block list file:\n %s\n", g_bb_list); + goto exit; + } + + bblist = (char*)GlobalAlloc(GMEM_FIXED, len); + if(RegQueryValueEx(hKey2, DevSerial, NULL, NULL, (UCHAR*)bblist, &len) != ERROR_SUCCESS) { + printf("Can't get registry value:\n %s\n", DevSerial); + goto exit; + } + if(g_bb_list) { + for (j = 0; j < 20; j += 2) { + MOV_DW_SWP(tmp[j], ((PUCHAR)(&g_ident.ModelNumber))[j]); + } + b = sprintf(BB_Msg, "#model: %20.20s\n", tmp); + WriteFile(hf, BB_Msg, b, &returned, NULL); + for (j = 0; j < 4; j += 2) { + MOV_DW_SWP(tmp[j], ((PUCHAR)(&g_ident.FirmwareRevision))[j]); + } + b = sprintf(BB_Msg, "#rev: %4.4s\n", tmp); + WriteFile(hf, BB_Msg, b, &returned, NULL); + for (j = 0; j < 20; j += 2) { + MOV_DW_SWP(tmp[j], ((PUCHAR)(&g_ident.SerialNumber))[j]); + } + b = sprintf(BB_Msg, "#s/n: %20.20s\n", tmp); + WriteFile(hf, BB_Msg, b, &returned, NULL); + b = sprintf(BB_Msg, "#%s\n", DevSerial); + WriteFile(hf, BB_Msg, b, &returned, NULL); + b = sprintf(BB_Msg, "#Starting LBA\tNum. of Blocks\n"); + WriteFile(hf, BB_Msg, b, &returned, NULL); + b = sprintf(BB_Msg, "hex:\n"); + WriteFile(hf, BB_Msg, b, &returned, NULL); + } else { + b = sprintf(BB_Msg, "Starting LBA\tNum. of Blocks (HEX)\n"); + WriteFile(hf, BB_Msg, b, &returned, NULL); + } + i = 0; + while(len >= sizeof(LONGLONG)*2) { + tmp_bb_lba = ((LONGLONG*)bblist)[i*2+0]; + tmp_bb_len = ((LONGLONG*)bblist)[i*2+1] - tmp_bb_lba; + b = sprintf(BB_Msg, "%I64x\t%I64x\n", tmp_bb_lba, tmp_bb_len); + WriteFile(hf, BB_Msg, b, &returned, NULL); + i++; + len -= sizeof(LONGLONG)*2; + } + } + retval = TRUE; +exit: + if(hKey2) + RegCloseKey(hKey2); + if(bblist) { + GlobalFree(bblist); + } + ata_close_dev(hf); + ata_close_dev(h); + return retval; +} // end ata_bblk() + +int +ata_num_to_x_dev( + char a + ) +{ + if(a >= '0' && a <= '9') + return a-'0'; + return -1; +} + +int +main ( + int argc, + char* argv[] + ) +{ + ULONG Flags = 0; + int i, j; + char a; + int bus_id = -1; + int dev_id = -1; + int cmd = 0; + int lock = -1; + int b_dev=-1, d_dev=-1, l_dev=0; + int mode=-1; + int list_bb=0; + int persistent_hide=0; + + printf("Console ATA control utility for Windows NT3.51/NT4/2000/XP/2003\n" + "Version 0." UNIATA_VER_STR ", Copyright (c) Alexander A. Telyatnikov, 2003-2008\n" + "Home site:
http://alter.org.ua\n
"); + + for(i=1; i<argc; i++) { + if(!argv[i]) + continue; + if((a = argv[i][0]) != '-') { + for(j=0; a = argv[i][j]; j++) { + switch(a) { + case 'a' : + case 's' : + case 'c' : + j++; + bus_id = ata_num_to_x_dev(argv[i][j]); + break; + case 'b' : + j++; + b_dev = ata_num_to_x_dev(argv[i][j]); + break; + case 'd' : + j++; + d_dev = ata_num_to_x_dev(argv[i][j]); + break; + case 'l' : + j++; + l_dev = ata_num_to_x_dev(argv[i][j]); + break; + case ':' : + break; + default: + print_help(); + } + } + continue; + } + j=1; + while(argv[i] && (a = argv[i][j]) && (a != ' ') && (a != '\t')) { + switch(a) { + case 'l' : + if(cmd || lock>0) { + print_help(); + } + cmd = CMD_ATA_LIST; + break; + case 'x' : + g_extended = 1; + break; + case 'a' : + g_adapter_info = 1; + break; + case 'S' : + persistent_hide = 1; + case 's' : + if(cmd || lock>0) { + print_help(); + } + cmd = CMD_ATA_FIND; + d_dev = 0; + break; + case 'H' : + persistent_hide = 1; + case 'h' : + if(cmd) { + print_help(); + } + cmd = CMD_ATA_HIDE; + d_dev = 0; + break; + case 'm' : + if(cmd) { + print_help(); + } + cmd = CMD_ATA_MODE; + i++; + if(!argv[i]) { + print_help(); + } + mode = ata_str_to_mode(argv[i]); + if(mode == -1) { + i--; + } else { + j = strlen(argv[i])-1; + } + break; + case 'r' : + if(cmd) { + print_help(); + } + cmd = CMD_ATA_RESET; + break; + case 'b' : + if(cmd) { + print_help(); + } + switch(argv[i][j+1]) { + case 'l': + list_bb = 1; + break; + case 'a': + list_bb = 0; + break; + case 'r': + list_bb = -1; + break; + default: + j--; + } + j++; + cmd = CMD_ATA_BBLK; + break; + case 'f' : + if(cmd != CMD_ATA_BBLK) { + print_help(); + } + i++; + if(!argv[i]) { + print_help(); + } + g_bb_list=argv[i]; + j = strlen(argv[i])-1; + break; + case 'd' : + if(cmd && cmd != CMD_ATA_FIND && cmd != CMD_ATA_HIDE) { + print_help(); + } + i++; + if(!argv[i]) { + print_help(); + } + if(!sscanf(argv[i], "%d", &lock)) { + lock = DEFAULT_REMOVAL_LOCK_TIMEOUT; + i--; + } + j = strlen(argv[i])-1; + break; + case 'n' : + if(cmd != CMD_ATA_BBLK) { + print_help(); + } + i++; + if(!argv[i]) { + print_help(); + } + if(!strcmp(argv[i], "hex") || + !strcmp(argv[i], "16")) { + gRadix = 16; + } else + if(!strcmp(argv[i], "dec") || + !strcmp(argv[i], "10")) { + gRadix = 10; + } else { + print_help(); + } + j = strlen(argv[i])-1; + break; + case '?' : + default: + print_help(); + } + j++; + } + } + + if(g_adapter_info && !cmd) { + cmd = CMD_ATA_LIST; + b_dev = 127; + d_dev = 127; + l_dev = 127; + } else + if(d_dev == -1 && b_dev != -1) { + d_dev = 127; + l_dev = 127; + } + + if(d_dev != -1 && b_dev != -1) { + dev_id = (b_dev << 16) | (d_dev << 8) | l_dev; + } + if(cmd == CMD_ATA_LIST) { + ata_list(bus_id, dev_id); + } else + if(cmd == CMD_ATA_MODE) { + ata_mode(bus_id, dev_id, mode); + } else + if(cmd == CMD_ATA_RESET) { + ata_reset(bus_id, dev_id); + } else + if(cmd == CMD_ATA_FIND) { + ata_scan(bus_id, dev_id, lock, persistent_hide); + } else + if(cmd == CMD_ATA_HIDE) { + ata_hide(bus_id, dev_id, lock, persistent_hide); + } else + if(cmd == CMD_ATA_BBLK) { + ata_bblk(bus_id, dev_id, list_bb); + } else { + print_help(); + } + exit(0); +} + Propchange: trunk/reactos/base/applications/atactl/atactl.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/base/applications/atactl/helper.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/atactl/h…
============================================================================== --- trunk/reactos/base/applications/atactl/helper.h (added) +++ trunk/reactos/base/applications/atactl/helper.h [iso-8859-1] Tue Jul 31 17:18:47 2012 @@ -1,0 +1,38 @@ +typedef struct _DRIVERSTATUS { + UCHAR bDriverError; + UCHAR bIDEError; + UCHAR bReserved[2]; + ULONG dwReserved[2]; +} DRIVERSTATUS, *PDRIVERSTATUS, *LPDRIVERSTATUS; + +typedef struct _IDEREGS { + UCHAR bFeaturesReg; + UCHAR bSectorCountReg; + UCHAR bSectorNumberReg; + UCHAR bCylLowReg; + UCHAR bCylHighReg; + UCHAR bDriveHeadReg; + UCHAR bCommandReg; + UCHAR bReserved; +} IDEREGS, *PIDEREGS, *LPIDEREGS; + +#define ATAPI_ID_CMD 0xA1 +#define ID_CMD 0xEC +#define SMART_CMD 0xB0 + +#include <pshpack1.h> +typedef struct _SENDCMDOUTPARAMS { + ULONG cBufferSize; + DRIVERSTATUS DriverStatus; + UCHAR bBuffer[1]; +} SENDCMDOUTPARAMS, *PSENDCMDOUTPARAMS, *LPSENDCMDOUTPARAMS; + +typedef struct _SENDCMDINPARAMS { + ULONG cBufferSize; + IDEREGS irDriveRegs; + UCHAR bDriveNumber; + UCHAR bReserved[3]; + ULONG dwReserved[4]; + UCHAR bBuffer[1]; +} SENDCMDINPARAMS, *PSENDCMDINPARAMS, *LPSENDCMDINPARAMS; +#include <poppack.h> Propchange: trunk/reactos/base/applications/atactl/helper.h ------------------------------------------------------------------------------ svn:eol-style = native
12 years, 4 months
1
0
0
0
[akhaldi] 57002: [DISK_NEW] * Allow warnings here (3rd party code).
by akhaldi@svn.reactos.org
Author: akhaldi Date: Tue Jul 31 16:47:04 2012 New Revision: 57002 URL:
http://svn.reactos.org/svn/reactos?rev=57002&view=rev
Log: [DISK_NEW] * Allow warnings here (3rd party code). Modified: trunk/reactos/drivers/storage/class/disk_new/CMakeLists.txt Modified: trunk/reactos/drivers/storage/class/disk_new/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/class/disk…
============================================================================== --- trunk/reactos/drivers/storage/class/disk_new/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/class/disk_new/CMakeLists.txt [iso-8859-1] Tue Jul 31 16:47:04 2012 @@ -17,8 +17,8 @@ if(ARCH MATCHES i386) # FIXME:
http://www.cmake.org/Bug/view.php?id=12998
if(NOT MSVC) - #add_target_compile_flags(disk_new "-Wno-format -Wno-pointer-sign") - set_source_files_properties(${SOURCE} PROPERTIES COMPILE_FLAGS "-Wno-format -Wno-pointer-sign") + #add_target_compile_flags(disk_new "-Wno-error -Wno-format -Wno-pointer-sign") + set_source_files_properties(${SOURCE} PROPERTIES COMPILE_FLAGS "-Wno-error -Wno-format -Wno-pointer-sign") endif() endif()
12 years, 4 months
1
0
0
0
[ion] 57001: [NTOSKRNL]: When dispatching a prototype PTE fault, call MiCompleteProtoPteFault instead of directly calling MiResolveProtoPteFault. Also add support/detection for clustering.
by ion@svn.reactos.org
Author: ion Date: Tue Jul 31 07:32:19 2012 New Revision: 57001 URL:
http://svn.reactos.org/svn/reactos?rev=57001&view=rev
Log: [NTOSKRNL]: When dispatching a prototype PTE fault, call MiCompleteProtoPteFault instead of directly calling MiResolveProtoPteFault. Also add support/detection for clustering. Modified: trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c Modified: trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/pagfault.…
============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c [iso-8859-1] Tue Jul 31 07:32:19 2012 @@ -841,12 +841,14 @@ IN BOOLEAN Recursive, IN PEPROCESS Process, IN PVOID TrapInformation, - IN PVOID Vad) + IN PMMVAD Vad) { MMPTE TempPte; KIRQL OldIrql, LockIrql; NTSTATUS Status; PMMPTE SuperProtoPte; + PMMPFN Pfn1; + PFN_NUMBER PageFrameIndex, PteCount, ProcessedPtes; DPRINT("ARM3 Page Fault Dispatcher for address: %p in process: %p\n", Address, Process); @@ -910,29 +912,73 @@ } else { - /* We currently only handle very limited paths */ - ASSERT(PointerPte->u.Soft.Prototype == 1); + /* We only handle the lookup path */ ASSERT(PointerPte->u.Soft.PageFileHigh == MI_PTE_LOOKUP_NEEDED); + + /* Is there a non-image VAD? */ + if ((Vad) && + (Vad->u.VadFlags.VadType != VadImageMap) && + !(Vad->u2.VadFlags2.ExtendableFile)) + { + /* One day, ReactOS will cluster faults */ + ASSERT(Address <= MM_HIGHEST_USER_ADDRESS); + DPRINT("Should cluster fault, but won't\n"); + } + + /* Only one PTE to handle for now */ + PteCount = 1; + ProcessedPtes = 0; /* Lock the PFN database */ LockIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock); - /* For our current usage, this should be true */ + /* We only handle the valid path */ ASSERT(SuperProtoPte->u.Hard.Valid == 1); - ASSERT(TempPte.u.Hard.Valid == 0); - - /* Resolve the fault -- this will release the PFN lock */ - Status = MiResolveProtoPteFault(StoreInstruction, + + /* Capture the PTE */ + TempPte = *PointerProtoPte; + + /* Loop to handle future case of clustered faults */ + while (TRUE) + { + /* For our current usage, this should be true */ + ASSERT(TempPte.u.Hard.Valid == 1); + ASSERT(TempPte.u.Soft.Prototype == 0); + ASSERT(TempPte.u.Soft.Transition == 0); + + /* Bump the share count on the PTE */ + PageFrameIndex = PFN_FROM_PTE(&TempPte); + Pfn1 = MI_PFN_ELEMENT(PageFrameIndex); + Pfn1->u2.ShareCount++; + + /* One more done, was it the last? */ + if (++ProcessedPtes == PteCount) + { + /* Complete the fault */ + MiCompleteProtoPteFault(StoreInstruction, Address, PointerPte, PointerProtoPte, - NULL, - NULL, - NULL, - Process, LockIrql, - TrapInformation); - ASSERT(Status == STATUS_SUCCESS); + NULL); + + /* THIS RELEASES THE PFN LOCK! */ + break; + } + + /* No clustered faults yet */ + ASSERT(FALSE); + } + + /* Only path that we support for now */ + ASSERT(ProcessedPtes != 0); + + /* Bump the transition count */ + InterlockedExchangeAdd(&KeGetCurrentPrcb()->MmTransitionCount, ProcessedPtes); + ProcessedPtes--; + + /* Loop all the processing we did */ + ASSERT(ProcessedPtes == 0); /* Complete this as a transition fault */ ASSERT(OldIrql == KeGetCurrentIrql());
12 years, 4 months
1
0
0
0
← Newer
1
2
3
4
...
20
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Results per page:
10
25
50
100
200