gdilib.c

来自「深圳市微逻辑电子有限公司 巨果&#8226 Kingmos&reg 系统核心」· C语言 代码 · 共 2,460 行 · 第 1/5 页

C
2,460
字号
		API_Leave(  );
	}
	return iRetv;
#endif
}

typedef BOOL ( WINAPI * PGDI_GETCURRENTPOSITION )( HDC hdc, LPPOINT lpPoint );
BOOL WINAPI Gdi_GetCurrentPosition( HDC hdc, LPPOINT lpPoint )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_GETCURRENTPOSITION, 2 );
    cs.arg0 = (DWORD)hdc;
    return (DWORD)CALL_SERVER( &cs, lpPoint );
#else

	PGDI_GETCURRENTPOSITION pGetCurrentPosition;// = (PGDI_GETCURRENTPOSITION)lpGDIAPI[GDI_GETCURRENTPOSITION];

	CALLSTACK cs;
	BOOL  bRetv = FALSE;

	if( API_Enter( API_GDI, GDI_GETCURRENTPOSITION, &pGetCurrentPosition, &cs ) )
	{
		lpPoint = MapProcessPtr( lpPoint, (LPPROCESS)cs.lpvData );

		bRetv = pGetCurrentPosition( hdc, lpPoint );
		API_Leave(  );
	}
	return bRetv;
#endif
}

typedef int ( WINAPI * PGDI_GETCLIPBOX )( HDC hdc, LPRECT lprc );
int WINAPI Gdi_GetClipBox( HDC hdc, LPRECT lprc )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_GETCLIPBOX, 2 );
    cs.arg0 = (DWORD)hdc;
    return (DWORD)CALL_SERVER( &cs, lprc );
#else

	PGDI_GETCLIPBOX pGetClipBox;// = (PGDI_GETCLIPBOX)lpGDIAPI[GDI_GETCLIPBOX];

	CALLSTACK cs;
	int   iRetv = ERROR;

	if( API_Enter( API_GDI, GDI_GETCLIPBOX, &pGetClipBox, &cs ) )
	{
		lprc = MapProcessPtr( lprc, (LPPROCESS)cs.lpvData );

		iRetv = pGetClipBox( hdc, lprc );
		API_Leave(  );
	}
	return iRetv;
#endif
}

typedef int ( WINAPI * PGDI_GETCLIPRGN )( HDC hdc, HRGN hrgn );
int WINAPI Gdi_GetClipRgn( HDC hdc, HRGN hrgn )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_GETCLIPRGN, 2 );
    cs.arg0 = (DWORD)hdc;
    return (DWORD)CALL_SERVER( &cs, hrgn );
#else

	PGDI_GETCLIPRGN pGetClipRgn;// = (PGDI_GETCLIPRGN)lpGDIAPI[GDI_GETCLIPRGN];

	CALLSTACK cs;
	int   iRetv = -1;

	if( API_Enter( API_GDI, GDI_GETCLIPRGN, &pGetClipRgn, &cs ) )
	{
		iRetv = pGetClipRgn( hdc, hrgn );
		API_Leave(  );
	}
	return iRetv;
#endif
}

typedef HGDIOBJ ( WINAPI * PGDI_GETCURRENTOBJECT )( HDC hdc, UINT uObjectType );
HGDIOBJ WINAPI Gdi_GetCurrentObject( HDC hdc, UINT uObjectType )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_GETCURRENTOBJECT, 2 );
    cs.arg0 = (DWORD)hdc;
    return (HGDIOBJ)CALL_SERVER( &cs, uObjectType );
#else

	PGDI_GETCURRENTOBJECT pGetCurrentObject;// = (PGDI_GETCURRENTOBJECT)lpGDIAPI[GDI_GETCURRENTOBJECT];

	CALLSTACK cs;
	HGDIOBJ  hRetv = NULL;

	if( API_Enter( API_GDI, GDI_GETCURRENTOBJECT, &pGetCurrentObject, &cs ) )
	{
		hRetv = pGetCurrentObject( hdc, uObjectType );
		API_Leave(  );
	}
	return hRetv;
#endif
}

typedef int ( WINAPI * PGDI_GETDIBITS )(
						 HDC hdc,           
						 HBITMAP hbmp,      
						 UINT uStartScan,   
						 UINT cScanLines,   
						 LPVOID lpvBits,    
						 LPBITMAPINFO lpbi, 
						 UINT uiUsage );
int WINAPI Gdi_GetDIBits(
						 HDC hdc,           
						 HBITMAP hbmp,      
						 UINT uStartScan,   
						 UINT cScanLines,   
						 LPVOID lpvBits,    
						 LPBITMAPINFO lpbi, 
						 UINT uiUsage )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_GETDIBITS, 7 );
    cs.arg0 = (DWORD)hdc;
    return (DWORD)CALL_SERVER( &cs, hbmp, uStartScan, cScanLines, lpvBits, lpbi, uiUsage );
#else

	PGDI_GETDIBITS pGetDIBits;// = (PGDI_GETDIBITS)lpGDIAPI[GDI_GETDIBITS];

	int   iRetv = 0;
    CALLSTACK cs;
	if( API_Enter( API_GDI, GDI_GETDIBITS, &pGetDIBits, &cs ) )
	{
		lpvBits = MapProcessPtr( lpvBits, (LPPROCESS)cs.lpvData );
		lpbi = MapProcessPtr( lpbi, (LPPROCESS)cs.lpvData );

		iRetv = pGetDIBits( hdc, hbmp, uStartScan, cScanLines, lpvBits, lpbi, uiUsage );
		API_Leave(  );
	}
	return iRetv;
#endif
}

typedef HICON ( WINAPI * PGDI_CREATEICONINDIRECT )( LPICONINFO piconinfo );
HICON WINAPI Gdi_CreateIconIndirect( LPICONINFO piconinfo )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_CREATEICONINDIRECT, 1 );
    cs.arg0 = (DWORD)piconinfo ;
    return (HICON)CALL_SERVER( &cs );
#else

	PGDI_CREATEICONINDIRECT pCreateIconIndirect;// = (PGDI_CREATEICONINDIRECT)lpGDIAPI[GDI_CREATEICONINDIRECT];

	HICON   hRetv = NULL;
    CALLSTACK cs;
	if( API_Enter( API_GDI, GDI_CREATEICONINDIRECT, &pCreateIconIndirect, &cs ) )
	{
		piconinfo = MapProcessPtr( piconinfo, (LPPROCESS)cs.lpvData );

		hRetv = pCreateIconIndirect( piconinfo );
		API_Leave(  );
	}
	return hRetv;
#endif
}

typedef BOOL ( WINAPI * PGDI_DESTROYICON )( HICON hIcon );
BOOL WINAPI Gdi_DestroyIcon( HICON hIcon )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_DESTROYICON, 1 );
    cs.arg0 = (DWORD)hIcon ;
    return (DWORD)CALL_SERVER( &cs );
#else

	PGDI_DESTROYICON pDestroyIcon;// = (PGDI_DESTROYICON)lpGDIAPI[GDI_DESTROYICON];

	BOOL  bRetv = FALSE;
    CALLSTACK cs;
	if( API_Enter( API_GDI, GDI_DESTROYICON, &pDestroyIcon, &cs ) )
	{
		bRetv = pDestroyIcon( hIcon );
		API_Leave(  );
	}
	return bRetv;
#endif
}

typedef BOOL ( WINAPI * PGDI_DESTROYCURSOR )( HCURSOR hCursor );
BOOL WINAPI Gdi_DestroyCursor( HCURSOR hCursor )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_DESTROYCURSOR, 1 );
    cs.arg0 = (DWORD)hCursor ;
    return (DWORD)CALL_SERVER( &cs );
#else

	PGDI_DESTROYCURSOR pDestroyCursor;// = (PGDI_DESTROYCURSOR)lpGDIAPI[GDI_DESTROYCURSOR];

	BOOL  bRetv = FALSE;
    CALLSTACK cs;
	if( API_Enter( API_GDI, GDI_DESTROYCURSOR, &pDestroyCursor, &cs ) )
	{
		bRetv = pDestroyCursor( hCursor );
		API_Leave(  );
	}
	return bRetv;
#endif
}
 
typedef BOOL ( WINAPI * PGDI_GETICONINFO )( HICON hIcon, LPICONINFO lpiconInfo);
BOOL WINAPI Gdi_GetIconInfo( HICON hIcon, LPICONINFO lpiconInfo)
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_GETICONINFO, 2 );
    cs.arg0 = (DWORD)hIcon;
    return (DWORD)CALL_SERVER( &cs, lpiconInfo );
#else

	PGDI_GETICONINFO pGetIconInfo;// = (PGDI_GETICONINFO)lpGDIAPI[GDI_GETICONINFO];

	BOOL  bRetv = FALSE;
    CALLSTACK cs;
	if( API_Enter( API_GDI, GDI_GETICONINFO, &pGetIconInfo, &cs ) )
	{
		lpiconInfo = MapProcessPtr( lpiconInfo, (LPPROCESS)cs.lpvData );

		bRetv = pGetIconInfo( hIcon, lpiconInfo );
		API_Leave(  );
	}
	return bRetv;
#endif
}

typedef  ( WINAPI * PGDI_GETOBJECTTYPE )( HGDIOBJ handle );
DWORD WINAPI Gdi_GetObjectType( HGDIOBJ handle )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_GETOBJECTTYPE, 1 );
    cs.arg0 = (DWORD)handle ;
    return (DWORD)CALL_SERVER( &cs );
#else

	PGDI_GETOBJECTTYPE pGetObjectType;// = (PGDI_GETOBJECTTYPE)lpGDIAPI[GDI_GETOBJECTTYPE];

	DWORD  dwRetv = 0;
    CALLSTACK cs;
	if( API_Enter( API_GDI, GDI_GETOBJECTTYPE, &pGetObjectType, &cs ) )
	{
		dwRetv = pGetObjectType( handle );
		API_Leave(  );
	}
	return dwRetv;
#endif
}

typedef int ( WINAPI * PGDI_GETOBJECTINFO )( HGDIOBJ handle, int nSize, LPVOID lpvBuf );
int WINAPI Gdi_GetObjectInfo( HGDIOBJ handle, int nSize, LPVOID lpvBuf )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_GETOBJECTINFO, 3 );
    cs.arg0 = (DWORD)handle;
    return (DWORD)CALL_SERVER( &cs, nSize, lpvBuf );
#else

	PGDI_GETOBJECTINFO pGetObjectInfo;// = (PGDI_GETOBJECTINFO)lpGDIAPI[GDI_GETOBJECTINFO];

	int  iRetv = 0;
    CALLSTACK cs;
	if( API_Enter( API_GDI, GDI_GETOBJECTINFO, &pGetObjectInfo, &cs ) )
	{
		lpvBuf = MapProcessPtr( lpvBuf, (LPPROCESS)cs.lpvData );

		iRetv = pGetObjectInfo( handle, nSize, lpvBuf );
		API_Leave(  );
	}
	return iRetv;
#endif
}

typedef COLORREF ( WINAPI * PGDI_GETPIXEL )( HDC, int x, int y );
COLORREF WINAPI Gdi_GetPixel( HDC hdc, int x, int y )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_GETPIXEL, 3 );
    cs.arg0 = (DWORD)hdc;
    return (DWORD)CALL_SERVER( &cs, x, y );
#else

	PGDI_GETPIXEL pGetPixel;// = (PGDI_GETPIXEL)lpGDIAPI[GDI_GETPIXEL];

	COLORREF clRetv = CLR_INVALID;
    CALLSTACK cs;
	if( API_Enter( API_GDI, GDI_GETPIXEL, &pGetPixel, &cs ) )
	{
		clRetv = pGetPixel( hdc, x, y );
		API_Leave(  );
	}
	return clRetv;
#endif
}

typedef int ( WINAPI * PGDI_GETROP2 )( HDC );
int WINAPI Gdi_GetROP2( HDC hdc )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_GETROP2, 1 );
    cs.arg0 = (DWORD)hdc ;
    return (DWORD)CALL_SERVER( &cs );
#else

	PGDI_GETROP2 pGetROP2;// = (PGDI_GETROP2)lpGDIAPI[GDI_GETROP2];

	int  iRetv = 0;
    CALLSTACK cs;
	if( API_Enter( API_GDI, GDI_GETROP2, &pGetROP2, &cs ) )
	{
		iRetv = pGetROP2( hdc );
		API_Leave(  );
	}
	return iRetv;
#endif
}

typedef COLORREF ( WINAPI * PGDI_GETTEXTCOLOR )( HDC );
COLORREF WINAPI Gdi_GetTextColor( HDC hdc )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_GETTEXTCOLOR, 1 );
    cs.arg0 = (DWORD)hdc ;
    return (DWORD)CALL_SERVER( &cs );
#else

	PGDI_GETTEXTCOLOR pGetTextColor;// = (PGDI_GETTEXTCOLOR)lpGDIAPI[GDI_GETTEXTCOLOR];

	COLORREF clRetv = CLR_INVALID;
    CALLSTACK cs;
	if( API_Enter( API_GDI, GDI_GETTEXTCOLOR, &pGetTextColor, &cs ) )
	{
		clRetv = pGetTextColor( hdc );
		API_Leave(  );
	}
	return clRetv;
#endif
}

typedef UINT ( WINAPI * PGDI_GETTEXTALIGN )( HDC );
UINT WINAPI Gdi_GetTextAlign( HDC hdc )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_GETTEXTALIGN, 1 );
    cs.arg0 = (DWORD)hdc ;
    return (DWORD)CALL_SERVER( &cs );
#else

	PGDI_GETTEXTALIGN pfn;// = (PGDI_GETTEXTCOLOR)lpGDIAPI[GDI_GETTEXTCOLOR];

	UINT retv = GDI_ERROR;
    CALLSTACK cs;

	if( API_Enter( API_GDI, GDI_GETTEXTALIGN, &pfn, &cs ) )
	{
		retv = pfn( hdc );
		API_Leave(  );
	}
	return retv;
#endif
}


typedef BOOL ( WINAPI * PGDI_GETTEXTEXTENTPOINT32 )( HDC hdc, LPCTSTR lpcstr, int nLength, LPSIZE lpSize );
BOOL WINAPI Gdi_GetTextExtentPoint32( HDC hdc, 
								    LPCTSTR lpcstr, 
									int nLength, 
									LPSIZE lpSize )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_GETTEXTEXTENTPOINT32, 4 );
    cs.arg0 = (DWORD)hdc;
    return (DWORD)CALL_SERVER( &cs, lpcstr, nLength, lpSize );
#else

	PGDI_GETTEXTEXTENTPOINT32 pGetTextExtentPoint32;

	BOOL  bRetv = FALSE;
    CALLSTACK cs;
	if( API_Enter( API_GDI, GDI_GETTEXTEXTENTPOINT32, &pGetTextExtentPoint32, &cs ) )
	{
		lpcstr = MapProcessPtr( lpcstr, (LPPROCESS)cs.lpvData );
		lpSize = MapProcessPtr( lpSize, (LPPROCESS)cs.lpvData );

		bRetv = pGetTextExtentPoint32( hdc, lpcstr, nLength, lpSize );
		API_Leave(  );
	}
	return bRetv;
#endif
}

typedef BOOL ( WINAPI * PGDI_GETTEXTEXTENTEXPOINT )( HDC hdc, LPCTSTR lpcstr, int nLength, int nMaxWidth, LPINT lpFitCharNum, LPINT lpGroupWidth, LPSIZE lpSize );
BOOL WINAPI Gdi_GetTextExtentExPoint( HDC hdc, 
									  LPCTSTR lpcstr, 
									  int nLength, 
									  int nMaxWidth, 
									  LPINT lpFitCharNum, 
									  LPINT lpGroupWidth, 
									  LPSIZE lpSize )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_GETTEXTEXTENTEXPOINT, 7 );
    cs.arg0 = (DWORD)hdc;
    return (DWORD)CALL_SERVER( &cs, lpcstr, nLength, nMaxWidth, lpFitCharNum, lpGroupWidth, lpSize );
#else

	PGDI_GETTEXTEXTENTEXPOINT pGetTextExtentExPoint;// = (PGDI_GETTEXTEXTENTEXPOINT)lpGDIAPI[GDI_GETTEXTEXTENTEXPOINT];

	BOOL  bRetv = FALSE;
    CALLSTACK cs;
	if( API_Enter( API_GDI, GDI_GETTEXTEXTENTEXPOINT, &pGetTextExtentExPoint, &cs ) )
	{
		lpcstr = MapProcessPtr( lpcstr, (LPPROCESS)cs.lpvData );
		lpFitCharNum = MapProcessPtr( lpFitCharNum, (LPPROCESS)cs.lpvData );
		lpGroupWidth = MapProcessPtr( lpGroupWidth, (LPPROCESS)cs.lpvData );
		lpSize = MapProcessPtr( lpSize, (LPPROCESS)cs.lpvData );

		bRetv = pGetTextExtentExPoint( hdc, lpcstr, nLength, nMaxWidth, lpFitCharNum, lpGroupWidth, lpSize );
		API_Leave(  );
	}
	return bRetv;
#endif
}

typedef BOOL ( WINAPI * PGDI_GETVIEWPORTORG )( HDC hdc, LPPOINT lpPoint );
BOOL WINAPI Gdi_GetViewportOrg( HDC hdc, LPPOINT lpPoint )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_GETVIEWPORTORG, 2 );
    cs.arg0 = (DWORD)hdc;
    return (DWORD)CALL_SERVER( &cs, lpPoint );
#else

	PGDI_GETVIEWPORTORG pGetViewportOrg ;//= (PGDI_GETVIEWPORTORG)lpGDIAPI[GDI_GETVIEWPORTORG];

	BOOL  bRetv = FALSE;
    CALLSTACK cs;

	if( API_Enter( API_GDI, GDI_GETVIEWPORTORG, &pGetViewportOrg, &cs ) )
	{
		lpPoint = MapProcessPtr( lpPoint, (LPPROCESS)cs.lpvData );

		bRetv = pGetViewportOrg( hdc, lpPoint );
		API_Leave(  );
	}
	return bRetv;

#endif
}

typedef BOOL ( WINAPI * PGDI_GETWINDOWORG )( HDC hdc, LPPOINT lpPoint );
BOOL WINAPI Gdi_GetWindowOrg( HDC hdc, LPPOINT lpPoint )
{
#ifdef CALL_TRAP
    CALLTRAP cs;
    cs.apiInfo = CALL_API( API_GDI, GDI_GETWINDOWORG, 2 );
    cs.arg0 = (DWORD)hdc;
    return (DWORD)CALL_SERVER( &cs, lpPoint );
#else

	PGDI_GETWINDOWORG pGetWindowOrg;//= (PGDI_GETWINDOWORG)lpGDIAPI[GDI_GETWINDOWORG];

	BOOL  bRetv = FALSE;
	CALLSTACK cs;

	if( API_Enter( API_GDI, GDI_GETWINDOWORG, &pGetWindowOrg, &cs ) )
	{
		lpPoint = MapProcessPtr( lpPoint, (LPPROCESS)cs.lpvData );

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?