Author: greatlrd
Date: Mon Mar 10 17:12:12 2008
New Revision: 32650
URL:
http://svn.reactos.org/svn/reactos?rev=3D32650&view=3Drev
Log:
partly implement gdi32 Escape
implemented command STARTDOC: Escape
=
Modified:
trunk/reactos/dll/win32/gdi32/misc/stubs.c
Modified: trunk/reactos/dll/win32/gdi32/misc/stubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/misc/=
stubs.c?rev=3D32650&r1=3D32649&r2=3D32650&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/dll/win32/gdi32/misc/stubs.c (original)
+++ trunk/reactos/dll/win32/gdi32/misc/stubs.c Mon Mar 10 17:12:12 2008
@@ -1500,7 +1500,7 @@
STDCALL
Escape(HDC hdc, INT nEscape, INT cbInput, LPCSTR lpvInData, LPVOID lpvOutD=
ata)
{
- int retValue =3D -1; =
+ int retValue =3D SP_ERROR; =
HGDIOBJ hObject =3D hdc;
UINT Type =3D 0;
LPVOID pUserData =3D NULL;
@@ -1565,7 +1565,7 @@
retValue =3D GetSystemPaletteEntries(hdc, (UINT)*lpvInData=
, 1, (LPPALETTEENTRY)lpvOutData);
if ( !retValue )
{
- retValue =3D -1; =
+ retValue =3D SP_ERROR; =
} =
break;
=
@@ -1599,6 +1599,72 @@
=
case GETEXTENDEDTEXTMETRICS:
retValue =3D (int) GetETM( hdc, (EXTTEXTMETRIC *) lpvOutDa=
ta) !=3D 0;
+ break;
+
+ case STARTDOC:
+ {
+ DOCINFOA *pUserDatalpdi;
+ DOCINFOA lpdi;
+
+ /* Note : Winodws check see if the handle have any use=
r data for STARTDOC command =
+ * ReactOS copy this behavior to be compatible with wi=
ndows 2003 =
+ */
+ if ( (!GdiGetHandleUserData(hObject, (DWORD)Type, (PVO=
ID) &pUserDatalpdi)) || =
+ (pUserData =3D=3D NULL) ) =
+ {
+ GdiSetLastError(ERROR_INVALID_HANDLE);
+ retValue =3D FALSE;
+ }
+
+ lpdi.cbSize =3D sizeof(DOCINFOA);
+
+ /* NOTE lpszOutput will be store in handle userdata */
+ lpdi.lpszOutput =3D 0;
+
+ lpdi.lpszDatatype =3D 0;
+ lpdi.fwType =3D 0;
+ lpdi.lpszDocName =3D lpvInData;
+
+ /* NOTE : doc for StartDocA/W at msdn
http://msdn2.mic=
rosoft.com/en-us/library/ms535793(VS.85).aspx */
+ retValue =3D StartDocA(hdc, &lpdi); =
+
+ /* StartDocA fail */
+ if (retValue < 0)
+ { =
+ /* check see if outbuffer contain any data, if it =
does abort */ =
+ if ( (pUserDatalpdi->lpszOutput !=3D 0) && =
+ ( (*(WCHAR *)pUserDatalpdi->lpszOutput) !=3D=
UNICODE_NULL) )
+ {
+ retValue =3D SP_APPABORT;
+ }
+ else
+ {
+ retValue =3D GetLastError();
+ =
+ /* Translate StartDocA error code to STARTDOC =
error code =
+ * see msdn
http://msdn2.microsoft.com/en-us/l=
ibrary/ms535472.aspx =
+ */
+ switch(retValue)
+ {
+ case ERROR_NOT_ENOUGH_MEMORY:
+ retValue =3D SP_OUTOFMEMORY;
+ break;
+
+ case ERROR_PRINT_CANCELLED:
+ retValue =3D SP_USERABORT;
+ break;
+
+ case ERROR_DISK_FULL:
+ retValue =3D SP_OUTOFDISK;
+ break;
+
+ default:
+ retValue =3D SP_ERROR;
+ break;
+ } =
+ } =
+ }
+ }
break;
=
=