mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 06:53:37 +00:00

- Fix memory overwrite in NtGdiGetCharWidth32() Fixes bug #258 svn path=/trunk/; revision=8845
615 lines
8.9 KiB
C
615 lines
8.9 KiB
C
/* $Id: stubsa.c,v 1.29 2004/03/23 07:59:47 gvg Exp $
|
|
*
|
|
* reactos/lib/gdi32/misc/stubs.c
|
|
*
|
|
* GDI32.DLL Stubs for ANSI functions
|
|
*
|
|
* When you implement one of these functions,
|
|
* remove its stub from this file.
|
|
*
|
|
*/
|
|
#ifdef UNICODE
|
|
#undef UNICODE
|
|
#endif
|
|
|
|
#undef WIN32_LEAN_AND_MEAN
|
|
#include <windows.h>
|
|
#include <ddk/ntddk.h>
|
|
#include <win32k/text.h>
|
|
#include <win32k/dc.h>
|
|
#include <rosrtl/devmode.h>
|
|
#include <rosrtl/logfont.h>
|
|
#include <internal/heap.h>
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
int
|
|
STDCALL
|
|
AddFontResourceExA ( LPCSTR lpszFilename, DWORD fl, PVOID pvReserved )
|
|
{
|
|
NTSTATUS Status;
|
|
PWSTR FilenameW;
|
|
int rc = 0;
|
|
|
|
Status = HEAP_strdupA2W ( &FilenameW, lpszFilename );
|
|
if ( !NT_SUCCESS (Status) )
|
|
SetLastError (RtlNtStatusToDosError(Status));
|
|
else
|
|
{
|
|
rc = AddFontResourceExW ( FilenameW, fl, pvReserved );
|
|
|
|
HEAP_free ( &FilenameW );
|
|
}
|
|
return rc;
|
|
}
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
int
|
|
STDCALL
|
|
AddFontResourceA ( LPCSTR lpszFilename )
|
|
{
|
|
return AddFontResourceExA ( lpszFilename, 0, 0 );
|
|
}
|
|
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
HDC
|
|
STDCALL
|
|
CreateICA(
|
|
LPCSTR lpszDriver,
|
|
LPCSTR lpszDevice,
|
|
LPCSTR lpszOutput,
|
|
CONST DEVMODEA * lpdvmInit
|
|
)
|
|
{
|
|
NTSTATUS Status;
|
|
LPWSTR lpszDriverW, lpszDeviceW, lpszOutputW;
|
|
UNICODE_STRING Driver, Device, Output;
|
|
DEVMODEW dvmInitW;
|
|
HDC rc = 0;
|
|
|
|
Status = HEAP_strdupA2W ( &lpszDriverW, lpszDriver );
|
|
if (!NT_SUCCESS (Status))
|
|
SetLastError (RtlNtStatusToDosError(Status));
|
|
else
|
|
{
|
|
Status = HEAP_strdupA2W ( &lpszDeviceW, lpszDevice );
|
|
if (!NT_SUCCESS (Status))
|
|
SetLastError (RtlNtStatusToDosError(Status));
|
|
else
|
|
{
|
|
Status = HEAP_strdupA2W ( &lpszOutputW, lpszOutput );
|
|
if (!NT_SUCCESS (Status))
|
|
SetLastError (RtlNtStatusToDosError(Status));
|
|
else
|
|
{
|
|
if ( lpdvmInit )
|
|
RosRtlDevModeA2W ( &dvmInitW, (const LPDEVMODEA)lpdvmInit );
|
|
|
|
RtlInitUnicodeString(&Driver, lpszDriverW);
|
|
RtlInitUnicodeString(&Device, lpszDeviceW);
|
|
RtlInitUnicodeString(&Output, lpszOutputW);
|
|
rc = NtGdiCreateIC ( &Driver,
|
|
&Device,
|
|
&Output,
|
|
lpdvmInit ? &dvmInitW : NULL );
|
|
|
|
HEAP_free ( lpszOutputW );
|
|
}
|
|
HEAP_free ( lpszDeviceW );
|
|
}
|
|
HEAP_free ( lpszDriverW );
|
|
}
|
|
return rc;
|
|
}
|
|
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
BOOL
|
|
STDCALL
|
|
CreateScalableFontResourceA(
|
|
DWORD fdwHidden,
|
|
LPCSTR lpszFontRes,
|
|
LPCSTR lpszFontFile,
|
|
LPCSTR lpszCurrentPath
|
|
)
|
|
{
|
|
NTSTATUS Status;
|
|
LPWSTR lpszFontResW, lpszFontFileW, lpszCurrentPathW;
|
|
BOOL rc = FALSE;
|
|
|
|
Status = HEAP_strdupA2W ( &lpszFontResW, lpszFontRes );
|
|
if (!NT_SUCCESS (Status))
|
|
SetLastError (RtlNtStatusToDosError(Status));
|
|
else
|
|
{
|
|
Status = HEAP_strdupA2W ( &lpszFontFileW, lpszFontFile );
|
|
if (!NT_SUCCESS (Status))
|
|
SetLastError (RtlNtStatusToDosError(Status));
|
|
else
|
|
{
|
|
Status = HEAP_strdupA2W ( &lpszCurrentPathW, lpszCurrentPath );
|
|
if (!NT_SUCCESS (Status))
|
|
SetLastError (RtlNtStatusToDosError(Status));
|
|
else
|
|
{
|
|
rc = NtGdiCreateScalableFontResource ( fdwHidden,
|
|
lpszFontResW,
|
|
lpszFontFileW,
|
|
lpszCurrentPathW );
|
|
|
|
HEAP_free ( lpszCurrentPathW );
|
|
}
|
|
|
|
HEAP_free ( lpszFontFileW );
|
|
}
|
|
|
|
HEAP_free ( lpszFontResW );
|
|
}
|
|
return rc;
|
|
}
|
|
|
|
|
|
/*
|
|
* @unimplemented
|
|
*/
|
|
int
|
|
STDCALL
|
|
DeviceCapabilitiesExA(
|
|
LPCSTR pDevice,
|
|
LPCSTR pPort,
|
|
WORD fwCapability,
|
|
LPSTR pOutput,
|
|
CONST DEVMODEA *pDevMode
|
|
)
|
|
{
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
return 0;
|
|
}
|
|
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
int
|
|
STDCALL
|
|
EnumFontsA (
|
|
HDC hDC,
|
|
LPCSTR lpFaceName,
|
|
FONTENUMPROCA FontFunc,
|
|
LPARAM lParam
|
|
)
|
|
{
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
return 0;
|
|
#if 0
|
|
NTSTATUS Status;
|
|
LPWSTR lpFaceNameW;
|
|
int rc = 0;
|
|
|
|
Status = HEAP_strdupA2W ( &lpFaceNameW, lpFaceName );
|
|
if (!NT_SUCCESS (Status))
|
|
SetLastError (RtlNtStatusToDosError(Status));
|
|
else
|
|
{
|
|
rc = NtGdiEnumFonts ( hDC, lpFaceNameW, FontFunc, lParam );
|
|
|
|
HEAP_free ( lpFaceNameW );
|
|
}
|
|
return rc;
|
|
#endif
|
|
}
|
|
|
|
|
|
/*
|
|
* @unimplemented
|
|
*/
|
|
BOOL
|
|
APIENTRY
|
|
GetCharWidthFloatA(
|
|
HDC hdc,
|
|
UINT iFirstChar,
|
|
UINT iLastChar,
|
|
PFLOAT pxBuffer
|
|
)
|
|
{
|
|
/* FIXME what to do with iFirstChar and iLastChar ??? */
|
|
return NtGdiGetCharWidthFloat ( hdc, iFirstChar, iLastChar, pxBuffer );
|
|
}
|
|
|
|
|
|
/*
|
|
* @unimplemented
|
|
*/
|
|
BOOL
|
|
APIENTRY
|
|
GetCharABCWidthsA(
|
|
HDC hdc,
|
|
UINT uFirstChar,
|
|
UINT uLastChar,
|
|
LPABC lpabc
|
|
)
|
|
{
|
|
/* FIXME what to do with uFirstChar and uLastChar ??? */
|
|
return NtGdiGetCharABCWidths ( hdc, uFirstChar, uLastChar, lpabc );
|
|
}
|
|
|
|
|
|
/*
|
|
* @unimplemented
|
|
*/
|
|
BOOL
|
|
APIENTRY
|
|
GetCharABCWidthsFloatA(
|
|
HDC hdc,
|
|
UINT iFirstChar,
|
|
UINT iLastChar,
|
|
LPABCFLOAT lpABCF
|
|
)
|
|
{
|
|
/* FIXME what to do with iFirstChar and iLastChar ??? */
|
|
return NtGdiGetCharABCWidthsFloat ( hdc, iFirstChar, iLastChar, lpABCF );
|
|
}
|
|
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
DWORD
|
|
STDCALL
|
|
GetGlyphOutlineA(
|
|
HDC hdc,
|
|
UINT uChar,
|
|
UINT uFormat,
|
|
LPGLYPHMETRICS lpgm,
|
|
DWORD cbBuffer,
|
|
LPVOID lpvBuffer,
|
|
CONST MAT2 *lpmat2
|
|
)
|
|
{
|
|
return NtGdiGetGlyphOutline ( hdc, uChar, uFormat, lpgm, cbBuffer, lpvBuffer, (CONST LPMAT2)lpmat2 );
|
|
}
|
|
|
|
|
|
/*
|
|
* @unimplemented
|
|
*/
|
|
UINT
|
|
APIENTRY
|
|
GetOutlineTextMetricsA(
|
|
HDC hdc,
|
|
UINT cbData,
|
|
LPOUTLINETEXTMETRICA lpOTM
|
|
)
|
|
{
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
return 0;
|
|
}
|
|
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
BOOL
|
|
APIENTRY
|
|
GetTextExtentExPointA(
|
|
HDC hdc,
|
|
LPCSTR lpszStr,
|
|
int cchString,
|
|
int nMaxExtent,
|
|
LPINT lpnFit,
|
|
LPINT alpDx,
|
|
LPSIZE lpSize
|
|
)
|
|
{
|
|
NTSTATUS Status;
|
|
LPWSTR lpszStrW;
|
|
BOOL rc = 0;
|
|
|
|
Status = HEAP_strdupA2W ( &lpszStrW, lpszStr );
|
|
if (!NT_SUCCESS (Status))
|
|
SetLastError (RtlNtStatusToDosError(Status));
|
|
else
|
|
{
|
|
rc = NtGdiGetTextExtentExPoint (
|
|
hdc, lpszStrW, cchString, nMaxExtent, lpnFit, alpDx, lpSize );
|
|
|
|
HEAP_free ( lpszStrW );
|
|
}
|
|
|
|
return rc;
|
|
}
|
|
|
|
|
|
/*
|
|
* @unimplemented
|
|
*/
|
|
DWORD
|
|
STDCALL
|
|
GetCharacterPlacementA(
|
|
HDC hDc,
|
|
LPCSTR a1,
|
|
int a2,
|
|
int a3,
|
|
LPGCP_RESULTSA a4,
|
|
DWORD a5
|
|
)
|
|
{
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
return 0;
|
|
}
|
|
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
HDC
|
|
STDCALL
|
|
ResetDCA(
|
|
HDC hdc,
|
|
CONST DEVMODEA *lpInitData
|
|
)
|
|
{
|
|
DEVMODEW InitDataW;
|
|
|
|
RosRtlDevModeA2W ( &InitDataW, (CONST LPDEVMODEA)lpInitData );
|
|
|
|
return NtGdiResetDC ( hdc, &InitDataW );
|
|
}
|
|
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
BOOL
|
|
STDCALL
|
|
RemoveFontResourceA(
|
|
LPCSTR lpFileName
|
|
)
|
|
{
|
|
NTSTATUS Status;
|
|
LPWSTR lpFileNameW;
|
|
BOOL rc = 0;
|
|
|
|
Status = HEAP_strdupA2W ( &lpFileNameW, lpFileName );
|
|
if (!NT_SUCCESS (Status))
|
|
SetLastError (RtlNtStatusToDosError(Status));
|
|
else
|
|
{
|
|
rc = NtGdiRemoveFontResource ( lpFileNameW );
|
|
|
|
HEAP_free ( lpFileNameW );
|
|
}
|
|
|
|
return rc;
|
|
}
|
|
|
|
|
|
/*
|
|
* @unimplemented
|
|
*/
|
|
int
|
|
STDCALL
|
|
StartDocA(
|
|
HDC hdc,
|
|
CONST DOCINFOA *a1
|
|
)
|
|
{
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
return 0;
|
|
}
|
|
|
|
|
|
/*
|
|
* @unimplemented
|
|
*/
|
|
int
|
|
STDCALL
|
|
GetObjectA(
|
|
HGDIOBJ a0,
|
|
int a1,
|
|
LPVOID a2
|
|
)
|
|
{
|
|
return NtGdiGetObject ( a0, a1, a2 );
|
|
}
|
|
|
|
|
|
/*
|
|
* @unimplemented
|
|
*/
|
|
BOOL
|
|
STDCALL
|
|
PolyTextOutA(
|
|
HDC hdc,
|
|
CONST POLYTEXTA *a1,
|
|
int a2
|
|
)
|
|
{
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
return FALSE;
|
|
}
|
|
|
|
|
|
/*
|
|
* @unimplemented
|
|
*/
|
|
int
|
|
STDCALL
|
|
GetTextFaceA(
|
|
HDC a0,
|
|
int a1,
|
|
LPSTR a2
|
|
)
|
|
{
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
return FALSE;
|
|
}
|
|
|
|
|
|
/*
|
|
* @unimplemented
|
|
*/
|
|
DWORD
|
|
STDCALL
|
|
GetKerningPairsA(
|
|
HDC a0,
|
|
DWORD a1,
|
|
LPKERNINGPAIR a2
|
|
)
|
|
{
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
return 0;
|
|
}
|
|
|
|
|
|
/*
|
|
* @unimplemented
|
|
*/
|
|
BOOL
|
|
STDCALL
|
|
GetLogColorSpaceA(
|
|
HCOLORSPACE a0,
|
|
LPLOGCOLORSPACEA a1,
|
|
DWORD a2
|
|
)
|
|
{
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
return FALSE;
|
|
}
|
|
|
|
|
|
/*
|
|
* @unimplemented
|
|
*/
|
|
HCOLORSPACE
|
|
STDCALL
|
|
CreateColorSpaceA(
|
|
LPLOGCOLORSPACEA a0
|
|
)
|
|
{
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
return 0;
|
|
}
|
|
|
|
|
|
/*
|
|
* @unimplemented
|
|
*/
|
|
BOOL
|
|
STDCALL
|
|
GetICMProfileA(
|
|
HDC a0,
|
|
DWORD a1, /* MS says LPDWORD! */
|
|
LPSTR a2
|
|
)
|
|
{
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
return FALSE;
|
|
}
|
|
|
|
|
|
/*
|
|
* @unimplemented
|
|
*/
|
|
BOOL
|
|
STDCALL
|
|
SetICMProfileA(
|
|
HDC a0,
|
|
LPSTR a1
|
|
)
|
|
{
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
return FALSE;
|
|
}
|
|
|
|
|
|
/*
|
|
* @unimplemented
|
|
*/
|
|
int
|
|
STDCALL
|
|
EnumICMProfilesA(
|
|
HDC a0,
|
|
ICMENUMPROCA a1,
|
|
LPARAM a2
|
|
)
|
|
{
|
|
/*
|
|
* FIXME - call NtGdiEnumICMProfiles with NULL for lpstrBuffer
|
|
* to find out how big a buffer we need. Then allocate that buffer
|
|
* and call NtGdiEnumICMProfiles again to have the buffer filled.
|
|
*
|
|
* Finally, step through the buffer ( MULTI-SZ recommended for format ),
|
|
* and convert each string to ANSI, calling the user's callback function
|
|
* until we run out of strings or the user returns FALSE
|
|
*/
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
return 0;
|
|
}
|
|
|
|
|
|
/*
|
|
* @unimplemented
|
|
*/
|
|
BOOL
|
|
STDCALL
|
|
wglUseFontBitmapsA(
|
|
HDC a0,
|
|
DWORD a1,
|
|
DWORD a2,
|
|
DWORD a3
|
|
)
|
|
{
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
return FALSE;
|
|
}
|
|
|
|
|
|
/*
|
|
* @unimplemented
|
|
*/
|
|
BOOL
|
|
STDCALL
|
|
wglUseFontOutlinesA(
|
|
HDC a0,
|
|
DWORD a1,
|
|
DWORD a2,
|
|
DWORD a3,
|
|
FLOAT a4,
|
|
FLOAT a5,
|
|
int a6,
|
|
LPGLYPHMETRICSFLOAT a7
|
|
)
|
|
{
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
return FALSE;
|
|
}
|
|
|
|
|
|
/*
|
|
* @unimplemented
|
|
*/
|
|
BOOL
|
|
STDCALL
|
|
UpdateICMRegKeyA(
|
|
DWORD a0,
|
|
DWORD a1,
|
|
LPSTR a2,
|
|
UINT a3
|
|
)
|
|
{
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
return FALSE;
|
|
}
|
|
|
|
|
|
/* EOF */
|