[prev in list] [next in list] [prev in thread] [next in thread]
List: ros-diffs
Subject: [ros-diffs] [CVS reactos] set proper errorcode in some functions
From: weiden () osexperts ! com
Date: 2004-04-25 12:51:53
Message-ID: 20040425125153.2302943AA () mok ! osexperts ! com
[Download RAW message or body]
<html>
<head>
<style><!--
body {background-color:#ffffff;}
.file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
.pathname {font-family:monospace; float:right;}
.fileheader {margin-bottom:.5em;}
.diff {margin:0;}
.tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
.tasklist ul {margin-top:0;margin-bottom:0;}
tr.alt {background-color:#eeeeee}
#added {background-color:#ddffdd;}
#addedchars {background-color:#99ff99;font-weight:bolder;}
tr.alt #added {background-color:#ccf7cc;}
#removed {background-color:#ffdddd;}
#removedchars {background-color:#ff9999;font-weight:bolder;}
tr.alt #removed {background-color:#f7cccc;}
#info {color:#888888;}
#context {background-color:#eeeeee;}
td {padding-left:.3em;padding-right:.3em;}
tr.head {border-bottom-width:1px;border-bottom-style:solid;}
tr.head td {padding:0;padding-top:.2em;}
.task {background-color:#ffff00;}
.comment {padding:4px;border:1px dashed #000000;background-color:#ffffdd}
.error {color:red;}
hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="4">Commit in \
<b><tt>reactos/subsys/win32k/objects</tt></b><span id="info"> on \
MAIN</span></td></tr> <tr><td><tt><a href="#file1">dc.c</a></tt></td><td \
align="right" id="added">+65</td><td align="right" id="removed">-26</td><td \
nowrap="nowrap" align="center"><a \
href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/subsys/win32k/objects/dc.c?rev=1.129&content-type=text/x-cvsweb-markup">1.129</a> \
<a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/subsys/win32k/objects/dc.c.diff?r1=text&tr1=1.129&r2=text&tr2=1.130&f=h">-></a> \
<a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/subsys/win32k/objects/dc.c?rev=1.130&content-type=text/x-cvsweb-markup">1.130</a></td></tr>
</table>
<pre class="comment">
set proper errorcode in some functions
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname"><a \
href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos">reactos</a>/<a \
href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/subsys">subsys</a>/<a \
href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/subsys/win32k">win32k</a>/<a \
href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/subsys/win32k/objects">objects</a><br \
/></span> <div class="fileheader"><big><b>dc.c</b></big> <small id="info"><a \
href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/subsys/win32k/objects/dc.c?rev=1.129&content-type=text/x-cvsweb-markup">1.129</a> \
<a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/subsys/win32k/objects/dc.c.diff?r1=text&tr1=1.129&r2=text&tr2=1.130&f=h">-></a> \
<a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/subsys/win32k/objects/dc.c?rev=1.130&content-type=text/x-cvsweb-markup">1.130</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.129 -r1.130
--- dc.c 25 Apr 2004 11:34:13 -0000 1.129
+++ dc.c 25 Apr 2004 12:51:53 -0000 1.130
@@ -16,7 +16,7 @@
</small></pre><pre class="diff" id="context"> * along with this program; if not, \
write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
</pre><pre class="diff" id="removed">-/* $Id: dc.c,v 1.129 2004/04/25 11:34:13 weiden \
Exp $ </pre><pre class="diff" id="added">+/* $Id: dc.c,v 1.130 2004/04/25 12:51:53 \
weiden Exp $ </pre><pre class="diff" id="context"> *
* DC.C - Device context functions
*
</pre><pre class="diff"><small id="info">@@ -72,6 +72,7 @@
</small></pre><pre class="diff" id="context"> PDC dc = DC_LockDc( hdc ); \
if (!dc) \
{ \
</pre><pre class="diff" id="added">+ SetLastWin32Error(ERROR_INVALID_HANDLE); \
</pre><pre class="diff" id="context"> return 0; \
} \
ft = dc->dc_field; \
</pre><pre class="diff"><small id="info">@@ -83,22 +84,38 @@
</small></pre><pre class="diff" id="context"> * important that the function has the \
right signature, for the implementation
* we can do whatever we want.
*/
</pre><pre class="diff" id="removed">-#define DC_GET_VAL_EX( NtGdiFuncName, \
IntFuncName, ret_x, ret_y, type ) \
-VOID FASTCALL IntFuncName ( PDC dc, LP##type pt ) \
-{ \
- ASSERT ( dc ); \
- ASSERT ( pt ); \
- ((LPPOINT)pt)->x = dc->ret_x; \
- ((LPPOINT)pt)->y = dc->ret_y; \
-} \
-BOOL STDCALL NtGdiFuncName ( HDC hdc, LP##type pt ) \
-{ \
- PDC dc = DC_LockDc ( hdc ); \
- if ( !dc ) \
- return FALSE; \
- IntFuncName ( dc, pt ); \
- DC_UnlockDc ( hdc ); \
- return TRUE; \
</pre><pre class="diff" id="added">+#define DC_GET_VAL_EX( FuncName, ret_x, ret_y, \
type, ax, ay ) \ +VOID FASTCALL Int##FuncName ( PDC dc, LP##type pt) \
+{ \
+ ASSERT(dc); \
+ ASSERT(pt); \
+ pt->ax = dc->ret_x; \
+ pt->ay = dc->ret_y; \
+} \
+BOOL STDCALL NtGdi##FuncName ( HDC hdc, LP##type pt ) \
+{ \
+ NTSTATUS Status; \
+ type Safept; \
+ PDC dc; \
+ if(!pt) \
+ { \
+ SetLastWin32Error(ERROR_INVALID_PARAMETER); \
+ return FALSE; \
+ } \
+ if(!(dc = DC_LockDc(hdc))) \
+ { \
+ SetLastWin32Error(ERROR_INVALID_HANDLE); \
+ return FALSE; \
+ } \
+ Int##FuncName( dc, &Safept); \
+ DC_UnlockDc(hdc); \
+ Status = MmCopyToCaller(pt, &Safept, sizeof( type )); \
+ if(!NT_SUCCESS(Status)) \
+ { \
+ SetLastNtError(Status); \
+ return FALSE; \
+ } \
+ return TRUE; \
</pre><pre class="diff" id="context"> }
#define DC_SET_MODE( func_name, dc_field, min_val, max_val ) \
</pre><pre class="diff"><small id="info">@@ -107,10 +124,16 @@
</small></pre><pre class="diff" id="context"> INT prevMode; \
\ PDC dc; \
if ((mode < min_val) || (mode > max_val)) \
</pre><pre class="diff" id="added">+ { \
+ SetLastWin32Error(ERROR_INVALID_PARAMETER); \
</pre><pre class="diff" id="context"> return 0; \
</pre><pre class="diff" id="added">+ } \
</pre><pre class="diff" id="context"> dc = DC_LockDc ( hdc ); \
if ( !dc ) \
</pre><pre class="diff" id="added">+ { \
+ SetLastWin32Error(ERROR_INVALID_HANDLE); \
</pre><pre class="diff" id="context"> return 0; \
</pre><pre class="diff" id="added">+ } \
</pre><pre class="diff" id="context"> prevMode = dc->dc_field; \
\ dc->dc_field = mode; \
DC_UnlockDc ( hdc ); \
</pre><pre class="diff"><small id="info">@@ -933,7 +956,7 @@
</small></pre><pre class="diff" id="context">
DC_GET_VAL( COLORREF, NtGdiGetBkColor, w.backgroundColor )
DC_GET_VAL( INT, NtGdiGetBkMode, w.backgroundMode )
</pre><pre class="diff" id="removed">-DC_GET_VAL_EX( NtGdiGetBrushOrgEx, \
IntGetBrushOrgEx, w.brushOrgX, w.brushOrgY, POINT ) </pre><pre class="diff" \
id="added">+DC_GET_VAL_EX( GetBrushOrgEx, w.brushOrgX, w.brushOrgY, POINT, x, y ) \
</pre><pre class="diff" id="context"> DC_GET_VAL( HRGN, NtGdiGetClipRgn, w.hClipRgn ) \
HGDIOBJ STDCALL
</pre><pre class="diff"><small id="info">@@ -942,7 +965,7 @@
</small></pre><pre class="diff" id="context"> UNIMPLEMENTED;
}
</pre><pre class="diff" id="removed">-DC_GET_VAL_EX ( NtGdiGetCurrentPositionEx, \
IntGetCurrentPositionEx, w.CursPosX, w.CursPosY, POINT ) </pre><pre class="diff" \
id="added">+DC_GET_VAL_EX ( GetCurrentPositionEx, w.CursPosX, w.CursPosY, POINT, x, y \
) </pre><pre class="diff" id="context">
BOOL FASTCALL
IntGdiGetDCOrgEx(DC *dc, LPPOINT Point)
</pre><pre class="diff"><small id="info">@@ -992,11 +1015,14 @@
</small></pre><pre class="diff" id="context"> NtGdiSetBkColor(HDC hDC, COLORREF \
color) {
COLORREF oldColor;
</pre><pre class="diff" id="removed">- PDC dc = DC_LockDc(hDC);
</pre><pre class="diff" id="added">+ PDC dc;
</pre><pre class="diff" id="context"> HBRUSH hBrush;
</pre><pre class="diff" id="removed">- if ( !dc )
- return 0x80000000;
</pre><pre class="diff" id="added">+ if (!(dc = DC_LockDc(hDC)))
+ {
+ SetLastWin32Error(ERROR_INVALID_HANDLE);
+ return CLR_INVALID;
+ }
</pre><pre class="diff" id="context">
oldColor = dc->w.backgroundColor;
dc->w.backgroundColor = color;
</pre><pre class="diff"><small id="info">@@ -1015,6 +1041,7 @@
</small></pre><pre class="diff" id="context"> dc = DC_LockDc(hDC);
if (dc == NULL)
{
</pre><pre class="diff" id="added">+ SetLastWin32Error(ERROR_INVALID_HANDLE);
</pre><pre class="diff" id="context"> return 0;
}
</pre><pre class="diff"><small id="info">@@ -1213,8 +1240,11 @@
</small></pre><pre class="diff" id="context"> DC_UnlockDc ( hDCSave );
} else {
DC_UnlockDc ( hDC );
</pre><pre class="diff" id="added">+ SetLastWin32Error(ERROR_INVALID_HANDLE);
</pre><pre class="diff" id="context"> }
}
</pre><pre class="diff" id="added">+ else
+ SetLastWin32Error(ERROR_INVALID_HANDLE);
</pre><pre class="diff" id="context"> }
INT STDCALL
</pre><pre class="diff"><small id="info">@@ -1228,6 +1258,7 @@
</small></pre><pre class="diff" id="context"> dc = DC_LockDc(hDC);
if (dc == NULL)
{
</pre><pre class="diff" id="added">+ SetLastWin32Error(ERROR_INVALID_HANDLE);
</pre><pre class="diff" id="context"> return 0;
}
</pre><pre class="diff"><small id="info">@@ -1436,6 +1467,7 @@
</small></pre><pre class="diff" id="context"> GdiObject = GDIOBJ_LockObj(Handle, \
GDI_OBJECT_TYPE_DONTCARE); if (NULL == GdiObject)
{
</pre><pre class="diff" id="added">+ SetLastWin32Error(ERROR_INVALID_HANDLE);
</pre><pre class="diff" id="context"> return 0;
}
</pre><pre class="diff"><small id="info">@@ -1519,7 +1551,10 @@
</small></pre><pre class="diff" id="context">
ptr = GDIOBJ_LockObj(handle, GDI_OBJECT_TYPE_DONTCARE);
if (ptr == 0)
</pre><pre class="diff" id="added">+ {
+ SetLastWin32Error(ERROR_INVALID_HANDLE);
</pre><pre class="diff" id="context"> return 0;
</pre><pre class="diff" id="added">+ }
</pre><pre class="diff" id="context">
objectType = GDIOBJ_GetObjectType(handle);
switch(objectType)
</pre><pre class="diff"><small id="info">@@ -1576,10 +1611,10 @@
</small></pre><pre class="diff" id="context"> DC_GET_VAL( INT, \
NtGdiGetStretchBltMode, w.stretchBltMode ) DC_GET_VAL( UINT, NtGdiGetTextAlign, \
w.textAlign ) DC_GET_VAL( COLORREF, NtGdiGetTextColor, w.textColor )
</pre><pre class="diff" id="removed">-DC_GET_VAL_EX( NtGdiGetViewportExtEx, \
IntGetViewportExtEx, vportExtX, vportExtY, SIZE )
-DC_GET_VAL_EX( NtGdiGetViewportOrgEx, IntGetViewportOrgEx, vportOrgX, vportOrgY, \
POINT )
-DC_GET_VAL_EX( NtGdiGetWindowExtEx, IntGetWindowExtEx, wndExtX, wndExtY, SIZE )
-DC_GET_VAL_EX( NtGdiGetWindowOrgEx, IntGetWindowOrgEx, wndOrgX, wndOrgY, POINT )
</pre><pre class="diff" id="added">+DC_GET_VAL_EX( GetViewportExtEx, vportExtX, \
vportExtY, SIZE, cx, cy ) +DC_GET_VAL_EX( GetViewportOrgEx, vportOrgX, vportOrgY, \
POINT, x, y ) +DC_GET_VAL_EX( GetWindowExtEx, wndExtX, wndExtY, SIZE, cx, cy )
+DC_GET_VAL_EX( GetWindowOrgEx, wndOrgX, wndOrgY, POINT, x, y )
</pre><pre class="diff" id="context">
HDC STDCALL
NtGdiResetDC(HDC hDC, CONST DEVMODEW *InitData)
</pre><pre class="diff"><small id="info">@@ -1596,6 +1631,7 @@
</small></pre><pre class="diff" id="context"> dc = DC_LockDc(hDC);
if(!dc)
{
</pre><pre class="diff" id="added">+ SetLastWin32Error(ERROR_INVALID_HANDLE);
</pre><pre class="diff" id="context"> return FALSE;
}
</pre><pre class="diff"><small id="info">@@ -1664,12 +1700,14 @@
</small></pre><pre class="diff" id="context"> dcs = DC_LockDc (hdcs);
if (dcs == NULL)
{
</pre><pre class="diff" id="added">+ SetLastWin32Error(ERROR_INVALID_HANDLE);
</pre><pre class="diff" id="context"> return 0;
}
dc = DC_LockDc (hDC);
if (dc == NULL)
{
DC_UnlockDc(dc);
</pre><pre class="diff" id="added">+ SetLastWin32Error(ERROR_INVALID_HANDLE);
</pre><pre class="diff" id="context"> return 0;
}
</pre><pre class="diff"><small id="info">@@ -1925,6 +1963,7 @@
</small></pre><pre class="diff" id="context">
if (NULL == dc)
{
</pre><pre class="diff" id="added">+ SetLastWin32Error(ERROR_INVALID_HANDLE);
</pre><pre class="diff" id="context"> return 0;
}
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" \
title="commit -> email">CVSspam</a> 0.2.8</small></center> </body></html>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic