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
March 2015
----- 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
18 participants
496 discussions
Start a n
N
ew thread
[tkreuzer] 66653: [INCLUDE/CRT] Fix annotations for _dupenv_s and _wdupenv_s (They are broken in MS headers, looks like nobody uses attributes for SAL...)
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Mar 10 09:09:48 2015 New Revision: 66653 URL:
http://svn.reactos.org/svn/reactos?rev=66653&view=rev
Log: [INCLUDE/CRT] Fix annotations for _dupenv_s and _wdupenv_s (They are broken in MS headers, looks like nobody uses attributes for SAL...) Modified: trunk/reactos/include/crt/sec_api/stdlib_s.h Modified: trunk/reactos/include/crt/sec_api/stdlib_s.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/crt/sec_api/stdlib…
============================================================================== --- trunk/reactos/include/crt/sec_api/stdlib_s.h [iso-8859-1] (original) +++ trunk/reactos/include/crt/sec_api/stdlib_s.h [iso-8859-1] Tue Mar 10 09:09:48 2015 @@ -19,7 +19,7 @@ errno_t __cdecl _dupenv_s( - _Outptr_result_buffer_maybenull_(*_PBufferSizeInBytes) _Outptr_result_z_ char **_PBuffer, + _Outptr_result_buffer_maybenull_(*_PBufferSizeInBytes) _Outptr_result_maybenull_z_ char **_PBuffer, _Out_opt_ size_t *_PBufferSizeInBytes, _In_z_ const char *_VarName); @@ -180,7 +180,7 @@ errno_t __cdecl _wdupenv_s( - _Outptr_result_buffer_maybenull_(*_BufferSizeInWords) _Outptr_result_z_ wchar_t **_Buffer, + _Outptr_result_buffer_maybenull_(*_BufferSizeInWords) _Outptr_result_maybenull_z_ wchar_t **_Buffer, _Out_opt_ size_t *_BufferSizeInWords, _In_z_ const wchar_t *_VarName);
9 years, 9 months
1
0
0
0
[tkreuzer] 66652: [SAL] Implement _Deref_post_bytecount_, _Outptr_result_maybenull_z_, _Pre_unknown_ and _Maybe_raises_SEH_exception_ annotations
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Mar 10 09:09:31 2015 New Revision: 66652 URL:
http://svn.reactos.org/svn/reactos?rev=66652&view=rev
Log: [SAL] Implement _Deref_post_bytecount_, _Outptr_result_maybenull_z_, _Pre_unknown_ and _Maybe_raises_SEH_exception_ annotations Modified: trunk/reactos/include/psdk/sal.h Modified: trunk/reactos/include/psdk/sal.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/sal.h?rev=666…
============================================================================== --- trunk/reactos/include/psdk/sal.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/sal.h [iso-8859-1] Tue Mar 10 09:09:31 2015 @@ -452,7 +452,7 @@ #define _Deref_post_bytecap_(size) _SAL11_NAME(_Deref_post_bytecap_) _Group_([SA_Post(Deref=1,Null=SA_No,Notref=1)] [SA_Post(Deref=1,WritableBytes="\n" _SA_SPECSTRIZE(size))]) //#define _Deref_post_bytecap_c_(size) //#define _Deref_post_bytecap_x_(size) -#define _Deref_post_bytecount_(size) +#define _Deref_post_bytecount_(size) _SAL11_NAME(_Deref_post_bytecount_) _Group_([SA_Post(Deref=1,Null=SA_No,Notref=1)] [SA_Post(Deref=1,ValidBytes="\n"#size)] [SA_Post(Valid=SA_Yes)]) //#define _Deref_post_bytecount_c_(size) //#define _Deref_post_bytecount_x_(size) //#define _Deref_post_cap_(size) @@ -837,7 +837,7 @@ #define _Outptr_result_bytebuffer_to_(size, count) _SAL2_NAME(_Outptr_result_bytebuffer_to_) _Group_([SA_Pre(Null=SA_No,Notref=1)] [SA_Pre(WritableElementsConst=1,Notref=1)] [SA_Post(Valid=SA_Yes)] [SA_Post(Deref=1,Null=SA_No,Notref=1,WritableBytes="\n" _SA_SPECSTRIZE(size), ValidBytes="\n" _SA_SPECSTRIZE(count))]) //#define _Outptr_result_bytebuffer_to_maybenull_(size, count) #define _Outptr_result_maybenull_ _SAL2_NAME(_Outptr_result_maybenull_) _Group_([SA_Pre(Null=SA_No,Notref=1)] [SA_Pre(WritableElementsConst=1,Notref=1)] [SA_Post(Valid=SA_Yes)] [SA_Post(Deref=1,Null=SA_Maybe,Notref=1,ValidElements="\n""1")] ) -//#define _Outptr_result_maybenull_z_ +#define _Outptr_result_maybenull_z_ _SAL2_NAME(_Outptr_result_maybenull_z_) _Group_([SA_Pre(Null=SA_No,Notref=1)] [SA_Pre(WritableElementsConst=1,Notref=1)] [SA_Post(Valid=SA_Yes)] _Deref_post_opt_z_) #define _Outptr_result_nullonfailure_ _SAL2_NAME(_Outptr_result_nullonfailure_) _Group_(_Outptr_ [SAL_context(p1="SAL_failed")] _Group_([SAL_post] _Deref_post_null_) ) #define _Outptr_result_z_ _SAL2_NAME(_Outptr_result_z_) _Group_([SA_Pre(Null=SA_No,Notref=1)] [SA_Pre(WritableElementsConst=1,Notref=1)] [SA_Post(Valid=SA_Yes)] _Deref_post_z_) //#define _Outref_ @@ -943,7 +943,7 @@ #define _Pre_readable_size_(size) _SAL2_NAME(_Pre_readable_size_) _Group_([SA_Pre(ValidElements="\n" _SA_SPECSTRIZE(size))] [SA_Pre(Valid=SA_Yes)] ) //#define _Pre_readonly_ #define _Pre_satisfies_(cond) _SAL2_NAME(_Pre_satisfies_) _Group_([SAL_pre] [SAL_annotes(Name="SAL_satisfies", p1=_SA_SPECSTRIZE(cond))]) -#define _Pre_unknown_ +#define _Pre_unknown_ _SAL2_NAME(_Pre_unknown_) _Group_([SA_Pre(Valid=SA_Maybe)]) #define _Pre_valid_ _SAL2_NAME(_Pre_valid_) _Group_([SA_Pre(Null=SA_No,Notref=1)] [SA_Pre(Valid=SA_Yes)] ) #define _Pre_valid_bytecap_(size) _SAL11_NAME(_Pre_valid_bytecap_) _Group_([SA_Pre(Null=SA_No,Notref=1)] [SA_Pre(WritableBytes="\n" _SA_SPECSTRIZE(size))] [SA_Pre(Valid=SA_Yes)] ) //#define _Pre_valid_bytecap_c_(size) @@ -979,7 +979,7 @@ #define _Prepost_z_ _SAL2_NAME(_Prepost_z_) _Group_(_Pre_z_ _Post_z_) #define _Printf_format_string_ _SAL2_NAME(_Printf_format_string_) _Group_([SA_FormatString(Style="printf")] ) //#define _Raises_SEH_exception_ -#define _Maybe_raises_SEH_exception_ +#define _Maybe_raises_SEH_exception_ _SAL2_NAME(_Maybe_raises_SEH_exception_) _Group_(_Pre_ [SAL_annotes(Name="SAL_inTry", p1="__yes")]) #define _Readable_bytes_(size) _SAL2_NAME(_Readable_bytes_) _Group_(_SA_annotes1(SAL_readableTo, byteCount(size))) #define _Readable_elements_(size) _SAL2_NAME(_Readable_elements_) _Group_([SAL_annotes(Name="SAL_readableTo", p1="elementCount(size)")]) #define _Reserved_ _SAL2_NAME(_Reserved_) _Group_([SA_Pre(Null=SA_Yes)])
9 years, 9 months
1
0
0
0
[tkreuzer] 66651: [XDK] Fix typos, spotted by Thomas.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Mar 10 09:05:08 2015 New Revision: 66651 URL:
http://svn.reactos.org/svn/reactos?rev=66651&view=rev
Log: [XDK] Fix typos, spotted by Thomas. Modified: trunk/reactos/include/xdk/exfuncs.h Modified: trunk/reactos/include/xdk/exfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/exfuncs.h?rev=…
============================================================================== --- trunk/reactos/include/xdk/exfuncs.h [iso-8859-1] (original) +++ trunk/reactos/include/xdk/exfuncs.h [iso-8859-1] Tue Mar 10 09:05:08 2015 @@ -606,14 +606,14 @@ VOID NTAPI ExFreePool( - _Pre_not __drv_freesMem(Mem) PVOID P); + _Pre_notnull_ __drv_freesMem(Mem) PVOID P); _IRQL_requires_max_(DISPATCH_LEVEL) NTKERNELAPI VOID NTAPI ExFreePoolWithTag( - _Pre_not __drv_freesMem(Mem) PVOID P, + _Pre_notnull_ __drv_freesMem(Mem) PVOID P, _In_ ULONG Tag); _IRQL_requires_max_(DISPATCH_LEVEL)
9 years, 9 months
1
0
0
0
[tkreuzer] 66650: [WIN32K] Annotate eng/mapping.c
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Mar 10 00:13:43 2015 New Revision: 66650 URL:
http://svn.reactos.org/svn/reactos?rev=66650&view=rev
Log: [WIN32K] Annotate eng/mapping.c Modified: trunk/reactos/include/psdk/winddi.h trunk/reactos/win32ss/gdi/eng/mapping.c trunk/reactos/win32ss/gdi/eng/mapping.h 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 Mar 10 00:13:43 2015 @@ -1842,7 +1842,7 @@ VOID APIENTRY EngFreeModule( - _In_ HANDLE h); + _In_ _Post_invalid_ HANDLE h); ENGAPI @@ -2089,6 +2089,8 @@ _Out_ ULONG_PTR *piFile); __drv_preferredFunction("EngMapFontFileFD", "Obsolete") +_Check_return_ +_Success_(return!=FALSE) ENGAPI BOOL APIENTRY @@ -2097,6 +2099,8 @@ _Outptr_result_bytebuffer_(*pcjBuf) PULONG *ppjBuf, _Out_ ULONG *pcjBuf); +_Check_return_ +_Success_(return!=FALSE) ENGAPI BOOL APIENTRY @@ -2105,12 +2109,15 @@ _Outptr_result_bytebuffer_(*pcjBuf) PULONG *ppjBuf, _Out_ ULONG *pcjBuf); +_Check_return_ +_Success_(return!=NULL) +_Post_writable_byte_size_(*pulSize) ENGAPI PVOID APIENTRY EngMapModule( - _In_ HANDLE h, - _Out_ PULONG pSize); + _In_ HANDLE h, + _Out_ PULONG pulSize); ENGAPI BOOL Modified: trunk/reactos/win32ss/gdi/eng/mapping.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/mapping.c?…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/mapping.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/mapping.c [iso-8859-1] Tue Mar 10 00:13:43 2015 @@ -86,13 +86,12 @@ ASSERT(NT_SUCCESS(Status)); } - PVOID NTAPI EngCreateSection( - IN ULONG fl, - IN SIZE_T cjSize, - IN ULONG ulTag) + _In_ ULONG fl, + _In_ SIZE_T cjSize, + _In_ ULONG ulTag) { NTSTATUS Status; PENGSECTION pSection; @@ -131,9 +130,9 @@ PVOID NTAPI EngCreateSectionHack( - IN ULONG fl, - IN SIZE_T cjSize, - IN ULONG ulTag) + _In_ ULONG fl, + _In_ SIZE_T cjSize, + _In_ ULONG ulTag) { NTSTATUS Status; PENGSECTION pSection; @@ -169,15 +168,14 @@ return pSection; } - - +_Success_(return!=FALSE) BOOL APIENTRY EngMapSection( - IN PVOID pvSection, - IN BOOL bMap, - IN HANDLE hProcess, - OUT PVOID* pvBaseAddress) + _In_ PVOID pvSection, + _In_ BOOL bMap, + _In_ HANDLE hProcess, + _When_(bMap, _Outptr_) PVOID* pvBaseAddress) { NTSTATUS Status; PENGSECTION pSection = pvSection; @@ -246,8 +244,8 @@ BOOL APIENTRY EngFreeSectionMem( - IN PVOID pvSection OPTIONAL, - IN PVOID pvMappedBase OPTIONAL) + _In_opt_ PVOID pvSection, + _In_opt_ PVOID pvMappedBase) { NTSTATUS Status; PENGSECTION pSection = pvSection; @@ -277,13 +275,17 @@ return bResult; } +_Check_return_ +_Success_(return!=NULL) +__drv_allocatesMem(Mem) +_Post_writable_byte_size_(cjSize) PVOID APIENTRY EngAllocSectionMem( - OUT PVOID *ppvSection, - IN ULONG fl, - IN SIZE_T cjSize, - IN ULONG ulTag) + _Outptr_ PVOID *ppvSection, + _In_ ULONG fl, + _In_ SIZE_T cjSize, + _In_ ULONG ulTag) { NTSTATUS Status; PENGSECTION pSection; @@ -321,13 +323,13 @@ return pSection->pvMappedBase; } - +_Check_return_ PFILEVIEW NTAPI EngLoadModuleEx( - LPWSTR pwsz, - ULONG cjSizeOfModule, - FLONG fl) + _In_z_ LPWSTR pwsz, + _In_ ULONG cjSizeOfModule, + _In_ FLONG fl) { PFILEVIEW pFileView = NULL; OBJECT_ATTRIBUTES ObjectAttributes; @@ -446,6 +448,9 @@ return (HANDLE)EngLoadModuleEx(pwsz, cjSizeOfModule, FVF_SYSTEMROOT); } +_Check_return_ +_Success_(return!=NULL) +_Post_writable_byte_size_(*pulSize) PVOID APIENTRY EngMapModule( @@ -475,7 +480,7 @@ VOID APIENTRY EngFreeModule( - _In_ HANDLE h) + _In_ _Post_invalid_ HANDLE h) { PFILEVIEW pFileView = (PFILEVIEW)h; NTSTATUS Status; @@ -540,7 +545,8 @@ return TRUE; } - +_Check_return_ +_Success_(return!=FALSE) BOOL APIENTRY EngMapFontFileFD( @@ -562,6 +568,9 @@ UNIMPLEMENTED; } +__drv_preferredFunction("EngMapFontFileFD", "Obsolete") +_Check_return_ +_Success_(return!=FALSE) BOOL APIENTRY EngMapFontFile( Modified: trunk/reactos/win32ss/gdi/eng/mapping.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/mapping.h?…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/mapping.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/mapping.h [iso-8859-1] Tue Mar 10 00:13:43 2015 @@ -53,36 +53,42 @@ PVOID NTAPI EngCreateSection( - IN ULONG fl, - IN SIZE_T cjSize, - IN ULONG ulTag); + _In_ ULONG fl, + _In_ SIZE_T cjSize, + _In_ ULONG ulTag); +_Success_(return!=FALSE) BOOL APIENTRY EngMapSection( - IN PVOID pvSection, - IN BOOL bMap, - IN HANDLE hProcess, - OUT PVOID* pvBaseAddress); + _In_ PVOID pvSection, + _In_ BOOL bMap, + _In_ HANDLE hProcess, + _When_(bMap, _Outptr_) PVOID* pvBaseAddress); +_Check_return_ +_Success_(return!=NULL) +__drv_allocatesMem(Mem) +_Post_writable_byte_size_(cjSize) PVOID APIENTRY EngAllocSectionMem( - OUT PVOID *ppvSection, - IN ULONG fl, - IN SIZE_T cjSize, - IN ULONG ulTag); + _Outptr_ PVOID *ppvSection, + _In_ ULONG fl, + _In_ SIZE_T cjSize, + _In_ ULONG ulTag); BOOL APIENTRY EngFreeSectionMem( - IN PVOID pvSection OPTIONAL, - IN PVOID pvMappedBase OPTIONAL); + _In_opt_ PVOID pvSection, + _In_opt_ PVOID pvMappedBase); +_Check_return_ PFILEVIEW NTAPI EngLoadModuleEx( - LPWSTR pwsz, - ULONG cjSizeOfModule, - FLONG fl); + _In_z_ LPWSTR pwsz, + _In_ ULONG cjSizeOfModule, + _In_ FLONG fl);
9 years, 9 months
1
0
0
0
[tkreuzer] 66649: [WIN32K] Annotate mouse.c, move some prototypes to the proper location. Fix bugs in EngSetPointerShape and IntEngSetPointerShape, where the passed in XLATEOBJ could be NULL. Found...
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Mar 10 00:13:29 2015 New Revision: 66649 URL:
http://svn.reactos.org/svn/reactos?rev=66649&view=rev
Log: [WIN32K] Annotate mouse.c, move some prototypes to the proper location. Fix bugs in EngSetPointerShape and IntEngSetPointerShape, where the passed in XLATEOBJ could be NULL. Found by MSVC static analyzer. Modified: trunk/reactos/win32ss/gdi/eng/inteng.h trunk/reactos/win32ss/gdi/eng/mouse.c trunk/reactos/win32ss/gdi/eng/mouse.h 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 Mar 10 00:13:29 2015 @@ -147,19 +147,6 @@ _In_ POINTL *pptlBrushOrg, _In_ __in_data_source(USER_MODE) MIX mix); -ULONG APIENTRY -IntEngSetPointerShape( - IN SURFOBJ *pso, - IN SURFOBJ *psoMask, - IN SURFOBJ *psoColor, - IN XLATEOBJ *pxlo, - IN LONG xHot, - IN LONG yHot, - IN LONG x, - IN LONG y, - IN RECTL *prcl, - IN FLONG fl); - BOOL APIENTRY IntEngAlphaBlend( Modified: trunk/reactos/win32ss/gdi/eng/mouse.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/mouse.c?re…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/mouse.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/mouse.c [iso-8859-1] Tue Mar 10 00:13:29 2015 @@ -15,14 +15,15 @@ /* FUNCTIONS *****************************************************************/ +__drv_preferredFunction("(see documentation)", "Obsolete, always returns false. ") BOOL APIENTRY EngSetPointerTag( - IN HDEV hdev, - IN SURFOBJ *psoMask, - IN SURFOBJ *psoColor, - IN XLATEOBJ *pxlo, - IN FLONG fl) + _In_ HDEV hdev, + _In_opt_ SURFOBJ *psoMask, + _In_opt_ SURFOBJ *psoColor, + _Reserved_ XLATEOBJ *pxlo, + _In_ FLONG fl) { // This function is obsolete for Windows 2000 and later. // This function is still supported, but always returns FALSE. @@ -34,13 +35,15 @@ * FUNCTION: Notify the mouse driver that drawing is about to begin in * a rectangle on a particular surface. */ -INT NTAPI +_Requires_lock_held_(*ppdev->hsemDevLock) +BOOL +NTAPI MouseSafetyOnDrawStart( - PPDEVOBJ ppdev, - LONG HazardX1, - LONG HazardY1, - LONG HazardX2, - LONG HazardY2) + _Inout_ PPDEVOBJ ppdev, + _In_ LONG HazardX1, + _In_ LONG HazardY1, + _In_ LONG HazardX2, + _In_ LONG HazardY2) { LONG tmp; GDIPOINTER *pgp; @@ -84,15 +87,17 @@ ppdev->pfnMovePointer(&ppdev->pSurface->SurfObj, -1, -1, NULL); } - return(TRUE); + return TRUE; } /* * FUNCTION: Notify the mouse driver that drawing has finished on a surface. */ -INT NTAPI +_Requires_lock_held_(*ppdev->hsemDevLock) +BOOL +NTAPI MouseSafetyOnDrawEnd( - PPDEVOBJ ppdev) + _Inout_ PPDEVOBJ ppdev) { GDIPOINTER *pgp; @@ -118,7 +123,7 @@ ppdev->SafetyRemoveLevel = 0; - return(TRUE); + return TRUE; } /* SOFTWARE MOUSE POINTER IMPLEMENTATION **************************************/ @@ -126,8 +131,8 @@ VOID NTAPI IntHideMousePointer( - PDEVOBJ *ppdev, - SURFOBJ *psoDest) + _Inout_ PDEVOBJ *ppdev, + _Inout_ SURFOBJ *psoDest) { GDIPOINTER *pgp; POINTL pt; @@ -179,7 +184,9 @@ VOID NTAPI -IntShowMousePointer(PDEVOBJ *ppdev, SURFOBJ *psoDest) +IntShowMousePointer( + _Inout_ PDEVOBJ *ppdev, + _Inout_ SURFOBJ *psoDest) { GDIPOINTER *pgp; POINTL pt; @@ -309,18 +316,19 @@ /* * @implemented */ -ULONG APIENTRY +ULONG +APIENTRY EngSetPointerShape( - IN SURFOBJ *pso, - IN SURFOBJ *psoMask, - IN SURFOBJ *psoColor, - IN XLATEOBJ *pxlo, - IN LONG xHot, - IN LONG yHot, - IN LONG x, - IN LONG y, - IN RECTL *prcl, - IN FLONG fl) + _In_ SURFOBJ *pso, + _In_opt_ SURFOBJ *psoMask, + _In_opt_ SURFOBJ *psoColor, + _In_opt_ XLATEOBJ *pxlo, + _In_ LONG xHot, + _In_ LONG yHot, + _In_ LONG x, + _In_ LONG y, + _In_ RECTL *prcl, + _In_ FLONG fl) { PDEVOBJ *ppdev; GDIPOINTER *pgp; @@ -334,6 +342,10 @@ ppdev = GDIDEV(pso); pgp = &ppdev->Pointer; + + /* Handle the case where we have no XLATEOBJ */ + if (pxlo == NULL) + pxlo = &gexloTrivial.xlo; /* Do we have any bitmap at all? */ if (psoColor || psoMask) @@ -549,13 +561,13 @@ /* * @implemented */ - -VOID APIENTRY +VOID +APIENTRY EngMovePointer( - IN SURFOBJ *pso, - IN LONG x, - IN LONG y, - IN RECTL *prcl) + _In_ SURFOBJ *pso, + _In_ LONG x, + _In_ LONG y, + _In_ RECTL *prcl) { PDEVOBJ *ppdev; GDIPOINTER *pgp; @@ -589,18 +601,19 @@ } } -ULONG APIENTRY +ULONG +NTAPI IntEngSetPointerShape( - IN SURFOBJ *pso, - IN SURFOBJ *psoMask, - IN SURFOBJ *psoColor, - IN XLATEOBJ *pxlo, - IN LONG xHot, - IN LONG yHot, - IN LONG x, - IN LONG y, - IN RECTL *prcl, - IN FLONG fl) + _In_ SURFOBJ *pso, + _In_opt_ SURFOBJ *psoMask, + _In_opt_ SURFOBJ *psoColor, + _In_opt_ XLATEOBJ *pxlo, + _In_ LONG xHot, + _In_ LONG yHot, + _In_ LONG x, + _In_ LONG y, + _In_ RECTL *prcl, + _In_ FLONG fl) { ULONG ulResult = SPS_DECLINE; PFN_DrvSetPointerShape pfnSetPointerShape; @@ -610,6 +623,11 @@ if (pfnSetPointerShape) { + /* Drivers expect to get an XLATEOBJ */ + if (pxlo == NULL) + pxlo = &gexloTrivial.xlo; + + /* Call the driver */ ulResult = pfnSetPointerShape(pso, psoMask, psoColor, @@ -651,14 +669,14 @@ ULONG NTAPI GreSetPointerShape( - HDC hdc, - HBITMAP hbmMask, - HBITMAP hbmColor, - LONG xHot, - LONG yHot, - LONG x, - LONG y, - FLONG fl) + _In_ HDC hdc, + _In_opt_ HBITMAP hbmMask, + _In_opt_ HBITMAP hbmColor, + _In_ LONG xHot, + _In_ LONG yHot, + _In_ LONG x, + _In_ LONG y, + _In_ FLONG fl) { PDC pdc; PSURFACE psurf, psurfMask, psurfColor; @@ -686,7 +704,9 @@ /* Lock the mask bitmap */ if (hbmMask) + { psurfMask = SURFACE_ShareLockSurface(hbmMask); + } else { //ASSERT(fl & SPS_ALPHA); @@ -707,9 +727,9 @@ } else psurfColor = NULL; - + /* We must have a valid surface in case of alpha bitmap */ - ASSERT(((fl & SPS_ALPHA) && psurfColor) || !(fl & SPS_ALPHA)); + ASSERT(((fl & SPS_ALPHA) && psurfColor) || !(fl & SPS_ALPHA)); /* Call the driver or eng function */ ulResult = IntEngSetPointerShape(&psurf->SurfObj, @@ -745,9 +765,9 @@ VOID NTAPI GreMovePointer( - HDC hdc, - LONG x, - LONG y) + _In_ HDC hdc, + _In_ LONG x, + _In_ LONG y) { PDC pdc; PRECTL prcl; Modified: trunk/reactos/win32ss/gdi/eng/mouse.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/mouse.h?re…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/mouse.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/mouse.h [iso-8859-1] Tue Mar 10 00:13:29 2015 @@ -1,24 +1,51 @@ #pragma once -INT NTAPI MouseSafetyOnDrawStart(PPDEVOBJ ppdev, LONG HazardX1, LONG HazardY1, LONG HazardX2, LONG HazardY2); -INT NTAPI MouseSafetyOnDrawEnd(PPDEVOBJ ppdev); +_Requires_lock_held_(*ppdev->hsemDevLock) +BOOL +NTAPI +MouseSafetyOnDrawStart( + _Inout_ PPDEVOBJ ppdev, + _In_ LONG HazardX1, + _In_ LONG HazardY1, + _In_ LONG HazardX2, + _In_ LONG HazardY2); + +_Requires_lock_held_(*ppdev->hsemDevLock) +BOOL +NTAPI +MouseSafetyOnDrawEnd( + _Inout_ PPDEVOBJ ppdev); + +ULONG +NTAPI +IntEngSetPointerShape( + _In_ SURFOBJ *pso, + _In_opt_ SURFOBJ *psoMask, + _In_opt_ SURFOBJ *psoColor, + _In_opt_ XLATEOBJ *pxlo, + _In_ LONG xHot, + _In_ LONG yHot, + _In_ LONG x, + _In_ LONG y, + _In_ RECTL *prcl, + _In_ FLONG fl); ULONG NTAPI GreSetPointerShape( - HDC hdc, - HBITMAP hbmMask, - HBITMAP hbmColor, - LONG xHot, - LONG yHot, - LONG x, - LONG y, - FLONG fl); + _In_ HDC hdc, + _In_opt_ HBITMAP hbmMask, + _In_opt_ HBITMAP hbmColor, + _In_ LONG xHot, + _In_ LONG yHot, + _In_ LONG x, + _In_ LONG y, + _In_ FLONG fl); VOID NTAPI GreMovePointer( - HDC hdc, - LONG x, - LONG y); + _In_ HDC hdc, + _In_ LONG x, + _In_ LONG y);
9 years, 9 months
1
0
0
0
[tkreuzer] 66648: [WIN32K] Annotate rect.c
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Mar 10 00:13:17 2015 New Revision: 66648 URL:
http://svn.reactos.org/svn/reactos?rev=66648&view=rev
Log: [WIN32K] Annotate rect.c Modified: trunk/reactos/win32ss/gdi/ntgdi/rect.c trunk/reactos/win32ss/gdi/ntgdi/rect.h Modified: trunk/reactos/win32ss/gdi/ntgdi/rect.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/rect.c?r…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/rect.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/rect.c [iso-8859-1] Tue Mar 10 00:13:17 2015 @@ -15,7 +15,10 @@ BOOL FASTCALL -RECTL_bUnionRect(RECTL *prclDst, const RECTL *prcl1, const RECTL *prcl2) +RECTL_bUnionRect( + _Out_ RECTL *prclDst, + _In_ const RECTL *prcl1, + _In_ const RECTL *prcl2) { if (RECTL_bIsEmptyRect(prcl1)) { @@ -47,10 +50,12 @@ return TRUE; } - BOOL FASTCALL -RECTL_bIntersectRect(RECTL* prclDst, const RECTL* prcl1, const RECTL* prcl2) +RECTL_bIntersectRect( + _Out_ RECTL* prclDst, + _In_ const RECTL* prcl1, + _In_ const RECTL* prcl2) { prclDst->left = max(prcl1->left, prcl2->left); prclDst->right = min(prcl1->right, prcl2->right); @@ -73,26 +78,30 @@ VOID FASTCALL -RECTL_vMakeWellOrdered(RECTL *prcl) +RECTL_vMakeWellOrdered( + _Inout_ RECTL *prcl) { LONG lTmp; if (prcl->left > prcl->right) { lTmp = prcl->left; prcl->left = prcl->right; - prcl->right = lTmp; + prcl->right = lTmp; } if (prcl->top > prcl->bottom) { lTmp = prcl->top; prcl->top = prcl->bottom; - prcl->bottom = lTmp; + prcl->bottom = lTmp; } } -VOID +VOID FASTCALL -RECTL_vInflateRect(RECTL *rect, INT dx, INT dy) +RECTL_vInflateRect( + _Inout_ RECTL *rect, + _In_ INT dx, + _In_ INT dy) { rect->left -= dx; rect->top -= dy; Modified: trunk/reactos/win32ss/gdi/ntgdi/rect.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/rect.h?r…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/rect.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/rect.h [iso-8859-1] Tue Mar 10 00:13:17 2015 @@ -2,7 +2,12 @@ FORCEINLINE VOID -RECTL_vSetRect(RECTL *prcl, LONG left, LONG top, LONG right, LONG bottom) +RECTL_vSetRect( + _Out_ RECTL *prcl, + _In_ LONG left, + _In_ LONG top, + _In_ LONG right, + _In_ LONG bottom) { prcl->left = left; prcl->top = top; @@ -12,7 +17,8 @@ FORCEINLINE VOID -RECTL_vSetEmptyRect(RECTL *prcl) +RECTL_vSetEmptyRect( + _Out_ RECTL *prcl) { prcl->left = 0; prcl->top = 0; @@ -22,7 +28,10 @@ FORCEINLINE VOID -RECTL_vOffsetRect(RECTL *prcl, INT cx, INT cy) +RECTL_vOffsetRect( + _Inout_ RECTL *prcl, + _In_ INT cx, + _In_ INT cy) { prcl->left += cx; prcl->right += cx; @@ -32,14 +41,18 @@ FORCEINLINE BOOL -RECTL_bIsEmptyRect(const RECTL *prcl) +RECTL_bIsEmptyRect( + _In_ const RECTL *prcl) { return (prcl->left >= prcl->right || prcl->top >= prcl->bottom); } FORCEINLINE BOOL -RECTL_bPointInRect(const RECTL *prcl, INT x, INT y) +RECTL_bPointInRect( + _In_ const RECTL *prcl, + _In_ INT x, + _In_ INT y) { return (x >= prcl->left && x < prcl->right && y >= prcl->top && y < prcl->bottom); @@ -47,7 +60,8 @@ FORCEINLINE BOOL -RECTL_bIsWellOrdered(const RECTL *prcl) +RECTL_bIsWellOrdered( + _In_ const RECTL *prcl) { return ((prcl->left <= prcl->right) && (prcl->top <= prcl->bottom)); @@ -55,16 +69,26 @@ BOOL FASTCALL -RECTL_bUnionRect(RECTL *prclDst, const RECTL *prcl1, const RECTL *prcl2); +RECTL_bUnionRect( + _Out_ RECTL *prclDst, + _In_ const RECTL *prcl1, + _In_ const RECTL *prcl2); BOOL FASTCALL -RECTL_bIntersectRect(RECTL *prclDst, const RECTL *prcl1, const RECTL *prcl2); +RECTL_bIntersectRect( + _Out_ RECTL* prclDst, + _In_ const RECTL* prcl1, + _In_ const RECTL* prcl2); VOID FASTCALL -RECTL_vMakeWellOrdered(RECTL *prcl); +RECTL_vMakeWellOrdered( + _Inout_ RECTL *prcl); VOID FASTCALL -RECTL_vInflateRect(RECTL *rect, INT dx, INT dy); +RECTL_vInflateRect( + _Inout_ RECTL *rect, + _In_ INT dx, + _In_ INT dy);
9 years, 9 months
1
0
0
0
[tkreuzer] 66647: [WIN32K] - Annotate eng/device.c and semaphor.c. - Get rid of IntGdiAcquire/ReleaseSemaphore - Move some prototypes where they belong
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Mar 10 00:13:04 2015 New Revision: 66647 URL:
http://svn.reactos.org/svn/reactos?rev=66647&view=rev
Log: [WIN32K] - Annotate eng/device.c and semaphor.c. - Get rid of IntGdiAcquire/ReleaseSemaphore - Move some prototypes where they belong Modified: trunk/reactos/include/psdk/winddi.h trunk/reactos/win32ss/gdi/eng/device.c trunk/reactos/win32ss/gdi/eng/device.h trunk/reactos/win32ss/gdi/eng/eng.h trunk/reactos/win32ss/gdi/eng/pdevobj.h trunk/reactos/win32ss/gdi/eng/semaphor.c trunk/reactos/win32ss/reactx/ntddraw/dxeng.c 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 Mar 10 00:13:04 2015 @@ -1581,10 +1581,13 @@ APIENTRY EngCreatePath(VOID); +__drv_allocatesMem(Mem) +_Post_writable_byte_size_(sizeof(ERESOURCE)) ENGAPI HSEMAPHORE APIENTRY -EngCreateSemaphore(VOID); +EngCreateSemaphore( + VOID); /* EngCreateWnd.fl constants */ #define WO_RGN_CLIENT_DELTA 0x00000001 @@ -1667,13 +1670,14 @@ VOID APIENTRY EngDeleteSafeSemaphore( - _Inout_ ENGSAFESEMAPHORE *pssem); - + _Inout_ _Post_invalid_ ENGSAFESEMAPHORE *pssem); + +_Requires_lock_not_held_(*hsem) ENGAPI VOID APIENTRY EngDeleteSemaphore( - _In_ _Post_ptr_invalid_ HSEMAPHORE hsem); + _Inout_ __drv_freesMem(Mem) HSEMAPHORE hsem); ENGAPI BOOL @@ -2302,11 +2306,14 @@ EngReadStateEvent( _In_ PEVENT pEvent); +_Requires_lock_held_(*hsem) +_Releases_lock_(*hsem) +_Releases_lock_(_Global_critical_region_) ENGAPI VOID APIENTRY EngReleaseSemaphore( - _In_ HSEMAPHORE hsem); + _Inout_ HSEMAPHORE hsem); #if defined(_M_AMD64) && (NTDDI_VERSION >= NTDDI_VISTA) @@ -3303,11 +3310,14 @@ _In_ SIZE_T Length, _In_reads_bytes_opt_(Length) PVOID Data); -ENGAPI -VOID -APIENTRY -EngAcquireSemaphoreShared( - _In_ HSEMAPHORE hsem); +_Requires_lock_not_held_(*hsem) +_Acquires_exclusive_lock_(*hsem) +_Acquires_lock_(_Global_critical_region_) +ENGAPI +VOID +APIENTRY +EngAcquireSemaphore( + _Inout_ HSEMAPHORE hsem); ENGAPI BOOL @@ -3315,11 +3325,14 @@ EngAcquireSemaphoreNoWait( _In_ HSEMAPHORE hsem); -ENGAPI -BOOL -APIENTRY -EngAcquireSemaphoreSharedNoWait( - _In_ HSEMAPHORE hsem); +_Acquires_lock_(_Global_critical_region_) +_Requires_lock_not_held_(*hsem) +_Acquires_shared_lock_(*hsem) +ENGAPI +VOID +NTAPI +EngAcquireSemaphoreShared( + _Inout_ HSEMAPHORE hsem); ENGAPI BOOL Modified: trunk/reactos/win32ss/gdi/eng/device.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/device.c?r…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/device.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/device.c [iso-8859-1] Tue Mar 10 00:13:04 2015 @@ -21,7 +21,7 @@ INIT_FUNCTION NTSTATUS NTAPI -InitDeviceImpl() +InitDeviceImpl(VOID) { ghsemGraphicsDeviceList = EngCreateSemaphore(); if (!ghsemGraphicsDeviceList) @@ -34,10 +34,10 @@ PGRAPHICS_DEVICE NTAPI EngpRegisterGraphicsDevice( - PUNICODE_STRING pustrDeviceName, - PUNICODE_STRING pustrDiplayDrivers, - PUNICODE_STRING pustrDescription, - PDEVMODEW pdmDefault) + _In_ PUNICODE_STRING pustrDeviceName, + _In_ PUNICODE_STRING pustrDiplayDrivers, + _In_ PUNICODE_STRING pustrDescription, + _In_ PDEVMODEW pdmDefault) { PGRAPHICS_DEVICE pGraphicsDevice; PDEVICE_OBJECT pDeviceObject; @@ -259,9 +259,9 @@ PGRAPHICS_DEVICE NTAPI EngpFindGraphicsDevice( - PUNICODE_STRING pustrDevice, - ULONG iDevNum, - DWORD dwFlags) + _In_opt_ PUNICODE_STRING pustrDevice, + _In_ ULONG iDevNum, + _In_ DWORD dwFlags) { UNICODE_STRING ustrCurrent; PGRAPHICS_DEVICE pGraphicsDevice; @@ -305,12 +305,12 @@ static NTSTATUS EngpFileIoRequest( - PFILE_OBJECT pFileObject, - ULONG ulMajorFunction, - LPVOID lpBuffer, - SIZE_T nBufferSize, - ULONGLONG ullStartOffset, - OUT PULONG_PTR lpInformation) + _In_ PFILE_OBJECT pFileObject, + _In_ ULONG ulMajorFunction, + _In_reads_(nBufferSize) PVOID lpBuffer, + _In_ SIZE_T nBufferSize, + _In_ ULONGLONG ullStartOffset, + _Out_ PULONG_PTR lpInformation) { PDEVICE_OBJECT pDeviceObject; KEVENT Event; @@ -363,29 +363,36 @@ VOID APIENTRY EngFileWrite( - IN PFILE_OBJECT pFileObject, - IN PVOID lpBuffer, - IN SIZE_T nLength, - IN PSIZE_T lpBytesWritten) -{ - EngpFileIoRequest(pFileObject, - IRP_MJ_WRITE, - lpBuffer, - nLength, - 0, - lpBytesWritten); -} - + _In_ PFILE_OBJECT pFileObject, + _In_reads_(nLength) PVOID lpBuffer, + _In_ SIZE_T nLength, + _Out_ PSIZE_T lpBytesWritten) +{ + NTSTATUS status; + + status = EngpFileIoRequest(pFileObject, + IRP_MJ_WRITE, + lpBuffer, + nLength, + 0, + lpBytesWritten); + if (!NT_SUCCESS(status)) + { + *lpBytesWritten = 0; + } +} + +_Success_(return>=0) NTSTATUS APIENTRY EngFileIoControl( - IN PFILE_OBJECT pFileObject, - IN DWORD dwIoControlCode, - IN PVOID lpInBuffer, - IN SIZE_T nInBufferSize, - OUT PVOID lpOutBuffer, - IN SIZE_T nOutBufferSize, - OUT PULONG_PTR lpInformation) + _In_ PFILE_OBJECT pFileObject, + _In_ DWORD dwIoControlCode, + _In_reads_(nInBufferSize) PVOID lpInBuffer, + _In_ SIZE_T nInBufferSize, + _Out_writes_(nOutBufferSize) PVOID lpOutBuffer, + _In_ SIZE_T nOutBufferSize, + _Out_ PULONG_PTR lpInformation) { PDEVICE_OBJECT pDeviceObject; KEVENT Event; Modified: trunk/reactos/win32ss/gdi/eng/device.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/device.h?r…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/device.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/device.h [iso-8859-1] Tue Mar 10 00:13:04 2015 @@ -1,48 +1,36 @@ + +#pragma once #define TAG_GDEV 'gdev' + +extern PGRAPHICS_DEVICE gpPrimaryGraphicsDevice; +extern PGRAPHICS_DEVICE gpVgaGraphicsDevice; VOID APIENTRY EngFileWrite( - IN PFILE_OBJECT pFileObject, - IN PVOID lpBuffer, - IN SIZE_T nLength, - IN PSIZE_T lpBytesWritten); + _In_ PFILE_OBJECT pFileObject, + _In_reads_(nLength) PVOID lpBuffer, + _In_ SIZE_T nLength, + _Out_ PSIZE_T lpBytesWritten); PGRAPHICS_DEVICE NTAPI EngpFindGraphicsDevice( - PUNICODE_STRING pustrDevice, - DWORD iDevNum, - DWORD dwFlags); + _In_opt_ PUNICODE_STRING pustrDevice, + _In_ ULONG iDevNum, + _In_ DWORD dwFlags); PGRAPHICS_DEVICE NTAPI EngpRegisterGraphicsDevice( - PUNICODE_STRING pustrDeviceName, - PUNICODE_STRING pustrDiplayDrivers, - PUNICODE_STRING pustrDescription, - PDEVMODEW pdmDefault); + _In_ PUNICODE_STRING pustrDeviceName, + _In_ PUNICODE_STRING pustrDiplayDrivers, + _In_ PUNICODE_STRING pustrDescription, + _In_ PDEVMODEW pdmDefault); INIT_FUNCTION NTSTATUS NTAPI InitDeviceImpl(VOID); -//#define KeRosDumpStackFrames(Frames, Count) KdSystemDebugControl(TAG('R', 'o', 's', 'D'), (PVOID)Frames, Count, NULL, 0, NULL, KernelMode) -NTSYSAPI ULONG APIENTRY RtlWalkFrameChain(OUT PVOID *Callers, IN ULONG Count, IN ULONG Flags); - -BOOL -NTAPI -PDEVOBJ_bSwitchMode( - PPDEVOBJ ppdev, - PDEVMODEW pdm); - -PDEVMODEW -NTAPI -PDEVOBJ_pdmMatchDevMode( - PPDEVOBJ ppdev, - PDEVMODEW pdm); - -extern PGRAPHICS_DEVICE gpPrimaryGraphicsDevice; -extern PGRAPHICS_DEVICE gpVgaGraphicsDevice; Modified: trunk/reactos/win32ss/gdi/eng/eng.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/eng.h?rev=…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/eng.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/eng.h [iso-8859-1] Tue Mar 10 00:13:04 2015 @@ -6,10 +6,15 @@ (((ULONG)gajRop2ToRop3[((mix) - 1) & 0xF]) | \ ((ULONG)gajRop2ToRop3[(((mix) >> 8) - 1) & 0xF] << 8)) +/* Copied from winddi.h, where it is only for vista+ */ +_Acquires_lock_(_Global_critical_region_) +_Requires_lock_not_held_(*hsem) +_Acquires_shared_lock_(*hsem) +ENGAPI VOID NTAPI EngAcquireSemaphoreShared( - IN HSEMAPHORE hsem); + _Inout_ HSEMAPHORE hsem); BOOL APIENTRY @@ -24,17 +29,27 @@ _In_ BRUSHOBJ *pbo, _In_ POINTL *pptlBrushOrg); -VOID FASTCALL +VOID +FASTCALL IntEngWindowChanged( _In_ PWND Window, _In_ FLONG flChanged); -VOID FASTCALL IntGdiAcquireSemaphore ( HSEMAPHORE hsem ); -VOID FASTCALL IntGdiReleaseSemaphore ( HSEMAPHORE hsem ); -ULONGLONG APIENTRY EngGetTickCount(VOID); - -VOID DecompressBitmap(SIZEL Size, BYTE *CompressedBits, BYTE *UncompressedBits, LONG Delta, ULONG iFormat); +ULONGLONG +APIENTRY +EngGetTickCount( + VOID); HANDLE APIENTRY -EngSecureMemForRead(PVOID Address, ULONG Length); +EngSecureMemForRead( + PVOID Address, + ULONG Length); + +VOID +DecompressBitmap( + SIZEL Size, + BYTE *CompressedBits, + BYTE *UncompressedBits, + LONG Delta, + ULONG iFormat); Modified: trunk/reactos/win32ss/gdi/eng/pdevobj.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/pdevobj.h?…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/pdevobj.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/pdevobj.h [iso-8859-1] Tue Mar 10 00:13:04 2015 @@ -189,4 +189,16 @@ _In_ PPDEVOBJ ppdev, _Out_ PSIZEL psizl); +BOOL +NTAPI +PDEVOBJ_bSwitchMode( + PPDEVOBJ ppdev, + PDEVMODEW pdm); + +PDEVMODEW +NTAPI +PDEVOBJ_pdmMatchDevMode( + PPDEVOBJ ppdev, + PDEVMODEW pdm); + #endif /* !__WIN32K_PDEVOBJ_H */ Modified: trunk/reactos/win32ss/gdi/eng/semaphor.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/semaphor.c…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/semaphor.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/semaphor.c [iso-8859-1] Tue Mar 10 00:13:04 2015 @@ -6,12 +6,17 @@ /* * @implemented */ +__drv_allocatesMem(Mem) +_Post_writable_byte_size_(sizeof(ERESOURCE)) HSEMAPHORE APIENTRY -EngCreateSemaphore(VOID) +EngCreateSemaphore( + VOID) { //
www.osr.com/ddk/graphics/gdifncs_95lz.htm
- PERESOURCE psem = ExAllocatePoolWithTag(NonPagedPool, sizeof(ERESOURCE), GDITAG_SEMAPHORE); + PERESOURCE psem = ExAllocatePoolWithTag(NonPagedPool, + sizeof(ERESOURCE), + GDITAG_SEMAPHORE); if (!psem) return NULL; @@ -24,57 +29,51 @@ return (HSEMAPHORE)psem; } +/* + * @implemented + */ +_Requires_lock_not_held_(*hsem) +_Acquires_exclusive_lock_(*hsem) +_Acquires_lock_(_Global_critical_region_) VOID -FASTCALL -IntGdiAcquireSemaphore(HSEMAPHORE hsem) +APIENTRY +EngAcquireSemaphore( + _Inout_ HSEMAPHORE hsem) { - KeEnterCriticalRegion(); - ExAcquireResourceExclusiveLite ((PERESOURCE)hsem, TRUE); + //
www.osr.com/ddk/graphics/gdifncs_14br.htm
+ PTHREADINFO W32Thread; + ASSERT(hsem); + ExEnterCriticalRegionAndAcquireResourceExclusive((PERESOURCE)hsem); + W32Thread = PsGetThreadWin32Thread(PsGetCurrentThread()); + if (W32Thread) W32Thread->dwEngAcquireCount++; } /* * @implemented */ +_Requires_lock_held_(*hsem) +_Releases_lock_(*hsem) +_Releases_lock_(_Global_critical_region_) VOID APIENTRY -EngAcquireSemaphore(IN HSEMAPHORE hsem) -{ - //
www.osr.com/ddk/graphics/gdifncs_14br.htm
- PTHREADINFO W32Thread; - ASSERT(hsem); - IntGdiAcquireSemaphore(hsem); - W32Thread = PsGetThreadWin32Thread(PsGetCurrentThread()); - if (W32Thread) W32Thread->dwEngAcquireCount++; -} - - -VOID -FASTCALL -IntGdiReleaseSemaphore ( HSEMAPHORE hsem ) -{ - ExReleaseResourceLite((PERESOURCE)hsem); - KeLeaveCriticalRegion(); -} - -/* - * @implemented - */ -VOID -APIENTRY -EngReleaseSemaphore ( IN HSEMAPHORE hsem ) +EngReleaseSemaphore( + _Inout_ HSEMAPHORE hsem) { //
www.osr.com/ddk/graphics/gdifncs_5u3r.htm
PTHREADINFO W32Thread; ASSERT(hsem); W32Thread = PsGetThreadWin32Thread(PsGetCurrentThread()); if (W32Thread) --W32Thread->dwEngAcquireCount; - IntGdiReleaseSemaphore(hsem); + ExReleaseResourceAndLeaveCriticalRegion((PERESOURCE)hsem); } +_Acquires_lock_(_Global_critical_region_) +_Requires_lock_not_held_(*hsem) +_Acquires_shared_lock_(*hsem) VOID NTAPI EngAcquireSemaphoreShared( - IN HSEMAPHORE hsem) + _Inout_ HSEMAPHORE hsem) { PTHREADINFO pti; @@ -87,9 +86,11 @@ /* * @implemented */ +_Requires_lock_not_held_(*hsem) VOID APIENTRY -EngDeleteSemaphore ( IN HSEMAPHORE hsem ) +EngDeleteSemaphore( + _Inout_ __drv_freesMem(Mem) HSEMAPHORE hsem) { //
www.osr.com/ddk/graphics/gdifncs_13c7.htm
ASSERT(hsem); @@ -103,7 +104,8 @@ */ BOOL APIENTRY -EngIsSemaphoreOwned ( IN HSEMAPHORE hsem ) +EngIsSemaphoreOwned( + _In_ HSEMAPHORE hsem) { //
www.osr.com/ddk/graphics/gdifncs_6wmf.htm
ASSERT(hsem); @@ -115,7 +117,8 @@ */ BOOL APIENTRY -EngIsSemaphoreOwnedByCurrentThread ( IN HSEMAPHORE hsem ) +EngIsSemaphoreOwnedByCurrentThread( + _In_ HSEMAPHORE hsem) { //
www.osr.com/ddk/graphics/gdifncs_9yxz.htm
ASSERT(hsem); @@ -125,9 +128,10 @@ /* * @implemented */ -BOOL APIENTRY +BOOL +APIENTRY EngInitializeSafeSemaphore( - OUT ENGSAFESEMAPHORE *Semaphore) + _Out_ ENGSAFESEMAPHORE *Semaphore) { HSEMAPHORE hSem; @@ -158,15 +162,16 @@ /* * @implemented */ -VOID APIENTRY +VOID +APIENTRY EngDeleteSafeSemaphore( - IN OUT ENGSAFESEMAPHORE *Semaphore) + _Inout_ _Post_invalid_ ENGSAFESEMAPHORE *pssem) { - if (InterlockedDecrement(&Semaphore->lCount) == 0) + if (InterlockedDecrement(&pssem->lCount) == 0) { /* FIXME: Not thread-safe! Use result of InterlockedCompareExchangePointer! */ - EngDeleteSemaphore(Semaphore->hsem); - (void)InterlockedExchangePointer((volatile PVOID *)&Semaphore->hsem, NULL); + EngDeleteSemaphore(pssem->hsem); + (void)InterlockedExchangePointer((volatile PVOID *)&pssem->hsem, NULL); } } Modified: trunk/reactos/win32ss/reactx/ntddraw/dxeng.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/reactx/ntddraw/dxe…
============================================================================== --- trunk/reactos/win32ss/reactx/ntddraw/dxeng.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/reactx/ntddraw/dxeng.c [iso-8859-1] Tue Mar 10 00:13:04 2015 @@ -180,7 +180,7 @@ { DPRINT1("ReactX Calling : DxEngLockShareSem\n"); if(!ghsemShareDevLock) ghsemShareDevLock = EngCreateSemaphore(); // Hax, should be in dllmain.c - IntGdiAcquireSemaphore(ghsemShareDevLock); + EngAcquireSemaphore(ghsemShareDevLock); return TRUE; } @@ -202,7 +202,7 @@ DxEngUnlockShareSem() { DPRINT1("ReactX Calling : DxEngUnlockShareSem\n"); - IntGdiReleaseSemaphore(ghsemShareDevLock); + EngReleaseSemaphore(ghsemShareDevLock); return TRUE; }
9 years, 9 months
1
0
0
0
[tkreuzer] 66646: [WIN32K] Fix all MSVC static analyzer warnings. (a few are suppressed after checking that it's ok) Fixes a number of missing or wrong function return checks, wrong printf format s...
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Mar 10 00:12:41 2015 New Revision: 66646 URL:
http://svn.reactos.org/svn/reactos?rev=66646&view=rev
Log: [WIN32K] Fix all MSVC static analyzer warnings. (a few are suppressed after checking that it's ok) Fixes a number of missing or wrong function return checks, wrong printf format specifiers and a few other things, Modified: trunk/reactos/include/ndk/kefuncs.h trunk/reactos/include/ndk/obfuncs.h trunk/reactos/include/ndk/psfuncs.h trunk/reactos/include/psdk/winddi.h trunk/reactos/win32ss/gdi/eng/float.c trunk/reactos/win32ss/gdi/eng/mem.c trunk/reactos/win32ss/gdi/ntgdi/freetype.c trunk/reactos/win32ss/gdi/ntgdi/misc.h trunk/reactos/win32ss/gdi/ntgdi/path.c trunk/reactos/win32ss/gdi/ntgdi/polyfill.c trunk/reactos/win32ss/gdi/ntgdi/text.h trunk/reactos/win32ss/gdi/ntgdi/xformobj.c trunk/reactos/win32ss/reactx/ntddraw/eng.c trunk/reactos/win32ss/user/ntuser/callback.c trunk/reactos/win32ss/user/ntuser/callproc.c trunk/reactos/win32ss/user/ntuser/caret.c trunk/reactos/win32ss/user/ntuser/class.c trunk/reactos/win32ss/user/ntuser/class.h trunk/reactos/win32ss/user/ntuser/cursoricon.c trunk/reactos/win32ss/user/ntuser/dde.c trunk/reactos/win32ss/user/ntuser/desktop.c trunk/reactos/win32ss/user/ntuser/event.c trunk/reactos/win32ss/user/ntuser/focus.c trunk/reactos/win32ss/user/ntuser/hook.c trunk/reactos/win32ss/user/ntuser/hotkey.c trunk/reactos/win32ss/user/ntuser/input.c trunk/reactos/win32ss/user/ntuser/kbdlayout.c trunk/reactos/win32ss/user/ntuser/keyboard.c trunk/reactos/win32ss/user/ntuser/main.c trunk/reactos/win32ss/user/ntuser/menu.c trunk/reactos/win32ss/user/ntuser/message.c trunk/reactos/win32ss/user/ntuser/misc.c trunk/reactos/win32ss/user/ntuser/misc/file.c trunk/reactos/win32ss/user/ntuser/misc/registry.c trunk/reactos/win32ss/user/ntuser/monitor.c trunk/reactos/win32ss/user/ntuser/msgqueue.c trunk/reactos/win32ss/user/ntuser/msgqueue.h trunk/reactos/win32ss/user/ntuser/ntstubs.c trunk/reactos/win32ss/user/ntuser/object.c trunk/reactos/win32ss/user/ntuser/painting.c trunk/reactos/win32ss/user/ntuser/prop.c trunk/reactos/win32ss/user/ntuser/shutdown.c trunk/reactos/win32ss/user/ntuser/sysparams.c trunk/reactos/win32ss/user/ntuser/timer.c trunk/reactos/win32ss/user/ntuser/win32.h trunk/reactos/win32ss/user/ntuser/window.c trunk/reactos/win32ss/user/ntuser/winpos.c trunk/reactos/win32ss/user/ntuser/winsta.c Modified: trunk/reactos/include/ndk/kefuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/kefuncs.h?rev=…
============================================================================== --- trunk/reactos/include/ndk/kefuncs.h [iso-8859-1] (original) +++ trunk/reactos/include/ndk/kefuncs.h [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -312,9 +312,9 @@ NTAPI KeUserModeCallback( _In_ ULONG FunctionID, - _In_ PVOID InputBuffer, + _In_reads_opt_(InputLength) PVOID InputBuffer, _In_ ULONG InputLength, - _Out_ PVOID *OutputBuffer, + _Outptr_result_buffer_(*OutputLength) PVOID *OutputBuffer, _Out_ PULONG OutputLength ); Modified: trunk/reactos/include/ndk/obfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/obfuncs.h?rev=…
============================================================================== --- trunk/reactos/include/ndk/obfuncs.h [iso-8859-1] (original) +++ trunk/reactos/include/ndk/obfuncs.h [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -153,8 +153,8 @@ _In_ PEPROCESS Process, _In_ PVOID Object, _In_ POBJECT_TYPE ObjectType, - _In_ POBJECT_HANDLE_INFORMATION HandleInformation, - _Out_ PHANDLE Handle + _In_opt_ POBJECT_HANDLE_INFORMATION HandleInformation, + _Out_opt_ PHANDLE Handle ); NTKERNELAPI Modified: trunk/reactos/include/ndk/psfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/psfuncs.h?rev=…
============================================================================== --- trunk/reactos/include/ndk/psfuncs.h [iso-8859-1] (original) +++ trunk/reactos/include/ndk/psfuncs.h [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -69,8 +69,8 @@ NTAPI PsSetThreadWin32Thread( _Inout_ PETHREAD Thread, - _In_ PVOID Win32Thread, - _In_ PVOID OldWin32Thread + _In_opt_ PVOID Win32Thread, + _In_opt_ PVOID OldWin32Thread ); NTKERNELAPI @@ -92,7 +92,7 @@ NTAPI PsSetProcessWindowStation( _Inout_ PEPROCESS Process, - _In_ PVOID WindowStation + _In_opt_ PVOID WindowStation ); NTKERNELAPI 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 Mar 10 00:12:41 2015 @@ -1372,6 +1372,7 @@ _Must_inspect_result_ _When_(fl & FL_ZERO_MEMORY, _Ret_opt_bytecount_(cjMemSize)) _When_(!(fl & FL_ZERO_MEMORY), _Ret_opt_bytecap_(cjMemSize)) +__drv_allocatesMem(Mem) ENGAPI PVOID APIENTRY @@ -1382,6 +1383,7 @@ _Must_inspect_result_ _Ret_opt_bytecount_(cjMemSize) +__drv_allocatesMem(PrivateUserMem) ENGAPI PVOID APIENTRY @@ -1392,6 +1394,7 @@ _Must_inspect_result_ _Ret_opt_bytecount_(cjMemSize) +__drv_allocatesMem(UserMem) ENGAPI PVOID APIENTRY @@ -1814,20 +1817,20 @@ VOID APIENTRY EngFreeMem( - _In_ _Post_ptr_invalid_ PVOID pv); + _Pre_notnull_ __drv_freesMem(Mem) PVOID pv); ENGAPI VOID APIENTRY EngFreePrivateUserMem( _In_ PDD_SURFACE_LOCAL psl, - _In_ _Post_ptr_invalid_ PVOID pv); + _Pre_notnull_ __drv_freesMem(PrivateUserMem) PVOID pv); ENGAPI VOID APIENTRY EngFreeUserMem( - _In_ _Post_ptr_invalid_ PVOID pv); + _Pre_notnull_ __drv_freesMem(UserMem) PVOID pv); #endif /* !USERMODE_DRIVER */ Modified: trunk/reactos/win32ss/gdi/eng/float.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/float.c?re…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/float.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/float.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -14,6 +14,10 @@ #include <debug.h> /* FUNCTIONS *****************************************************************/ + +#ifdef _PREFAST_ +#pragma warning(disable:__WARNING_WRONG_KIND) +#endif _Check_return_ _Success_(return) Modified: trunk/reactos/win32ss/gdi/eng/mem.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/mem.c?rev=…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/mem.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/mem.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -17,6 +17,7 @@ _Must_inspect_result_ _When_(fl & FL_ZERO_MEMORY, _Ret_opt_bytecount_(cjMemSize)) _When_(!(fl & FL_ZERO_MEMORY), _Ret_opt_bytecap_(cjMemSize)) +__drv_allocatesMem(Mem) ENGAPI PVOID APIENTRY @@ -61,6 +62,7 @@ */ _Must_inspect_result_ _Ret_opt_bytecount_(cjMemSize) +__drv_allocatesMem(UserMem) ENGAPI PVOID APIENTRY Modified: trunk/reactos/win32ss/gdi/ntgdi/freetype.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/freetype…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/freetype.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/freetype.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -4346,13 +4346,14 @@ return TRUE; } +#if 0 DWORD FASTCALL GreGetGlyphIndicesW( _In_ HDC hdc, - _In_opt_ LPWSTR pwc, + _In_reads_(cwc) LPWSTR pwc, _In_ INT cwc, - _Out_opt_ LPWORD pgi, + _Out_writes_opt_(cwc) LPWORD pgi, _In_ DWORD iMode, _In_ DWORD dwUnknown) { @@ -4431,25 +4432,30 @@ IntUnLockFreeType; - RtlCopyMemory( pgi, Buffer, cwc*sizeof(WORD)); + if (pgi != NULL) + { + RtlCopyMemory(pgi, Buffer, cwc * sizeof(WORD)); + } ErrorRet: if (Buffer) ExFreePoolWithTag(Buffer, GDITAG_TEXT); return cwc; } - +#endif // 0 /* * @implemented */ +__kernel_entry +W32KAPI DWORD APIENTRY NtGdiGetGlyphIndicesW( - IN HDC hdc, - IN OPTIONAL LPWSTR UnSafepwc, - IN INT cwc, - OUT OPTIONAL LPWORD UnSafepgi, - IN DWORD iMode) + _In_ HDC hdc, + _In_reads_opt_(cwc) LPWSTR pwc, + _In_ INT cwc, + _Out_writes_opt_(cwc) LPWORD pgi, + _In_ DWORD iMode) { PDC dc; PDC_ATTR pdcattr; @@ -4464,8 +4470,16 @@ PWSTR Buffer = NULL; ULONG Size, pwcSize; PWSTR Safepwc = NULL; + LPWSTR UnSafepwc = pwc; + LPWORD UnSafepgi = pgi; if ((!UnSafepwc) && (!UnSafepgi)) return cwc; + + if ((UnSafepwc == NULL) || (UnSafepgi == NULL)) + { + DPRINT1("UnSafepwc == %p, UnSafepgi = %p\n", UnSafepwc, UnSafepgi); + return -1; + } dc = DC_LockDc(hdc); if (!dc) @@ -4563,7 +4577,10 @@ ErrorRet: ExFreePoolWithTag(Buffer, GDITAG_TEXT); - ExFreePoolWithTag(Safepwc, GDITAG_TEXT); + if (Safepwc != NULL) + { + ExFreePoolWithTag(Safepwc, GDITAG_TEXT); + } if (NT_SUCCESS(Status)) return cwc; EngSetLastError(Status); return GDI_ERROR; Modified: trunk/reactos/win32ss/gdi/ntgdi/misc.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/misc.h?r…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/misc.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/misc.h [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -54,14 +54,15 @@ NTAPI RegReadDWORD(HKEY hkey, PWSTR pwszValue, PDWORD pdwData); +_Success_(return!=FALSE) BOOL NTAPI RegReadUserSetting( - IN PCWSTR pwszKeyName, - IN PCWSTR pwszValueName, - IN ULONG ulType, - OUT PVOID pvData, - IN ULONG cbDataSize); + _In_z_ PCWSTR pwszKeyName, + _In_z_ PCWSTR pwszValueName, + _In_ ULONG ulType, + _Out_writes_(cbDataSize) _When_(ulType == REG_SZ, _Post_z_) PVOID pvData, + _In_ ULONG cbDataSize); BOOL NTAPI Modified: trunk/reactos/win32ss/gdi/ntgdi/path.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/path.c?r…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/path.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/path.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -1736,6 +1736,13 @@ } elp = ExAllocatePoolWithTag(PagedPool, size, TAG_PATH); + if (elp == NULL) + { + PATH_UnlockPath(pPath); + EngSetLastError(ERROR_OUTOFMEMORY); + return FALSE; + } + GreGetObject(pdcattr->hpen, size, elp); obj_type = GDI_HANDLE_GET_TYPE(pdcattr->hpen); Modified: trunk/reactos/win32ss/gdi/ntgdi/polyfill.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/polyfill…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/polyfill.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/polyfill.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -84,6 +84,7 @@ { for (i = 0; i < list->Count; i++) { + _PRAGMA_WARNING_SUPPRESS(__WARNING_USING_UNINIT_VAR) if (list->Edges[i]) EngFreeMem(list->Edges[i]); } Modified: trunk/reactos/win32ss/gdi/ntgdi/text.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/text.h?r…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/text.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/text.h [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -130,7 +130,6 @@ DWORD FASTCALL IntGetCharDimensions(HDC, PTEXTMETRICW, PDWORD); BOOL FASTCALL GreGetTextExtentW(HDC,LPWSTR,INT,LPSIZE,UINT); BOOL FASTCALL GreGetTextExtentExW(HDC,LPWSTR,ULONG,ULONG,PULONG,PULONG,LPSIZE,FLONG); -DWORD FASTCALL GreGetGlyphIndicesW(HDC,LPWSTR,INT,LPWORD,DWORD,DWORD); BOOL FASTCALL GreTextOutW(HDC,int,int,LPCWSTR,int); HFONT FASTCALL GreCreateFontIndirectW( LOGFONTW * ); Modified: trunk/reactos/win32ss/gdi/ntgdi/xformobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/xformobj…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/xformobj.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/xformobj.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -332,7 +332,8 @@ if ((flAccel & (XFORM_SCALE|XFORM_UNITY)) == (XFORM_SCALE|XFORM_UNITY)) { - /* Identity transformation, nothing to do */ + /* Identity transformation */ + RtlCopyMemory(pptOut, pptIn, cPoints * sizeof(POINTL)); } else if (flAccel & XFORM_INTEGER) { Modified: trunk/reactos/win32ss/reactx/ntddraw/eng.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/reactx/ntddraw/eng…
============================================================================== --- trunk/reactos/win32ss/reactx/ntddraw/eng.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/reactx/ntddraw/eng.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -59,11 +59,16 @@ /************************************************************************/ /* EngAllocPrivateUserMem */ /************************************************************************/ +_Must_inspect_result_ +_Ret_opt_bytecount_(cjMemSize) +__drv_allocatesMem(PrivateUserMem) +ENGAPI PVOID APIENTRY -EngAllocPrivateUserMem(PDD_SURFACE_LOCAL psl, - SIZE_T cj, - ULONG tag) +EngAllocPrivateUserMem( + _In_ PDD_SURFACE_LOCAL psl, + _In_ SIZE_T cjMemSize, + _In_ ULONG ulTag) { PGD_ENGALLOCPRIVATEUSERMEM pfnEngAllocPrivateUserMem = (PGD_ENGALLOCPRIVATEUSERMEM)gpDxFuncs[DXG_INDEX_DxDdAllocPrivateUserMem].pfn; @@ -74,7 +79,7 @@ } DPRINT1("Calling dxg.sys pfnEngAllocPrivateUserMem\n"); - return pfnEngAllocPrivateUserMem(psl, cj, tag); + return pfnEngAllocPrivateUserMem(psl, cjMemSize, ulTag); } /************************************************************************/ Modified: trunk/reactos/win32ss/user/ntuser/callback.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/callba…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/callback.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/callback.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -338,6 +338,11 @@ ArgumentLength, &ResultPointer, &ResultLength); + if (!NT_SUCCESS(Status)) + { + UserEnterCo(); + return -1; + } _SEH2_TRY { @@ -346,7 +351,7 @@ } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { - ERR("Failed to copy result from user mode, Message %d lParam size %d!\n", Message, lParamBufferSize); + ERR("Failed to copy result from user mode, Message %u lParam size %d!\n", Message, lParamBufferSize); Status = _SEH2_GetExceptionCode(); } _SEH2_END; @@ -357,7 +362,7 @@ if (!NT_SUCCESS(Status)) { - ERR("Call to user mode failed! %p\n",Status); + ERR("Call to user mode failed! 0x%08lx\n",Status); if (lParamBufferSize != -1) { IntCbFreeMemory(Arguments); @@ -372,11 +377,11 @@ // Is this message being processed from inside kernel space? BOOL InSendMessage = (pti->pcti->CTI_flags & CTI_INSENDMESSAGE); - TRACE("Copy lParam Message %d lParam %d!\n", Message, lParam); + TRACE("Copy lParam Message %u lParam %d!\n", Message, lParam); switch (Message) { default: - TRACE("Don't copy lParam, Message %d Size %d lParam %d!\n", Message, lParamBufferSize, lParam); + TRACE("Don't copy lParam, Message %u Size %d lParam %d!\n", Message, lParamBufferSize, lParam); break; // Write back to user/kernel space. Also see g_MsgMemory. case WM_CREATE: @@ -388,7 +393,7 @@ case WM_WINDOWPOSCHANGING: case WM_SIZING: case WM_MOVING: - TRACE("Copy lParam, Message %d Size %d lParam %d!\n", Message, lParamBufferSize, lParam); + TRACE("Copy lParam, Message %u Size %d lParam %d!\n", Message, lParamBufferSize, lParam); if (InSendMessage) // Copy into kernel space. RtlMoveMemory((PVOID) lParam, @@ -404,7 +409,7 @@ } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { - ERR("Failed to copy lParam to user space, Message %d!\n", Message); + ERR("Failed to copy lParam to user space, Message %u!\n", Message); } _SEH2_END; } @@ -483,13 +488,14 @@ UserEnterCo(); + if (!NT_SUCCESS(Status)) + { + return FALSE; + } + /* HACK: The desktop class doen't have a proper cursor yet, so set it here */ gDesktopCursor = *((HCURSOR*)ResultPointer); - if (!NT_SUCCESS(Status)) - { - return FALSE; - } return TRUE; } @@ -721,6 +727,12 @@ UserEnterCo(); + if (!NT_SUCCESS(Status)) + { + ERR("Failure to make Callback! Status 0x%x",Status); + goto Fault_Exit; + } + if (ResultPointer) { _SEH2_TRY @@ -741,11 +753,6 @@ ERR("ERROR: Hook %d Code %d ResultPointer 0x%p ResultLength %u\n",HookId,Code,ResultPointer,ResultLength); } - if (!NT_SUCCESS(Status)) - { - ERR("Failure to make Callback! Status 0x%x",Status); - goto Fault_Exit; - } /* Support write backs... SEH is in UserCallNextHookEx. */ switch (HookId) { @@ -906,14 +913,16 @@ UserEnterCo(); - Result = *(LRESULT*)ResultPointer; + if (NT_SUCCESS(Status)) + { + Result = *(LRESULT*)ResultPointer; + } + else + { + Result = 0; + } IntCbFreeMemory(Argument); - - if (!NT_SUCCESS(Status)) - { - return 0; - } return (HMENU)Result; } @@ -984,15 +993,17 @@ UserEnterCo(); - Handle = *(HANDLE*)ResultPointer; + if (NT_SUCCESS(Status)) + { + Handle = *(HANDLE*)ResultPointer; + } + else + { + ERR("CopyImage callback failed!\n"); + Handle = NULL; + } IntCbFreeMemory(Argument); - - if (!NT_SUCCESS(Status)) - { - ERR("CopyImage callback failed!\n"); - return 0; - } return Handle; } @@ -1029,17 +1040,20 @@ &ResultPointer, &ResultLength); - _SEH2_TRY - { - /* Need to copy into our local buffer */ - RtlMoveMemory(Argument, ResultPointer, ArgumentLength); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - ERR("Failed to copy result from user mode!\n"); - Status = _SEH2_GetExceptionCode(); - } - _SEH2_END; + if (NT_SUCCESS(Status)) + { + _SEH2_TRY + { + /* Need to copy into our local buffer */ + RtlMoveMemory(Argument, ResultPointer, ArgumentLength); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + ERR("Failed to copy result from user mode!\n"); + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END; + } UserEnterCo(); @@ -1115,14 +1129,16 @@ VOID FASTCALL co_IntDeliverUserAPC(VOID) { + ULONG ResultLength; + PVOID ResultPointer; NTSTATUS Status; UserLeaveCo(); Status = KeUserModeCallback(USER32_CALLBACK_DELIVERUSERAPC, 0, 0, - NULL, - NULL); + &ResultPointer, + &ResultLength); UserEnterCo(); @@ -1130,6 +1146,6 @@ if (!NT_SUCCESS(Status)) { ERR("Delivering User APC callback failed!\n"); - } + } } /* EOF */ Modified: trunk/reactos/win32ss/user/ntuser/callproc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/callpr…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/callproc.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/callproc.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -135,7 +135,7 @@ { if (!pCls->rpdeskParent) { - TRACE("Null DESKTOP Atom %d\n",pCls->atomClassName); + TRACE("Null DESKTOP Atom %u\n",pCls->atomClassName); pDesk = pti->rpdesk; } else @@ -157,7 +157,7 @@ /* SYSCALLS *****************************************************************/ -/* +/* Retrieve the WinProcA/W or CallProcData handle for Class, Dialog or Window. This Function called from user space uses Window handle for class, window and dialog procs only. @@ -183,12 +183,12 @@ UserEnterExclusive(); if (!(Wnd = UserGetWindowObject(hWnd))) - { + { goto Cleanup; } // Processing Window only from User space. - if ((Flags & ~(UserGetCPDU2A|UserGetCPDA2U)) != UserGetCPDClass) + if ((Flags & ~(UserGetCPDU2A|UserGetCPDA2U)) != UserGetCPDClass) Result = UserGetCPD(Wnd, Flags, ProcIn); Cleanup: Modified: trunk/reactos/win32ss/user/ntuser/caret.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/caret.…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/caret.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/caret.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -35,8 +35,14 @@ NtGdiSaveDC(hdc); } - if(CaretInfo->Bitmap && NtGdiGetBitmapDimension(CaretInfo->Bitmap, &CaretInfo->Size)) + if (CaretInfo->Bitmap) { + if (!NtGdiGetBitmapDimension(CaretInfo->Bitmap, &CaretInfo->Size)) + { + ERR("Failed to get bitmap dimensions\n"); + return; + } + hdcMem = NtGdiCreateCompatibleDC(hdc); if (hdcMem) { @@ -88,13 +94,13 @@ pti = PsGetCurrentThreadWin32Thread(); ThreadQueue = pti->MessageQueue; - + if (ThreadQueue->CaretInfo->hWnd != hwnd) { ERR("Not the same caret window!\n"); return; } - + if (hwnd) { pWnd = UserGetWindowObject(hwnd); @@ -118,7 +124,7 @@ co_IntDrawCaret(pWnd, ThreadQueue->CaretInfo); } } - return; + return; } static Modified: trunk/reactos/win32ss/user/ntuser/class.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/class.…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/class.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/class.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -1042,7 +1042,7 @@ /* FIXME: The class was created before being connected to a desktop. It is possible for the desktop window, but should it be allowed for any other case? */ - TRACE("This CLASS has no Desktop to heap from! Atom %d\n",Atom); + TRACE("This CLASS has no Desktop to heap from! Atom %u\n",Atom); Class = UserHeapAlloc(ClassSize); } @@ -1232,6 +1232,7 @@ return Class; } +_Success_(return) BOOL NTAPI IntGetAtomFromStringOrAtom( @@ -1314,8 +1315,7 @@ ASSERT(BaseClass != NULL); - if (IntGetAtomFromStringOrAtom(ClassName, - &Atom) && + if (IntGetAtomFromStringOrAtom(ClassName, &Atom) && Atom != (RTL_ATOM)0) { PCLS Class; @@ -1368,6 +1368,10 @@ FoundClass: *BaseClass = Class; + } + else + { + Atom = 0; } return Atom; Modified: trunk/reactos/win32ss/user/ntuser/class.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/class.…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/class.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/class.h [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -46,6 +46,7 @@ UserAddCallProcToClass(IN OUT PCLS Class, IN PCALLPROCDATA CallProc); +_Success_(return) BOOL NTAPI IntGetAtomFromStringOrAtom( Modified: trunk/reactos/win32ss/user/ntuser/cursoricon.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/cursor…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/cursoricon.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/cursoricon.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -1310,6 +1310,7 @@ /* Get a pointer to the frame cursor */ aspcur[i] = UserGetCurIconObject(hcurFrame); + _PRAGMA_WARNING_SUPPRESS(__WARNING_READ_OVERRUN); NT_ASSERT(aspcur[i] != NULL); /* Check if the flags are valid */ Modified: trunk/reactos/win32ss/user/ntuser/dde.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/dde.c?…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/dde.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/dde.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -243,6 +243,11 @@ { // Set buffer with users data size. Buffer = ExAllocatePoolWithTag(PagedPool, size, USERTAG_DDE); + if (Buffer == NULL) + { + ERR("Failed to allocate %i bytes.\n", size); + return FALSE; + } // No SEH? Yes, the user memory is freed after the Acknowledgment or at Termination. RtlCopyMemory(Buffer, userBuf, size); } @@ -254,6 +259,7 @@ case WM_DDE_POKE: { DDEPOKE *pddePoke = Buffer; + NT_ASSERT(pddePoke != NULL); switch(pddePoke->cfFormat) { case CF_BITMAP: @@ -268,13 +274,14 @@ } case WM_DDE_DATA: { - DDEDATA *pddeData = Buffer; - switch(pddeData->cfFormat) + DDEDATA *pddeData2 = Buffer; + NT_ASSERT(pddeData2 != NULL); + switch(pddeData2->cfFormat) { case CF_BITMAP: case CF_DIB: case CF_PALETTE: - RtlCopyMemory(&Object, pddeData->Value, sizeof(HGDIOBJ)); + RtlCopyMemory(&Object, pddeData2->Value, sizeof(HGDIOBJ)); break; default: break; @@ -292,14 +299,20 @@ } pddeData = ExAllocatePoolWithTag(PagedPool, sizeof(DDE_DATA), USERTAG_DDE5); + if (pddeData == NULL) + { + ERR("Failed to allocate DDE_DATA\n"); + ExFreePoolWithTag(Buffer, USERTAG_DDE); + return FALSE; + } pddeData->cbSize = size; pddeData->pvBuffer = Buffer; pddeData->lParam = lp; - + TRACE("DDE Post lParam c=%08lx\n",lp); *lParam = lp; - + // Attach this data packet to the user message. *ExtraInfo = (LONG_PTR)pddeData; } @@ -397,6 +410,11 @@ // Setup property so this conversation can be tracked. pddeProp = ExAllocatePoolWithTag(PagedPool, sizeof(DDE_PROP), USERTAG_DDE1); + if (pddeProp == NULL) + { + ERR("failed to allocate DDE_PROP\n"); + return FALSE; + } pddeProp->spwnd = pWndServer; pddeProp->spwndPartner = pWnd; 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 Mar 10 00:12:41 2015 @@ -515,8 +515,8 @@ if(Old != NULL) { (void)InterlockedExchangePointer((PVOID*)&Old->Desktop, 0); + gpqForegroundPrev = Old; IntDereferenceMessageQueue(Old); - gpqForegroundPrev = Old; } // Only one Q can have active foreground even when there are more than one desktop. if (NewQueue) @@ -999,7 +999,10 @@ UINT align_old; int mode_old; - GdiGetClipBox(hDC, &Rect); + if (GdiGetClipBox(hDC, &Rect) == ERROR) + { + return FALSE; + } hWndDesktop = IntGetDesktopWindow(); // rpdesk->DesktopWindow; @@ -1292,7 +1295,7 @@ PDESKTOP pdesk = NULL; NTSTATUS Status = STATUS_SUCCESS; HDESK hdesk; - BOOLEAN Context; + BOOLEAN Context = FALSE; UNICODE_STRING ClassName; LARGE_STRING WindowName; BOOL NoHooks = FALSE; Modified: trunk/reactos/win32ss/user/ntuser/event.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/event.…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/event.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/event.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -11,7 +11,7 @@ typedef struct _EVENTPACK { - PEVENTHOOK pEH; + PEVENTHOOK pEH; LONG idObject; LONG idChild; LONG idThread; @@ -97,7 +97,7 @@ FASTCALL IntCallLowLevelEvent( PEVENTHOOK pEH, DWORD event, - HWND hwnd, + HWND hwnd, LONG idObject, LONG idChild, LONG idThread) @@ -158,7 +158,7 @@ PEVENTPACK pEP = (PEVENTPACK)idChild; pEH = pEP->pEH; - TRACE("Dispatch Event 0x%x, idObject %d hwnd %p\n", event, idObject, hwnd); + TRACE("Dispatch Event 0x%lx, idObject %uI hwnd %p\n", event, idObject, hwnd); Result = co_IntCallEventProc( UserHMGetHandle(pEH), event, hwnd, @@ -241,13 +241,13 @@ idChild, PtrToUint(NtCurrentTeb()->ClientId.UniqueThread)); } - } + } } UserDereferenceObject(pEH); pLE = pEH->Chain.Flink; pEH = CONTAINING_RECORD(pLE, EVENTHOOK, Chain); } while (pLE != &GlobalEvents->Events); -} +} VOID APIENTRY @@ -311,7 +311,7 @@ EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); goto SetEventExit; } - GlobalEvents->Counts = 0; + GlobalEvents->Counts = 0; InitializeListHead(&GlobalEvents->Events); } @@ -353,7 +353,7 @@ PETHREAD Thread; Status = PsLookupThreadByThreadId((HANDLE)(DWORD_PTR)idThread, &Thread); if (!NT_SUCCESS(Status)) - { + { EngSetLastError(ERROR_INVALID_THREAD_ID); goto SetEventExit; } @@ -419,7 +419,7 @@ UserEnterExclusive(); pEH = (PEVENTHOOK)UserGetObject(gHandleTable, hWinEventHook, TYPE_WINEVENTHOOK); - if (pEH) + if (pEH) { Ret = IntRemoveEvent(pEH); } Modified: trunk/reactos/win32ss/user/ntuser/focus.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/focus.…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/focus.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/focus.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -416,7 +416,7 @@ static BOOL FASTCALL co_IntSetForegroundAndFocusWindow( - _In_ PWND Wnd, + _In_opt_ PWND Wnd, _In_ BOOL MouseActivate) { HWND hWnd = Wnd ? UserHMGetHandle(Wnd) : NULL; @@ -805,6 +805,7 @@ { if (pwndTop->style & (WS_MINIMIZED|WS_DISABLED)) return 0; if ((pwndTop->style & (WS_POPUP|WS_CHILD)) != WS_CHILD) break; + if (pwndTop->spwndParent == NULL) break; } //// if (co_HOOK_CallHooks( WH_CBT, HCBT_SETFOCUS, (WPARAM)Window->head.h, (LPARAM)hWndPrev)) Modified: trunk/reactos/win32ss/user/ntuser/hook.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/hook.c…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/hook.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/hook.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -720,7 +720,8 @@ if (!IS_ATOM(pcbtcww->lpcs->lpszClass)) { - ProbeForRead( pcbtcww->lpcs->lpszClass, + _Analysis_assume_(pcbtcww->lpcs->lpszClass != NULL); + ProbeForRead(pcbtcww->lpcs->lpszClass, sizeof(CHAR), 1); } @@ -739,7 +740,8 @@ if (!IS_ATOM(pcbtcww->lpcs->lpszClass)) { - ProbeForRead( pcbtcww->lpcs->lpszClass, + _Analysis_assume_(pcbtcww->lpcs->lpszClass != NULL); + ProbeForRead(pcbtcww->lpcs->lpszClass, sizeof(WCHAR), 1); } @@ -968,15 +970,16 @@ ++cHooks; pList = ExAllocatePoolWithTag(PagedPool, (cHooks + 1) * sizeof(HHOOK), TAG_HOOK); - if(!pList) + if (!pList) { EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); return NULL; -} + } for (pElem = pLastHead->Flink; pElem != pLastHead; pElem = pElem->Flink) -{ + { pHook = CONTAINING_RECORD(pElem, HOOK, Chain); + NT_ASSERT(i < cHooks); pList[i++] = pHook->head.h; } pList[i] = NULL; @@ -1180,7 +1183,7 @@ wParam, lParam, Hook->Proc, - Hook->ihmod, + Hook->ihmod, Hook->offPfn, Hook->Ansi, &Hook->ModuleName); @@ -1261,7 +1264,7 @@ wParam, lParam, Hook->Proc, - Hook->ihmod, + Hook->ihmod, Hook->offPfn, Hook->Ansi, &Hook->ModuleName); @@ -1279,7 +1282,7 @@ wParam, lParam, Hook->Proc, - Hook->ihmod, + Hook->ihmod, Hook->offPfn, Hook->Ansi, &Hook->ModuleName); Modified: trunk/reactos/win32ss/user/ntuser/hotkey.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/hotkey…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/hotkey.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/hotkey.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -217,7 +217,7 @@ pWnd = ValidateHwndNoErr(InputWindowStation->ShellWindow); if (pWnd) { - TRACE("System Hot key Id %d Key %d\n",pHotKey->id, wVk ); + TRACE("System Hot key Id %d Key %u\n", pHotKey->id, wVk ); UserPostMessage(UserHMGetHandle(pWnd), WM_SYSCOMMAND, SC_TASKLIST, 0); co_IntShellHookNotify(HSHELL_TASKMAN, 0, 0); bWinHotkeyActive = FALSE; @@ -238,7 +238,7 @@ { if (!pHotKey->pWnd) { - TRACE("UPTM Hot key Id %d Key %d\n",pHotKey->id, wVk ); + TRACE("UPTM Hot key Id %d Key %u\n", pHotKey->id, wVk ); UserPostThreadMessage(pHotKey->pti, WM_HOTKEY, pHotKey->id, MAKELONG(fModifiers, wVk)); //ptiLastInput = pHotKey->pti; return TRUE; /* Don't send any message */ @@ -267,7 +267,7 @@ } else { - TRACE("UPM Hot key Id %d Key %d\n",pHotKey->id, wVk ); + TRACE("UPM Hot key Id %d Key %u\n", pHotKey->id, wVk ); UserPostMessage(UserHMGetHandle(pWnd), WM_HOTKEY, pHotKey->id, MAKELONG(fModifiers, wVk)); } //ptiLastInput = pWnd->head.pti; Modified: trunk/reactos/win32ss/user/ntuser/input.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/input.…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/input.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/input.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -153,6 +153,9 @@ StartTheTimers(); UserLeave(); + NT_ASSERT(ghMouseDevice == NULL); + NT_ASSERT(ghKeyboardDevice == NULL); + for (;;) { if (!ghMouseDevice) @@ -247,10 +250,16 @@ pSignaledObject = WaitObjects[Status - STATUS_WAIT_0]; /* Check if it is mouse or keyboard and update status */ - if (pSignaledObject == &pMouDevice->Event) + if ((MouStatus == STATUS_PENDING) && + (pSignaledObject == &pMouDevice->Event)) + { MouStatus = MouIosb.Status; - else if (pSignaledObject == &pKbdDevice->Event) + } + else if ((KbdStatus == STATUS_PENDING) && + (pSignaledObject == &pKbdDevice->Event)) + { KbdStatus = KbdIosb.Status; + } else if (pSignaledObject == MasterTimer) { ProcessTimers(); @@ -414,7 +423,7 @@ do { if (!gpai) return TRUE; - + pai = gpai; // Bottom of the list. do @@ -432,7 +441,7 @@ break; } pai = pai->paiNext; - + } while (pai); if (!pai && !ptiFrom && !ptiTo) break; @@ -529,7 +538,7 @@ } ptiFrom->MessageQueue->cThreads++; - ERR("ptiTo S Share count %d\n", ptiFrom->MessageQueue->cThreads); + ERR("ptiTo S Share count %u\n", ptiFrom->MessageQueue->cThreads); IntReferenceMessageQueue(ptiTo->MessageQueue); } @@ -563,9 +572,9 @@ } if (!Hit) return STATUS_INVALID_PARAMETER; - + ERR("Attach Free! ptiFrom 0x%p ptiTo 0x%p paiCount %d\n",ptiFrom,ptiTo,paiCount); - + if (ptiTo->MessageQueue == ptiFrom->MessageQueue) { if (gptiForeground == ptiFrom) @@ -575,7 +584,7 @@ gptiForeground = ptiTo; } ptiTo->MessageQueue->cThreads--; - ERR("ptiTo E Share count %d\n", ptiTo->MessageQueue->cThreads); + ERR("ptiTo E Share count %u\n", ptiTo->MessageQueue->cThreads); ASSERT(ptiTo->MessageQueue->cThreads >= 1); IntDereferenceMessageQueue(ptiTo->MessageQueue); Modified: trunk/reactos/win32ss/user/ntuser/kbdlayout.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/kbdlay…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/kbdlayout.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/kbdlayout.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -204,7 +204,7 @@ * Loads keyboard layout and creates KL object */ static PKL -UserLoadKbdLayout(PUNICODE_STRING pwszKLID, HKL hKL) +UserLoadKbdLayout(PUNICODE_STRING pustrKLID, HKL hKL) { LCID lCid; CHARSETINFO cs; @@ -219,7 +219,7 @@ } pKl->hkl = hKL; - pKl->spkf = UserLoadKbdFile(pwszKLID); + pKl->spkf = UserLoadKbdFile(pustrKLID); /* Dereference keyboard layout */ UserDereferenceObject(pKl); @@ -227,20 +227,27 @@ /* If we failed, remove KL object */ if (!pKl->spkf) { - ERR("UserLoadKbdFile(%wZ) failed!\n", pwszKLID); + ERR("UserLoadKbdFile(%wZ) failed!\n", pustrKLID); UserDeleteObject(pKl->head.h, TYPE_KBDLAYOUT); return NULL; } // Up to Language Identifiers.. - RtlUnicodeStringToInteger(pwszKLID, (ULONG)16, (PULONG)&lCid); - TRACE("Language Identifiers %wZ LCID 0x%x\n", pwszKLID, lCid); + if (!NT_SUCCESS(RtlUnicodeStringToInteger(pustrKLID, 16, (PULONG)&lCid))) + { + ERR("RtlUnicodeStringToInteger failed for '%wZ'\n", pustrKLID); + UserDeleteObject(pKl->head.h, TYPE_KBDLAYOUT); + return NULL; + } + + TRACE("Language Identifiers %wZ LCID 0x%x\n", pustrKLID, lCid); if (co_IntGetCharsetInfo(lCid, &cs)) { pKl->iBaseCharset = cs.ciCharset; pKl->dwFontSigs = cs.fs.fsCsb[0]; pKl->CodePage = (USHORT)cs.ciACP; - TRACE("Charset %u Font Sig %lu CodePage %u\n", pKl->iBaseCharset, pKl->dwFontSigs, pKl->CodePage); + TRACE("Charset %u Font Sig %lu CodePage %u\n", + pKl->iBaseCharset, pKl->dwFontSigs, pKl->CodePage); } else { Modified: trunk/reactos/win32ss/user/ntuser/keyboard.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/keyboa…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/keyboard.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/keyboard.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -170,12 +170,16 @@ &Block, IOCTL_KEYBOARD_QUERY_INDICATORS, NULL, 0, - &gIndicators, sizeof(gIndicators)); + &gIndicators, + sizeof(gIndicators)); if (!NT_SUCCESS(Status)) { WARN("NtDeviceIoControlFile() failed, ignored\n"); - } + gIndicators.LedFlags = 0; + gIndicators.UnitId = 0; + } + SET_KEY_LOCKED(gafAsyncKeyState, VK_CAPITAL, gIndicators.LedFlags & KEYBOARD_CAPS_LOCK_ON); SET_KEY_LOCKED(gafAsyncKeyState, VK_NUMLOCK, @@ -197,7 +201,7 @@ { ERR("NtDeviceIoControlFile() failed, ignored\n"); } - TRACE("Keyboard type %d, subtype %d and number of func keys %d\n", + TRACE("Keyboard type %u, subtype %u and number of func keys %u\n", gKeyboardInfo.KeyboardIdentifier.Type, gKeyboardInfo.KeyboardIdentifier.Subtype, gKeyboardInfo.NumberOfFunctionKeys); @@ -1067,7 +1071,7 @@ but it wouldn't interpret E1 key(s) properly */ wVk = IntVscToVk(wScanCode, pKbdTbl); TRACE("UserProcessKeyboardInput: %x (break: %u) -> %x\n", - wScanCode, (pKbdInputData->Flags & KEY_BREAK) ? 1 : 0, wVk); + wScanCode, (pKbdInputData->Flags & KEY_BREAK) ? 1u : 0, wVk); if (wVk) { @@ -1194,7 +1198,7 @@ bResult = TRUE; } - TRACE("Leave IntTranslateKbdMessage ret %u, cch %d, msg %x, wch %x\n", + TRACE("Leave IntTranslateKbdMessage ret %d, cch %d, msg %x, wch %x\n", bResult, cch, NewMsg.message, NewMsg.wParam); return bResult; } Modified: trunk/reactos/win32ss/user/ntuser/main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/main.c…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/main.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/main.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -100,7 +100,8 @@ * Called from IntDereferenceProcessInfo */ VOID -UserDeleteW32Process(PPROCESSINFO ppiCurrent) +UserDeleteW32Process( + _Pre_notnull_ __drv_freesMem(Mem) PPROCESSINFO ppiCurrent) { if (ppiCurrent->InputIdleEvent) { @@ -863,7 +864,7 @@ return Status; } - +_Function_class_(DRIVER_UNLOAD) VOID NTAPI DriverUnload(IN PDRIVER_OBJECT DriverObject) { Modified: trunk/reactos/win32ss/user/ntuser/menu.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/menu.c…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/menu.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/menu.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -286,7 +286,7 @@ if( depth > MAXMENUDEPTH) return depth; item = pmenu->rgItems; subdepth = depth; - for( i = 0; item, i < pmenu->cItems && subdepth <= MAXMENUDEPTH; i++, item++) + for( i = 0; i < pmenu->cItems && subdepth <= MAXMENUDEPTH; i++, item++) { if( item->spSubMenu)//VerifyMenu(item->spSubMenu)) { @@ -323,7 +323,7 @@ else { PITEM item = menu->rgItems; - for (i = 0; item, i < menu->cItems; i++, item++) + for (i = 0; i < menu->cItems; i++, item++) { if (item->spSubMenu) { @@ -478,7 +478,7 @@ SubMenu->cyMenu = 0; MenuItem->hbmpChecked = MenuItem->hbmpUnchecked = 0; - TRACE("IntInsertMenuItemToList = %i %d\n", uItem, (BOOL)((INT)uItem >= 0)); + TRACE("IntInsertMenuItemToList = %u %i\n", uItem, (BOOL)((INT)uItem >= 0)); return TRUE; } @@ -1033,7 +1033,7 @@ if (!MenuItem) return FALSE; /* reset all default-item flags */ - for (i = 0; MenuItem, i < MenuObject->cItems; i++, MenuItem++) + for (i = 0; i < MenuObject->cItems; i++, MenuItem++) { MenuItem->fState &= ~MFS_DEFAULT; } @@ -1052,7 +1052,7 @@ } else { - for (i = 0; MenuItem, i < MenuObject->cItems; i++, MenuItem++) + for (i = 0; i < MenuObject->cItems; i++, MenuItem++) { if (MenuItem->wID == uItem) { @@ -1623,7 +1623,7 @@ } else { - ERR("Failed Item Lookup! %d\n", uItem); + ERR("Failed Item Lookup! %u\n", uItem); return FALSE; } @@ -2162,7 +2162,7 @@ RETURN(FALSE); if (pWnd->pcls->fnid != FNID_MENU) { - WARN("called on invalid window: %d\n", pWnd->pcls->fnid); + WARN("called on invalid window: %u\n", pWnd->pcls->fnid); EngSetLastError(ERROR_INVALID_MENU_HANDLE); RETURN(FALSE); } Modified: trunk/reactos/win32ss/user/ntuser/message.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/messag…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/message.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/message.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -319,6 +319,7 @@ } else { + NT_ASSERT(ClassName->Buffer != NULL); *((WCHAR *) CsData) = L'S'; CsData += sizeof(WCHAR); RtlCopyMemory(CsData, ClassName->Buffer, ClassName->Length); @@ -444,7 +445,7 @@ /* Copy data if required */ if (0 != (MsgMemoryEntry->Flags & MMS_FLAG_READ)) { - TRACE("Copy Message %d from usermode buffer\n", KernelModeMsg->message); + TRACE("Copy Message %u from usermode buffer\n", KernelModeMsg->message); Status = MmCopyFromCaller(KernelMem, (PVOID) UserModeMsg->lParam, Size); if (! NT_SUCCESS(Status)) { @@ -612,7 +613,7 @@ pWnd == UserGetMessageWindow() ) // pWnd->fnid == FNID_MESSAGEWND return 0; - TRACE("Internal Event Msg %p hWnd 0x%x\n",msg,pWnd->head.h); + TRACE("Internal Event Msg 0x%x hWnd 0x%p\n", msg, pWnd->head.h); switch(msg) { @@ -1225,7 +1226,7 @@ Window = UserGetWindowObject(Wnd); if ( !Window ) { - ERR("UserPostMessage: Invalid handle 0x%p Msg %d!\n",Wnd,Msg); + ERR("UserPostMessage: Invalid handle 0x%p Msg 0x%x!\n", Wnd, Msg); return FALSE; } Modified: trunk/reactos/win32ss/user/ntuser/misc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/misc.c…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/misc.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/misc.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -58,7 +58,7 @@ HANDLE KeyHandle; OBJECT_ATTRIBUTES ObAttr; //
http://support.microsoft.com/kb/324097
- ULONG Ret = 0x409; // English + ULONG Ret = MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT); PKEY_VALUE_PARTIAL_INFORMATION pKeyInfo; ULONG Size = sizeof(KEY_VALUE_PARTIAL_INFORMATION) + MAX_PATH*sizeof(WCHAR); UNICODE_STRING Language; @@ -87,7 +87,10 @@ &Size)) ) { RtlInitUnicodeString(&Language, (PWSTR)pKeyInfo->Data); - RtlUnicodeStringToInteger(&Language, 16, &Ret); + if (!NT_SUCCESS(RtlUnicodeStringToInteger(&Language, 16, &Ret))) + { + Ret = MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT); + } } ExFreePoolWithTag(pKeyInfo, TAG_STRING); } Modified: trunk/reactos/win32ss/user/ntuser/misc/file.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/misc/f…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/misc/file.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/misc/file.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -83,7 +83,7 @@ ULONGLONG ullMaxSize) { NTSTATUS Status; - HANDLE hSection = NULL; + HANDLE hSection; ACCESS_MASK amDesiredAccess; /* Set access mask */ @@ -107,6 +107,7 @@ if (!NT_SUCCESS(Status)) { SetLastNtError(Status); + hSection = NULL; } DPRINT("Leaving W32kCreateFileSection, Status=0x%lx, hSection=0x%p\n", Status, hSection); @@ -125,7 +126,7 @@ NTSTATUS Status; LARGE_INTEGER liSectionOffset; ULONG_PTR ulViewSize; - PVOID pvBase = 0; + PVOID pvBase = NULL; liSectionOffset.QuadPart = ulViewSize = ulSectionOffset; Status = ZwMapViewOfSection(hSection, @@ -141,6 +142,7 @@ if (!NT_SUCCESS(Status)) { SetLastNtError(Status); + pvBase = NULL; } DPRINT("Leaving W32kMapViewOfSection, Status=0x%lx, pvBase=0x%p\n", Status, pvBase); Modified: trunk/reactos/win32ss/user/ntuser/misc/registry.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/misc/r…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/misc/registry.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/misc/registry.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -82,19 +82,34 @@ cbInfoSize, &cbInfoSize); - cbDataSize = pInfo->DataLength; - /* Note: STATUS_BUFFER_OVERFLOW is not a success */ if (NT_SUCCESS(Status)) { + cbDataSize = pInfo->DataLength; + /* Did we get the right type */ - if (pInfo->Type == ulType) + if (pInfo->Type != ulType) + { + Status = STATUS_OBJECT_TYPE_MISMATCH; + } + else if (cbDataSize > *pcbValue) + { + Status = STATUS_BUFFER_TOO_SMALL; + } + else { /* Copy the contents to the caller */ RtlCopyMemory(pvData, pInfo->Data, cbDataSize); } - else - Status = STATUS_OBJECT_TYPE_MISMATCH; + } + else if ((Status == STATUS_BUFFER_OVERFLOW) || (Status == STATUS_BUFFER_TOO_SMALL)) + { + _PRAGMA_WARNING_SUPPRESS(6102); /* cbInfoSize is initialized here! */ + cbDataSize = cbInfoSize - FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data); + } + else + { + cbDataSize = 0; } /* Return the data size to the caller */ @@ -140,14 +155,15 @@ return NT_SUCCESS(Status); } +_Success_(return!=FALSE) BOOL NTAPI RegReadUserSetting( - IN PCWSTR pwszKeyName, - IN PCWSTR pwszValueName, - IN ULONG ulType, - OUT PVOID pvData, - IN ULONG cbDataSize) + _In_z_ PCWSTR pwszKeyName, + _In_z_ PCWSTR pwszValueName, + _In_ ULONG ulType, + _Out_writes_(cbDataSize) _When_(ulType == REG_SZ, _Post_z_) PVOID pvData, + _In_ ULONG cbDataSize) { NTSTATUS Status; OBJECT_ATTRIBUTES ObjectAttributes; Modified: trunk/reactos/win32ss/user/ntuser/monitor.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/monito…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/monitor.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/monitor.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -542,7 +542,8 @@ OPTIONAL OUT PRECTL prcUnsafeMonitorList, OPTIONAL IN DWORD dwListSize) { - INT cMonitors, iRet = -1, i; + UINT cMonitors, i; + INT iRet = -1; HMONITOR *phMonitorList = NULL; PRECTL prcMonitorList = NULL; RECTL rc, *pRect; @@ -619,7 +620,7 @@ (phUnsafeMonitorList == NULL && prcUnsafeMonitorList == NULL)) { /* Simple case - just return monitors count */ - TRACE("cMonitors = %d\n", cMonitors); + TRACE("cMonitors = %u\n", cMonitors); iRet = cMonitors; goto cleanup; } @@ -636,7 +637,7 @@ } if (prcUnsafeMonitorList != NULL && dwListSize != 0) { - prcMonitorList = ExAllocatePoolWithTag(PagedPool, sizeof (RECT) * dwListSize, USERTAG_MONITORRECTS); + prcMonitorList = ExAllocatePoolWithTag(PagedPool, sizeof(RECT) * dwListSize,USERTAG_MONITORRECTS); if (prcMonitorList == NULL) { EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); @@ -649,13 +650,16 @@ dwListSize, MONITOR_DEFAULTTONULL); if (hdc != NULL && pRect != NULL && prcMonitorList != NULL) - for (i = 0; i < cMonitors; i++) - { + { + for (i = 0; i < min(cMonitors, dwListSize); i++) + { + _Analysis_assume_(i < dwListSize); prcMonitorList[i].left -= DcRect.left; prcMonitorList[i].right -= DcRect.left; prcMonitorList[i].top -= DcRect.top; prcMonitorList[i].bottom -= DcRect.top; } + } /* Output result */ if (phUnsafeMonitorList != NULL && dwListSize != 0) Modified: trunk/reactos/win32ss/user/ntuser/msgqueue.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/msgque…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/msgqueue.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/msgqueue.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -738,7 +738,8 @@ } BOOLEAN FASTCALL -co_MsqDispatchOneSentMessage(PTHREADINFO pti) +co_MsqDispatchOneSentMessage( + _In_ PTHREADINFO pti) { PUSER_SENT_MESSAGE SaveMsg, Message; PLIST_ENTRY Entry; @@ -2107,7 +2108,10 @@ if (CurrentSentMessage->HasPackedLParam) { if (CurrentSentMessage->Msg.lParam) + { + _PRAGMA_WARNING_SUPPRESS(__WARNING_USING_UNINIT_VAR); ExFreePool((PVOID)CurrentSentMessage->Msg.lParam); + } } /* free the message */ @@ -2219,11 +2223,12 @@ } VOID FASTCALL -MsqDestroyMessageQueue(PTHREADINFO pti) +MsqDestroyMessageQueue(_In_ PTHREADINFO pti) { PDESKTOP desk; PUSER_MESSAGE_QUEUE MessageQueue = pti->MessageQueue; + NT_ASSERT(MessageQueue != NULL); MessageQueue->QF_flags |= QF_INDESTROY; /* remove the message queue from any desktops */ @@ -2237,6 +2242,7 @@ MsqCleanupMessageQueue(pti); /* decrease the reference counter, if it hits zero, the queue will be freed */ + _PRAGMA_WARNING_SUPPRESS(__WARNING_USING_UNINIT_VAR); IntDereferenceMessageQueue(MessageQueue); } Modified: trunk/reactos/win32ss/user/ntuser/msgqueue.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/msgque…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/msgqueue.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/msgqueue.h [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -146,9 +146,9 @@ BOOLEAN FASTCALL MsqInitializeMessageQueue(PTHREADINFO, PUSER_MESSAGE_QUEUE); PUSER_MESSAGE_QUEUE FASTCALL MsqCreateMessageQueue(PTHREADINFO); VOID FASTCALL MsqCleanupThreadMsgs(PTHREADINFO); -VOID FASTCALL MsqDestroyMessageQueue(PTHREADINFO); +VOID FASTCALL MsqDestroyMessageQueue(_In_ PTHREADINFO pti); INIT_FUNCTION NTSTATUS NTAPI MsqInitializeImpl(VOID); -BOOLEAN FASTCALL co_MsqDispatchOneSentMessage(PTHREADINFO pti); +BOOLEAN FASTCALL co_MsqDispatchOneSentMessage(_In_ PTHREADINFO pti); NTSTATUS FASTCALL co_MsqWaitForNewMessages(PTHREADINFO pti, PWND WndFilter, UINT MsgFilterMin, UINT MsgFilterMax); Modified: trunk/reactos/win32ss/user/ntuser/ntstubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/ntstub…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/ntstubs.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/ntstubs.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -479,7 +479,7 @@ } default: - ERR("Calling invalid control %lu in NtUserConsoleControl\n", ConsoleCtrl); + ERR("Calling invalid control %d in NtUserConsoleControl\n", ConsoleCtrl); Status = STATUS_INVALID_INFO_CLASS; break; } Modified: trunk/reactos/win32ss/user/ntuser/object.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/object…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/object.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/object.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -13,6 +13,7 @@ PUSER_HANDLE_TABLE gHandleTable = NULL; /* Forward declarations */ +_Success_(return!=NULL) static PVOID AllocThreadObject( _In_ PDESKTOP pDesk, _In_ PTHREADINFO pti, @@ -53,6 +54,7 @@ IntDereferenceThreadInfo(pti); } +_Success_(return!=NULL) static PVOID AllocDeskThreadObject( _In_ PDESKTOP pDesk, _In_ PTHREADINFO pti, @@ -97,6 +99,7 @@ IntDereferenceThreadInfo(pti); } +_Success_(return!=NULL) static PVOID AllocDeskProcObject( _In_ PDESKTOP pDesk, _In_ PTHREADINFO pti, @@ -141,6 +144,7 @@ DesktopHeapFree(pDesk, Object); } +_Success_(return!=NULL) static PVOID AllocProcMarkObject( _In_ PDESKTOP pDesk, _In_ PTHREADINFO pti, @@ -179,6 +183,7 @@ IntDereferenceProcessInfo(ppi); } +_Success_(return!=NULL) static PVOID AllocSysObject( _In_ PDESKTOP pDesk, _In_ PTHREADINFO pti, Modified: trunk/reactos/win32ss/user/ntuser/painting.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/painti…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/painting.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/painting.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -419,7 +419,7 @@ VOID FASTCALL IntInvalidateWindows(PWND Wnd, PREGION Rgn, ULONG Flags) { - INT RgnType; + INT RgnType = NULLREGION; BOOL HadPaintMessage; TRACE("IntInvalidateWindows start\n"); @@ -986,7 +986,7 @@ // Set previous window state. Ret = !!(FlashState & FLASHW_ACTIVE); - if ( pfwi->dwFlags & FLASHW_TIMERNOFG && + if ( pfwi->dwFlags & FLASHW_TIMERNOFG && gpqForeground == pWnd->head.pti->MessageQueue ) { // Flashing until foreground, set this to Stop. @@ -1390,8 +1390,11 @@ EngSetLastError(ERROR_INVALID_HANDLE); _ret_ = ERROR; } - IntGdiCombineRgn(TheRgn, Rgn, NULL, RGN_COPY); - REGION_UnlockRgn(TheRgn); + else + { + IntGdiCombineRgn(TheRgn, Rgn, NULL, RGN_COPY); + REGION_UnlockRgn(TheRgn); + } } if (Rgn) @@ -1604,7 +1607,12 @@ RECTL rcScroll, rcClip, rcSrc, rcDst; INT Result; - GdiGetClipBox(hDC, &rcClip); + if (GdiGetClipBox(hDC, &rcClip) == ERROR) + { + ERR("GdiGetClipBox failed for HDC %p\n", hDC); + return ERROR; + } + rcScroll = rcClip; if (prcClip) { Modified: trunk/reactos/win32ss/user/ntuser/prop.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/prop.c…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/prop.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/prop.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -26,7 +26,7 @@ if (ListEntry == NULL) { - ERR("Corrupted (or uninitialized?) property list for window %p. Prop count %d. Atom %d.\n", + ERR("Corrupted (or uninitialized?) property list for window %p. Prop count %u. Atom %u.\n", Window, Window->PropListItems, Atom); return NULL; } Modified: trunk/reactos/win32ss/user/ntuser/shutdown.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/shutdo…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/shutdown.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/shutdown.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -64,10 +64,9 @@ } } ExFreePoolWithTag(List, USERTAG_WINDOWLIST); - } - - if (List && (lResult == MCSR_DONOTSHUTDOWN)) - return lResult; + if (lResult == MCSR_DONOTSHUTDOWN) + return lResult; + } /* Send to the caller */ if (wParam & MCS_QUERYENDSESSION) Modified: trunk/reactos/win32ss/user/ntuser/sysparams.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/syspar…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/sysparams.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/sysparams.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -570,14 +570,18 @@ if (fl & SPIF_UPDATEINIFILE) { /* Read current value */ - RegReadUserSetting(KEY_DESKTOP, - VAL_USERPREFMASK, - REG_BINARY, - &dwRegMask, - sizeof(DWORD)); + if (!RegReadUserSetting(KEY_DESKTOP, + VAL_USERPREFMASK, + REG_BINARY, + &dwRegMask, + sizeof(DWORD))) + { + WARN("Failed to read UserPreferencesMask setting\n"); + dwRegMask = 0; + } /* Set or clear bit according to bValue */ - dwRegMask = bValue ? dwRegMask | dwMask : dwRegMask & ~dwMask; + dwRegMask = bValue ? (dwRegMask | dwMask) : (dwRegMask & ~dwMask); /* write back value */ RegWriteUserSetting(KEY_DESKTOP, Modified: trunk/reactos/win32ss/user/ntuser/timer.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/timer.…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/timer.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/timer.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -571,7 +571,7 @@ IntKillTimer(PWND Window, UINT_PTR IDEvent, BOOL SystemTimer) { PTIMER pTmr = NULL; - TRACE("IntKillTimer Window %p id %p systemtimer %s\n", + TRACE("IntKillTimer Window %p id %uI systemtimer %s\n", Window, IDEvent, SystemTimer ? "TRUE" : "FALSE"); TimerEnterExclusive(); Modified: trunk/reactos/win32ss/user/ntuser/win32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/win32.…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/win32.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/win32.h [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -175,7 +175,7 @@ #define IntReferenceProcessInfo(ppi) \ InterlockedIncrement((volatile LONG*)(&(ppi)->RefCount)) -VOID UserDeleteW32Process(PPROCESSINFO); +VOID UserDeleteW32Process(_Pre_notnull_ __drv_freesMem(Mem) PPROCESSINFO); #define IntDereferenceProcessInfo(ppi) \ do { \ Modified: trunk/reactos/win32ss/user/ntuser/window.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/window…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/window.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/window.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -594,7 +594,7 @@ if (Window->PropListItems) { IntRemoveWindowProp(Window); - TRACE("Window->PropListItems %d\n",Window->PropListItems); + TRACE("Window->PropListItems %lu\n",Window->PropListItems); ASSERT(Window->PropListItems==0); } @@ -610,6 +610,7 @@ } /* dereference the class */ + NT_ASSERT(Window->head.pti != NULL); IntDereferenceClass(Window->pcls, Window->head.pti->pDeskInfo, Window->head.pti->ppi); @@ -1170,7 +1171,7 @@ { if ( Wnd->spwndParent != co_GetDesktopWindow(Wnd)) { - if (Wnd->head.pti != WndOldParent->head.pti) + if (WndOldParent && (Wnd->head.pti != WndOldParent->head.pti)) { //ERR("SetParent Old out.\n"); UserAttachThreadInput(Wnd->head.pti, WndOldParent->head.pti, FALSE); @@ -2483,10 +2484,7 @@ Cs.x = x; Cs.y = y; Cs.lpszName = (LPCWSTR) plstrWindowName->Buffer; - if (IS_ATOM(plstrClassName)) - Cs.lpszClass = (LPCWSTR) plstrClassName; - else - Cs.lpszClass = (LPCWSTR) plstrClassName->Buffer; + Cs.lpszClass = ustrClassName.Buffer; Cs.dwExStyle = dwExStyle; UserEnterExclusive(); @@ -3181,12 +3179,7 @@ } _SEH2_TRY { - if(pcbi) - { - ProbeForWrite(pcbi, - sizeof(COMBOBOXINFO), - 1); - } + ProbeForWrite(pcbi, sizeof(COMBOBOXINFO), 1); } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { Modified: trunk/reactos/win32ss/user/ntuser/winpos.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/winpos…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/winpos.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/winpos.c [iso-8859-1] Tue Mar 10 00:12:41 2015 @@ -372,7 +372,7 @@ done: if (WndTo) UserRefObjectCo(WndTo, &Ref); - if ((gpqForeground && !gpqForeground->spwndActive) || Wnd == gpqForeground->spwndActive) + if (gpqForeground && (!gpqForeground->spwndActive || Wnd == gpqForeground->spwndActive)) { /* ReactOS can pass WndTo = NULL to co_IntSetForegroundWindow and returns FALSE. */ //ERR("WinPosActivateOtherWindow Set FG 0x%p hWnd %p\n",WndTo, WndTo ? WndTo->head.h : 0); @@ -2218,7 +2218,8 @@ WasVisible = (Wnd->style & WS_VISIBLE) != 0; style = Wnd->style; - TRACE("co_WinPosShowWindow START hwnd %p Cmd %d usicmd %d\n",Wnd->head.h,Cmd,pti->ppi->usi.wShowWindow); + TRACE("co_WinPosShowWindow START hwnd %p Cmd %d usicmd %u\n", + Wnd->head.h, Cmd, pti->ppi->usi.wShowWindow); if ( pti->ppi->usi.dwFlags & STARTF_USESHOWWINDOW ) { @@ -2378,7 +2379,7 @@ if ((ShowFlag != WasVisible || Cmd == SW_SHOWNA) && Cmd != SW_SHOWMAXIMIZED && !(Swp & SWP_STATECHANGED)) { - co_IntSendMessageNoWait(Wnd->head.h, WM_SHOWWINDOW, ShowFlag, 0); + co_IntSendMessageNoWait(Wnd->head.h, WM_SHOWWINDOW, ShowFlag, 0); #if 0 // Fix wine msg test_SetParent:WmSetParentSeq_1:2 if (!(Wnd->state2 & WNDS2_WIN31COMPAT)) // <------------- XP sets this bit! co_IntSendMessageNoWait(Wnd->head.h, WM_SETVISIBLE, ShowFlag, 0); @@ -2517,7 +2518,7 @@ } /* not minimized and check if point is inside the window */ - if (!(ScopeWin->style & WS_MINIMIZE) && + if (!(ScopeWin->style & WS_MINIMIZE) && RECTL_bPointInRect(&ScopeWin->rcClient, Point->x, Point->y) ) { UserReferenceObject(ScopeWin); 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 Mar 10 00:12:41 2015 @@ -669,7 +669,7 @@ DWORD nLength, PDWORD nLengthNeeded) { - PWINSTATION_OBJECT WinStaObject = NULL; + PWINSTATION_OBJECT WinStaObject; PDESKTOP DesktopObject = NULL; NTSTATUS Status; PVOID pvData = NULL; @@ -702,6 +702,7 @@ { /* try desktop */ TRACE("Trying to open desktop %p\n", hObject); + WinStaObject = NULL; Status = IntValidateDesktopHandle( hObject, UserMode, @@ -934,7 +935,7 @@ ppi->prpwinsta = NewWinSta; ppi->hwinsta = hWindowStation; ppi->amwinsta = hWindowStation != NULL ? ObjectHandleInfo.GrantedAccess : 0; - TRACE("WS : Granted Access %p\n",ppi->amwinsta); + TRACE("WS : Granted Access 0x%08lx\n",ppi->amwinsta); if (RtlAreAllAccessesGranted(ppi->amwinsta, WINSTA_READSCREEN)) { @@ -1133,10 +1134,11 @@ /* Need a larger buffer, check how large exactly */ Status = ZwQueryDirectoryObject(DirectoryHandle, NULL, 0, FALSE, TRUE, &Context, &ReturnLength); - if (STATUS_BUFFER_TOO_SMALL == Status) + if (!NT_SUCCESS(Status)) { + ERR("ZwQueryDirectoryObject failed\n"); ObDereferenceObject(DirectoryHandle); - return STATUS_NO_MEMORY; + return Status; } BufferSize = ReturnLength;
9 years, 9 months
1
0
0
0
[tkreuzer] 66645: [WIN32K] Apply proper formatting to polyfill.c
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Mar 10 00:11:43 2015 New Revision: 66645 URL:
http://svn.reactos.org/svn/reactos?rev=66645&view=rev
Log: [WIN32K] Apply proper formatting to polyfill.c Modified: trunk/reactos/win32ss/gdi/ntgdi/polyfill.c Modified: trunk/reactos/win32ss/gdi/ntgdi/polyfill.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/polyfill…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/polyfill.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/polyfill.c [iso-8859-1] Tue Mar 10 00:11:43 2015 @@ -18,31 +18,31 @@ */ typedef struct _tagFILL_EDGE { - /* Basic line information */ - int FromX; - int FromY; - int ToX; - int ToY; - int dx; - int dy; - int absdx, absdy; - int x, y; - int xmajor; - - /* Active Edge List information */ - int XIntercept[2]; - int Error; - int ErrorMax; - int XDirection, YDirection; - - /* The next edge in the active Edge List */ - struct _tagFILL_EDGE * pNext; + /* Basic line information */ + int FromX; + int FromY; + int ToX; + int ToY; + int dx; + int dy; + int absdx, absdy; + int x, y; + int xmajor; + + /* Active Edge List information */ + int XIntercept[2]; + int Error; + int ErrorMax; + int XDirection, YDirection; + + /* The next edge in the active Edge List */ + struct _tagFILL_EDGE * pNext; } FILL_EDGE; typedef struct _FILL_EDGE_LIST { - int Count; - FILL_EDGE** Edges; + int Count; + FILL_EDGE** Edges; } FILL_EDGE_LIST; #if 0 @@ -50,19 +50,19 @@ void DEBUG_PRINT_ACTIVE_EDGELIST ( FILL_EDGE* list ) { - FILL_EDGE* pThis = list; - if (0 == list) - { - DPRINT1("List is NULL\n"); - return; - } - - while(0 != pThis) - { - //DPRINT1("EDGE: (%d, %d) to (%d, %d)\n", pThis->FromX, pThis->FromY, pThis->ToX, pThis->ToY); - DPRINT1("EDGE: [%d,%d]\n", pThis->XIntercept[0], pThis->XIntercept[1] ); - pThis = pThis->pNext; - } + FILL_EDGE* pThis = list; + if (0 == list) + { + DPRINT1("List is NULL\n"); + return; + } + + while(0 != pThis) + { + //DPRINT1("EDGE: (%d, %d) to (%d, %d)\n", pThis->FromX, pThis->FromY, pThis->ToX, pThis->ToY); + DPRINT1("EDGE: [%d,%d]\n", pThis->XIntercept[0], pThis->XIntercept[1] ); + pThis = pThis->pNext; + } } #else #define DEBUG_PRINT_ACTIVE_EDGELIST(x) @@ -76,20 +76,23 @@ FASTCALL POLYGONFILL_DestroyEdgeList(FILL_EDGE_LIST* list) { - int i; - if ( list ) - { - if ( list->Edges ) - { - for ( i = 0; i < list->Count; i++ ) - { - if ( list->Edges[i] ) - EngFreeMem ( list->Edges[i] ); - } - EngFreeMem ( list->Edges ); - } - EngFreeMem ( list ); - } + int i; + + if (list) + { + if (list->Edges) + { + for (i = 0; i < list->Count; i++) + { + if (list->Edges[i]) + EngFreeMem(list->Edges[i]); + } + + EngFreeMem(list->Edges); + } + + EngFreeMem(list); + } } /* @@ -100,57 +103,57 @@ FASTCALL POLYGONFILL_MakeEdge(POINT From, POINT To) { - FILL_EDGE* rc = (FILL_EDGE*)EngAllocMem(FL_ZERO_MEMORY, sizeof(FILL_EDGE), FILL_EDGE_ALLOC_TAG); - - if (0 == rc) - return NULL; - - //DPRINT1("Making Edge: (%d, %d) to (%d, %d)\n", From.x, From.y, To.x, To.y); - // Now fill the struct. - if ( To.y < From.y ) - { - rc->FromX = To.x; - rc->FromY = To.y; - rc->ToX = From.x; - rc->ToY = From.y; - rc->YDirection = -1; - - // Lines that go up get walked backwards, so need to be offset - // by -1 in order to make the walk identically on a pixel-level - rc->Error = -1; - } - else - { - rc->FromX = From.x; - rc->FromY = From.y; - rc->ToX = To.x; - rc->ToY = To.y; - rc->YDirection = 1; - - rc->Error = 0; - } - - rc->x = rc->FromX; - rc->y = rc->FromY; - rc->dx = rc->ToX - rc->FromX; - rc->dy = rc->ToY - rc->FromY; - rc->absdx = abs(rc->dx); - rc->absdy = abs(rc->dy); - - rc->xmajor = rc->absdx > rc->absdy; - - rc->ErrorMax = max(rc->absdx,rc->absdy); - - rc->Error += rc->ErrorMax / 2; - - rc->XDirection = (rc->dx < 0)?(-1):(1); - - rc->pNext = 0; - - //DPRINT("MakeEdge (%i,%i)->(%i,%i) d=(%i,%i) dir=(%i,%i) err=%i max=%i\n", - // From.x, From.y, To.x, To.y, rc->dx, rc->dy, rc->XDirection, rc->YDirection, rc->Error, rc->ErrorMax ); - - return rc; + FILL_EDGE* rc = (FILL_EDGE*)EngAllocMem(FL_ZERO_MEMORY, sizeof(FILL_EDGE), FILL_EDGE_ALLOC_TAG); + + if (0 == rc) + return NULL; + + //DPRINT1("Making Edge: (%d, %d) to (%d, %d)\n", From.x, From.y, To.x, To.y); + // Now fill the struct. + if ( To.y < From.y ) + { + rc->FromX = To.x; + rc->FromY = To.y; + rc->ToX = From.x; + rc->ToY = From.y; + rc->YDirection = -1; + + // Lines that go up get walked backwards, so need to be offset + // by -1 in order to make the walk identically on a pixel-level + rc->Error = -1; + } + else + { + rc->FromX = From.x; + rc->FromY = From.y; + rc->ToX = To.x; + rc->ToY = To.y; + rc->YDirection = 1; + + rc->Error = 0; + } + + rc->x = rc->FromX; + rc->y = rc->FromY; + rc->dx = rc->ToX - rc->FromX; + rc->dy = rc->ToY - rc->FromY; + rc->absdx = abs(rc->dx); + rc->absdy = abs(rc->dy); + + rc->xmajor = rc->absdx > rc->absdy; + + rc->ErrorMax = max(rc->absdx,rc->absdy); + + rc->Error += rc->ErrorMax / 2; + + rc->XDirection = (rc->dx < 0)?(-1):(1); + + rc->pNext = 0; + + //DPRINT("MakeEdge (%i,%i)->(%i,%i) d=(%i,%i) dir=(%i,%i) err=%i max=%i\n", + // From.x, From.y, To.x, To.y, rc->dx, rc->dy, rc->XDirection, rc->YDirection, rc->Error, rc->ErrorMax ); + + return rc; } /* ** My Edge comparison routine. @@ -171,10 +174,10 @@ FASTCALL FILL_EDGE_Compare(FILL_EDGE* Edge1, FILL_EDGE* Edge2) { - int e1 = Edge1->XIntercept[0] + Edge1->XIntercept[1]; - int e2 = Edge2->XIntercept[0] + Edge2->XIntercept[1]; - - return e1 - e2; + int e1 = Edge1->XIntercept[0] + Edge1->XIntercept[1]; + int e2 = Edge2->XIntercept[0] + Edge2->XIntercept[1]; + + return e1 - e2; } @@ -186,39 +189,41 @@ FASTCALL POLYGONFILL_ActiveListInsert(FILL_EDGE** activehead, FILL_EDGE* NewEdge ) { - FILL_EDGE *pPrev, *pThis; - //DPRINT1("In POLYGONFILL_ActiveListInsert()\n"); - ASSERT ( activehead && NewEdge ); - if ( !*activehead ) - { - NewEdge->pNext = NULL; - *activehead = NewEdge; - return; - } - /* - ** First lets check to see if we have a new smallest value. - */ - if (FILL_EDGE_Compare(NewEdge, *activehead) <= 0) - { - NewEdge->pNext = *activehead; - *activehead = NewEdge; - return; - } - /* - ** Ok, now scan to the next spot to put this item. - */ - pThis = *activehead; - pPrev = NULL; - while ( pThis && FILL_EDGE_Compare(pThis, NewEdge) < 0 ) - { - pPrev = pThis; - pThis = pThis->pNext; - } - - ASSERT(pPrev); - NewEdge->pNext = pPrev->pNext; - pPrev->pNext = NewEdge; - //DEBUG_PRINT_ACTIVE_EDGELIST(*activehead); + FILL_EDGE *pPrev, *pThis; + //DPRINT1("In POLYGONFILL_ActiveListInsert()\n"); + ASSERT(activehead && NewEdge); + + if (!*activehead) + { + NewEdge->pNext = NULL; + *activehead = NewEdge; + return; + } + /* + ** First lets check to see if we have a new smallest value. + */ + if (FILL_EDGE_Compare(NewEdge, *activehead) <= 0) + { + NewEdge->pNext = *activehead; + *activehead = NewEdge; + return; + } + + /* + ** Ok, now scan to the next spot to put this item. + */ + pThis = *activehead; + pPrev = NULL; + while ( pThis && FILL_EDGE_Compare(pThis, NewEdge) < 0 ) + { + pPrev = pThis; + pThis = pThis->pNext; + } + + ASSERT(pPrev); + NewEdge->pNext = pPrev->pNext; + pPrev->pNext = NewEdge; + //DEBUG_PRINT_ACTIVE_EDGELIST(*activehead); } /* @@ -229,50 +234,50 @@ FASTCALL POLYGONFILL_MakeEdgeList(PPOINT Points, int Count) { - int CurPt = 0; - FILL_EDGE_LIST* list = 0; - FILL_EDGE* e = 0; - - if ( 0 == Points || 2 > Count ) + int CurPt = 0; + FILL_EDGE_LIST* list = 0; + FILL_EDGE* e = 0; + + if (0 == Points || 2 > Count) + return 0; + + list = (FILL_EDGE_LIST*)EngAllocMem(FL_ZERO_MEMORY, sizeof(FILL_EDGE_LIST), FILL_EDGE_ALLOC_TAG); + if ( 0 == list ) + goto fail; + list->Count = 0; + list->Edges = (FILL_EDGE**)EngAllocMem(FL_ZERO_MEMORY, Count*sizeof(FILL_EDGE*), FILL_EDGE_ALLOC_TAG); + if ( !list->Edges ) + goto fail; + + memset(list->Edges, 0, Count * sizeof(FILL_EDGE*)); + + for (CurPt = 1; CurPt < Count; ++CurPt) + { + e = POLYGONFILL_MakeEdge ( Points[CurPt-1], Points[CurPt] ); + if (!e) + goto fail; + + // If a straight horizontal line - who cares? + if (!e->absdy) + EngFreeMem(e); + else + list->Edges[list->Count++] = e; + } + e = POLYGONFILL_MakeEdge ( Points[CurPt-1], Points[0] ); + if ( !e ) + goto fail; + + if (!e->absdy) + EngFreeMem(e); + else + list->Edges[list->Count++] = e; + return list; + +fail: + + DPRINT1("Out Of MEMORY!!\n"); + POLYGONFILL_DestroyEdgeList ( list ); return 0; - - list = (FILL_EDGE_LIST*)EngAllocMem(FL_ZERO_MEMORY, sizeof(FILL_EDGE_LIST), FILL_EDGE_ALLOC_TAG); - if ( 0 == list ) - goto fail; - list->Count = 0; - list->Edges = (FILL_EDGE**)EngAllocMem(FL_ZERO_MEMORY, Count*sizeof(FILL_EDGE*), FILL_EDGE_ALLOC_TAG); - if ( !list->Edges ) - goto fail; - - memset ( list->Edges, 0, Count * sizeof(FILL_EDGE*) ); - - for ( CurPt = 1; CurPt < Count; ++CurPt ) - { - e = POLYGONFILL_MakeEdge ( Points[CurPt-1], Points[CurPt] ); - if ( !e ) - goto fail; - - // If a straight horizontal line - who cares? - if ( !e->absdy ) - EngFreeMem ( e ); - else - list->Edges[list->Count++] = e; - } - e = POLYGONFILL_MakeEdge ( Points[CurPt-1], Points[0] ); - if ( !e ) - goto fail; - - if ( !e->absdy ) - EngFreeMem ( e ); - else - list->Edges[list->Count++] = e; - return list; - -fail: - - DPRINT1("Out Of MEMORY!!\n"); - POLYGONFILL_DestroyEdgeList ( list ); - return 0; } @@ -287,63 +292,63 @@ FASTCALL POLYGONFILL_UpdateScanline(FILL_EDGE* pEdge, int Scanline) { - if ( 0 == pEdge->dy ) - return; - - ASSERT ( pEdge->FromY <= Scanline && pEdge->ToY > Scanline ); - - if ( pEdge->xmajor ) - { - int steps; - - ASSERT ( pEdge->y == Scanline ); - - // Now shoot to end of scanline collision - steps = (pEdge->ErrorMax-pEdge->Error-1)/pEdge->absdy; - if ( steps ) - { - // Record first collision with scanline - int x1 = pEdge->x; - pEdge->x += steps * pEdge->XDirection; - pEdge->Error += steps * pEdge->absdy; - ASSERT ( pEdge->Error < pEdge->ErrorMax ); - pEdge->XIntercept[0] = min(x1,pEdge->x); - pEdge->XIntercept[1] = max(x1,pEdge->x); - } - else - { - pEdge->XIntercept[0] = pEdge->x; - pEdge->XIntercept[1] = pEdge->x; - } - - // We should require exactly 1 step to step onto next scanline... - ASSERT ( (pEdge->ErrorMax-pEdge->Error-1) / pEdge->absdy == 0 ); - pEdge->x += pEdge->XDirection; - pEdge->Error += pEdge->absdy; - ASSERT ( pEdge->Error >= pEdge->ErrorMax ); - - // Now step onto next scanline... - pEdge->Error -= pEdge->absdx; - pEdge->y++; - } - else // Then this is a y-major line - { - pEdge->XIntercept[0] = pEdge->x; - pEdge->XIntercept[1] = pEdge->x; - - pEdge->Error += pEdge->absdx; - pEdge->y++; - - if ( pEdge->Error >= pEdge->ErrorMax ) - { - pEdge->Error -= pEdge->ErrorMax; - pEdge->x += pEdge->XDirection; - ASSERT ( pEdge->Error < pEdge->ErrorMax ); - } - } - - //DPRINT("Line (%d, %d) to (%d, %d) intersects scanline %d at (%d,%d)\n", - // pEdge->FromX, pEdge->FromY, pEdge->ToX, pEdge->ToY, Scanline, pEdge->XIntercept[0], pEdge->XIntercept[1] ); + if (0 == pEdge->dy) + return; + + ASSERT(pEdge->FromY <= Scanline && pEdge->ToY > Scanline); + + if (pEdge->xmajor) + { + int steps; + + ASSERT(pEdge->y == Scanline); + + // Now shoot to end of scanline collision + steps = (pEdge->ErrorMax-pEdge->Error-1)/pEdge->absdy; + if (steps) + { + // Record first collision with scanline + int x1 = pEdge->x; + pEdge->x += steps * pEdge->XDirection; + pEdge->Error += steps * pEdge->absdy; + ASSERT ( pEdge->Error < pEdge->ErrorMax ); + pEdge->XIntercept[0] = min(x1,pEdge->x); + pEdge->XIntercept[1] = max(x1,pEdge->x); + } + else + { + pEdge->XIntercept[0] = pEdge->x; + pEdge->XIntercept[1] = pEdge->x; + } + + // We should require exactly 1 step to step onto next scanline... + ASSERT((pEdge->ErrorMax-pEdge->Error-1) / pEdge->absdy == 0); + pEdge->x += pEdge->XDirection; + pEdge->Error += pEdge->absdy; + ASSERT(pEdge->Error >= pEdge->ErrorMax); + + // Now step onto next scanline... + pEdge->Error -= pEdge->absdx; + pEdge->y++; + } + else // Then this is a y-major line + { + pEdge->XIntercept[0] = pEdge->x; + pEdge->XIntercept[1] = pEdge->x; + + pEdge->Error += pEdge->absdx; + pEdge->y++; + + if (pEdge->Error >= pEdge->ErrorMax) + { + pEdge->Error -= pEdge->ErrorMax; + pEdge->x += pEdge->XDirection; + ASSERT ( pEdge->Error < pEdge->ErrorMax ); + } + } + + //DPRINT("Line (%d, %d) to (%d, %d) intersects scanline %d at (%d,%d)\n", + // pEdge->FromX, pEdge->FromY, pEdge->ToX, pEdge->ToY, Scanline, pEdge->XIntercept[0], pEdge->XIntercept[1] ); } /* @@ -352,22 +357,25 @@ static void APIENTRY -POLYGONFILL_BuildActiveList ( int Scanline, FILL_EDGE_LIST* list, FILL_EDGE** ActiveHead ) -{ - int i; - - ASSERT ( list && ActiveHead ); - *ActiveHead = 0; - for ( i = 0; i < list->Count; i++ ) - { - FILL_EDGE* pEdge = list->Edges[i]; - ASSERT(pEdge); - if ( pEdge->FromY <= Scanline && pEdge->ToY > Scanline ) - { - POLYGONFILL_UpdateScanline ( pEdge, Scanline ); - POLYGONFILL_ActiveListInsert ( ActiveHead, pEdge ); - } - } +POLYGONFILL_BuildActiveList( + int Scanline, + FILL_EDGE_LIST* list, + FILL_EDGE** ActiveHead) +{ + int i; + + ASSERT(list && ActiveHead); + *ActiveHead = 0; + for (i = 0; i < list->Count; i++) + { + FILL_EDGE* pEdge = list->Edges[i]; + ASSERT(pEdge); + if (pEdge->FromY <= Scanline && pEdge->ToY > Scanline) + { + POLYGONFILL_UpdateScanline(pEdge, Scanline); + POLYGONFILL_ActiveListInsert(ActiveHead, pEdge); + } + } } /* @@ -378,202 +386,203 @@ void APIENTRY POLYGONFILL_FillScanLineAlternate( - PDC dc, - int ScanLine, - FILL_EDGE* ActiveHead, - SURFACE *psurf, - BRUSHOBJ *BrushObj, - MIX RopMode ) -{ - FILL_EDGE *pLeft, *pRight; - - if ( !ActiveHead ) - return; - - pLeft = ActiveHead; - pRight = pLeft->pNext; - ASSERT(pRight); - - while ( NULL != pRight ) - { - int x1 = pLeft->XIntercept[0]; - int x2 = pRight->XIntercept[1]; - if ( x2 > x1 ) - { - RECTL BoundRect; - BoundRect.top = ScanLine; - BoundRect.bottom = ScanLine + 1; - BoundRect.left = x1; - BoundRect.right = x2; - - //DPRINT("Fill Line (%d, %d) to (%d, %d)\n",x1, ScanLine, x2, ScanLine); - IntEngLineTo(&psurf->SurfObj, - &dc->co.ClipObj, - BrushObj, - x1, - ScanLine, - x2, - ScanLine, - &BoundRect, // Bounding rectangle - RopMode); // MIX - } - pLeft = pRight->pNext; - pRight = pLeft ? pLeft->pNext : NULL; - } -} - -static -void -APIENTRY -POLYGONFILL_FillScanLineWinding( - PDC dc, - int ScanLine, - FILL_EDGE* ActiveHead, - SURFACE *psurf, - BRUSHOBJ *BrushObj, - MIX RopMode ) -{ - FILL_EDGE *pLeft, *pRight; - int x1, x2, winding = 0; - RECTL BoundRect; - - if ( !ActiveHead ) - return; - - BoundRect.top = ScanLine; - BoundRect.bottom = ScanLine + 1; - - pLeft = ActiveHead; - winding = pLeft->YDirection; - pRight = pLeft->pNext; - ASSERT(pRight); - - // Setup first line... - x1 = pLeft->XIntercept[0]; - x2 = pRight->XIntercept[1]; - - pLeft = pRight; - pRight = pLeft->pNext; - winding += pLeft->YDirection; - - while ( NULL != pRight ) - { - int newx1 = pLeft->XIntercept[0]; - int newx2 = pRight->XIntercept[1]; - if ( winding ) - { - // Check and see if this new line touches the previous... - if ( (newx1 >= x1 && newx1 <= x2) - || (newx2 >= x1 && newx2 <= x2) - || (x1 >= newx1 && x1 <= newx2) - || (x2 >= newx2 && x2 <= newx2) - ) - { - // Yup, just tack it on to our existing line - x1 = min(x1,newx1); - x2 = max(x2,newx2); - } - else - { - // Nope - render the old line.. - BoundRect.left = x1; - BoundRect.right = x2; - - //DPRINT("Fill Line (%d, %d) to (%d, %d)\n",x1, ScanLine, x2, ScanLine); - IntEngLineTo(&psurf->SurfObj, - &dc->co.ClipObj, - BrushObj, - x1, - ScanLine, - x2, - ScanLine, - &BoundRect, // Bounding rectangle - RopMode); // MIX - - x1 = newx1; - x2 = newx2; - } - } - pLeft = pRight; - pRight = pLeft->pNext; - winding += pLeft->YDirection; - } - // There will always be a line left-over, render it now... - BoundRect.left = x1; - BoundRect.right = x2; - - //DPRINT("Fill Line (%d, %d) to (%d, %d)\n",x1, ScanLine, x2, ScanLine); - IntEngLineTo(&psurf->SurfObj, - &dc->co.ClipObj, - BrushObj, - x1, - ScanLine, - x2, - ScanLine, - &BoundRect, // Bounding rectangle - RopMode); // MIX -} - -// When the fill mode is ALTERNATE, GDI fills the area between odd-numbered and -// even-numbered polygon sides on each scan line. That is, GDI fills the area between the -// first and second side, between the third and fourth side, and so on. - -// WINDING Selects winding mode (fills any region with a nonzero winding value). -// When the fill mode is WINDING, GDI fills any region that has a nonzero winding value. -// This value is defined as the number of times a pen used to draw the polygon would go around the region. -// The direction of each edge of the polygon is important. - -BOOL -APIENTRY -FillPolygon( - PDC dc, - SURFACE *psurf, - BRUSHOBJ *BrushObj, - MIX RopMode, - CONST PPOINT Points, - int Count, - RECTL BoundRect ) -{ - FILL_EDGE_LIST *list = 0; - FILL_EDGE *ActiveHead = 0; - int ScanLine; - PDC_ATTR pdcattr = dc->pdcattr; - void - (APIENTRY *FillScanLine)( PDC dc, int ScanLine, FILL_EDGE* ActiveHead, SURFACE *psurf, BRUSHOBJ *BrushObj, - MIX RopMode ); - - //DPRINT("FillPolygon\n"); - - /* Create Edge List. */ - list = POLYGONFILL_MakeEdgeList(Points, Count); - /* DEBUG_PRINT_EDGELIST(list); */ - if (NULL == list) - return FALSE; - - if ( WINDING == pdcattr->jFillMode ) - FillScanLine = POLYGONFILL_FillScanLineWinding; - else /* Default */ - FillScanLine = POLYGONFILL_FillScanLineAlternate; - - /* For each Scanline from BoundRect.bottom to BoundRect.top, - * determine line segments to draw - */ - for ( ScanLine = BoundRect.top; ScanLine < BoundRect.bottom; ++ScanLine ) - { - POLYGONFILL_BuildActiveList(ScanLine, list, &ActiveHead); - //DEBUG_PRINT_ACTIVE_EDGELIST(ActiveHead); - FillScanLine ( dc, ScanLine, ActiveHead, psurf, BrushObj, RopMode ); - } - - /* Free Edge List. If any are left. */ - POLYGONFILL_DestroyEdgeList(list); - - return TRUE; + MIX RopMode ) +{ + FILL_EDGE *pLeft, *pRight; + + if (!ActiveHead) + return; + + pLeft = ActiveHead; + pRight = pLeft->pNext; + ASSERT(pRight); + + while (NULL != pRight) + { + int x1 = pLeft->XIntercept[0]; + int x2 = pRight->XIntercept[1]; + if (x2 > x1) + { + RECTL BoundRect; + BoundRect.top = ScanLine; + BoundRect.bottom = ScanLine + 1; + BoundRect.left = x1; + BoundRect.right = x2; + + //DPRINT("Fill Line (%d, %d) to (%d, %d)\n",x1, ScanLine, x2, ScanLine); + IntEngLineTo(&psurf->SurfObj, + &dc->co.ClipObj, + BrushObj, + x1, + ScanLine, + x2, + ScanLine, + &BoundRect, // Bounding rectangle + RopMode); // MIX + } + pLeft = pRight->pNext; + pRight = pLeft ? pLeft->pNext : NULL; + } +} + +static +void +APIENTRY +POLYGONFILL_FillScanLineWinding( + PDC dc, + int ScanLine, + FILL_EDGE* ActiveHead, + SURFACE *psurf, + BRUSHOBJ *BrushObj, + MIX RopMode ) +{ + FILL_EDGE *pLeft, *pRight; + int x1, x2, winding = 0; + RECTL BoundRect; + + if (!ActiveHead) + return; + + BoundRect.top = ScanLine; + BoundRect.bottom = ScanLine + 1; + + pLeft = ActiveHead; + winding = pLeft->YDirection; + pRight = pLeft->pNext; + ASSERT(pRight); + + // Setup first line... + x1 = pLeft->XIntercept[0]; + x2 = pRight->XIntercept[1]; + + pLeft = pRight; + pRight = pLeft->pNext; + winding += pLeft->YDirection; + + while ( NULL != pRight ) + { + int newx1 = pLeft->XIntercept[0]; + int newx2 = pRight->XIntercept[1]; + if ( winding ) + { + // Check and see if this new line touches the previous... + if ((newx1 >= x1 && newx1 <= x2) || + (newx2 >= x1 && newx2 <= x2) || + (x1 >= newx1 && x1 <= newx2) || + (x2 >= newx2 && x2 <= newx2)) + { + // Yup, just tack it on to our existing line + x1 = min(x1,newx1); + x2 = max(x2,newx2); + } + else + { + // Nope - render the old line.. + BoundRect.left = x1; + BoundRect.right = x2; + + //DPRINT("Fill Line (%d, %d) to (%d, %d)\n",x1, ScanLine, x2, ScanLine); + IntEngLineTo(&psurf->SurfObj, + &dc->co.ClipObj, + BrushObj, + x1, + ScanLine, + x2, + ScanLine, + &BoundRect, // Bounding rectangle + RopMode); // MIX + + x1 = newx1; + x2 = newx2; + } + } + + pLeft = pRight; + pRight = pLeft->pNext; + winding += pLeft->YDirection; + } + + // There will always be a line left-over, render it now... + BoundRect.left = x1; + BoundRect.right = x2; + + //DPRINT("Fill Line (%d, %d) to (%d, %d)\n",x1, ScanLine, x2, ScanLine); + IntEngLineTo(&psurf->SurfObj, + &dc->co.ClipObj, + BrushObj, + x1, + ScanLine, + x2, + ScanLine, + &BoundRect, // Bounding rectangle + RopMode); // MIX +} + +// When the fill mode is ALTERNATE, GDI fills the area between odd-numbered and +// even-numbered polygon sides on each scan line. That is, GDI fills the area between the +// first and second side, between the third and fourth side, and so on. + +// WINDING Selects winding mode (fills any region with a nonzero winding value). +// When the fill mode is WINDING, GDI fills any region that has a nonzero winding value. +// This value is defined as the number of times a pen used to draw the polygon would go around the region. +// The direction of each edge of the polygon is important. + +BOOL +APIENTRY +FillPolygon( + PDC dc, + SURFACE *psurf, + BRUSHOBJ *BrushObj, + MIX RopMode, + CONST PPOINT Points, + int Count, + RECTL BoundRect ) +{ + FILL_EDGE_LIST *list = 0; + FILL_EDGE *ActiveHead = 0; + int ScanLine; + PDC_ATTR pdcattr = dc->pdcattr; + void + (APIENTRY *FillScanLine)( + PDC dc, + int ScanLine, + FILL_EDGE* ActiveHead, + SURFACE *psurf, + BRUSHOBJ *BrushObj, + MIX RopMode); + + //DPRINT("FillPolygon\n"); + + /* Create Edge List. */ + list = POLYGONFILL_MakeEdgeList(Points, Count); + /* DEBUG_PRINT_EDGELIST(list); */ + if (NULL == list) + return FALSE; + + if (WINDING == pdcattr->jFillMode) + FillScanLine = POLYGONFILL_FillScanLineWinding; + else /* Default */ + FillScanLine = POLYGONFILL_FillScanLineAlternate; + + /* For each Scanline from BoundRect.bottom to BoundRect.top, + * determine line segments to draw + */ + for (ScanLine = BoundRect.top; ScanLine < BoundRect.bottom; ++ScanLine) + { + POLYGONFILL_BuildActiveList(ScanLine, list, &ActiveHead); + //DEBUG_PRINT_ACTIVE_EDGELIST(ActiveHead); + FillScanLine(dc, ScanLine, ActiveHead, psurf, BrushObj, RopMode); + } + + /* Free Edge List. If any are left. */ + POLYGONFILL_DestroyEdgeList(list); + + return TRUE; } BOOL FASTCALL @@ -600,23 +609,24 @@ return FALSE; /* For each Scanline from DestRect.top to DestRect.bottom, determine line segments to draw */ - for ( ScanLine = DestRect.top; ScanLine < DestRect.bottom; ++ScanLine ) + for (ScanLine = DestRect.top; ScanLine < DestRect.bottom; ++ScanLine) { POLYGONFILL_BuildActiveList(ScanLine, list, &ActiveHead); //DEBUG_PRINT_ACTIVE_EDGELIST(ActiveHead); - if ( !ActiveHead ) - return FALSE; + if (!ActiveHead) + return FALSE; pLeft = ActiveHead; pRight = pLeft->pNext; ASSERT(pRight); - while ( NULL != pRight ) + while (NULL != pRight) { int x1 = pLeft->XIntercept[0]; int x2 = pRight->XIntercept[1]; - if ( x2 > x1 ) + + if (x2 > x1) { RECTL LineRect; LineRect.top = ScanLine; @@ -625,17 +635,18 @@ LineRect.right = x2; IntEngBitBlt(&psurf->SurfObj, - NULL, - NULL, - &dc->co.ClipObj, - NULL, - &LineRect, - NULL, - NULL, - BrushObj, - BrushOrigin, - ROP4_FROM_INDEX(R3_OPINDEX_PATCOPY)); + NULL, + NULL, + &dc->co.ClipObj, + NULL, + &LineRect, + NULL, + NULL, + BrushObj, + BrushOrigin, + ROP4_FROM_INDEX(R3_OPINDEX_PATCOPY)); } + pLeft = pRight->pNext; pRight = pLeft ? pLeft->pNext : NULL; }
9 years, 9 months
1
0
0
0
[tkreuzer] 66644: [WIN32K] Annotate a number of GDI functions to match public header declarations.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Mar 10 00:11:29 2015 New Revision: 66644 URL:
http://svn.reactos.org/svn/reactos?rev=66644&view=rev
Log: [WIN32K] Annotate a number of GDI functions to match public header declarations. Modified: trunk/reactos/win32ss/gdi/eng/clip.c trunk/reactos/win32ss/gdi/eng/eng.h trunk/reactos/win32ss/gdi/eng/float.c trunk/reactos/win32ss/gdi/eng/inteng.h trunk/reactos/win32ss/gdi/eng/ldevobj.h trunk/reactos/win32ss/gdi/eng/mapping.c trunk/reactos/win32ss/gdi/eng/semaphor.c trunk/reactos/win32ss/gdi/eng/stubs.c trunk/reactos/win32ss/gdi/eng/umpdstubs.c trunk/reactos/win32ss/gdi/ntgdi/arc.c trunk/reactos/win32ss/gdi/ntgdi/bezier.c trunk/reactos/win32ss/gdi/ntgdi/bitblt.c trunk/reactos/win32ss/gdi/ntgdi/brush.c trunk/reactos/win32ss/gdi/ntgdi/cliprgn.c trunk/reactos/win32ss/gdi/ntgdi/cliprgn.h trunk/reactos/win32ss/gdi/ntgdi/coord.c trunk/reactos/win32ss/gdi/ntgdi/dclife.c trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c trunk/reactos/win32ss/gdi/ntgdi/dcstate.c trunk/reactos/win32ss/gdi/ntgdi/dibobj.c trunk/reactos/win32ss/gdi/ntgdi/fillshap.c trunk/reactos/win32ss/gdi/ntgdi/freetype.c trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c trunk/reactos/win32ss/gdi/ntgdi/region.c trunk/reactos/win32ss/gdi/ntgdi/region.h trunk/reactos/win32ss/gdi/ntgdi/wingl.c Modified: trunk/reactos/win32ss/gdi/eng/clip.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/clip.c?rev…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/clip.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/clip.c [iso-8859-1] Tue Mar 10 00:11:29 2015 @@ -241,10 +241,10 @@ EngDeleteClip( _In_ _Post_ptr_invalid_ CLIPOBJ *pco) { - XCLIPOBJ* Clip = CONTAINING_RECORD(pco, XCLIPOBJ, ClipObj); - TRACE("Deleting %p.\n"); - IntEngFreeClipResources(Clip); - EngFreeMem(Clip); + XCLIPOBJ* pxco = CONTAINING_RECORD(pco, XCLIPOBJ, ClipObj); + TRACE("Deleting %p.\n", pco); + IntEngFreeClipResources(pxco); + EngFreeMem(pxco); } /* Modified: trunk/reactos/win32ss/gdi/eng/eng.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/eng.h?rev=…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/eng.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/eng.h [iso-8859-1] Tue Mar 10 00:11:29 2015 @@ -11,16 +11,18 @@ EngAcquireSemaphoreShared( IN HSEMAPHORE hsem); -BOOL APIENTRY -IntEngMaskBlt(SURFOBJ *psoDest, - SURFOBJ *psoMask, - CLIPOBJ *ClipRegion, - XLATEOBJ *DestColorTranslation, - XLATEOBJ *SourceColorTranslation, - RECTL *DestRect, - POINTL *pptlMask, - BRUSHOBJ *pbo, - POINTL *BrushOrigin); +BOOL +APIENTRY +IntEngMaskBlt( + _Inout_ SURFOBJ *psoDest, + _In_ SURFOBJ *psoMask, + _In_ CLIPOBJ *pco, + _In_ XLATEOBJ *pxloDest, + _In_ XLATEOBJ *pxloSource, + _In_ RECTL *prclDest, + _In_ POINTL *pptlMask, + _In_ BRUSHOBJ *pbo, + _In_ POINTL *pptlBrushOrg); VOID FASTCALL IntEngWindowChanged( Modified: trunk/reactos/win32ss/gdi/eng/float.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/float.c?re…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/float.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/float.c [iso-8859-1] Tue Mar 10 00:11:29 2015 @@ -15,14 +15,20 @@ /* FUNCTIONS *****************************************************************/ +_Check_return_ +_Success_(return) +_Kernel_float_restored_ +_At_(*pBuffer, _Kernel_requires_resource_held_(EngFloatState) + _Kernel_releases_resource_(EngFloatState)) +ENGAPI BOOL APIENTRY EngRestoreFloatingPointState( - PVOID Buffer) + _In_reads_(_Inexpressible_(statesize)) PVOID pBuffer) { NTSTATUS Status; - Status = KeRestoreFloatingPointState((PKFLOATING_SAVE)Buffer); + Status = KeRestoreFloatingPointState((PKFLOATING_SAVE)pBuffer); if (!NT_SUCCESS(Status)) { return FALSE; @@ -31,16 +37,24 @@ return TRUE; } +_Check_return_ +_Success_(((pBuffer != NULL && cjBufferSize != 0) && return == 1) || + ((pBuffer == NULL || cjBufferSize == 0) && return > 0)) +_When_(pBuffer != NULL && cjBufferSize != 0 && return == 1, _Kernel_float_saved_ + _At_(*pBuffer, _Post_valid_ _Kernel_acquires_resource_(EngFloatState))) +_On_failure_(_Post_satisfies_(return == 0)) +ENGAPI ULONG APIENTRY EngSaveFloatingPointState( - PVOID Buffer, - ULONG BufferSize) + _At_(*pBuffer, _Kernel_requires_resource_not_held_(EngFloatState)) + _Out_writes_bytes_opt_(cjBufferSize) PVOID pBuffer, + _Inout_ ULONG cjBufferSize) { KFLOATING_SAVE TempBuffer; NTSTATUS Status; - if ((Buffer == NULL) || (BufferSize == 0)) + if ((pBuffer == NULL) || (cjBufferSize == 0)) { /* Check for floating point support. */ Status = KeSaveFloatingPointState(&TempBuffer); @@ -53,12 +67,12 @@ return(sizeof(KFLOATING_SAVE)); } - if (BufferSize < sizeof(KFLOATING_SAVE)) + if (cjBufferSize < sizeof(KFLOATING_SAVE)) { return(0); } - Status = KeSaveFloatingPointState((PKFLOATING_SAVE)Buffer); + Status = KeSaveFloatingPointState((PKFLOATING_SAVE)pBuffer); if (!NT_SUCCESS(Status)) { return FALSE; 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 Mar 10 00:11:29 2015 @@ -138,12 +138,14 @@ ULONG iTransColor, ULONG Reserved); -BOOL APIENTRY -IntEngPaint(IN SURFOBJ *Surface, - IN CLIPOBJ *ClipRegion, - IN BRUSHOBJ *Brush, - IN POINTL *BrushOrigin, - IN MIX Mix); +BOOL +APIENTRY +IntEngPaint( + _In_ SURFOBJ *pso, + _In_ CLIPOBJ *pco, + _In_ BRUSHOBJ *pbo, + _In_ POINTL *pptlBrushOrg, + _In_ __in_data_source(USER_MODE) MIX mix); ULONG APIENTRY IntEngSetPointerShape( Modified: trunk/reactos/win32ss/gdi/eng/ldevobj.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/ldevobj.h?…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/ldevobj.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/ldevobj.h [iso-8859-1] Tue Mar 10 00:11:29 2015 @@ -43,8 +43,8 @@ PLDEVOBJ APIENTRY EngLoadImageEx( - LPWSTR pwszDriverName, - ULONG ldevtype); + _In_z_ LPWSTR pwszDriverName, + _In_ ULONG ldevtype); PLDEVOBJ NTAPI Modified: trunk/reactos/win32ss/gdi/eng/mapping.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/mapping.c?…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/mapping.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/mapping.c [iso-8859-1] Tue Mar 10 00:11:29 2015 @@ -381,6 +381,12 @@ FILE_NON_DIRECTORY_FILE, NULL, 0); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to open file, hFile=%p, Status=0x%x\n", hFile, Status); + EngFreeMem(pFileView); + return NULL; + } Status = ZwQueryInformationFile(hFile, &IoStatusBlock, Modified: trunk/reactos/win32ss/gdi/eng/semaphor.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/semaphor.c…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/semaphor.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/semaphor.c [iso-8859-1] Tue Mar 10 00:11:29 2015 @@ -17,7 +17,7 @@ if (!NT_SUCCESS(ExInitializeResourceLite(psem))) { - ExFreePoolWithTag ( psem, GDITAG_SEMAPHORE ); + ExFreePoolWithTag(psem, GDITAG_SEMAPHORE ); return NULL; } Modified: trunk/reactos/win32ss/gdi/eng/stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/stubs.c?re…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/stubs.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/stubs.c [iso-8859-1] Tue Mar 10 00:11:29 2015 @@ -423,11 +423,13 @@ /* * @unimplemented */ +_Ret_opt_bytecount_(*pcjFile) +ENGAPI PVOID APIENTRY FONTOBJ_pvTrueTypeFontFile( - IN FONTOBJ *FontObj, - IN ULONG *FileSize) + _In_ FONTOBJ *pfo, + _Out_ ULONG *pcjFile) { UNIMPLEMENTED; return NULL; @@ -729,12 +731,14 @@ /* * @unimplemented */ +_Ret_opt_bytecount_(*pcjTable) +ENGAPI PBYTE APIENTRY FONTOBJ_pjOpenTypeTablePointer( - IN FONTOBJ *FontObj, - IN ULONG Tag, - OUT ULONG *Table) + _In_ FONTOBJ *pfo, + _In_ ULONG ulTag, + _Out_ ULONG *pcjTable) { UNIMPLEMENTED; return NULL; @@ -1628,11 +1632,14 @@ return FALSE; } +_Must_inspect_result_ +_Ret_opt_bytecap_(cjSize) +ENGAPI PVOID APIENTRY EngFntCacheAlloc( - IN ULONG FastCheckSum, - IN ULONG ulSize) + _In_ ULONG ulFastCheckSum, + _In_ ULONG cjSize) { UNIMPLEMENTED; return NULL; Modified: trunk/reactos/win32ss/gdi/eng/umpdstubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/umpdstubs.…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/umpdstubs.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/umpdstubs.c [iso-8859-1] Tue Mar 10 00:11:29 2015 @@ -3,653 +3,709 @@ #define UNIMPLEMENTED DbgPrint("(%s:%i) WIN32K: %s UNIMPLEMENTED\n", __FILE__, __LINE__, __FUNCTION__ ) +__kernel_entry BOOL APIENTRY NtGdiUMPDEngFreeUserMem( - IN KERNEL_PVOID *ppv) -{ - UNIMPLEMENTED; - return FALSE; -} - + _In_ KERNEL_PVOID *ppv) +{ + UNIMPLEMENTED; + return FALSE; +} + +__kernel_entry BOOL APIENTRY NtGdiSetPUMPDOBJ( - IN HUMPD humpd, - IN BOOL bStoreID, - OUT HUMPD *phumpd, - OUT BOOL *pbWOW64) -{ - UNIMPLEMENTED; - return FALSE; -} - + _In_opt_ HUMPD humpd, + _In_ BOOL bStoreID, + _Inout_opt_ HUMPD *phumpd, + _Out_opt_ BOOL *pbWOW64) +{ + UNIMPLEMENTED; + return FALSE; +} + +__kernel_entry HANDLE APIENTRY NtGdiBRUSHOBJ_hGetColorTransform( - IN BRUSHOBJ *pbo) -{ - UNIMPLEMENTED; - return NULL; -} - + _In_ BRUSHOBJ *pbo) +{ + UNIMPLEMENTED; + return NULL; +} + +__kernel_entry PVOID APIENTRY NtGdiBRUSHOBJ_pvAllocRbrush( - IN BRUSHOBJ *pbo, - IN ULONG cj) -{ - UNIMPLEMENTED; - return NULL; -} - + _In_ BRUSHOBJ *pbo, + _In_ ULONG cj) +{ + UNIMPLEMENTED; + return NULL; +} + +__kernel_entry PVOID APIENTRY NtGdiBRUSHOBJ_pvGetRbrush( - IN BRUSHOBJ *pbo) -{ - UNIMPLEMENTED; - return NULL; -} - + _In_ BRUSHOBJ *pbo) +{ + UNIMPLEMENTED; + return NULL; +} + +__kernel_entry ULONG APIENTRY NtGdiBRUSHOBJ_ulGetBrushColor( - BRUSHOBJ *pbo) -{ - UNIMPLEMENTED; - return 0; -} - + _In_ BRUSHOBJ *pbo) +{ + UNIMPLEMENTED; + return 0; +} + +__kernel_entry BOOL APIENTRY NtGdiBRUSHOBJ_DeleteRbrush( - IN BRUSHOBJ *pbo, - IN BRUSHOBJ *pboB) -{ - UNIMPLEMENTED; - return 0; -} - + _In_opt_ BRUSHOBJ *pbo, + _In_opt_ BRUSHOBJ *pboB) +{ + UNIMPLEMENTED; + return 0; +} + +__kernel_entry BOOL APIENTRY NtGdiCLIPOBJ_bEnum( - IN CLIPOBJ *pco, - IN ULONG cj, - OUT ULONG *pv) -{ - UNIMPLEMENTED; - return FALSE; -} - + _In_ CLIPOBJ *pco, + _In_ ULONG cj, + _Out_writes_bytes_(cj) ULONG *pul) +{ + UNIMPLEMENTED; + return FALSE; +} + +__kernel_entry ULONG APIENTRY NtGdiCLIPOBJ_cEnumStart( - IN CLIPOBJ *pco, - IN BOOL bAll, - IN ULONG iType, - IN ULONG iDirection, - IN ULONG cLimit) -{ - UNIMPLEMENTED; - return 0; -} - + _In_ CLIPOBJ *pco, + _In_ BOOL bAll, + _In_ ULONG iType, + _In_ ULONG iDirection, + _In_ ULONG cLimit) +{ + UNIMPLEMENTED; + return 0; +} + +__kernel_entry PATHOBJ* APIENTRY NtGdiCLIPOBJ_ppoGetPath( - CLIPOBJ *pco) -{ - UNIMPLEMENTED; - return NULL; -} - + _In_ CLIPOBJ *pco) +{ + UNIMPLEMENTED; + return NULL; +} + +__kernel_entry BOOL APIENTRY NtGdiEngAssociateSurface( - IN HSURF hsurf, - IN HDEV hdev, - IN ULONG flHooks) -{ - UNIMPLEMENTED; - return FALSE; -} - + _In_ HSURF hsurf, + _In_ HDEV hdev, + _In_ FLONG flHooks) +{ + UNIMPLEMENTED; + return FALSE; +} + +__kernel_entry BOOL APIENTRY NtGdiEngCheckAbort( - IN SURFOBJ *pso) -{ - UNIMPLEMENTED; - return FALSE; -} - + _In_ SURFOBJ *pso) +{ + UNIMPLEMENTED; + return FALSE; +} + +__kernel_entry FD_GLYPHSET* APIENTRY NtGdiEngComputeGlyphSet( - INT nCodePage, - INT nFirstChar, - INT cChars) -{ - UNIMPLEMENTED; - return NULL; -} - + _In_ INT nCodePage, + _In_ INT nFirstChar, + _In_ INT cChars) +{ + UNIMPLEMENTED; + return NULL; +} + +__kernel_entry BOOL APIENTRY NtGdiEngCopyBits( - SURFOBJ *psoDest, - SURFOBJ *psoSrc, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - RECTL *prclDest, - POINTL *pptlSrc) -{ - UNIMPLEMENTED; - return FALSE; -} - + _In_ SURFOBJ *psoDst, + _In_ SURFOBJ *psoSrc, + _In_opt_ CLIPOBJ *pco, + _In_opt_ XLATEOBJ *pxlo, + _In_ RECTL *prclDst, + _In_ POINTL *pptlSrc) +{ + UNIMPLEMENTED; + return FALSE; +} + +__kernel_entry HBITMAP APIENTRY NtGdiEngCreateBitmap( - IN SIZEL sizl, - IN LONG lWidth, - IN ULONG iFormat, - IN ULONG fl, - IN PVOID pvBits) -{ - UNIMPLEMENTED; - return NULL; -} - + _In_ SIZEL sizl, + _In_ LONG lWidth, + _In_ ULONG iFormat, + _In_ FLONG fl, + _In_opt_ PVOID pvBits) +{ + UNIMPLEMENTED; + return NULL; +} + +__kernel_entry CLIPOBJ* APIENTRY -NtGdiEngCreateClip(VOID) -{ - UNIMPLEMENTED; - return NULL; -} - +NtGdiEngCreateClip( + VOID) +{ + UNIMPLEMENTED; + return NULL; +} + +__kernel_entry HBITMAP APIENTRY NtGdiEngCreateDeviceBitmap( - IN DHSURF dhsurf, - IN SIZEL sizl, - IN ULONG iFormatCompat) -{ - UNIMPLEMENTED; - return NULL; -} - + _In_ DHSURF dhsurf, + _In_ SIZEL sizl, + _In_ ULONG iFormatCompat) +{ + UNIMPLEMENTED; + return NULL; +} + +__kernel_entry HSURF APIENTRY NtGdiEngCreateDeviceSurface( - IN DHSURF dhsurf, - IN SIZEL sizl, - IN ULONG iFormatCompat) -{ - UNIMPLEMENTED; - return NULL; -} - + _In_ DHSURF dhsurf, + _In_ SIZEL sizl, + _In_ ULONG iFormatCompat) +{ + UNIMPLEMENTED; + return NULL; +} + +__kernel_entry HPALETTE APIENTRY NtGdiEngCreatePalette( - IN ULONG iMode, - IN ULONG cColors, - IN ULONG *pulColors, - IN ULONG flRed, - IN ULONG flGreen, - IN ULONG flBlue) -{ - UNIMPLEMENTED; - return NULL; -} - + _In_ ULONG iMode, + _In_ ULONG cColors, + _In_ ULONG *pulColors, + _In_ FLONG flRed, + _In_ FLONG flGreen, + _In_ FLONG flBlue) +{ + UNIMPLEMENTED; + return NULL; +} + +__kernel_entry NTSTATUS APIENTRY NtGdiEngDeleteClip( - CLIPOBJ *pco) + _In_ CLIPOBJ*pco) { UNIMPLEMENTED; return STATUS_NOT_IMPLEMENTED; } +__kernel_entry BOOL APIENTRY NtGdiEngDeletePalette( - IN HPALETTE hpal) -{ - UNIMPLEMENTED; - return FALSE; -} - + _In_ HPALETTE hPal) +{ + UNIMPLEMENTED; + return FALSE; +} + +__kernel_entry NTSTATUS APIENTRY NtGdiEngDeletePath( - IN PATHOBJ *ppo) + _In_ PATHOBJ *ppo) { UNIMPLEMENTED; return STATUS_NOT_IMPLEMENTED; } +__kernel_entry BOOL APIENTRY NtGdiEngDeleteSurface( - IN HSURF hsurf) -{ - UNIMPLEMENTED; - return FALSE; -} - + _In_ HSURF hsurf) +{ + UNIMPLEMENTED; + return FALSE; +} + +__kernel_entry BOOL APIENTRY NtGdiEngEraseSurface( - SURFOBJ *pso, - RECTL *prcl, - ULONG iColor) -{ - UNIMPLEMENTED; - return FALSE; -} - + _In_ SURFOBJ *pso, + _In_ RECTL *prcl, + _In_ ULONG iColor) +{ + UNIMPLEMENTED; + return FALSE; +} + +__kernel_entry BOOL APIENTRY NtGdiEngFillPath( - SURFOBJ *pso, - PATHOBJ *ppo, - CLIPOBJ *pco, - BRUSHOBJ *pbo, - POINTL *pptlBrushOrg, - MIX mix, - FLONG flOptions) -{ - UNIMPLEMENTED; - return FALSE; -} - + _In_ SURFOBJ *pso, + _In_ PATHOBJ *ppo, + _In_ CLIPOBJ *pco, + _In_ BRUSHOBJ *pbo, + _In_ POINTL *pptlBrushOrg, + _In_ MIX mix, + _In_ FLONG flOptions) +{ + UNIMPLEMENTED; + return FALSE; +} + +__kernel_entry BOOL APIENTRY NtGdiEngGradientFill( - SURFOBJ *psoDest, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - TRIVERTEX *pVertex, - ULONG nVertex, - PVOID pMesh, - ULONG nMesh, - RECTL *prclExtents, - POINTL *pptlDitherOrg, - ULONG ulMode) -{ - UNIMPLEMENTED; - return FALSE; -} - + _In_ SURFOBJ *psoDest, + _In_ CLIPOBJ *pco, + _In_ XLATEOBJ *pxlo, + _In_reads_(nVertex) TRIVERTEX *pVertex, + _In_ ULONG nVertex, + _In_ /* _In_reads_(nMesh) */ PVOID pMesh, + _In_ ULONG nMesh, + _In_ RECTL *prclExtents, + _In_ POINTL *pptlDitherOrg, + _In_ ULONG ulMode) +{ + UNIMPLEMENTED; + return FALSE; +} + +__kernel_entry BOOL APIENTRY NtGdiEngLineTo( - IN SURFOBJ *pso, - IN CLIPOBJ *pco, - IN BRUSHOBJ *pbo, - IN LONG x1, - IN LONG y1, - IN LONG x2, - IN LONG y2, - IN RECTL *prclBounds, - IN MIX mix) -{ - UNIMPLEMENTED; - return FALSE; -} - + _In_ SURFOBJ *pso, + _In_ CLIPOBJ *pco, + _In_ BRUSHOBJ *pbo, + _In_ LONG x1, + _In_ LONG y1, + _In_ LONG x2, + _In_ LONG y2, + _In_ RECTL *prclBounds, + _In_ MIX mix) +{ + UNIMPLEMENTED; + return FALSE; +} + +__kernel_entry BOOL APIENTRY NtGdiEngMarkBandingSurface( - HSURF hsurf) -{ - UNIMPLEMENTED; - return FALSE; -} - + _In_ HSURF hsurf) +{ + UNIMPLEMENTED; + return FALSE; +} + +__kernel_entry BOOL APIENTRY NtGdiEngPaint( - IN SURFOBJ *pso, - IN CLIPOBJ *pco, - IN BRUSHOBJ *pbo, - IN POINTL *pptlBrushOrg, - IN MIX mix) -{ - UNIMPLEMENTED; - return FALSE; -} - + _In_ SURFOBJ *pso, + _In_ CLIPOBJ *pco, + _In_ BRUSHOBJ *pbo, + _In_ POINTL *pptlBrushOrg, + _In_ MIX mix) +{ + UNIMPLEMENTED; + return FALSE; +} + +__kernel_entry BOOL APIENTRY NtGdiEngPlgBlt( - SURFOBJ *psoTrg, - SURFOBJ *psoSrc, - SURFOBJ *psoMsk, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - COLORADJUSTMENT *pca, - POINTL *pptlBrushOrg, - POINTFIX *pptfx, - RECTL *prcl, - POINTL *pptl, - ULONG iMode) -{ - UNIMPLEMENTED; - return FALSE; -} - + _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, + _In_opt_ POINTL *pptl, + _In_ ULONG iMode) +{ + UNIMPLEMENTED; + return FALSE; +} + +__kernel_entry BOOL APIENTRY NtGdiEngStretchBltROP( - SURFOBJ *psoDest, - SURFOBJ *psoSrc, - SURFOBJ *psoMask, - CLIPOBJ *pco, - XLATEOBJ *pxlo, - COLORADJUSTMENT *pca, - POINTL *pptlHTOrg, - RECTL *prclDest, - RECTL *prclSrc, - POINTL *pptlMask, - ULONG iMode, - BRUSHOBJ *pbo, - DWORD rop4) -{ - UNIMPLEMENTED; - return FALSE; -} - + _In_ SURFOBJ *psoTrg, + _In_ SURFOBJ *psoSrc, + _In_ SURFOBJ *psoMask, + _In_ CLIPOBJ *pco, + _In_ XLATEOBJ *pxlo, + _In_ COLORADJUSTMENT *pca, + _In_ POINTL *pptlBrushOrg, + _In_ RECTL *prclTrg, + _In_ RECTL *prclSrc, + _In_ POINTL *pptlMask, + _In_ ULONG iMode, + _In_ BRUSHOBJ *pbo, + _In_ ROP4 rop4) +{ + UNIMPLEMENTED; + return FALSE; +} + +__kernel_entry BOOL APIENTRY NtGdiEngStrokePath( - SURFOBJ *pso, - PATHOBJ *ppo, - CLIPOBJ *pco, - XFORMOBJ *pxo, - BRUSHOBJ *pbo, - POINTL *pptlBrushOrg, - LINEATTRS *plineattrs, - MIX mix) -{ - UNIMPLEMENTED; - return FALSE; -} - + _In_ SURFOBJ *pso, + _In_ PATHOBJ *ppo, + _In_ CLIPOBJ *pco, + _In_ XFORMOBJ *pxo, + _In_ BRUSHOBJ *pbo, + _In_ POINTL *pptlBrushOrg, + _In_ LINEATTRS *plineattrs, + _In_ MIX mix) +{ + UNIMPLEMENTED; + return FALSE; +} + +__kernel_entry BOOL APIENTRY NtGdiEngStrokeAndFillPath( - SURFOBJ *pso, - PATHOBJ *ppo, - CLIPOBJ *pco, - XFORMOBJ *pxo, - BRUSHOBJ *pboStroke, - LINEATTRS *plineattrs, - BRUSHOBJ *pboFill, - POINTL *pptlBrushOrg, - MIX mixFill, - FLONG flOptions) -{ - UNIMPLEMENTED; - return FALSE; -} - + _In_ SURFOBJ *pso, + _In_ PATHOBJ *ppo, + _In_ CLIPOBJ *pco,IN XFORMOBJ *pxo, + _In_ BRUSHOBJ *pboStroke, + _In_ LINEATTRS *plineattrs, + _In_ BRUSHOBJ *pboFill, + _In_ POINTL *pptlBrushOrg, + _In_ MIX mix, + _In_ FLONG flOptions) +{ + UNIMPLEMENTED; + return FALSE; +} + +__kernel_entry BOOL APIENTRY NtGdiEngTextOut( - SURFOBJ *pso, - STROBJ *pstro, - FONTOBJ *pfo, - CLIPOBJ *pco, - RECTL *prclExtra, - RECTL *prclOpaque, - BRUSHOBJ *pboFore, - BRUSHOBJ *pboOpaque, - POINTL *pptlOrg, - MIX mix) + _In_ SURFOBJ *pso, + _In_ STROBJ *pstro, + _In_ FONTOBJ *pfo, + _In_ CLIPOBJ *pco, + _In_ RECTL *prclExtra, + _In_ RECTL *prclOpaque, + _In_ BRUSHOBJ *pboFore, + _In_ BRUSHOBJ *pboOpaque, + _In_ POINTL *pptlOrg, + _In_ MIX mix) { UNIMPLEMENTED; return FALSE; } +__kernel_entry BOOL APIENTRY NtGdiEngTransparentBlt( - IN SURFOBJ *psoDst, - IN SURFOBJ *psoSrc, - IN CLIPOBJ *pco, - IN XLATEOBJ *pxlo, - IN PRECTL prclDst, - IN PRECTL prclSrc, - IN ULONG iTransColor, - IN ULONG ulReserved) -{ - UNIMPLEMENTED; - return FALSE; -} - + _In_ SURFOBJ *psoDst, + _In_ SURFOBJ *psoSrc, + _In_ CLIPOBJ *pco, + _In_ XLATEOBJ *pxlo, + _In_ RECTL *prclDst, + _In_ RECTL *prclSrc, + _In_ ULONG iTransColor, + _In_ ULONG ulReserved) +{ + UNIMPLEMENTED; + return FALSE; +} + +__kernel_entry NTSTATUS APIENTRY NtGdiFONTOBJ_vGetInfo( - IN FONTOBJ *pfo, - IN ULONG cjSize, - OUT FONTINFO *pfi) + _In_ FONTOBJ *pfo, + _In_ ULONG cjSize, + _Out_writes_bytes_(cjSize) FONTINFO *pfi) { UNIMPLEMENTED; return STATUS_NOT_IMPLEMENTED; } +__kernel_entry XFORMOBJ* APIENTRY NtGdiFONTOBJ_pxoGetXform( - IN FONTOBJ *pfo) -{ - UNIMPLEMENTED; - return NULL; -} - + _In_ FONTOBJ *pfo) +{ + UNIMPLEMENTED; + return NULL; +} + +__kernel_entry ULONG APIENTRY NtGdiFONTOBJ_cGetGlyphs( - IN FONTOBJ *pfo, - IN ULONG iMode, - IN ULONG cGlyph, - IN HGLYPH *phg, - IN PVOID *ppvGlyph) -{ - UNIMPLEMENTED; - return 0; -} - + _In_ FONTOBJ *pfo, + _In_ ULONG iMode, + _In_ ULONG cGlyph, + _In_ HGLYPH *phg, + _At_((GLYPHDATA**)ppvGlyph, _Outptr_) PVOID *ppvGlyph) +{ + UNIMPLEMENTED; + return 0; +} + +__kernel_entry IFIMETRICS* APIENTRY NtGdiFONTOBJ_pifi( - IN FONTOBJ *pfo) -{ - UNIMPLEMENTED; - return NULL; -} - + _In_ FONTOBJ *pfo) +{ + UNIMPLEMENTED; + return NULL; +} + +__kernel_entry FD_GLYPHSET* APIENTRY NtGdiFONTOBJ_pfdg( - IN FONTOBJ *pfo) -{ - UNIMPLEMENTED; - return NULL; -} - + _In_ FONTOBJ *pfo) +{ + UNIMPLEMENTED; + return NULL; +} + +__kernel_entry PFD_GLYPHATTR APIENTRY NtGdiFONTOBJ_pQueryGlyphAttrs( - IN FONTOBJ *pfo, - IN ULONG iMode) -{ - UNIMPLEMENTED; - return NULL; -} - + _In_ FONTOBJ *pfo, + _In_ ULONG iMode) +{ + UNIMPLEMENTED; + return NULL; +} + +__kernel_entry PVOID APIENTRY NtGdiFONTOBJ_pvTrueTypeFontFile( - IN FONTOBJ *pfo, - OUT ULONG *pcjFile) -{ - UNIMPLEMENTED; - return NULL; -} - + _In_ FONTOBJ *pfo, + _Out_ ULONG *pcjFile) +{ + UNIMPLEMENTED; + return NULL; +} + +__kernel_entry ULONG APIENTRY NtGdiFONTOBJ_cGetAllGlyphHandles( - IN FONTOBJ *pfo, - IN HGLYPH *phg) -{ - UNIMPLEMENTED; - return 0; -} - + _In_ FONTOBJ *pfo, + _Out_opt_ _Post_count_(return) HGLYPH *phg) +{ + UNIMPLEMENTED; + return 0; +} + +__kernel_entry LONG APIENTRY NtGdiHT_Get8BPPMaskPalette( - OUT OPTIONAL LPPALETTEENTRY pPaletteEntry, - IN BOOL Use8BPPMaskPal, - IN BYTE CMYMask, - IN USHORT RedGamma, - IN USHORT GreenGamma, - IN USHORT BlueGamma) -{ - UNIMPLEMENTED; - return FALSE; -} - + _Out_opt_ _Post_count_(return) LPPALETTEENTRY pPaletteEntry, + _In_ BOOL Use8BPPMaskPal, + _In_ BYTE CMYMask, + _In_ USHORT RedGamma, + _In_ USHORT GreenGamma, + _In_ USHORT BlueGamma) +{ + UNIMPLEMENTED; + return FALSE; +} + +__kernel_entry LONG APIENTRY NtGdiHT_Get8BPPFormatPalette( - OUT OPTIONAL LPPALETTEENTRY pPaletteEntry, - IN USHORT RedGamma, - IN USHORT GreenGamma, - IN USHORT BlueGamma) -{ - UNIMPLEMENTED; - return FALSE; -} - + _Out_opt_ _Post_count_(return) LPPALETTEENTRY pPaletteEntry, + _In_ USHORT RedGamma, + _In_ USHORT GreenGamma, + _In_ USHORT BlueGamma) +{ + UNIMPLEMENTED; + return FALSE; +} + +__kernel_entry NTSTATUS APIENTRY NtGdiPATHOBJ_vGetBounds( - IN PATHOBJ *ppo, - OUT PRECTFX prectfx) + _In_ PATHOBJ *ppo, + _Out_ PRECTFX prectfx) { UNIMPLEMENTED; return STATUS_NOT_IMPLEMENTED; } +__kernel_entry BOOL APIENTRY NtGdiPATHOBJ_bEnum( - IN PATHOBJ *ppo, - OUT PATHDATA *ppd) -{ - UNIMPLEMENTED; - return FALSE; -} - + _In_ PATHOBJ *ppo, + _Out_ PATHDATA *ppd) +{ + UNIMPLEMENTED; + return FALSE; +} + +__kernel_entry NTSTATUS APIENTRY NtGdiPATHOBJ_vEnumStart( - IN PATHOBJ *ppo) + _In_ PATHOBJ *ppo) { UNIMPLEMENTED; return STATUS_NOT_IMPLEMENTED; } +__kernel_entry NTSTATUS APIENTRY NtGdiPATHOBJ_vEnumStartClipLines( - IN PATHOBJ *ppo, - IN CLIPOBJ *pco, - IN SURFOBJ *pso, - IN LINEATTRS *pla) + _In_ PATHOBJ *ppo, + _In_ CLIPOBJ *pco, + _In_ SURFOBJ *pso, + _In_ LINEATTRS *pla) { UNIMPLEMENTED; return STATUS_NOT_IMPLEMENTED; } +__kernel_entry BOOL APIENTRY NtGdiPATHOBJ_bEnumClipLines( - IN PATHOBJ *ppo, - IN ULONG cb, - OUT CLIPLINE *pcl) -{ - UNIMPLEMENTED; - return FALSE; -} - + _In_ PATHOBJ *ppo, + _In_ ULONG cb, + _Out_writes_bytes_(cb) CLIPLINE *pcl) +{ + UNIMPLEMENTED; + return FALSE; +} + +__kernel_entry BOOL APIENTRY NtGdiSTROBJ_bEnum( - IN STROBJ *pstro, - OUT ULONG *pc, - OUT PGLYPHPOS *ppgpos) -{ - UNIMPLEMENTED; - return FALSE; -} - + _In_ STROBJ *pstro, + _Out_ ULONG *pc, + _Outptr_result_buffer_(*pc) PGLYPHPOS *ppgpos) +{ + UNIMPLEMENTED; + return FALSE; +} + +__kernel_entry BOOL APIENTRY NtGdiSTROBJ_bEnumPositionsOnly( - IN STROBJ *pstro, - OUT ULONG *pc, - OUT PGLYPHPOS *ppgpos) -{ - UNIMPLEMENTED; - return FALSE; -} - + _In_ STROBJ *pstro, + _Out_ ULONG *pc, + _Outptr_result_buffer_(*pc) PGLYPHPOS *ppgpos) +{ + UNIMPLEMENTED; + return FALSE; +} + +__kernel_entry BOOL APIENTRY NtGdiSTROBJ_bGetAdvanceWidths( - IN STROBJ *pstro, - IN ULONG iFirst, - IN ULONG c, - OUT POINTQF *pptqD) -{ - UNIMPLEMENTED; - return FALSE; -} - + _In_ STROBJ*pstro, + _In_ ULONG iFirst, + _In_ ULONG c, + _Out_writes_(c) POINTQF*pptqD) +{ + UNIMPLEMENTED; + return FALSE; +} + +__kernel_entry NTSTATUS APIENTRY NtGdiSTROBJ_vEnumStart( - IN STROBJ *pstro) + _Inout_ STROBJ *pstro) { UNIMPLEMENTED; return STATUS_NOT_IMPLEMENTED; } +__kernel_entry DWORD APIENTRY NtGdiSTROBJ_dwGetCodePage( - IN STROBJ *pstro) -{ - UNIMPLEMENTED; - return 0; -} - + _In_ STROBJ *pstro) +{ + UNIMPLEMENTED; + return 0; +} + +__kernel_entry BOOL APIENTRY NtGdiXFORMOBJ_bApplyXform( - IN XFORMOBJ *pxo, - IN ULONG iMode, - IN ULONG cPoints, + _In_ XFORMOBJ *pxo, + _In_ ULONG iMode, + _In_ ULONG cPoints, _In_reads_(cPoints) PPOINTL pptIn, _Out_writes_(cPoints) PPOINTL pptOut) { @@ -657,42 +713,46 @@ return FALSE; } +__kernel_entry ULONG APIENTRY NtGdiXFORMOBJ_iGetXform( - IN XFORMOBJ *pxo, - OUT OPTIONAL XFORML *pxform) -{ - UNIMPLEMENTED; - return 0; -} - + _In_ XFORMOBJ *pxo, + _Out_opt_ XFORML *pxform) +{ + UNIMPLEMENTED; + return 0; +} + +__kernel_entry ULONG APIENTRY NtGdiXLATEOBJ_cGetPalette( - IN XLATEOBJ *pxlo, - IN ULONG iPal, - IN ULONG cPal, - OUT ULONG *pPal) -{ - UNIMPLEMENTED; - return 0; -} - + _In_ XLATEOBJ *pxlo, + _In_ ULONG iPal, + _In_ ULONG cPal, + _Out_writes_(cPal) ULONG *pPal) +{ + UNIMPLEMENTED; + return 0; +} + +__kernel_entry ULONG APIENTRY NtGdiXLATEOBJ_iXlate( - IN XLATEOBJ *pxlo, - IN ULONG iColor) -{ - UNIMPLEMENTED; - return 0; -} - + _In_ XLATEOBJ *pxlo, + _In_ ULONG iColor) +{ + UNIMPLEMENTED; + return 0; +} + +__kernel_entry HANDLE APIENTRY NtGdiXLATEOBJ_hGetColorTransform( - IN XLATEOBJ *pxlo) + _In_ XLATEOBJ *pxlo) { UNIMPLEMENTED; return 0; Modified: trunk/reactos/win32ss/gdi/ntgdi/arc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/arc.c?re…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/arc.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/arc.c [iso-8859-1] Tue Mar 10 00:11:29 2015 @@ -317,6 +317,7 @@ BOOL Ret = FALSE; gxf_long worker, worker1; KFLOATING_SAVE FloatSave; + NTSTATUS status; pDC = DC_LockDc (hDC); if(!pDC) @@ -331,7 +332,12 @@ return TRUE; } - KeSaveFloatingPointState(&FloatSave); + status = KeSaveFloatingPointState(&FloatSave); + if (!NT_SUCCESS(status)) + { + DC_UnlockDc( pDC ); + return FALSE; + } worker.l = dwStartAngle; worker1.l = dwSweepAngle; @@ -366,6 +372,7 @@ DC *dc; BOOL Ret; KFLOATING_SAVE FloatSave; + NTSTATUS status; dc = DC_LockDc (hDC); if(!dc) @@ -388,7 +395,12 @@ if (dc->pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY)) DC_vUpdateLineBrush(dc); - KeSaveFloatingPointState(&FloatSave); + status = KeSaveFloatingPointState(&FloatSave); + if (!NT_SUCCESS(status)) + { + DC_UnlockDc( dc ); + return FALSE; + } Ret = IntGdiArcInternal( arctype, Modified: trunk/reactos/win32ss/gdi/ntgdi/bezier.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/bezier.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/bezier.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/bezier.c [iso-8859-1] Tue Mar 10 00:11:29 2015 @@ -138,6 +138,12 @@ if(*nPtsOut == *dwOut) { *dwOut *= 2; *PtsOut = ExAllocatePoolWithTag(PagedPool, *dwOut * sizeof(POINT), TAG_BEZIER); + if (*PtsOut == NULL) + { + /// \todo FIXME! + NT_ASSERT(FALSE); + return; + } } if(!level || BezierCheck(level, Points)) { 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 Mar 10 00:11:29 2015 @@ -1090,11 +1090,12 @@ return bResult; } +static BOOL IntGdiFillRgn( _In_ PDC pdc, _In_ PREGION prgn, - _In_ PBRUSH pbrFill) + _In_opt_ PBRUSH pbrFill) { PREGION prgnClip; XCLIPOBJ xcoClip; Modified: trunk/reactos/win32ss/gdi/ntgdi/brush.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/brush.c?…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/brush.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/brush.c [iso-8859-1] Tue Mar 10 00:11:29 2015 @@ -47,6 +47,7 @@ ppi = PsGetCurrentProcessWin32Process(); NT_ASSERT(ppi); + __analysis_assume(ppi); pBrushAttr = GdiPoolAllocate(ppi->pPoolBrushAttr); if (!pBrushAttr) Modified: trunk/reactos/win32ss/gdi/ntgdi/cliprgn.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/cliprgn.…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/cliprgn.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/cliprgn.c [iso-8859-1] Tue Mar 10 00:11:29 2015 @@ -143,6 +143,7 @@ return retval; } +_Success_(return!=ERROR) INT FASTCALL GdiGetClipBox( @@ -186,6 +187,7 @@ return iComplexity; } +_Success_(return!=ERROR) INT APIENTRY NtGdiGetAppClipBox( Modified: trunk/reactos/win32ss/gdi/ntgdi/cliprgn.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/cliprgn.…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/cliprgn.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/cliprgn.h [iso-8859-1] Tue Mar 10 00:11:29 2015 @@ -1,5 +1,6 @@ #pragma once +_Success_(return!=ERROR) INT FASTCALL GdiGetClipBox( Modified: trunk/reactos/win32ss/gdi/ntgdi/coord.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/coord.c?…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/coord.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/coord.c [iso-8859-1] Tue Mar 10 00:11:29 2015 @@ -517,7 +517,13 @@ /* The xform is permitted to be NULL for MWT_IDENTITY. * However, if it is not NULL, then it must be valid even * though it is not used. */ - if ((pxformUnsafe != NULL) || (dwMode != MWT_IDENTITY)) + if ((dwMode != MWT_IDENTITY) && (pxformUnsafe == NULL)) + { + DC_UnlockDc(pdc); + return FALSE; + } + + if (pxformUnsafe != NULL) { _SEH2_TRY { Modified: trunk/reactos/win32ss/gdi/ntgdi/dclife.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dclife.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dclife.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dclife.c [iso-8859-1] Tue Mar 10 00:11:29 2015 @@ -670,17 +670,18 @@ return hdc; } +__kernel_entry HDC APIENTRY NtGdiOpenDCW( - PUNICODE_STRING pustrDevice, - DEVMODEW *pdmInit, - PUNICODE_STRING pustrLogAddr, - ULONG iType, - BOOL bDisplay, - HANDLE hspool, - DRIVER_INFO_2W *pDriverInfo2, - VOID *pUMdhpdev) + _In_opt_ PUNICODE_STRING pustrDevice, + _In_ DEVMODEW *pdmInit, + _In_ PUNICODE_STRING pustrLogAddr, + _In_ ULONG iType, + _In_ BOOL bDisplay, + _In_opt_ HANDLE hspool, + _In_opt_ DRIVER_INFO_2W *pDriverInfo2, + _At_((PUMDHPDEV*)pUMdhpdev, _Out_) PVOID pUMdhpdev) { UNICODE_STRING ustrDevice; WCHAR awcDevice[CCHDEVICENAME]; @@ -706,6 +707,8 @@ if (pdmInit) { /* FIXME: could be larger */ + /* According to a comment in Windows SDK the size of the buffer for + pdm is (pdm->dmSize + pdm->dmDriverExtra) */ ProbeForRead(pdmInit, sizeof(DEVMODEW), 1); RtlCopyMemory(&dmInit, pdmInit, sizeof(DEVMODEW)); } Modified: trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c [iso-8859-1] Tue Mar 10 00:11:29 2015 @@ -159,7 +159,8 @@ * * @implemented */ -_Success_(return != FALSE) +_Success_(return!=FALSE) +__kernel_entry BOOL APIENTRY NtGdiSetBrushOrg( Modified: trunk/reactos/win32ss/gdi/ntgdi/dcstate.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dcstate.…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dcstate.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dcstate.c [iso-8859-1] Tue Mar 10 00:11:29 2015 @@ -105,17 +105,20 @@ return TRUE; } +__kernel_entry BOOL APIENTRY NtGdiResetDC( - IN HDC hdc, - IN LPDEVMODEW pdm, - OUT PBOOL pbBanding, - IN OPTIONAL DRIVER_INFO_2W *pDriverInfo2, - OUT VOID *ppUMdhpdev) -{ + _In_ HDC hdc, + _In_ LPDEVMODEW pdm, + _Out_ PBOOL pbBanding, + _In_opt_ DRIVER_INFO_2W *pDriverInfo2, + _At_((PUMDHPDEV*)ppUMdhpdev, _Out_) PVOID ppUMdhpdev) +{ + /* According to a comment in Windows SDK the size of the buffer for + pdm is (pdm->dmSize + pdm->dmDriverExtra) */ UNIMPLEMENTED; - return 0; + return FALSE; } 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 Mar 10 00:11:29 2015 @@ -1002,6 +1002,8 @@ return ScanLines; } +_Success_(return!=0) +__kernel_entry INT APIENTRY NtGdiGetDIBitsInternal( @@ -1009,13 +1011,13 @@ _In_ HBITMAP hbm, _In_ UINT iStartScan, _In_ UINT cScans, - _Out_opt_ LPBYTE pjBits, - _Inout_ LPBITMAPINFO pbmiUser, + _Out_writes_bytes_opt_(cjMaxBits) LPBYTE pjBits, + _Inout_ LPBITMAPINFO pbmi, _In_ UINT iUsage, _In_ UINT cjMaxBits, _In_ UINT cjMaxInfo) { - PBITMAPINFO pbmi; + PBITMAPINFO pbmiSafe; HANDLE hSecure = NULL; INT iResult = 0; UINT cjAlloc; @@ -1037,8 +1039,8 @@ cjAlloc = sizeof(BITMAPV5HEADER) + 256 * sizeof(RGBQUAD); /* Allocate a buffer the bitmapinfo */ - pbmi = ExAllocatePoolWithTag(PagedPool, cjAlloc, 'imBG'); - if (!pbmi) + pbmiSafe = ExAllocatePoolWithTag(PagedPool, cjAlloc, 'imBG'); + if (!pbmiSafe) { /* Fail */ return 0; @@ -1048,8 +1050,8 @@ _SEH2_TRY { /* Probe and copy the BITMAPINFO */ - ProbeForRead(pbmiUser, cjMaxInfo, 1); - RtlCopyMemory(pbmi, pbmiUser, cjMaxInfo); + ProbeForRead(pbmi, cjMaxInfo, 1); + RtlCopyMemory(pbmi, pbmi, cjMaxInfo); } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { @@ -1058,8 +1060,8 @@ _SEH2_END; /* Check if the header size is large enough */ - if ((pbmi->bmiHeader.biSize < sizeof(BITMAPCOREHEADER)) || - (pbmi->bmiHeader.biSize > cjMaxInfo)) + if ((pbmiSafe->bmiHeader.biSize < sizeof(BITMAPCOREHEADER)) || + (pbmiSafe->bmiHeader.biSize > cjMaxInfo)) { goto cleanup; } @@ -1081,7 +1083,7 @@ iStartScan, cScans, pjBits, - pbmi, + pbmiSafe, iUsage, cjMaxBits, cjMaxInfo); @@ -1093,20 +1095,21 @@ _SEH2_TRY { /* Copy the data back */ - cjMaxInfo = min(cjMaxInfo, (UINT)DIB_BitmapInfoSize(pbmi, (WORD)iUsage)); - ProbeForWrite(pbmiUser, cjMaxInfo, 1); - RtlCopyMemory(pbmiUser, pbmi, cjMaxInfo); + cjMaxInfo = min(cjMaxInfo, (UINT)DIB_BitmapInfoSize(pbmiSafe, (WORD)iUsage)); + ProbeForWrite(pbmi, cjMaxInfo, 1); + RtlCopyMemory(pbmi, pbmiSafe, cjMaxInfo); } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { /* Ignore */ + (VOID)0; } _SEH2_END; } cleanup: if (hSecure) EngUnsecureMem(hSecure); - ExFreePoolWithTag(pbmi, 'imBG'); + ExFreePoolWithTag(pbmiSafe, 'imBG'); return iResult; } Modified: trunk/reactos/win32ss/gdi/ntgdi/fillshap.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/fillshap…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/fillshap.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/fillshap.c [iso-8859-1] Tue Mar 10 00:11:29 2015 @@ -1074,7 +1074,7 @@ #if 0 PDC_ATTR pdcattr; #endif - SURFACE *psurf = NULL; + SURFACE *psurf; EXLATEOBJ exlo; BOOL Ret = FALSE; RECTL DestRect; @@ -1111,6 +1111,7 @@ DC_vPrepareDCsForBlit(dc, &DestRect, NULL, NULL); /// FIXME: what about prgnVIS? And what about REAL clipping? + psurf = dc->dclevel.pSurface; if (dc->prgnRao) { Ret = REGION_PtInRegion(dc->prgnRao, Pt.x, Pt.y); @@ -1127,8 +1128,6 @@ RECTL_vSetRect(&DestRect, 0, 0, psurf->SurfObj.sizlBitmap.cx, psurf->SurfObj.sizlBitmap.cy); } - psurf = dc->dclevel.pSurface; - EXLATEOBJ_vInitialize(&exlo, &gpalRGB, psurf->ppal, 0, 0xffffff, 0); /* Only solid fills supported for now Modified: trunk/reactos/win32ss/gdi/ntgdi/freetype.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/freetype…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/freetype.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/freetype.c [iso-8859-1] Tue Mar 10 00:11:29 2015 @@ -153,8 +153,17 @@ FontCacheNumEntries = 0; /* Fast Mutexes must be allocated from non paged pool */ FontListLock = ExAllocatePoolWithTag(NonPagedPool, sizeof(FAST_MUTEX), TAG_INTERNAL_SYNC); + if (FontListLock == NULL) + { + return FALSE; + } + ExInitializeFastMutex(FontListLock); FreeTypeLock = ExAllocatePoolWithTag(NonPagedPool, sizeof(FAST_MUTEX), TAG_INTERNAL_SYNC); + if (FreeTypeLock == NULL) + { + return FALSE; + } ExInitializeFastMutex(FreeTypeLock); ulError = FT_Init_FreeType(&library); @@ -417,7 +426,15 @@ Entry->Font = FontGDI; Entry->NotEnum = (Characteristics & FR_NOT_ENUM); RtlInitAnsiString(&AnsiFaceName, (LPSTR)Face->family_name); - RtlAnsiStringToUnicodeString(&Entry->FaceName, &AnsiFaceName, TRUE); + Status = RtlAnsiStringToUnicodeString(&Entry->FaceName, &AnsiFaceName, TRUE); + if (!NT_SUCCESS(Status)) + { + ExFreePoolWithTag(FontGDI->Filename, GDITAG_PFF); + EngFreeMem(FontGDI); + FT_Done_Face(Face); + ExFreePoolWithTag(Entry, TAG_FONT); + return 0; + } if (Characteristics & FR_PRIVATE) { @@ -786,14 +803,24 @@ FT_WinFNT_HeaderRec Win; FT_Error Error; char *Cp; + NTSTATUS status; Needed = sizeof(OUTLINETEXTMETRICW); RtlInitAnsiString(&FamilyNameA, FontGDI->face->family_name); - RtlAnsiStringToUnicodeString(&FamilyNameW, &FamilyNameA, TRUE); + status = RtlAnsiStringToUnicodeString(&FamilyNameW, &FamilyNameA, TRUE); + if (!NT_SUCCESS(status)) + { + return 0; + } RtlInitAnsiString(&StyleNameA, FontGDI->face->style_name); - RtlAnsiStringToUnicodeString(&StyleNameW, &StyleNameA, TRUE); + status = RtlAnsiStringToUnicodeString(&StyleNameW, &StyleNameA, TRUE); + if (!NT_SUCCESS(status)) + { + RtlFreeUnicodeString(&FamilyNameW); + return 0; + } /* These names should be read from the TT name table */ @@ -939,6 +966,7 @@ ANSI_STRING EntryFaceNameA; UNICODE_STRING EntryFaceNameW; FONTGDI *FontGDI; + NTSTATUS status; Entry = Head->Flink; while (Entry != Head) @@ -949,7 +977,12 @@ ASSERT(FontGDI); RtlInitAnsiString(&EntryFaceNameA, FontGDI->face->family_name); - RtlAnsiStringToUnicodeString(&EntryFaceNameW, &EntryFaceNameA, TRUE); + status = RtlAnsiStringToUnicodeString(&EntryFaceNameW, &EntryFaceNameA, TRUE); + if (!NT_SUCCESS(status)) + { + break; + } + if ((LF_FACESIZE - 1) * sizeof(WCHAR) < EntryFaceNameW.Length) { EntryFaceNameW.Length = (LF_FACESIZE - 1) * sizeof(WCHAR); @@ -1007,6 +1040,7 @@ TEXTMETRICW *TM; NEWTEXTMETRICW *Ntm; DWORD fs0; + NTSTATUS status; RtlZeroMemory(Info, sizeof(FONTFAMILYINFO)); Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL); @@ -1078,7 +1112,11 @@ RtlInitAnsiString(&StyleA, FontGDI->face->style_name); StyleW.Buffer = Info->EnumLogFontEx.elfStyle; StyleW.MaximumLength = sizeof(Info->EnumLogFontEx.elfStyle); - RtlAnsiStringToUnicodeString(&StyleW, &StyleA, FALSE); + status = RtlAnsiStringToUnicodeString(&StyleW, &StyleA, FALSE); + if (!NT_SUCCESS(status)) + { + return; + } Info->EnumLogFontEx.elfLogFont.lfCharSet = DEFAULT_CHARSET; Info->EnumLogFontEx.elfScript[0] = L'\0'; @@ -1192,6 +1230,7 @@ ANSI_STRING EntryFaceNameA; UNICODE_STRING EntryFaceNameW; FONTGDI *FontGDI; + NTSTATUS status; Entry = Head->Flink; while (Entry != Head) @@ -1202,7 +1241,12 @@ ASSERT(FontGDI); RtlInitAnsiString(&EntryFaceNameA, FontGDI->face->family_name); - RtlAnsiStringToUnicodeString(&EntryFaceNameW, &EntryFaceNameA, TRUE); + status = RtlAnsiStringToUnicodeString(&EntryFaceNameW, &EntryFaceNameA, TRUE); + if (!NT_SUCCESS(status)) + { + return FALSE; + } + if ((LF_FACESIZE - 1) * sizeof(WCHAR) < EntryFaceNameW.Length) { EntryFaceNameW.Length = (LF_FACESIZE - 1) * sizeof(WCHAR); @@ -1232,6 +1276,7 @@ DWORD Size; } FONT_FAMILY_INFO_CALLBACK_CONTEXT, *PFONT_FAMILY_INFO_CALLBACK_CONTEXT; +_Function_class_(RTL_QUERY_REGISTRY_ROUTINE) static NTSTATUS APIENTRY FontFamilyInfoQueryRegistryCallback(IN PWSTR ValueName, IN ULONG ValueType, IN PVOID ValueData, IN ULONG ValueLength, @@ -1779,7 +1824,7 @@ for (n = 0; n < ft_face->num_charmaps; n++) { charmap = ft_face->charmaps[n]; - DPRINT("Found charmap encoding: %u\n", charmap->encoding); + DPRINT("Found charmap encoding: %i\n", charmap->encoding); if (charmap->encoding != 0) { found = charmap; @@ -2230,7 +2275,7 @@ for (n = 0; n < face->num_charmaps; n++) { charmap = face->charmaps[n]; - DPRINT("Found charmap encoding: %u\n", charmap->encoding); + DPRINT("Found charmap encoding: %i\n", charmap->encoding); if (charmap->encoding != 0) { found = charmap; @@ -2505,7 +2550,7 @@ } } else - DPRINT1("Encoding %u not supported\n", face->charmap->encoding); + DPRINT1("Encoding %i not supported\n", face->charmap->encoding); size = sizeof(GLYPHSET) + sizeof(WCRANGE) * (num_ranges - 1); if (glyphset) @@ -3356,7 +3401,7 @@ Start.y = YStart; IntLPtoDP(dc, &Start, 1); - RealXStart = (Start.x + dc->ptlDCOrig.x) << 6; + RealXStart = ((LONGLONG)Start.x + dc->ptlDCOrig.x) << 6; YStart = Start.y + dc->ptlDCOrig.y; SourcePoint.x = 0; @@ -3433,7 +3478,7 @@ for (n = 0; n < face->num_charmaps; n++) { charmap = face->charmaps[n]; - DPRINT("Found charmap encoding: %u\n", charmap->encoding); + DPRINT("Found charmap encoding: %i\n", charmap->encoding); if (charmap->encoding != 0) { found = charmap; @@ -3498,7 +3543,7 @@ { ULONGLONG TextWidth = 0; LPCWSTR TempText = String; - int Start; + int iStart; /* * Calculate width of the text. @@ -3506,16 +3551,16 @@ if (NULL != Dx) { - Start = Count < 2 ? 0 : Count - 2; + iStart = Count < 2 ? 0 : Count - 2; TextWidth = Count < 2 ? 0 : (Dx[(Count-2)<<DxShift] << 6); } else { - Start = 0; - } - TempText = String + Start; - - for (i = Start; i < Count; i++) + iStart = 0; + } + TempText = String + iStart; + + for (i = iStart; i < Count; i++) { if (fuOptions & ETO_GLYPH_INDEX) glyph_index = *TempText; @@ -4304,12 +4349,12 @@ DWORD FASTCALL GreGetGlyphIndicesW( - HDC hdc, - LPWSTR pwc, - INT cwc, - LPWORD pgi, - DWORD iMode, - DWORD Unknown) + _In_ HDC hdc, + _In_opt_ LPWSTR pwc, + _In_ INT cwc, + _Out_opt_ LPWORD pgi, + _In_ DWORD iMode, + _In_ DWORD dwUnknown) { PDC dc; PDC_ATTR pdcattr; Modified: trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c [iso-8859-1] Tue Mar 10 00:11:29 2015 @@ -37,6 +37,13 @@ #define NDEBUG #include <debug.h> +FORCEINLINE +ULONG +InterlockedReadUlong( + _In_ _Interlocked_operand_ ULONG volatile *Source) +{ + return *Source; +} FORCEINLINE void @@ -126,8 +133,8 @@ static PVOID gpvGdiHdlTblSection = NULL; PENTRY gpentHmgr; PULONG gpaulRefCount; -ULONG gulFirstFree; -ULONG gulFirstUnused; +volatile ULONG gulFirstFree; +volatile ULONG gulFirstUnused; static PPAGED_LOOKASIDE_LIST gpaLookasideList; static VOID NTAPI GDIOBJ_vCleanup(PVOID ObjectBody); @@ -293,6 +300,7 @@ Status = PsLookupProcessByProcessId(ULongToHandle(ulProcessId), &pep); NT_ASSERT(NT_SUCCESS(Status)); + __analysis_assume(NT_SUCCESS(Status)); ppi = PsGetProcessWin32Process(pep); if (ppi) InterlockedIncrement((LONG*)&ppi->GDIHandleCount); @@ -309,6 +317,7 @@ Status = PsLookupProcessByProcessId(ULongToHandle(ulProcessId), &pep); NT_ASSERT(NT_SUCCESS(Status)); + __analysis_assume(NT_SUCCESS(Status)); ppi = PsGetProcessWin32Process(pep); if (ppi) InterlockedDecrement((LONG*)&ppi->GDIHandleCount); @@ -327,7 +336,7 @@ do { /* Get the index and sequence number of the first free entry */ - iFirst = gulFirstFree; + iFirst = InterlockedReadUlong(&gulFirstFree); /* Check if we have a free entry */ if (!(iFirst & GDI_HANDLE_INDEX_MASK)) @@ -395,7 +404,7 @@ do { /* Get the current first free index and sequence number */ - iFirst = gulFirstFree; + iFirst = InterlockedReadUlong(&gulFirstFree); /* Set the einfo.pobj member to the index of the first free entry */ pentFree->einfo.pobj = UlongToPtr(iFirst & GDI_HANDLE_INDEX_MASK); Modified: trunk/reactos/win32ss/gdi/ntgdi/region.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/region.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/region.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/region.c [iso-8859-1] Tue Mar 10 00:11:29 2015 @@ -2288,7 +2288,7 @@ static VOID REGION_vSyncRegion( - PREGION prgn) + _In_ PREGION prgn) { PRGN_ATTR prgnattr; @@ -3997,11 +3997,12 @@ return bResult; } +__kernel_entry BOOL APIENTRY NtGdiRectInRegion( _In_ HRGN hrgn, - _In_ LPRECT prclUnsafe) + _Inout_ LPRECT prclUnsafe) { RECTL rcTemp; @@ -4059,12 +4060,13 @@ * If the function fails, the return value is zero." */ _Success_(return!=0) +__kernel_entry ULONG APIENTRY NtGdiGetRegionData( _In_ HRGN hrgn, _In_ ULONG cjBuffer, - _Out_opt_bytecap_(cjBuffer) LPRGNDATA lpRgnData) + _Out_writes_bytes_to_opt_(cjBuffer, return) LPRGNDATA lpRgnData) { ULONG cjRects, cjSize; PREGION prgn; Modified: trunk/reactos/win32ss/gdi/ntgdi/region.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/region.h…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/region.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/region.h [iso-8859-1] Tue Mar 10 00:11:29 2015 @@ -9,7 +9,7 @@ /* Header for all gdi objects in the handle table. Do not (re)move this. */ BASEOBJECT BaseObject; - PRGN_ATTR prgnattr; + _Notnull_ PRGN_ATTR prgnattr; RGN_ATTR rgnattr; RGNDATAHEADER rdh; @@ -101,4 +101,8 @@ IntSysCreateRectpRgn(INT LeftRect, INT TopRect, INT RightRect, INT BottomRect); // FIXME: move this -BOOL FASTCALL IntGdiPaintRgn(PDC, PREGION ); +BOOL +FASTCALL +IntGdiPaintRgn( + _In_ PDC pdc, + _In_ PREGION prgn); Modified: trunk/reactos/win32ss/gdi/ntgdi/wingl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/wingl.c?…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/wingl.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/wingl.c [iso-8859-1] Tue Mar 10 00:11:29 2015 @@ -39,13 +39,14 @@ } _Success_(return != 0) +__kernel_entry INT APIENTRY NtGdiDescribePixelFormat( _In_ HDC hdc, _In_ INT ipfd, _In_ UINT cjpfd, - _When_(cjpfd != 0, _Out_) PPIXELFORMATDESCRIPTOR ppfd) + _Out_writes_bytes_(cjpfd) PPIXELFORMATDESCRIPTOR ppfd) { PDC pdc; PPDEVOBJ ppdev;
9 years, 9 months
1
0
0
0
← Newer
1
...
33
34
35
36
37
38
39
...
50
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Results per page:
10
25
50
100
200