Compare commits

...

6 Commits

Author SHA1 Message Date
Aleksey Bragin
0eab87cfa8 - Sync Win32k's DIB code with trunk.
svn path=/branches/win32k-stable/; revision=29710
2007-10-20 13:48:16 +00:00
Aleksey Bragin
d5fb3386c7 - Merge 21563, 21589, 21652, 21794.
svn path=/branches/win32k-stable/; revision=29708
2007-10-20 13:41:15 +00:00
Aleksey Bragin
5560ca60ce - Merge 29405 (memory-overwrite in region.c bugfix) from trunk.
svn path=/branches/win32k-stable/; revision=29457
2007-10-08 12:54:07 +00:00
Aleksey Bragin
2ea501aa53 - Remove excessive debug output.
svn path=/branches/win32k-stable/; revision=29442
2007-10-07 19:12:05 +00:00
Aleksey Bragin
4fdfb75e69 - Inspired by 22169:
* Update GetRegistryPath
* Get SetupDevMode from trunk's 29435 dc.c
* Copy GetVideoDeviceName and IntChangeDisplaySettings from trunk's 29435 dc.c
- This solves the weird font + video mode issues (vmware video driver, for example) in this branch.

svn path=/branches/win32k-stable/; revision=29436
2007-10-07 13:11:34 +00:00
Aleksey Bragin
dc133fd970 - Take win32k, gdi32 and user32 from revision 21459 and fix their kernel interface and internal Ob-related routines so that they work with the modern kernel.
- Interface looks ugly, and it's mainly intended for regression testing (what worked "back then", and what does not work "now").
- OS installs and runs, AbiWord installs and runs.

svn path=/branches/win32k-stable/; revision=29429
2007-10-06 21:48:36 +00:00
223 changed files with 18659 additions and 31139 deletions

View File

@@ -3,6 +3,7 @@
; gdi32.def ; gdi32.def
; ;
; ReactOS Operating System ; ReactOS Operating System
;
; From Anders Norlander's w32api-0.1.5 gdi32.def. ; From Anders Norlander's w32api-0.1.5 gdi32.def.
; ;
LIBRARY gdi32.dll LIBRARY gdi32.dll
@@ -13,55 +14,55 @@ AddFontMemResourceEx@16
AddFontResourceA@4 AddFontResourceA@4
AddFontResourceExA@12 AddFontResourceExA@12
AddFontResourceExW@12 AddFontResourceExW@12
AddFontResourceTracking@8
AddFontResourceW@4 AddFontResourceW@4
AddFontResourceTracking@8
AngleArc@24 AngleArc@24
AnimatePalette@16 AnimatePalette@16=NtGdiAnimatePalette@16
AnyLinkedFonts@0=NtGdiAnyLinkedFonts@0 AnyLinkedFonts@0
Arc@36 Arc@36=NtGdiArc@36
ArcTo@36 ArcTo@36=NtGdiArcTo@36
BRUSHOBJ_hGetColorTransform@4=NtGdiBRUSHOBJ_hGetColorTransform@4
BRUSHOBJ_pvAllocRbrush@8=NtGdiBRUSHOBJ_pvAllocRbrush@8
BRUSHOBJ_pvGetRbrush@4=NtGdiBRUSHOBJ_pvGetRbrush@4
BRUSHOBJ_ulGetBrushColor@4=NtGdiBRUSHOBJ_ulGetBrushColor@4
BeginPath@4 BeginPath@4
BRUSHOBJ_hGetColorTransform@4
BRUSHOBJ_pvAllocRbrush@8
BRUSHOBJ_pvGetRbrush@4
BRUSHOBJ_ulGetBrushColor@4
BitBlt@36 BitBlt@36
CLIPOBJ_bEnum@12=NtGdiCLIPOBJ_bEnum@12
CLIPOBJ_cEnumStart@20=NtGdiCLIPOBJ_cEnumStart@20
CLIPOBJ_ppoGetPath@4=NtGdiCLIPOBJ_ppoGetPath@4
CancelDC@4 CancelDC@4
CheckColorsInGamut@16 CheckColorsInGamut@16
ChoosePixelFormat@8 ChoosePixelFormat@8
Chord@36 Chord@36
ClearBitmapAttributes@8 ClearBitmapAttributes@8
ClearBrushAttributes@8 ClearBrushAttributes@8
CLIPOBJ_bEnum@12
CLIPOBJ_cEnumStart@20
CLIPOBJ_ppoGetPath@4
CloseEnhMetaFile@4 CloseEnhMetaFile@4
CloseFigure@4 CloseFigure@4
CloseMetaFile@4 CloseMetaFile@4
ColorCorrectPalette@16 ColorCorrectPalette@16
ColorMatchToTarget@12 ColorMatchToTarget@12
CombineRgn@16 CombineRgn@16=NtGdiCombineRgn@16
CombineTransform@12=NtGdiCombineTransform@12 CombineTransform@12=NtGdiCombineTransform@12
CopyEnhMetaFileA@8 CopyEnhMetaFileA@8
CopyEnhMetaFileW@8 CopyEnhMetaFileW@8
CopyMetaFileA@8 CopyMetaFileA@8
CopyMetaFileW@8 CopyMetaFileW@8
CreateBitmap@20 CreateBitmap@20=NtGdiCreateBitmap@20
CreateBitmapIndirect@4 CreateBitmapIndirect@4=NtGdiCreateBitmapIndirect@4
CreateBrushIndirect@4 CreateBrushIndirect@4
CreateColorSpaceA@4 CreateColorSpaceA@4
CreateColorSpaceW@4 CreateColorSpaceW@4
CreateCompatibleBitmap@12 CreateCompatibleBitmap@12=NtGdiCreateCompatibleBitmap@12
CreateCompatibleDC@4 CreateCompatibleDC@4=NtGdiCreateCompatibleDC@4
CreateDCA@16 CreateDCA@16
CreateDCW@16 CreateDCW@16
CreateDIBPatternBrush@8 CreateDIBPatternBrush@8
CreateDIBPatternBrushPt@8 CreateDIBPatternBrushPt@8
CreateDIBSection@24 CreateDIBSection@24
CreateDIBitmap@24 CreateDIBitmap@24=NtGdiCreateDIBitmap@24
CreateDiscardableBitmap@12 CreateDiscardableBitmap@12=NtGdiCreateDiscardableBitmap@12
CreateEllipticRgn@16=NtGdiCreateEllipticRgn@16 CreateEllipticRgn@16=NtGdiCreateEllipticRgn@16
CreateEllipticRgnIndirect@4 CreateEllipticRgnIndirect@4=NtGdiCreateEllipticRgnIndirect@4
CreateEnhMetaFileA@16 CreateEnhMetaFileA@16
CreateEnhMetaFileW@16 CreateEnhMetaFileW@16
CreateFontA@56 CreateFontA@56
@@ -76,31 +77,46 @@ CreateICA@16
CreateICW@16 CreateICW@16
CreateMetaFileA@4 CreateMetaFileA@4
CreateMetaFileW@4 CreateMetaFileW@4
CreatePalette@4 CreatePalette@4=NtGdiCreatePalette@4
CreatePatternBrush@4 CreatePatternBrush@4
CreatePen@12 CreatePen@12=NtGdiCreatePen@12
CreatePenIndirect@4 CreatePenIndirect@4=NtGdiCreatePenIndirect@4
CreatePolyPolygonRgn@16 CreatePolyPolygonRgn@16=NtGdiCreatePolyPolygonRgn@16
CreatePolygonRgn@12 CreatePolygonRgn@12=NtGdiCreatePolygonRgn@12
CreateRectRgn@16 CreateRectRgn@16=NtGdiCreateRectRgn@16
CreateRectRgnIndirect@4 CreateRectRgnIndirect@4=NtGdiCreateRectRgnIndirect@4
CreateRoundRectRgn@24=NtGdiCreateRoundRectRgn@24 CreateRoundRectRgn@24=NtGdiCreateRoundRectRgn@24
CreateScalableFontResourceA@16 CreateScalableFontResourceA@16
CreateScalableFontResourceW@16 CreateScalableFontResourceW@16
CreateSolidBrush@4 CreateSolidBrush@4
DPtoLP@12 DPtoLP@12=NtGdiDPtoLP@12
DdEntry0@24=NtGdiDxgGenericThunk@24 DeleteColorSpace@4
DeleteDC@4=NtGdiDeleteObjectApp@4
DeleteEnhMetaFile@4
DeleteMetaFile@4
DeleteObject@4
DescribePixelFormat@16
DeviceCapabilitiesExA@20
DeviceCapabilitiesExW@20
DdEntry1@16=NtGdiD3dContextCreate@16
DdEntry2@4=NtGdiD3dContextDestroy@4
DdEntry3@4=NtGdiD3dContextDestroy@4
DdEntry4@4=NtGdiD3dValidateTextureStageState@4
DdEntry5@28=NtGdiD3dDrawPrimitives2@28
DdEntry6@4=NtGdiDdGetDriverState@4
DdEntry7@12=NtGdiDdAddAttachedSurface@12
DdEntry8@12=NtGdiDdAlphaBlt@12
DdEntry9@8=NtGdiDdAttachSurface@8
DdEntry10@8=NtGdiDdBeginMoCompFrame@8 DdEntry10@8=NtGdiDdBeginMoCompFrame@8
DdEntry11@12=NtGdiDdBlt@12 DdEntry11@12=NtGdiDdBlt@12
DdEntry12@8=NtGdiDdCanCreateSurface@8
DdEntry13@8=NtGdiDdCanCreateD3DBuffer@8 DdEntry13@8=NtGdiDdCanCreateD3DBuffer@8
DdEntry12@8=NtGdiDdCanCreateSurface@8
DdEntry14@8=NtGdiDdColorControl@8 DdEntry14@8=NtGdiDdColorControl@8
DdEntry15@4=NtGdiDdCreateDirectDrawObject@4 DdEntry15@4=NtGdiDdCreateDirectDrawObject@4
DdEntry16@32=NtGdiDdCreateSurface@32 DdEntry16@32=NtGdiDdCreateSurface@32
DdEntry17@32=NtGdiDdCreateD3DBuffer@32 DdEntry17@32=NtGdiDdCreateD3DBuffer@32
DdEntry18@8=NtGdiDdCreateMoComp@8 DdEntry18@8=NtGdiDdCreateMoComp@8
DdEntry19@24=NtGdiDdCreateSurfaceObject@24 DdEntry19@24=NtGdiDdCreateSurfaceObject@24
DdEntry1@16=NtGdiD3dContextCreate@16
DdEntry20@4=NtGdiDdDeleteDirectDrawObject@4 DdEntry20@4=NtGdiDdDeleteDirectDrawObject@4
DdEntry21@4=NtGdiDdDeleteSurfaceObject@4 DdEntry21@4=NtGdiDdDeleteSurfaceObject@4
DdEntry22@8=NtGdiDdDestroyMoComp@8 DdEntry22@8=NtGdiDdDestroyMoComp@8
@@ -111,7 +127,6 @@ DdEntry26@20=NtGdiDdFlip@20
DdEntry27@8=NtGdiDdFlipToGDISurface@8 DdEntry27@8=NtGdiDdFlipToGDISurface@8
DdEntry28@8=NtGdiDdGetAvailDriverMemory@8 DdEntry28@8=NtGdiDdGetAvailDriverMemory@8
DdEntry29@8=NtGdiDdGetBltStatus@8 DdEntry29@8=NtGdiDdGetBltStatus@8
DdEntry2@4=NtGdiD3dContextDestroy@4
DdEntry30@8=NtGdiDdGetDC@8 DdEntry30@8=NtGdiDdGetDC@8
DdEntry31@8=NtGdiDdGetDriverInfo@8 DdEntry31@8=NtGdiDdGetDriverInfo@8
DdEntry32@12=NtGdiDdGetDxHandle@12 DdEntry32@12=NtGdiDdGetDxHandle@12
@@ -122,7 +137,6 @@ DdEntry36@8=NtGdiDdGetMoCompGuids@8
DdEntry37@8=NtGdiDdGetMoCompFormats@8 DdEntry37@8=NtGdiDdGetMoCompFormats@8
DdEntry38@8=NtGdiDdGetScanLine@8 DdEntry38@8=NtGdiDdGetScanLine@8
DdEntry39@12=NtGdiDdLock@12 DdEntry39@12=NtGdiDdLock@12
DdEntry3@4=NtGdiD3dContextDestroyAll@4
DdEntry40@8=NtGdiDdLockD3D@8 DdEntry40@8=NtGdiDdLockD3D@8
DdEntry41@44=NtGdiDdQueryDirectDrawObject@44 DdEntry41@44=NtGdiDdQueryDirectDrawObject@44
DdEntry42@8=NtGdiDdQueryMoCompStatus@8 DdEntry42@8=NtGdiDdQueryMoCompStatus@8
@@ -133,79 +147,65 @@ DdEntry46@8=NtGdiDdResetVisrgn@8
DdEntry47@8=NtGdiDdSetColorKey@8 DdEntry47@8=NtGdiDdSetColorKey@8
DdEntry48@8=NtGdiDdSetExclusiveMode@8 DdEntry48@8=NtGdiDdSetExclusiveMode@8
DdEntry49@12=NtGdiDdSetGammaRamp@12 DdEntry49@12=NtGdiDdSetGammaRamp@12
DdEntry4@4=NtGdiD3dValidateTextureStageState@4
DdEntry50@12=NtGdiDdCreateSurfaceEx@12 DdEntry50@12=NtGdiDdCreateSurfaceEx@12
DdEntry51@12=NtGdiDdSetOverlayPosition@12 DdEntry51@12=NtGdiDdSetOverlayPosition@12
DdEntry52@8=NtGdiDdUnattachSurface@8 DdEntry52@8=NtGdiDdUnattachSurface@8
DdEntry53@8=NtGdiDdUnlock@8 DdEntry53@8=NtGdiDdUnlock@8
DdEntry54@8=NtGdiDdUnlockD3D@8 DdEntry54@8=NtGdiDdUnlockD3D@8
DdEntry55@12=NtGdiDdUpdateOverlay@12 DdEntry55@12=NtGdiDdUpdateOverlay@12
DdEntry56@8=NtGdiDdWaitForVerticalBlank@8 DdEntry56@8=NtGdiDdWaitForVerticalBlank@8
DdEntry5@28=NtGdiD3dDrawPrimitives2@28
DdEntry6@4=NtGdiDdGetDriverState@4
DdEntry7@12=NtGdiDdAddAttachedSurface@12
DdEntry8@12=NtGdiDdAlphaBlt@12
DdEntry9@8=NtGdiDdAttachSurface@8
DeleteColorSpace@4=NtGdiDeleteColorSpace@4
DeleteDC@4
DeleteEnhMetaFile@4
DeleteMetaFile@4
DeleteObject@4
DescribePixelFormat@16
DeviceCapabilitiesExA@20
DeviceCapabilitiesExW@20
DrawEscape@16 DrawEscape@16
Ellipse@20 Ellipse@20=NtGdiEllipse@20
EnableEUDC@4=NtGdiEnableEudc@4 EnableEUDC@4
EndDoc@4 EndDoc@4
EndFormPage@4 EndFormPage@4
EndPage@4 EndPage@4
EndPath@4 EndPath@4
EngAcquireSemaphore@4 EngAcquireSemaphore@4
EngAlphaBlend@28=NtGdiEngAlphaBlend@28 EngAlphaBlend@28
EngAssociateSurface@12=NtGdiEngAssociateSurface@12 EngAssociateSurface@12
EngBitBlt=NtGdiEngBitBlt@44 EngBitBlt@44
EngCheckAbort@4=NtGdiEngCheckAbort@4 EngCheckAbort@4
EngComputeGlyphSet@12 EngComputeGlyphSet@12
EngCopyBits@24=NtGdiEngCopyBits@24 EngCopyBits@24
EngCreateBitmap@24=NtGdiEngCreateBitmap@24 EngCreateBitmap@24
EngCreateClip@0=NtGdiEngCreateClip@0 EngCreateClip@0
EngCreateDeviceBitmap@16=NtGdiEngCreateDeviceBitmap@16 EngCreateDeviceBitmap@16
EngCreateDeviceSurface@16=NtGdiEngCreateDeviceSurface@16 EngCreateDeviceSurface@16
EngCreatePalette@24=NtGdiEngCreatePalette@24 EngCreatePalette@24
EngCreateSemaphore@0 EngCreateSemaphore@0
EngDeleteClip@4=NtGdiEngDeleteClip@4 EngDeleteClip@4
EngDeletePalette@4=NtGdiEngDeletePalette@4 EngDeletePalette@4
EngDeletePath@4=NtGdiEngDeletePath@4 EngDeletePath@4
EngDeleteSemaphore@4 EngDeleteSemaphore@4
EngDeleteSurface@4=NtGdiEngDeleteSurface@4 EngDeleteSurface@4
EngEraseSurface@12=NtGdiEngEraseSurface@12 EngEraseSurface@12
EngFillPath@28=NtGdiEngFillPath@28 EngFillPath@28
EngFindResource@16 EngFindResource@16
EngFreeModule@4 EngFreeModule@4
EngGetCurrentCodePage@8 EngGetCurrentCodePage@8
EngGetDriverName@4 EngGetDriverName@4
EngGetPrinterDataFileName@4 EngGetPrinterDataFileName@4
EngGradientFill@40=NtGdiEngGradientFill@40 EngGradientFill@40
EngLineTo@36=NtGdiEngLineTo@36 EngLineTo@36
EngLoadModule@4 EngLoadModule@4
EngLockSurface@4=NtGdiEngLockSurface@4 EngLockSurface@4
EngMarkBandingSurface@4=NtGdiEngMarkBandingSurface@4 EngMarkBandingSurface@4
EngMultiByteToUnicodeN@20=RtlMultiByteToUnicodeN@20 EngMultiByteToUnicodeN@20
EngMultiByteToWideChar@20 EngMultiByteToWideChar@20
EngPaint@20=NtGdiEngPaint@20 EngPaint@20
EngPlgBlt@44=NtGdiEngPlgBlt@44 EngPlgBlt@44
EngQueryEMFInfo@8 EngQueryEMFInfo@8
EngQueryLocalTime@4 EngQueryLocalTime@4
EngReleaseSemaphore@4 EngReleaseSemaphore@4
EngStretchBlt@44=NtGdiEngStretchBlt@44 EngStretchBlt@44
EngStretchBltROP@52=NtGdiEngStretchBltROP@52 EngStretchBltROP@52
EngStrokeAndFillPath@40=NtGdiEngStrokeAndFillPath@40 EngStrokeAndFillPath@40
EngStrokePath@32=NtGdiEngStrokePath@32 EngStrokePath@32
EngTextOut@40=NtGdiEngTextOut@40 EngTextOut@40
EngTransparentBlt@32=NtGdiEngTransparentBlt@32 EngTransparentBlt@32
EngUnicodeToMultiByteN@20=RtlUnicodeToMultiByteN@20 EngUnicodeToMultiByteN@20
EngUnlockSurface@4=NtGdiEngUnlockSurface@4 EngUnlockSurface@4
EngWideCharToMultiByte@20 EngWideCharToMultiByte@20
EnumEnhMetaFile@20 EnumEnhMetaFile@20
EnumFontFamiliesA@16 EnumFontFamiliesA@16
@@ -222,40 +222,40 @@ EqualRgn@8=NtGdiEqualRgn@8
Escape@20 Escape@20
EudcLoadLinkW@16 EudcLoadLinkW@16
EudcUnloadLinkW@8 EudcUnloadLinkW@8
ExcludeClipRect@20 ExcludeClipRect@20=NtGdiExcludeClipRect@20
ExtCreatePen@20 ExtCreatePen@20
ExtCreateRegion@12 ExtCreateRegion@12=NtGdiExtCreateRegion@12
ExtEscape@24 ExtEscape@24=NtGdiExtEscape@24
ExtFloodFill@20 ExtFloodFill@20=NtGdiExtFloodFill@20
ExtSelectClipRgn@12 ExtSelectClipRgn@12=NtGdiExtSelectClipRgn@12
ExtTextOutA@32 ExtTextOutA@32
ExtTextOutW@32 ExtTextOutW@32
FONTOBJ_cGetAllGlyphHandles@8=NtGdiFONTOBJ_cGetAllGlyphHandles@8
FONTOBJ_cGetGlyphs@20=NtGdiFONTOBJ_cGetGlyphs@20
FONTOBJ_pQueryGlyphAttrs@8=NtGdiFONTOBJ_pQueryGlyphAttrs@8
FONTOBJ_pfdg@4=NtGdiFONTOBJ_pfdg@4
FONTOBJ_pifi@4=NtGdiFONTOBJ_pifi@4
FONTOBJ_pvTrueTypeFontFile@8=NtGdiFONTOBJ_pvTrueTypeFontFile@8
FONTOBJ_pxoGetXform@4=NtGdiFONTOBJ_pxoGetXform@4
FONTOBJ_vGetInfo@12=NtGdiFONTOBJ_vGetInfo@12
FillPath@4 FillPath@4
FillRgn@12 FillRgn@12=NtGdiFillRgn@12
FixBrushOrgEx@16 FixBrushOrgEx@16
FlattenPath@4 FlattenPath@4
FloodFill@16 FloodFill@16=NtGdiFloodFill@16
FontIsLinked@4=NtGdiFontIsLinked@4 FontIsLinked@4
FrameRgn@20 FONTOBJ_cGetAllGlyphHandles@8
FONTOBJ_cGetGlyphs@20
FONTOBJ_pQueryGlyphAttrs@8
FONTOBJ_pfdg@4
FONTOBJ_pifi@4
FONTOBJ_pvTrueTypeFontFile@8
FONTOBJ_pxoGetXform@4
FONTOBJ_vGetInfo@12
FrameRgn@20=NtGdiFrameRgn@20
GdiAddFontResourceW@12 GdiAddFontResourceW@12
GdiAddGlsBounds@8 GdiAddGlsBounds@8
GdiAddGlsRecord@16 GdiAddGlsRecord@16
GdiAlphaBlend@44 GdiAlphaBlend@44=NtGdiAlphaBlend@44
GdiArtificialDecrementDriver@8 GdiArtificialDecrementDriver@8
GdiCleanCacheDC@4 GdiCleanCacheDC@4
GdiComment@12 GdiComment@12
GdiConsoleTextOut@16=NtGdiConsoleTextOut@16 GdiConsoleTextOut@16
GdiConvertAndCheckDC@4 GdiConvertAndCheckDC@4
GdiConvertBitmap@4 GdiConvertBitmap@4
GdiConvertBitmapV5@16 ;GdiConvertBitmapV5
GdiConvertBrush@4 GdiConvertBrush@4
GdiConvertDC@4 GdiConvertDC@4
GdiConvertEnhMetaFile@4 GdiConvertEnhMetaFile@4
@@ -268,18 +268,11 @@ GdiCreateLocalEnhMetaFile@4
GdiCreateLocalMetaFilePict@4 GdiCreateLocalMetaFilePict@4
GdiDeleteLocalDC@4 GdiDeleteLocalDC@4
GdiDeleteSpoolFileHandle@4 GdiDeleteSpoolFileHandle@4
GdiDescribePixelFormat@16=NtGdiDescribePixelFormat@16 GdiDescribePixelFormat@16
GdiDllInitialize@12 GdiDllInitialize@12
GdiDrawStream@12 GdiDrawStream@12
GdiEndDocEMF@4 GdiEndDocEMF@4
GdiEndPageEMF@8 GdiEndPageEMF@8
GdiEntry10@8
GdiEntry11@8
GdiEntry12@8
GdiEntry13@0
GdiEntry14@12
GdiEntry15@12
GdiEntry16@12
GdiEntry1@8 GdiEntry1@8
GdiEntry2@44 GdiEntry2@44
GdiEntry3@4 GdiEntry3@4
@@ -289,9 +282,16 @@ GdiEntry6@8
GdiEntry7@8 GdiEntry7@8
GdiEntry8@4 GdiEntry8@4
GdiEntry9@24 GdiEntry9@24
GdiEntry10@8
GdiEntry11@8
GdiEntry12@8
GdiEntry13@0
GdiEntry14@12
GdiEntry15@12
GdiEntry16@12
GdiFixUpHandle@4 GdiFixUpHandle@4
GdiFlush@0 GdiFlush@0
GdiFullscreenControl@20=NtGdiFullscreenControl@20 GdiFullscreenControl@20
GdiGetBatchLimit@0 GdiGetBatchLimit@0
GdiGetCharDimensions@12 GdiGetCharDimensions@12
GdiGetCodePage@4 GdiGetCodePage@4
@@ -303,9 +303,9 @@ GdiGetLocalFont@4
GdiGetPageCount@4 GdiGetPageCount@4
GdiGetPageHandle@12 GdiGetPageHandle@12
GdiGetSpoolFileHandle@12 GdiGetSpoolFileHandle@12
GdiGetSpoolMessage@16=NtGdiGetSpoolMessage@16 ;GdiGetSpoolMessage
GdiGradientFill@24 GdiGradientFill@24=NtGdiGradientFill@24
GdiInitSpool@0=NtGdiInitSpool@0 GdiInitSpool@0
GdiInitializeLanguagePack@4 GdiInitializeLanguagePack@4
GdiIsMetaFileDC@4 GdiIsMetaFileDC@4
GdiIsMetaPrintDC@4 GdiIsMetaPrintDC@4
@@ -316,9 +316,9 @@ GdiPlayJournal@20
GdiPlayPageEMF@20 GdiPlayPageEMF@20
GdiPlayPrivatePageEMF@12 GdiPlayPrivatePageEMF@12
GdiPlayScript@28 GdiPlayScript@28
GdiPrinterThunk@12 ;GdiPrinterThunk
GdiProcessSetup@0 GdiProcessSetup@0
GdiQueryFonts@12=NtGdiQueryFonts@12 GdiQueryFonts@12
GdiQueryTable@0 GdiQueryTable@0
GdiRealizationInfo@8 GdiRealizationInfo@8
GdiReleaseDC@4 GdiReleaseDC@4
@@ -327,53 +327,51 @@ GdiResetDCEMF@8
GdiSetAttrs@4 GdiSetAttrs@4
GdiSetBatchLimit@4 GdiSetBatchLimit@4
GdiSetLastError@4 GdiSetLastError@4
GdiSetPixelFormat@8=NtGdiSetPixelFormat@8 GdiSetPixelFormat@8
GdiSetServerAttr@8 GdiSetServerAttr@8
GdiStartDocEMF@8 GdiStartDocEMF@8
GdiStartPageEMF@4 GdiStartPageEMF@4
GdiSwapBuffers@4=NtGdiSwapBuffers@4 GdiSwapBuffers@4
GdiTransparentBlt@44 GdiTransparentBlt@44=NtGdiTransparentBlt@44
GdiValidateHandle@4 GdiValidateHandle@4
GetArcDirection@4 GetArcDirection@4=NtGdiGetArcDirection@4
GetAspectRatioFilterEx@8 GetAspectRatioFilterEx@8
GetBitmapAttributes@4 GetBitmapAttributes@4
GetBitmapBits@12=NtGdiGetBitmapBits@12 GetBitmapBits@12=NtGdiGetBitmapBits@12
GetBitmapDimensionEx@8=NtGdiGetBitmapDimension@8 GetBitmapDimensionEx@8=NtGdiGetBitmapDimensionEx@8
GetBkColor@4 GetBkColor@4=NtGdiGetBkColor@4
GetBkMode@4 GetBkMode@4=NtGdiGetBkMode@4
GetBoundsRect@12 GetBoundsRect@12
GetBrushOrgEx@8 GetBrushAttributes@4
GetBrushOrgEx@8=NtGdiGetBrushOrgEx@8
GetCharABCWidthsA@16 GetCharABCWidthsA@16
GetCharABCWidthsFloatA@16 GetCharABCWidthsFloatA@16
GetCharABCWidthsFloatW@16 GetCharABCWidthsFloatW@16=NtGdiGetCharABCWidthsFloat@16
GetCharABCWidthsI@20 GetCharABCWidthsI@20
GetCharABCWidthsW@16 GetCharABCWidthsW@16=NtGdiGetCharABCWidths@16
GetCharWidth32A@16 GetCharWidth32A@16
GetCharWidth32W@16 GetCharWidth32W@16=NtGdiGetCharWidth32@16
GetCharWidthA@16 GetCharWidthA@16
GetCharWidthFloatA@16 GetCharWidthFloatA@16
GetCharWidthFloatW@16 GetCharWidthFloatW@16=NtGdiGetCharWidthFloat@16
GetCharWidthI@20 GetCharWidthI@20
GetCharWidthInfo@8=NtGdiGetCharWidthInfo@8 GetCharWidthInfo@8
GetCharWidthW@16 GetCharWidthW@16
GetCharacterPlacementA@24 GetCharacterPlacementA@24
GetCharacterPlacementW@24 GetCharacterPlacementW@24
GetClipBox@8 GetClipBox@8=NtGdiGetClipBox@8
GetClipRgn@8 GetClipRgn@8
GetColorAdjustment@8=NtGdiGetColorAdjustment@8 GetColorAdjustment@8
GetColorSpace@4 GetColorSpace@4
GetCurrentObject@8 GetCurrentObject@8=NtGdiGetCurrentObject@8
GetCurrentPositionEx@8 GetCurrentPositionEx@8=NtGdiGetCurrentPositionEx@8
GetDCBrushColor@4 GetDCBrushColor@4
GetDCOrgEx@8 GetDCOrgEx@8=NtGdiGetDCOrgEx@8
GetDCPenColor@4 GetDCPenColor@4
GetDIBColorTable@16 GetDIBColorTable@16=NtGdiGetDIBColorTable@16
GetDIBits@28 GetDIBits@28=NtGdiGetDIBits@28
GetDeviceCaps@8 GetDeviceCaps@8=NtGdiGetDeviceCaps@8
GetDeviceGammaRamp@8 GetDeviceGammaRamp@8
GetETM@8
GetEUDCTimeStamp@0
GetEUDCTimeStampExW@4
GetEnhMetaFileA@4 GetEnhMetaFileA@4
GetEnhMetaFileBits@12 GetEnhMetaFileBits@12
GetEnhMetaFileDescriptionA@12 GetEnhMetaFileDescriptionA@12
@@ -382,33 +380,37 @@ GetEnhMetaFileHeader@12
GetEnhMetaFilePaletteEntries@12 GetEnhMetaFilePaletteEntries@12
GetEnhMetaFilePixelFormat@12 GetEnhMetaFilePixelFormat@12
GetEnhMetaFileW@4 GetEnhMetaFileW@4
GetETM@8
GetEUDCTimeStamp@0
GetEUDCTimeStampExW@4
GetFontAssocStatus@4 GetFontAssocStatus@4
GetFontData@20 GetFontData@20=NtGdiGetFontData@20
GetFontLanguageInfo@4 GetFontLanguageInfo@4
GetFontResourceInfo@16
GetFontResourceInfoW@16 GetFontResourceInfoW@16
GetFontUnicodeRanges@8=NtGdiGetFontUnicodeRanges@8 GetFontUnicodeRanges@8
GetGlyphIndicesA@20 GetGlyphIndicesA@20
GetGlyphIndicesW@20=NtGdiGetGlyphIndicesW@20 GetGlyphIndicesW@20
GetGlyphOutline@28=GetGlyphOutlineA@28 GetGlyphOutline=GetGlyphOutlineA@28
GetGlyphOutlineA@28 GetGlyphOutlineA@28
GetGlyphOutlineW@28 GetGlyphOutlineW@28
GetGlyphOutlineWow@28 GetGlyphOutlineWow@28
GetGraphicsMode@4 GetGraphicsMode@4=NtGdiGetGraphicsMode@4
GetHFONT@4 GetHFONT@4
GetICMProfileA@12 GetICMProfileA@12
GetICMProfileW@12 GetICMProfileW@12
GetKerningPairs@12=GetKerningPairsA@12 GetKerningPairs=GetKerningPairsA@12
GetKerningPairsA@12 GetKerningPairsA@12
GetKerningPairsW@12 GetKerningPairsW@12
GetLayout@4 GetLayout@4
GetLogColorSpaceA@12 GetLogColorSpaceA@12
GetLogColorSpaceW@12 GetLogColorSpaceW@12
GetMapMode@4 GetMapMode@4=NtGdiGetMapMode@4
GetMetaFileA@4 GetMetaFileA@4
GetMetaFileBitsEx@12 GetMetaFileBitsEx@12
GetMetaFileW@4 GetMetaFileW@4
GetMetaRgn@8 GetMetaRgn@8
GetMiterLimit@8=NtGdiGetMiterLimit@8 GetMiterLimit@8
GetNearestColor@8=NtGdiGetNearestColor@8 GetNearestColor@8=NtGdiGetNearestColor@8
GetNearestPaletteIndex@8=NtGdiGetNearestPaletteIndex@8 GetNearestPaletteIndex@8=NtGdiGetNearestPaletteIndex@8
GetObjectA@12 GetObjectA@12
@@ -416,28 +418,28 @@ GetObjectType@4
GetObjectW@12 GetObjectW@12
GetOutlineTextMetricsA@12 GetOutlineTextMetricsA@12
GetOutlineTextMetricsW@12 GetOutlineTextMetricsW@12
GetPaletteEntries@16 GetPaletteEntries@16=NtGdiGetPaletteEntries@16
GetPath@16 GetPath@16
GetPixel@12 GetPixel@12=NtGdiGetPixel@12
GetPixelFormat@4 GetPixelFormat@4
GetPolyFillMode@4 GetPolyFillMode@4=NtGdiGetPolyFillMode@4
GetROP2@4 GetROP2@4=NtGdiGetROP2@4
GetRandomRgn@12=NtGdiGetRandomRgn@12 GetRandomRgn@12
GetRasterizerCaps@8=NtGdiGetRasterizerCaps@8 GetRasterizerCaps@8
GetRegionData@12 GetRegionData@12=NtGdiGetRegionData@12
GetRelAbs@8 GetRelAbs@8
GetRgnBox@8 GetRgnBox@8=NtGdiGetRgnBox@8
GetStockObject@4 GetStockObject@4=NtGdiGetStockObject@4
GetStretchBltMode@4 GetStretchBltMode@4=NtGdiGetStretchBltMode@4
GetStringBitmapA@20 GetStringBitmapA@20
GetStringBitmapW@20 GetStringBitmapW@20
GetSystemPaletteEntries@16 GetSystemPaletteEntries@16=NtGdiGetSystemPaletteEntries@16
GetSystemPaletteUse@4=NtGdiGetSystemPaletteUse@4 GetSystemPaletteUse@4
GetTextAlign@4 GetTextAlign@4=NtGdiGetTextAlign@4
GetTextCharacterExtra@4 GetTextCharacterExtra@4
GetTextCharset@4 GetTextCharset@4
GetTextCharsetInfo@12 GetTextCharsetInfo@12
GetTextColor@4 GetTextColor@4=NtGdiGetTextColor@4
GetTextExtentExPointA@28 GetTextExtentExPointA@28
GetTextExtentExPointI@28 GetTextExtentExPointI@28
GetTextExtentExPointW@28 GetTextExtentExPointW@28
@@ -448,174 +450,166 @@ GetTextExtentPointA@16
GetTextExtentPointI@16 GetTextExtentPointI@16
GetTextExtentPointW@16 GetTextExtentPointW@16
GetTextFaceA@12 GetTextFaceA@12
GetTextFaceAliasW@12
GetTextFaceW@12 GetTextFaceW@12
GetTextFaceAliasW@12
GetTextMetricsA@8 GetTextMetricsA@8
GetTextMetricsW@8 GetTextMetricsW@8
GetTransform@12=NtGdiGetTransform@12 GetTransform@12
GetViewportExtEx@8 GetViewportExtEx@8=NtGdiGetViewportExtEx@8
GetViewportOrgEx@8 GetViewportOrgEx@8=NtGdiGetViewportOrgEx@8
GetWinMetaFileBits@20 GetWinMetaFileBits@20
GetWindowExtEx@8 GetWindowExtEx@8=NtGdiGetWindowExtEx@8
GetWindowOrgEx@8 GetWindowOrgEx@8=NtGdiGetWindowOrgEx@8
GetWorldTransform@8 GetWorldTransform@8=NtGdiGetWorldTransform@8
HT_Get8BPPFormatPalette@16=NtGdiHT_Get8BPPFormatPalette@16 HT_Get8BPPFormatPalette@16
HT_Get8BPPMaskPalette@24=NtGdiHT_Get8BPPMaskPalette@24 HT_Get8BPPMaskPalette@24
IntersectClipRect@20 IntersectClipRect@20=NtGdiIntersectClipRect@20
InvertRgn@8 InvertRgn@8=NtGdiInvertRgn@8
IsValidEnhMetaRecord@8 LPtoDP@12=NtGdiLPtoDP@12
IsValidEnhMetaRecordOffExt@16
LPtoDP@12
LineDDA@24 LineDDA@24
LineTo@12 LineTo@12=NtGdiLineTo@12
MaskBlt@48 MaskBlt@48=NtGdiMaskBlt@48
MirrorRgn@8 MirrorRgn@8
ModifyWorldTransform@12 ModifyWorldTransform@12=NtGdiModifyWorldTransform@12
MoveToEx@16 MoveToEx@16=NtGdiMoveToEx@16
NamedEscape@28 NamedEscape@32
OffsetClipRgn@12 OffsetClipRgn@12=NtGdiOffsetClipRgn@12
OffsetRgn@12 OffsetRgn@12=NtGdiOffsetRgn@12
OffsetViewportOrgEx@16 OffsetViewportOrgEx@16=NtGdiOffsetViewportOrgEx@16
OffsetWindowOrgEx@16 OffsetWindowOrgEx@16=NtGdiOffsetWindowOrgEx@16
PATHOBJ_bEnum@8=NtGdiPATHOBJ_bEnum@8 PaintRgn@8=NtGdiPaintRgn@8
PATHOBJ_bEnumClipLines@12=NtGdiPATHOBJ_bEnumClipLines@12 PatBlt@24=NtGdiPatBlt@24
PATHOBJ_vEnumStart@4=NtGdiPATHOBJ_vEnumStart@4 PATHOBJ_bEnum@8
PATHOBJ_vEnumStartClipLines@16=NtGdiPATHOBJ_vEnumStartClipLines@16 PATHOBJ_bEnumClipLines@12
PATHOBJ_vGetBounds@8=NtGdiPATHOBJ_vGetBounds@8 PATHOBJ_vEnumStart@4
PaintRgn@8 PATHOBJ_vEnumStartClipLines@16
PatBlt@24 PATHOBJ_vGetBounds@8
PolyPatBlt@20=NtGdiPolyPatBlt@20
PathToRegion@4 PathToRegion@4
Pie@36 Pie@36=NtGdiPie@36
PlayEnhMetaFile@12 PlayEnhMetaFile@12
PlayEnhMetaFileRecord@16 PlayEnhMetaFileRecord@16
PlayMetaFile@8 PlayMetaFile@8
PlayMetaFileRecord@16 PlayMetaFileRecord@16
PlgBlt@40 PlgBlt@40=NtGdiPlgBlt@40
PolyBezier@12 PolyBezier@12=NtGdiPolyBezier@12
PolyBezierTo@12 PolyBezierTo@12=NtGdiPolyBezierTo@12
PolyDraw@16 PolyDraw@16
PolyPatBlt@20 PolyPolygon@16=NtGdiPolyPolygon@16
PolyPolygon@16 PolyPolyline@16=NtGdiPolyPolyline@16
PolyPolyline@16
PolyTextOutA@12 PolyTextOutA@12
PolyTextOutW@12 PolyTextOutW@12
Polygon@12 Polygon@12=NtGdiPolygon@12
Polyline@12 Polyline@12=NtGdiPolyline@12
PolylineTo@12 PolylineTo@12=NtGdiPolylineTo@12
PtInRegion@12 PtInRegion@12=NtGdiPtInRegion@12
PtVisible@12=NtGdiPtVisible@12 PtVisible@12=NtGdiPtVisible@12
QueryFontAssocStatus@0 QueryFontAssocStatus@0
RealizePalette@4 RealizePalette@4=NtGdiRealizePalette@4
RectInRegion@8 RectInRegion@8=NtGdiRectInRegion@8
RectVisible@8=NtGdiRectVisible@8 RectVisible@8=NtGdiRectVisible@8
Rectangle@20 Rectangle@20=NtGdiRectangle@20
RemoveFontMemResourceEx@4 RemoveFontMemResourceEx@4
RemoveFontResourceA@4 RemoveFontResourceA@4
RemoveFontResourceExA@12 RemoveFontResourceExA@12
RemoveFontResourceExW@12 RemoveFontResourceExW@12
RemoveFontResourceTracking@8
RemoveFontResourceW@4 RemoveFontResourceW@4
RemoveFontResourceTracking@8
ResetDCA@8 ResetDCA@8
ResetDCW@8 ResetDCW@8
ResizePalette@8 ResizePalette@8
RestoreDC@8 RestoreDC@8=NtGdiRestoreDC@8
RoundRect@28 RoundRect@28=NtGdiRoundRect@28
STROBJ_bEnum@12=NtGdiSTROBJ_bEnum@12 SaveDC@4=NtGdiSaveDC@4
STROBJ_bEnumPositionsOnly@12=NtGdiSTROBJ_bEnumPositionsOnly@12
STROBJ_bGetAdvanceWidths@16=NtGdiSTROBJ_bGetAdvanceWidths@16
STROBJ_dwGetCodePage@4=NtGdiSTROBJ_dwGetCodePage@4
STROBJ_vEnumStart@4=NtGdiSTROBJ_vEnumStart@4
SaveDC@4
ScaleViewportExtEx@24 ScaleViewportExtEx@24
ScaleWindowExtEx@24 ScaleWindowExtEx@24
SelectBrushLocal@8 SelectBrushLocal@8
SelectClipPath@8 SelectClipPath@8
SelectClipRgn@8 SelectClipRgn@8=NtGdiSelectClipRgn@8
SelectFontLocal@8 SelectFontLocal@8
SelectObject@8 SelectObject@8=NtGdiSelectObject@8
SelectPalette@12 SelectPalette@12=NtGdiSelectPalette@12
SetAbortProc@8 SetAbortProc@8
SetArcDirection@8 SetArcDirection@8=NtGdiSetArcDirection@8
SetBitmapAttributes@8
SetBitmapBits@12=NtGdiSetBitmapBits@12 SetBitmapBits@12=NtGdiSetBitmapBits@12
SetBitmapDimensionEx@16=NtGdiSetBitmapDimension@16 SetBitmapDimensionEx@16=NtGdiSetBitmapDimensionEx@16
SetBkColor@8 SetBkColor@8=NtGdiSetBkColor@8
SetBkMode@8 SetBkMode@8=NtGdiSetBkMode@8
SetBoundsRect@12 SetBoundsRect@12
SetBrushOrgEx@16 SetBrushAttributes@8
SetBrushOrgEx@16=NtGdiSetBrushOrgEx@16
SetColorAdjustment@8 SetColorAdjustment@8
SetColorSpace@8 SetColorSpace@8
SetDCBrushColor@8 SetDCBrushColor@8
SetDCPenColor@8 SetDCPenColor@8
SetDIBColorTable@16 SetDIBColorTable@16=NtGdiSetDIBColorTable@16
SetDIBits@28 SetDIBits@28=NtGdiSetDIBits@28
SetDIBitsToDevice@48 SetDIBitsToDevice@48=NtGdiSetDIBitsToDevice@48
SetDeviceGammaRamp@8 SetDeviceGammaRamp@8
SetEnhMetaFileBits@8 SetEnhMetaFileBits@8
SetFontEnumeration@4=NtGdiSetFontEnumeration@4 SetFontEnumeration@4
SetGraphicsMode@8 SetGraphicsMode@8=NtGdiSetGraphicsMode@8
SetICMMode@8 SetICMMode@8
SetICMProfileA@8 SetICMProfileA@8
SetICMProfileW@8 SetICMProfileW@8
SetLayout@8 SetLayout@8
SetLayoutWidth@12 SetLayoutWidth@12
SetMagicColors@12=NtGdiSetMagicColors@12 SetMagicColors@12
SetMapMode@8 SetMapMode@8=NtGdiSetMapMode@8
SetMapperFlags@8 SetMapperFlags@8
SetMetaFileBitsEx@8 SetMetaFileBitsEx@8
SetMetaRgn@4 SetMetaRgn@4
SetMiterLimit@12 SetMiterLimit@12
SetPaletteEntries@16 SetPaletteEntries@16=NtGdiSetPaletteEntries@16
SetPixel@16 SetPixel@16=NtGdiSetPixel@16
SetPixelFormat@12 SetPixelFormat@12
SetPixelV@16 SetPixelV@16=NtGdiSetPixelV@16
SetPolyFillMode@8 SetPolyFillMode@8=NtGdiSetPolyFillMode@8
SetROP2@8 SetROP2@8=NtGdiSetROP2@8
SetRectRgn@20 SetRectRgn@20=NtGdiSetRectRgn@20
SetRelAbs@8 SetRelAbs@8
SetStretchBltMode@8 SetStretchBltMode@8=NtGdiSetStretchBltMode@8
SetSystemPaletteUse@8=NtGdiSetSystemPaletteUse@8 SetSystemPaletteUse@8
SetTextAlign@8 SetTextAlign@8=NtGdiSetTextAlign@8
SetTextCharacterExtra@8 SetTextCharacterExtra@8
SetTextColor@8 SetTextColor@8=NtGdiSetTextColor@8
SetTextJustification@12 SetTextJustification@12
SetViewportExtEx@16 SetViewportExtEx@16=NtGdiSetViewportExtEx@16
SetViewportOrgEx@16 SetViewportOrgEx@16=NtGdiSetViewportOrgEx@16
SetVirtualResolution@20=NtGdiSetVirtualResolution@20 SetVirtualResolution@20
SetWinMetaFileBits@16 SetWinMetaFileBits@16
SetWindowExtEx@16 SetWindowExtEx@16=NtGdiSetWindowExtEx@16
SetWindowOrgEx@16 SetWindowOrgEx@16=NtGdiSetWindowOrgEx@16
SetWorldTransform@8 SetWorldTransform@8=NtGdiSetWorldTransform@8
StartDocA@8 StartDocA@8
StartDocW@8 StartDocW@8
StartFormPage@4 StartFormPage@4
StartPage@4 StartPage@4
StretchBlt@44 StretchBlt@44
StretchDIBits@52 StretchDIBits@52=NtGdiStretchDIBits@52
STROBJ_bEnum@12
STROBJ_bEnumPositionsOnly@12
STROBJ_bGetAdvanceWidths@16
STROBJ_dwGetCodePage@4
STROBJ_vEnumStart@4
StrokeAndFillPath@4 StrokeAndFillPath@4
StrokePath@4 StrokePath@4
SwapBuffers@4 SwapBuffers@4
TextOutA@20 TextOutA@20
TextOutW@20 TextOutW@20
TranslateCharsetInfo@12 TranslateCharsetInfo@12=NtGdiTranslateCharsetInfo@12
UnloadNetworkFonts@4
UnrealizeObject@4 UnrealizeObject@4
UnloadNetworkFonts@4
UpdateColors@4 UpdateColors@4
UpdateICMRegKeyA@16 UpdateICMRegKeyA@16
UpdateICMRegKeyA@16
UpdateICMRegKeyW@16 UpdateICMRegKeyW@16
WidenPath@4 WidenPath@4
XFORMOBJ_bApplyXform@20=NtGdiXFORMOBJ_bApplyXform@20 XFORMOBJ_bApplyXform@20
XFORMOBJ_iGetXform@8=NtGdiXFORMOBJ_iGetXform@8 XFORMOBJ_iGetXform@8
XLATEOBJ_cGetPalette@16=NtGdiXLATEOBJ_cGetPalette@16 XLATEOBJ_cGetPalette@16
XLATEOBJ_hGetColorTransform@4=NtGdiXLATEOBJ_hGetColorTransform@4 XLATEOBJ_hGetColorTransform@4
GetBrushAttributes@4
GetGlyphIndicesA@20
GetTextExtentExPointWPri@28
GetTextExtentPoint32A@16
SetBitmapAttributes@8
SetBrushAttributes@8
XLATEOBJ_iXlate@8 XLATEOBJ_iXlate@8
XLATEOBJ_piVector@4 XLATEOBJ_piVector@4
bInitSystemAndFontsDirectoriesW@8 bInitSystemAndFontsDirectoriesW@8

View File

@@ -20,28 +20,19 @@
<directory name="misc"> <directory name="misc">
<file>heap.c</file> <file>heap.c</file>
<file>gdientry.c</file> <file>gdientry.c</file>
<file>hacks.c</file>
<file>historic.c</file>
<file>misc.c</file> <file>misc.c</file>
<file>stubs.c</file> <file>stubs.c</file>
<file>stubsa.c</file> <file>stubsa.c</file>
<file>stubsw.c</file> <file>stubsw.c</file>
<file>wingl.c</file> <file>wingl.c</file>
</directory> </directory>
<directory name="objects"> <directory name="objects">
<file>arc.c</file>
<file>bitmap.c</file> <file>bitmap.c</file>
<file>brush.c</file> <file>brush.c</file>
<file>coord.c</file>
<file>dc.c</file> <file>dc.c</file>
<file>eng.c</file>
<file>enhmfile.c</file>
<file>font.c</file> <file>font.c</file>
<file>linedda.c</file> <file>linedda.c</file>
<file>metafile.c</file> <file>metafile.c</file>
<file>painting.c</file>
<file>palette.c</file>
<file>pen.c</file>
<file>region.c</file> <file>region.c</file>
<file>text.c</file> <file>text.c</file>
<file>utils.c</file> <file>utils.c</file>

View File

@@ -6,14 +6,11 @@
* PROGRAMMER: Alex Ionescu (alex@relsoft.net) * PROGRAMMER: Alex Ionescu (alex@relsoft.net)
*/ */
#define GDI_BATCH_LIMIT 20
/* DATA **********************************************************************/ /* DATA **********************************************************************/
extern PGDI_TABLE_ENTRY GdiHandleTable; extern PGDI_TABLE_ENTRY GdiHandleTable;
extern HANDLE hProcessHeap; extern HANDLE hProcessHeap;
extern HANDLE CurrentProcessId; extern HANDLE CurrentProcessId;
extern DWORD GDI_BatchLimit;
typedef INT typedef INT
(CALLBACK* EMFPLAYPROC)( (CALLBACK* EMFPLAYPROC)(
@@ -22,63 +19,6 @@ typedef INT
HANDLE hPageQuery HANDLE hPageQuery
); );
/* DEFINES *******************************************************************/
#define HANDLE_LIST_INC 20
#define METAFILE_MEMORY 1
#define METAFILE_DISK 2
#define STOCK_LAST 19
#define DEFAULT_BITMAP (STOCK_LAST+1)
#define NB_STOCK_OBJECTS (STOCK_LAST+2)
/* TYPES *********************************************************************/
// Based on wmfapi.h and Wine.
typedef struct tagMETAFILEDC {
PVOID pvMetaBuffer;
HANDLE hFile;
DWORD Size;
METAHEADER mh;
UINT handles_size, cur_handles;
HGDIOBJ *handles;
// more DC object stuff.
HGDIOBJ Pen;
HGDIOBJ Brush;
HGDIOBJ Palette;
HGDIOBJ Font;
WCHAR Filename[MAX_PATH+2];
// Add more later.
} METAFILEDC,*PMETAFILEDC;
// Metafile Entry handle
typedef struct tagMF_ENTRY {
LIST_ENTRY List;
HGDIOBJ hmDC; // Handle return from NtGdiCreateClientObj.
PMETAFILEDC pmfDC;
} MF_ENTRY, *PMF_ENTRY;
typedef struct tagENHMETAFILE {
PVOID pvMetaBuffer;
HANDLE hFile; /* Handle for disk based MetaFile */
DWORD Size;
INT iType;
PENHMETAHEADER emf;
UINT handles_size, cur_handles;
HGDIOBJ *handles;
INT horzres, vertres;
INT horzsize, vertsize;
INT logpixelsx, logpixelsy;
INT bitspixel;
INT textcaps;
INT rastercaps;
INT technology;
INT planes;
} ENHMETAFILE,*PENHMETAFILE;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
PVOID PVOID
@@ -123,13 +63,6 @@ GdiGetHandleUserData(
PVOID *UserData PVOID *UserData
); );
PLDC
GdiGetLDC(HDC hDC);
HGDIOBJ
STDCALL
GdiFixUpHandle(HGDIOBJ hGO);
BOOL BOOL
WINAPI WINAPI
CalculateColorTableSize( CalculateColorTableSize(
@@ -151,18 +84,6 @@ DEVMODEW *
NTAPI NTAPI
GdiConvertToDevmodeW(DEVMODEA *dm); GdiConvertToDevmodeW(DEVMODEA *dm);
DWORD
STDCALL
GetAndSetDCDWord( HDC, INT, DWORD, DWORD, DWORD, DWORD );
DWORD
STDCALL
GetDCDWord( HDC, INT, DWORD);
HGDIOBJ
STDCALL
GetDCObject( HDC, INT);
VOID VOID
NTAPI NTAPI
LogFontA2W( LogFontA2W(
@@ -177,24 +98,9 @@ LogFontW2A(
CONST LOGFONTW *pW CONST LOGFONTW *pW
); );
VOID
STDCALL
EnumLogFontExW2A(
LPENUMLOGFONTEXA fontA,
CONST ENUMLOGFONTEXW *fontW );
/* FIXME: Put in some public header */ /* FIXME: Put in some public header */
UINT UINT
WINAPI WINAPI
UserRealizePalette(HDC hDC); UserRealizePalette(HDC hDC);
int
STDCALL
GdiAddFontResourceW(LPCWSTR lpszFilename,FLONG fl,DESIGNVECTOR *pdv);
VOID
STDCALL
GdiSetLastError( DWORD dwErrCode );
/* EOF */ /* EOF */

View File

@@ -9,9 +9,6 @@
#include "precomp.h" #include "precomp.h"
extern HGDIOBJ stock_objects[];
BOOL SetStockObjects = FALSE;
/* /*
* GDI32.DLL doesn't have an entry point. The initialization is done by a call * GDI32.DLL doesn't have an entry point. The initialization is done by a call
* to GdiDllInitialize(). This call is done from the entry point of USER32.DLL. * to GdiDllInitialize(). This call is done from the entry point of USER32.DLL.
@@ -37,7 +34,6 @@ GdiProcessSetup (VOID)
/* map the gdi handle table to user space */ /* map the gdi handle table to user space */
GdiHandleTable = NtCurrentTeb()->ProcessEnvironmentBlock->GdiSharedHandleTable; GdiHandleTable = NtCurrentTeb()->ProcessEnvironmentBlock->GdiSharedHandleTable;
CurrentProcessId = NtCurrentTeb()->Cid.UniqueProcess; CurrentProcessId = NtCurrentTeb()->Cid.UniqueProcess;
GDI_BatchLimit = NtCurrentTeb()->GdiBatchCount;
} }
@@ -70,12 +66,7 @@ GdiDllInitialize (
NtCurrentTeb()->GdiTebBatch.Offset = 0; NtCurrentTeb()->GdiTebBatch.Offset = 0;
NtCurrentTeb()->GdiBatchCount = 0; NtCurrentTeb()->GdiBatchCount = 0;
#endif #endif
// Very simple, the list will fill itself as it is needed.
if(!SetStockObjects)
{
RtlZeroMemory( &stock_objects, NB_STOCK_OBJECTS); //Assume Ros is dirty.
SetStockObjects = TRUE;
}
return TRUE; return TRUE;
} }

File diff suppressed because it is too large Load Diff

View File

@@ -30,65 +30,6 @@
PGDI_TABLE_ENTRY GdiHandleTable = NULL; PGDI_TABLE_ENTRY GdiHandleTable = NULL;
HANDLE CurrentProcessId = NULL; HANDLE CurrentProcessId = NULL;
DWORD GDI_BatchLimit = 1;
BOOL
STDCALL
GdiAlphaBlend(
HDC hDCDst,
int DstX,
int DstY,
int DstCx,
int DstCy,
HDC hDCSrc,
int SrcX,
int SrcY,
int SrcCx,
int SrcCy,
BLENDFUNCTION BlendFunction
)
{
if ( hDCSrc == NULL ) return FALSE;
if (GDI_HANDLE_GET_TYPE(hDCSrc) == GDI_OBJECT_TYPE_METADC) return FALSE;
return NtGdiAlphaBlend(
hDCDst,
DstX,
DstY,
DstCx,
DstCy,
hDCSrc,
SrcX,
SrcY,
SrcCx,
SrcCy,
BlendFunction,
0 );
}
/*
* @implemented
*/
HGDIOBJ
STDCALL
GdiFixUpHandle(HGDIOBJ hGdiObj)
{
PGDI_TABLE_ENTRY Entry;
if (((ULONG_PTR)(hGdiObj)) & GDI_HANDLE_UPPER_MASK )
{
return hGdiObj;
}
/* FIXME is this right ?? */
Entry = GdiHandleTable + GDI_HANDLE_GET_INDEX(hGdiObj);
/* Rebuild handle for Object */
return hGdiObj = (HGDIOBJ)(((LONG_PTR)(hGdiObj)) | (Entry->Type << GDI_ENTRY_UPPER_SHIFT));
}
/* /*
* @implemented * @implemented
@@ -103,8 +44,7 @@ GdiQueryTable(VOID)
BOOL GdiIsHandleValid(HGDIOBJ hGdiObj) BOOL GdiIsHandleValid(HGDIOBJ hGdiObj)
{ {
PGDI_TABLE_ENTRY Entry = GdiHandleTable + GDI_HANDLE_GET_INDEX(hGdiObj); PGDI_TABLE_ENTRY Entry = GdiHandleTable + GDI_HANDLE_GET_INDEX(hGdiObj);
if((Entry->Type & GDI_ENTRY_BASETYPE_MASK) != 0 && if(Entry->KernelData != NULL && (Entry->Type & GDI_HANDLE_TYPE_MASK) == (LONG)GDI_HANDLE_GET_TYPE(hGdiObj))
(Entry->Type << GDI_ENTRY_UPPER_SHIFT) == GDI_HANDLE_GET_UPPER(hGdiObj))
{ {
HANDLE pid = (HANDLE)((ULONG_PTR)Entry->ProcessId & ~0x1); HANDLE pid = (HANDLE)((ULONG_PTR)Entry->ProcessId & ~0x1);
if(pid == NULL || pid == CurrentProcessId) if(pid == NULL || pid == CurrentProcessId)
@@ -118,8 +58,7 @@ BOOL GdiIsHandleValid(HGDIOBJ hGdiObj)
BOOL GdiGetHandleUserData(HGDIOBJ hGdiObj, PVOID *UserData) BOOL GdiGetHandleUserData(HGDIOBJ hGdiObj, PVOID *UserData)
{ {
PGDI_TABLE_ENTRY Entry = GdiHandleTable + GDI_HANDLE_GET_INDEX(hGdiObj); PGDI_TABLE_ENTRY Entry = GdiHandleTable + GDI_HANDLE_GET_INDEX(hGdiObj);
if((Entry->Type & GDI_ENTRY_BASETYPE_MASK) != 0 && if(Entry->KernelData != NULL && (Entry->Type & GDI_HANDLE_TYPE_MASK) == (LONG)GDI_HANDLE_GET_TYPE(hGdiObj))
(Entry->Type << GDI_ENTRY_UPPER_SHIFT) == GDI_HANDLE_GET_UPPER(hGdiObj))
{ {
HANDLE pid = (HANDLE)((ULONG_PTR)Entry->ProcessId & ~0x1); HANDLE pid = (HANDLE)((ULONG_PTR)Entry->ProcessId & ~0x1);
if(pid == NULL || pid == CurrentProcessId) if(pid == NULL || pid == CurrentProcessId)
@@ -128,77 +67,5 @@ BOOL GdiGetHandleUserData(HGDIOBJ hGdiObj, PVOID *UserData)
return TRUE; return TRUE;
} }
} }
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE; return FALSE;
} }
PLDC GdiGetLDC(HDC hDC)
{
PDC_ATTR Dc_Attr;
if (!GdiGetHandleUserData((HGDIOBJ) hDC, (PVOID) &Dc_Attr))
return NULL;
return Dc_Attr->pvLDC;
}
/*
* @implemented
*/
DWORD
STDCALL
GdiSetBatchLimit(DWORD Limit)
{
DWORD OldLimit = GDI_BatchLimit;
if ( (!Limit) ||
(Limit >= GDI_BATCH_LIMIT))
{
return Limit;
}
GdiFlush();
GDI_BatchLimit = Limit;
return OldLimit;
}
/*
* @implemented
*/
DWORD
STDCALL
GdiGetBatchLimit()
{
return GDI_BatchLimit;
}
/*
* @unimplemented
*/
BOOL
STDCALL
GdiReleaseDC(HDC hdc)
{
return 0;
}
INT
STDCALL
ExtEscape(HDC hDC,
int nEscape,
int cbInput,
LPCSTR lpszInData,
int cbOutput,
LPSTR lpszOutData)
{
return NtGdiExtEscape(hDC, NULL, 0, nEscape, cbInput, (LPSTR)lpszInData, cbOutput, lpszOutData);
}
/*
* @implemented
*/
VOID
STDCALL
GdiSetLastError(DWORD dwErrCode)
{
NtCurrentTeb ()->LastErrorValue = (ULONG) dwErrCode;
}

File diff suppressed because it is too large Load Diff

View File

@@ -14,6 +14,39 @@
#define UNIMPLEMENTED DbgPrint("GDI32: %s is unimplemented, please try again later.\n", __FUNCTION__); #define UNIMPLEMENTED DbgPrint("GDI32: %s is unimplemented, please try again later.\n", __FUNCTION__);
/*
* @unimplemented
*/
int
STDCALL
DeviceCapabilitiesExA(
LPCSTR pDevice,
LPCSTR pPort,
WORD fwCapability,
LPSTR pOutput,
CONST DEVMODEA *pDevMode
)
{
UNIMPLEMENTED;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/*
* @unimplemented
*/
UINT
APIENTRY
GetOutlineTextMetricsA(
HDC hdc,
UINT cbData,
LPOUTLINETEXTMETRICA lpOTM
)
{
UNIMPLEMENTED;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/* /*
@@ -235,6 +268,36 @@ UpdateICMRegKeyA(
return FALSE; return FALSE;
} }
/*
* @unimplemented
*/
BOOL
STDCALL
RemoveFontResourceExA(
LPCSTR lpFileName,
DWORD fl,
PVOID pdv
)
{
UNIMPLEMENTED;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/*
* @unimplemented
*/
HFONT
STDCALL
CreateFontIndirectExA(const ENUMLOGFONTEXDVA *elfexd)
{
UNIMPLEMENTED;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/* /*
* @unimplemented * @unimplemented
*/ */
@@ -254,37 +317,15 @@ GetGlyphIndicesA(
} }
/* /*
* @implemented * @unimplemented
*/ */
UINT UINT
STDCALL STDCALL
GetStringBitmapA(HDC hdc, GetStringBitmapA(HDC hdc,LPSTR psz,BOOL unknown,UINT cj,BYTE *lpSB)
LPSTR psz,
BOOL DoCall,
UINT cj,
BYTE *lpSB)
{ {
UNIMPLEMENTED;
NTSTATUS Status; SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
PWSTR pwsz; return 0;
UINT retValue = 0;
if (DoCall)
{
Status = HEAP_strdupA2W ( &pwsz, psz );
if ( !NT_SUCCESS (Status) )
{
SetLastError (RtlNtStatusToDosError(Status));
}
else
{
retValue = NtGdiGetStringBitmapW(hdc, pwsz, 1, lpSB, cj);
HEAP_free ( pwsz );
}
}
return retValue;
} }

View File

@@ -13,7 +13,48 @@
#define UNIMPLEMENTED DbgPrint("GDI32: %s is unimplemented, please try again later.\n", __FUNCTION__); #define UNIMPLEMENTED DbgPrint("GDI32: %s is unimplemented, please try again later.\n", __FUNCTION__);
/*
* @unimplemented
*/
int
STDCALL
DeviceCapabilitiesExW(
LPCWSTR pDevice,
LPCWSTR pPort,
WORD fwCapability,
LPWSTR pOutput,
CONST DEVMODEW *pDevMode
)
{
#if 0
/* FIXME no NtGdiDeviceCapabilities???? */
return NtGdiDeviceCapabilities ( pDevice,
pPort,
fwCapability,
pOutput,
pDevMode );
#else
UNIMPLEMENTED;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
#endif
}
/*
* @unimplemented
*/
UINT
APIENTRY
GetOutlineTextMetricsW(
HDC hdc,
UINT cbData,
LPOUTLINETEXTMETRICW lpOTM
)
{
UNIMPLEMENTED;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/* /*
@@ -34,23 +75,19 @@ PolyTextOutW(
/* /*
* @implemented * @unimplemented
*/ */
DWORD DWORD
STDCALL STDCALL
GetKerningPairsW(HDC hdc, GetKerningPairsW(
ULONG cPairs, HDC a0,
LPKERNINGPAIR pkpDst) DWORD a1,
LPKERNINGPAIR a2
)
{ {
if ((cPairs != 0) || (pkpDst == 0)) UNIMPLEMENTED;
{ SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return NtGdiGetKerningPairs(hdc,cPairs,pkpDst); return 0;
}
else
{
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
} }
@@ -208,6 +245,23 @@ UpdateICMRegKeyW(
*/ */
/*
* @unimplemented
*/
DWORD
STDCALL
GetFontResourceInfoW(
DWORD a0,
DWORD a1,
DWORD a2,
DWORD a3
)
{
UNIMPLEMENTED;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/* /*
* @unimplemented * @unimplemented
*/ */
@@ -237,41 +291,52 @@ EudcUnloadLinkW(LPCWSTR pBaseFaceName,LPCWSTR pEudcFontPath)
*/ */
int int
STDCALL STDCALL
GdiAddFontResourceW(LPCWSTR lpszFilename,FLONG fl,DESIGNVECTOR *pdv) GdiAddFontResourceW(LPCWSTR filename,FLONG f,DESIGNVECTOR *pdv)
{ {
UNICODE_STRING Filename; UNIMPLEMENTED;
//UNIMPLEMENTED; SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
//SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return 0;
//return 0;
/* FIXME handle fl parameter */
RtlInitUnicodeString(&Filename, lpszFilename);
return NtGdiAddFontResource ( &Filename, fl );
} }
/*
* @unimplemented
*/
BOOL
STDCALL
GdiConsoleTextOut(HDC hdc, POLYTEXTW *lpto,UINT nStrings, RECTL *prclBounds)
{
UNIMPLEMENTED;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/* /*
* @implemented * @unimplemented
*/ */
DWORD DWORD
STDCALL STDCALL
GetEUDCTimeStampExW(LPWSTR lpBaseFaceName) GetEUDCTimeStampExW(LPCWSTR str)
{ {
DWORD retValue = 0; UNIMPLEMENTED;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
if (!lpBaseFaceName) return 0;
{
retValue = NtGdiGetEudcTimeStampEx(NULL,0,FALSE);
}
else
{
retValue = NtGdiGetEudcTimeStampEx(lpBaseFaceName, wcslen(lpBaseFaceName), FALSE);
}
return retValue;
} }
/*
* @unimplemented
*/
BOOL
STDCALL
RemoveFontResourceExW(
LPCWSTR lpFileName,
DWORD fl,
PVOID pdv
)
{
UNIMPLEMENTED;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/* /*
* @unimplemented * @unimplemented
@@ -297,6 +362,18 @@ bMakePathNameW(LPWSTR lpBuffer,LPCWSTR lpFileName,LPWSTR *lpFilePart,DWORD unkno
return 0; return 0;
} }
/*
* @unimplemented
*/
HFONT
STDCALL
CreateFontIndirectExW(const ENUMLOGFONTEXDVW *elfexd)
{
UNIMPLEMENTED;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/* /*
* @unimplemented * @unimplemented
*/ */
@@ -316,25 +393,15 @@ GetGlyphIndicesW(
} }
/* /*
* @implemented * @unimplemented
*/ */
UINT UINT
STDCALL STDCALL
GetStringBitmapW(HDC hdc, GetStringBitmapW(HDC hdc,LPWSTR pwsz,BOOL unknown,UINT cj,BYTE *lpSB)
LPWSTR pwsz,
BOOL doCall,
UINT cj,
BYTE *lpSB)
{ {
UINT retValue = 0; UNIMPLEMENTED;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
if (doCall) return 0;
{
retValue = NtGdiGetStringBitmapW(hdc, pwsz, 1, lpSB, cj);
}
return retValue;
} }

View File

@@ -28,11 +28,11 @@
typedef int STDCALL (*CHOOSEPIXELFMT) (HDC, CONST PIXELFORMATDESCRIPTOR *); typedef int (*CHOOSEPIXELFMT) (HDC, CONST PIXELFORMATDESCRIPTOR *);
typedef BOOL STDCALL (*SETPIXELFMT) (HDC, int, CONST PIXELFORMATDESCRIPTOR *); typedef BOOL (*SETPIXELFMT) (HDC, int, CONST PIXELFORMATDESCRIPTOR *);
typedef BOOL STDCALL (*SWAPBUFFERS) (HDC hdc); typedef BOOL (*SWAPBUFFERS) (HDC hdc);
typedef int STDCALL (*DESCRIBEPIXELFMT) (HDC, int, UINT, LPPIXELFORMATDESCRIPTOR); typedef int (*DESCRIBEPIXELFMT) (HDC, int, UINT, LPPIXELFORMATDESCRIPTOR);
typedef int STDCALL (*GETPIXELFMT) (HDC); typedef int (*GETPIXELFMT) (HDC);
static CHOOSEPIXELFMT glChoosePixelFormat = NULL; static CHOOSEPIXELFMT glChoosePixelFormat = NULL;
@@ -58,7 +58,7 @@ static BOOL OpenGLEnable(void)
if(glChoosePixelFormat == NULL) { if(glChoosePixelFormat == NULL) {
glChoosePixelFormat = (CHOOSEPIXELFMT)GetProcAddress(hOpenGL, "wglChoosePixelFormat"); glChoosePixelFormat = (CHOOSEPIXELFMT)GetProcAddress(hOpenGL, "wglChoosePixelFormat");
if(glChoosePixelFormat == NULL) if(glChoosePixelFormat == NULL)
return(FALSE); return(0);
} }
if(glSetPixelFormat == NULL) { if(glSetPixelFormat == NULL) {

View File

@@ -1,35 +1,5 @@
#include "precomp.h" #include "precomp.h"
//#define NDEBUG
//#include <debug.h>
/*
* Return the full scan size for a bitmap.
*
* Based on Wine, Utils.c and Windows Graphics Prog pg 595
*/
UINT
FASTCALL
DIB_BitmapMaxBitsSize( PBITMAPINFO Info, UINT ScanLines )
{
UINT MaxBits = 0;
if (Info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
{
PBITMAPCOREHEADER Core = (PBITMAPCOREHEADER)Info;
MaxBits = Core->bcBitCount * Core->bcPlanes * Core->bcWidth;
}
else /* assume BITMAPINFOHEADER */
{
if ((Info->bmiHeader.biCompression) && (Info->bmiHeader.biCompression != BI_BITFIELDS))
return Info->bmiHeader.biSizeImage;
// Planes are over looked by Yuan. I guess assumed always 1.
MaxBits = Info->bmiHeader.biBitCount * Info->bmiHeader.biPlanes * Info->bmiHeader.biWidth;
}
MaxBits = ((MaxBits + 31) & ~31 ) / 8; // From Yuan, ScanLineSize = (Width * bitcount + 31)/32
return (MaxBits * ScanLines); // ret the full Size.
}
/* /*
* @implemented * @implemented
*/ */
@@ -114,83 +84,3 @@ StretchBlt(
return NtGdiBitBlt(hdcDest, nXOriginDest, nYOriginDest, nWidthDest, return NtGdiBitBlt(hdcDest, nXOriginDest, nYOriginDest, nWidthDest,
nHeightDest, hdcSrc, nXOriginSrc, nYOriginSrc, dwRop, 0, 0); nHeightDest, hdcSrc, nXOriginSrc, nYOriginSrc, dwRop, 0, 0);
} }
/*
* @implemented
*/
HBITMAP WINAPI
CreateBitmapIndirect(const BITMAP *pbm)
{
if (pbm)
{
return NtGdiCreateBitmap(pbm->bmWidth,
pbm->bmHeight,
pbm->bmPlanes,
pbm->bmBitsPixel,
pbm->bmBits);
}
return NULL;
}
HBITMAP WINAPI
CreateDiscardableBitmap(
HDC hDC,
INT Width,
INT Height)
{
return CreateCompatibleBitmap(hDC, Width, Height);
}
HBITMAP WINAPI
CreateCompatibleBitmap(
HDC hDC,
INT Width,
INT Height)
{
/* FIXME some part shall be done in user mode */
return NtGdiCreateCompatibleBitmap(hDC, Width, Height);
}
INT
STDCALL
GetDIBits(
HDC hDC,
HBITMAP hbmp,
UINT uStartScan,
UINT cScanLines,
LPVOID lpvBits,
LPBITMAPINFO lpbmi,
UINT uUsage)
{
INT ret = 0;
if (hDC == NULL || !GdiIsHandleValid((HGDIOBJ)hDC))
{
GdiSetLastError(ERROR_INVALID_PARAMETER);
}
else if (lpbmi == NULL)
{
// XP doesn't run this check and results in a
// crash in DIB_BitmapMaxBitsSize, we'll be more forgiving
GdiSetLastError(ERROR_INVALID_PARAMETER);
}
else
{
UINT cjBmpScanSize = DIB_BitmapMaxBitsSize(lpbmi, cScanLines);
ret = NtGdiGetDIBitsInternal(hDC,
hbmp,
uStartScan,
cScanLines,
lpvBits,
lpbmi,
uUsage,
cjBmpScanSize,
0);
}
return ret;
}

View File

@@ -3,7 +3,19 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
/*
* @implemented
*/
BOOL
STDCALL
FixBrushOrgEx(
HDC hDC,
INT nXOrg,
INT nYOrg,
LPPOINT lpPoint)
{
return FALSE;
}
/* /*
* @implemented * @implemented

File diff suppressed because it is too large Load Diff

View File

@@ -15,58 +15,6 @@
#define INITIAL_FAMILY_COUNT 64 #define INITIAL_FAMILY_COUNT 64
/***********************************************************************
* TEXTMETRIC conversion functions.
*/
static void FONT_TextMetricWToA(const TEXTMETRICW *ptmW, LPTEXTMETRICA ptmA )
{
ptmA->tmHeight = ptmW->tmHeight;
ptmA->tmAscent = ptmW->tmAscent;
ptmA->tmDescent = ptmW->tmDescent;
ptmA->tmInternalLeading = ptmW->tmInternalLeading;
ptmA->tmExternalLeading = ptmW->tmExternalLeading;
ptmA->tmAveCharWidth = ptmW->tmAveCharWidth;
ptmA->tmMaxCharWidth = ptmW->tmMaxCharWidth;
ptmA->tmWeight = ptmW->tmWeight;
ptmA->tmOverhang = ptmW->tmOverhang;
ptmA->tmDigitizedAspectX = ptmW->tmDigitizedAspectX;
ptmA->tmDigitizedAspectY = ptmW->tmDigitizedAspectY;
ptmA->tmFirstChar = ptmW->tmFirstChar > 255 ? 255 : ptmW->tmFirstChar;
ptmA->tmLastChar = ptmW->tmLastChar > 255 ? 255 : ptmW->tmLastChar;
ptmA->tmDefaultChar = ptmW->tmDefaultChar > 255 ? 255 : ptmW->tmDefaultChar;
ptmA->tmBreakChar = ptmW->tmBreakChar > 255 ? 255 : ptmW->tmBreakChar;
ptmA->tmItalic = ptmW->tmItalic;
ptmA->tmUnderlined = ptmW->tmUnderlined;
ptmA->tmStruckOut = ptmW->tmStruckOut;
ptmA->tmPitchAndFamily = ptmW->tmPitchAndFamily;
ptmA->tmCharSet = ptmW->tmCharSet;
}
/***********************************************************************
* FONT_mbtowc
*
* Returns a Unicode translation of str. If count is -1 then str is
* assumed to be '\0' terminated, otherwise it contains the number of
* bytes to convert. If plenW is non-NULL, on return it will point to
* the number of WCHARs that have been written. The caller should free
* the returned LPWSTR from the process heap itself.
*/
static LPWSTR FONT_mbtowc(LPCSTR str, INT count, INT *plenW)
{
UINT cp = CP_ACP;
INT lenW;
LPWSTR strW;
if(count == -1) count = strlen(str);
lenW = MultiByteToWideChar(cp, 0, str, count, NULL, 0);
strW = HeapAlloc(GetProcessHeap(), 0, lenW*sizeof(WCHAR));
MultiByteToWideChar(cp, 0, str, count, strW, lenW);
DPRINT1("mapped %s -> %s \n", str, strW);
if(plenW) *plenW = lenW;
return strW;
}
static BOOL FASTCALL static BOOL FASTCALL
MetricsCharConvert(WCHAR w, UCHAR *b) MetricsCharConvert(WCHAR w, UCHAR *b)
{ {
@@ -277,12 +225,12 @@ IntEnumFontFamilies(HDC Dc, LPLOGFONTW LogFont, PVOID EnumProc, LPARAM lParam,
if (Unicode) if (Unicode)
{ {
Ret = ((FONTENUMPROCW) EnumProc)( Ret = ((FONTENUMPROCW) EnumProc)(
&Info[i].EnumLogFontEx, (LPLOGFONTW)&Info[i].EnumLogFontEx,
&Info[i].NewTextMetricEx, (LPTEXTMETRICW)&Info[i].NewTextMetricEx,
Info[i].FontType, lParam); Info[i].FontType, lParam);
} }
else else
{ // Could use EnumLogFontExW2A here? {
LogFontW2A(&EnumLogFontExA.elfLogFont, &Info[i].EnumLogFontEx.elfLogFont); LogFontW2A(&EnumLogFontExA.elfLogFont, &Info[i].EnumLogFontEx.elfLogFont);
WideCharToMultiByte(CP_THREAD_ACP, 0, Info[i].EnumLogFontEx.elfFullName, -1, WideCharToMultiByte(CP_THREAD_ACP, 0, Info[i].EnumLogFontEx.elfFullName, -1,
(LPSTR)EnumLogFontExA.elfFullName, LF_FULLFACESIZE, NULL, NULL); (LPSTR)EnumLogFontExA.elfFullName, LF_FULLFACESIZE, NULL, NULL);
@@ -293,8 +241,8 @@ IntEnumFontFamilies(HDC Dc, LPLOGFONTW LogFont, PVOID EnumProc, LPARAM lParam,
NewTextMetricExW2A(&NewTextMetricExA, NewTextMetricExW2A(&NewTextMetricExA,
&Info[i].NewTextMetricEx); &Info[i].NewTextMetricEx);
Ret = ((FONTENUMPROCA) EnumProc)( Ret = ((FONTENUMPROCA) EnumProc)(
&EnumLogFontExA, (LPLOGFONTA)&EnumLogFontExA,
&NewTextMetricExA, (LPTEXTMETRICA)&NewTextMetricExA,
Info[i].FontType, lParam); Info[i].FontType, lParam);
} }
} }
@@ -383,8 +331,6 @@ GetCharWidthA (
LPINT lpBuffer LPINT lpBuffer
) )
{ {
DPRINT1("GCWA iFirstChar %x\n",iFirstChar);
return GetCharWidth32A ( hdc, iFirstChar, iLastChar, lpBuffer ); return GetCharWidth32A ( hdc, iFirstChar, iLastChar, lpBuffer );
} }
@@ -401,35 +347,8 @@ GetCharWidth32A(
LPINT lpBuffer LPINT lpBuffer
) )
{ {
INT i, wlen, count = (INT)(iLastChar - iFirstChar + 1); /* FIXME should be NtGdiGetCharWidthW */
LPSTR str; return NtGdiGetCharWidth32(hdc, iFirstChar, iLastChar, lpBuffer);
LPWSTR wstr;
BOOL ret = TRUE;
DPRINT1("GCW32A iFirstChar %x\n",iFirstChar);
if(count <= 0) return FALSE;
str = HeapAlloc(GetProcessHeap(), 0, count);
for(i = 0; i < count; i++)
str[i] = (BYTE)(iFirstChar + i);
wstr = FONT_mbtowc(str, count, &wlen);
for(i = 0; i < wlen; i++)
{
/* FIXME should be NtGdiGetCharWidthW */
if(!NtGdiGetCharWidth32 (hdc, wstr[i], wstr[i], lpBuffer))
{
ret = FALSE;
break;
}
lpBuffer++;
}
HeapFree(GetProcessHeap(), 0, str);
HeapFree(GetProcessHeap(), 0, wstr);
return ret;
} }
@@ -445,8 +364,6 @@ GetCharWidthW (
LPINT lpBuffer LPINT lpBuffer
) )
{ {
DPRINT1("GCW32w uFirstChar %x\n",iFirstChar);
/* FIXME should be NtGdiGetCharWidthW */ /* FIXME should be NtGdiGetCharWidthW */
return NtGdiGetCharWidth32 ( hdc, iFirstChar, iLastChar, lpBuffer ); return NtGdiGetCharWidth32 ( hdc, iFirstChar, iLastChar, lpBuffer );
} }
@@ -552,7 +469,7 @@ GetCharWidthFloatA(
/* /*
* @implemented * @unimplemented
*/ */
BOOL BOOL
APIENTRY APIENTRY
@@ -563,9 +480,8 @@ GetCharABCWidthsA(
LPABC lpabc LPABC lpabc
) )
{ {
DPRINT1("GCABCWA uFirstChar %x\n",uFirstChar); /* FIXME what to do with uFirstChar and uLastChar ??? */
return NtGdiGetCharABCWidths ( hdc, uFirstChar, uLastChar, lpabc );
return NtGdiGetCharABCWidths(hdc, uFirstChar, uLastChar, lpabc);
} }
@@ -581,8 +497,6 @@ GetCharABCWidthsFloatA(
LPABCFLOAT lpABCF LPABCFLOAT lpABCF
) )
{ {
DPRINT1("GCABCWFA iFirstChar %x\n",iFirstChar);
/* FIXME what to do with iFirstChar and iLastChar ??? */ /* FIXME what to do with iFirstChar and iLastChar ??? */
return NtGdiGetCharABCWidthsFloat ( hdc, iFirstChar, iLastChar, lpABCF ); return NtGdiGetCharABCWidthsFloat ( hdc, iFirstChar, iLastChar, lpABCF );
} }
@@ -603,32 +517,9 @@ GetGlyphOutlineA(
CONST MAT2 *lpmat2 CONST MAT2 *lpmat2
) )
{ {
return NtGdiGetGlyphOutline ( hdc, uChar, uFormat, lpgm, cbBuffer, lpvBuffer, (CONST LPMAT2)lpmat2, TRUE);
LPWSTR p = NULL;
DWORD ret;
UINT c;
DPRINT1("GetGlyphOutlineA uChar %x\n", uChar);
if(!(uFormat & GGO_GLYPH_INDEX)) {
int len;
char mbchs[2];
if(uChar > 0xff) { /* but, 2 bytes character only */
len = 2;
mbchs[0] = (uChar & 0xff00) >> 8;
mbchs[1] = (uChar & 0xff);
} else {
len = 1;
mbchs[0] = (uChar & 0xff);
}
p = FONT_mbtowc(mbchs, len, NULL);
c = p[0];
} else
c = uChar;
ret = NtGdiGetGlyphOutline(hdc, c, uFormat, lpgm, cbBuffer, lpvBuffer, (CONST LPMAT2)lpmat2, TRUE);
HeapFree(GetProcessHeap(), 0, p);
return ret;
} }
/* /*
* @implemented * @implemented
*/ */
@@ -644,223 +535,10 @@ GetGlyphOutlineW(
CONST MAT2 *lpmat2 CONST MAT2 *lpmat2
) )
{ {
DPRINT1("GetGlyphOutlineW uChar %x\n", uChar);
return NtGdiGetGlyphOutline ( hdc, uChar, uFormat, lpgm, cbBuffer, lpvBuffer, (CONST LPMAT2)lpmat2, TRUE); return NtGdiGetGlyphOutline ( hdc, uChar, uFormat, lpgm, cbBuffer, lpvBuffer, (CONST LPMAT2)lpmat2, TRUE);
} }
/*
* @implemented
*/
UINT
APIENTRY
GetOutlineTextMetricsA(
HDC hdc,
UINT cbData,
LPOUTLINETEXTMETRICA lpOTM
)
{
char buf[512], *ptr;
UINT ret, needed;
OUTLINETEXTMETRICW *lpOTMW = (OUTLINETEXTMETRICW *)buf;
OUTLINETEXTMETRICA *output = lpOTM;
INT left, len;
if((ret = GetOutlineTextMetricsW(hdc, 0, NULL)) == 0)
return 0;
if(ret > sizeof(buf))
lpOTMW = HeapAlloc(GetProcessHeap(), 0, ret);
GetOutlineTextMetricsW(hdc, ret, lpOTMW);
needed = sizeof(OUTLINETEXTMETRICA);
if(lpOTMW->otmpFamilyName)
needed += WideCharToMultiByte(CP_ACP, 0,
(WCHAR*)((char*)lpOTMW + (int)lpOTMW->otmpFamilyName), -1,
NULL, 0, NULL, NULL);
if(lpOTMW->otmpFaceName)
needed += WideCharToMultiByte(CP_ACP, 0,
(WCHAR*)((char*)lpOTMW + (int)lpOTMW->otmpFaceName), -1,
NULL, 0, NULL, NULL);
if(lpOTMW->otmpStyleName)
needed += WideCharToMultiByte(CP_ACP, 0,
(WCHAR*)((char*)lpOTMW + (int)lpOTMW->otmpStyleName), -1,
NULL, 0, NULL, NULL);
if(lpOTMW->otmpFullName)
needed += WideCharToMultiByte(CP_ACP, 0,
(WCHAR*)((char*)lpOTMW + (int)lpOTMW->otmpFullName), -1,
NULL, 0, NULL, NULL);
if(!lpOTM) {
ret = needed;
goto end;
}
DPRINT("needed = %d\n", needed);
if(needed > cbData)
/* Since the supplied buffer isn't big enough, we'll alloc one
that is and memcpy the first cbData bytes into the lpOTM at
the end. */
output = HeapAlloc(GetProcessHeap(), 0, needed);
ret = output->otmSize = min(needed, cbData);
FONT_TextMetricWToA( &lpOTMW->otmTextMetrics, &output->otmTextMetrics );
output->otmFiller = 0;
output->otmPanoseNumber = lpOTMW->otmPanoseNumber;
output->otmfsSelection = lpOTMW->otmfsSelection;
output->otmfsType = lpOTMW->otmfsType;
output->otmsCharSlopeRise = lpOTMW->otmsCharSlopeRise;
output->otmsCharSlopeRun = lpOTMW->otmsCharSlopeRun;
output->otmItalicAngle = lpOTMW->otmItalicAngle;
output->otmEMSquare = lpOTMW->otmEMSquare;
output->otmAscent = lpOTMW->otmAscent;
output->otmDescent = lpOTMW->otmDescent;
output->otmLineGap = lpOTMW->otmLineGap;
output->otmsCapEmHeight = lpOTMW->otmsCapEmHeight;
output->otmsXHeight = lpOTMW->otmsXHeight;
output->otmrcFontBox = lpOTMW->otmrcFontBox;
output->otmMacAscent = lpOTMW->otmMacAscent;
output->otmMacDescent = lpOTMW->otmMacDescent;
output->otmMacLineGap = lpOTMW->otmMacLineGap;
output->otmusMinimumPPEM = lpOTMW->otmusMinimumPPEM;
output->otmptSubscriptSize = lpOTMW->otmptSubscriptSize;
output->otmptSubscriptOffset = lpOTMW->otmptSubscriptOffset;
output->otmptSuperscriptSize = lpOTMW->otmptSuperscriptSize;
output->otmptSuperscriptOffset = lpOTMW->otmptSuperscriptOffset;
output->otmsStrikeoutSize = lpOTMW->otmsStrikeoutSize;
output->otmsStrikeoutPosition = lpOTMW->otmsStrikeoutPosition;
output->otmsUnderscoreSize = lpOTMW->otmsUnderscoreSize;
output->otmsUnderscorePosition = lpOTMW->otmsUnderscorePosition;
ptr = (char*)(output + 1);
left = needed - sizeof(*output);
if(lpOTMW->otmpFamilyName) {
output->otmpFamilyName = (LPSTR)(ptr - (char*)output);
len = WideCharToMultiByte(CP_ACP, 0,
(WCHAR*)((char*)lpOTMW + (int)lpOTMW->otmpFamilyName), -1,
ptr, left, NULL, NULL);
left -= len;
ptr += len;
} else
output->otmpFamilyName = 0;
if(lpOTMW->otmpFaceName) {
output->otmpFaceName = (LPSTR)(ptr - (char*)output);
len = WideCharToMultiByte(CP_ACP, 0,
(WCHAR*)((char*)lpOTMW + (int)lpOTMW->otmpFaceName), -1,
ptr, left, NULL, NULL);
left -= len;
ptr += len;
} else
output->otmpFaceName = 0;
if(lpOTMW->otmpStyleName) {
output->otmpStyleName = (LPSTR)(ptr - (char*)output);
len = WideCharToMultiByte(CP_ACP, 0,
(WCHAR*)((char*)lpOTMW + (int)lpOTMW->otmpStyleName), -1,
ptr, left, NULL, NULL);
left -= len;
ptr += len;
} else
output->otmpStyleName = 0;
if(lpOTMW->otmpFullName) {
output->otmpFullName = (LPSTR)(ptr - (char*)output);
len = WideCharToMultiByte(CP_ACP, 0,
(WCHAR*)((char*)lpOTMW + (int)lpOTMW->otmpFullName), -1,
ptr, left, NULL, NULL);
left -= len;
} else
output->otmpFullName = 0;
assert(left == 0);
if(output != lpOTM) {
memcpy(lpOTM, output, cbData);
HeapFree(GetProcessHeap(), 0, output);
/* check if the string offsets really fit into the provided size */
/* FIXME: should we check string length as well? */
if ((UINT_PTR)lpOTM->otmpFamilyName >= lpOTM->otmSize)
lpOTM->otmpFamilyName = 0; /* doesn't fit */
if ((UINT_PTR)lpOTM->otmpFaceName >= lpOTM->otmSize)
lpOTM->otmpFaceName = 0; /* doesn't fit */
if ((UINT_PTR)lpOTM->otmpStyleName >= lpOTM->otmSize)
lpOTM->otmpStyleName = 0; /* doesn't fit */
if ((UINT_PTR)lpOTM->otmpFullName >= lpOTM->otmSize)
lpOTM->otmpFullName = 0; /* doesn't fit */
}
end:
if(lpOTMW != (OUTLINETEXTMETRICW *)buf)
HeapFree(GetProcessHeap(), 0, lpOTMW);
return ret;
}
/*
* @implemented
*/
UINT
APIENTRY
GetOutlineTextMetricsW(
HDC hdc,
UINT cbData,
LPOUTLINETEXTMETRICW lpOTM
)
{
TMDIFF Tmd; // Should not be zero.
return NtGdiGetOutlineTextMetricsInternalW(hdc, cbData, lpOTM, &Tmd);
}
/*
* @implemented
*/
HFONT
STDCALL
CreateFontIndirectExA(const ENUMLOGFONTEXDVA *elfexd)
{
if (elfexd)
{
ENUMLOGFONTEXDVW Logfont;
EnumLogFontExW2A( (LPENUMLOGFONTEXA) elfexd,
&Logfont.elfEnumLogfontEx );
RtlCopyMemory( &Logfont.elfDesignVector,
(PVOID) &elfexd->elfDesignVector,
sizeof(DESIGNVECTOR));
return NtGdiHfontCreate( &Logfont, 0, 0, 0, NULL);
}
else return NULL;
}
/*
* @implemented
*/
HFONT
STDCALL
CreateFontIndirectExW(const ENUMLOGFONTEXDVW *elfexd)
{
/* Msdn: Note, this function ignores the elfDesignVector member in
ENUMLOGFONTEXDV.
*/
if ( elfexd )
{
return NtGdiHfontCreate((PENUMLOGFONTEXDVW) elfexd, 0, 0, 0, NULL );
}
else return NULL;
}
/* /*
* @implemented * @implemented
@@ -871,14 +549,11 @@ CreateFontIndirectA(
CONST LOGFONTA *lplf CONST LOGFONTA *lplf
) )
{ {
if (lplf) LOGFONTW tlf;
{
LOGFONTW tlf;
LogFontA2W(&tlf, lplf); LogFontA2W(&tlf, lplf);
return CreateFontIndirectW(&tlf);
} return NtGdiCreateFontIndirect(&tlf);
else return NULL;
} }
@@ -891,25 +566,7 @@ CreateFontIndirectW(
CONST LOGFONTW *lplf CONST LOGFONTW *lplf
) )
{ {
if (lplf) return NtGdiCreateFontIndirect((CONST LPLOGFONTW)lplf);
{
ENUMLOGFONTEXDVW Logfont;
RtlCopyMemory( &Logfont.elfEnumLogfontEx.elfLogFont, lplf, sizeof(LOGFONTW));
// Need something other than just cleaning memory here.
// Guess? Use caller data to determine the rest.
RtlZeroMemory( &Logfont.elfEnumLogfontEx.elfFullName,
sizeof(Logfont.elfEnumLogfontEx.elfFullName));
RtlZeroMemory( &Logfont.elfEnumLogfontEx.elfStyle,
sizeof(Logfont.elfEnumLogfontEx.elfStyle));
RtlZeroMemory( &Logfont.elfEnumLogfontEx.elfScript,
sizeof(Logfont.elfEnumLogfontEx.elfScript));
RtlZeroMemory( &Logfont.elfDesignVector, sizeof(DESIGNVECTOR));
return CreateFontIndirectExW(&Logfont);
}
else return NULL;
} }
@@ -942,20 +599,8 @@ CreateFontA(
RtlInitAnsiString(&StringA, (LPSTR)lpszFace); RtlInitAnsiString(&StringA, (LPSTR)lpszFace);
RtlAnsiStringToUnicodeString(&StringU, &StringA, TRUE); RtlAnsiStringToUnicodeString(&StringU, &StringA, TRUE);
ret = CreateFontW(nHeight, ret = CreateFontW(nHeight, nWidth, nEscapement, nOrientation, fnWeight, fdwItalic, fdwUnderline, fdwStrikeOut,
nWidth, fdwCharSet, fdwOutputPrecision, fdwClipPrecision, fdwQuality, fdwPitchAndFamily, StringU.Buffer);
nEscapement,
nOrientation,
fnWeight,
fdwItalic,
fdwUnderline,
fdwStrikeOut,
fdwCharSet,
fdwOutputPrecision,
fdwClipPrecision,
fdwQuality,
fdwPitchAndFamily,
StringU.Buffer);
RtlFreeUnicodeString(&StringU); RtlFreeUnicodeString(&StringU);
@@ -985,35 +630,8 @@ CreateFontW(
LPCWSTR lpszFace LPCWSTR lpszFace
) )
{ {
LOGFONTW logfont; return NtGdiCreateFont(nHeight, nWidth, nEscapement, nOrientation, nWeight, fnItalic, fdwUnderline, fdwStrikeOut,
fdwCharSet, fdwOutputPrecision, fdwClipPrecision, fdwQuality, fdwPitchAndFamily, lpszFace);
logfont.lfHeight = nHeight;
logfont.lfWidth = nWidth;
logfont.lfEscapement = nEscapement;
logfont.lfOrientation = nOrientation;
logfont.lfWeight = nWeight;
logfont.lfItalic = fnItalic;
logfont.lfUnderline = fdwUnderline;
logfont.lfStrikeOut = fdwStrikeOut;
logfont.lfCharSet = fdwCharSet;
logfont.lfOutPrecision = fdwOutputPrecision;
logfont.lfClipPrecision = fdwClipPrecision;
logfont.lfQuality = fdwQuality;
logfont.lfPitchAndFamily = fdwPitchAndFamily;
if (NULL != lpszFace)
{
int Size = sizeof(logfont.lfFaceName) / sizeof(WCHAR);
wcsncpy((wchar_t *)logfont.lfFaceName, lpszFace, Size - 1);
/* Be 101% sure to have '\0' at end of string */
logfont.lfFaceName[Size - 1] = '\0';
}
else
{
logfont.lfFaceName[0] = L'\0';
}
return CreateFontIndirectW(&logfont);
} }
@@ -1091,13 +709,11 @@ int
STDCALL STDCALL
AddFontResourceExW ( LPCWSTR lpszFilename, DWORD fl, PVOID pvReserved ) AddFontResourceExW ( LPCWSTR lpszFilename, DWORD fl, PVOID pvReserved )
{ {
if (fl & ~(FR_PRIVATE | FR_NOT_ENUM)) UNICODE_STRING Filename;
{
SetLastError( ERROR_INVALID_PARAMETER );
return 0;
}
return GdiAddFontResourceW(lpszFilename, fl,0); /* FIXME handle fl parameter */
RtlInitUnicodeString(&Filename, lpszFilename);
return NtGdiAddFontResource ( &Filename, fl );
} }
@@ -1108,26 +724,20 @@ int
STDCALL STDCALL
AddFontResourceExA ( LPCSTR lpszFilename, DWORD fl, PVOID pvReserved ) AddFontResourceExA ( LPCSTR lpszFilename, DWORD fl, PVOID pvReserved )
{ {
NTSTATUS Status; NTSTATUS Status;
PWSTR FilenameW; PWSTR FilenameW;
int rc; int rc = 0;
if (fl & ~(FR_PRIVATE | FR_NOT_ENUM)) Status = HEAP_strdupA2W ( &FilenameW, lpszFilename );
if ( !NT_SUCCESS (Status) )
SetLastError (RtlNtStatusToDosError(Status));
else
{ {
SetLastError( ERROR_INVALID_PARAMETER ); rc = AddFontResourceExW ( FilenameW, fl, pvReserved );
return 0;
}
Status = HEAP_strdupA2W ( &FilenameW, lpszFilename ); HEAP_free ( FilenameW );
if ( !NT_SUCCESS (Status) )
{
SetLastError (RtlNtStatusToDosError(Status));
return 0;
} }
return rc;
rc = GdiAddFontResourceW ( FilenameW, fl, 0 );
HEAP_free ( FilenameW );
return rc;
} }
@@ -1138,22 +748,7 @@ int
STDCALL STDCALL
AddFontResourceA ( LPCSTR lpszFilename ) AddFontResourceA ( LPCSTR lpszFilename )
{ {
NTSTATUS Status; return AddFontResourceExA ( lpszFilename, 0, 0 );
PWSTR FilenameW;
int rc = 0;
Status = HEAP_strdupA2W ( &FilenameW, lpszFilename );
if ( !NT_SUCCESS (Status) )
{
SetLastError (RtlNtStatusToDosError(Status));
}
else
{
rc = GdiAddFontResourceW ( FilenameW, 0, 0);
HEAP_free ( FilenameW );
}
return rc;
} }
@@ -1164,7 +759,7 @@ int
STDCALL STDCALL
AddFontResourceW ( LPCWSTR lpszFilename ) AddFontResourceW ( LPCWSTR lpszFilename )
{ {
return GdiAddFontResourceW ( lpszFilename, 0, 0 ); return AddFontResourceExW ( lpszFilename, 0, 0 );
} }
@@ -1173,9 +768,11 @@ AddFontResourceW ( LPCWSTR lpszFilename )
*/ */
BOOL BOOL
STDCALL STDCALL
RemoveFontResourceW(LPCWSTR lpFileName) RemoveFontResourceW(
LPCWSTR lpFileName
)
{ {
return RemoveFontResourceExW(lpFileName,0,0); return NtGdiRemoveFontResource ( lpFileName );
} }
@@ -1184,58 +781,27 @@ RemoveFontResourceW(LPCWSTR lpFileName)
*/ */
BOOL BOOL
STDCALL STDCALL
RemoveFontResourceA(LPCSTR lpFileName) RemoveFontResourceA(
LPCSTR lpFileName
)
{ {
return RemoveFontResourceExA(lpFileName,0,0); NTSTATUS Status;
} LPWSTR lpFileNameW;
BOOL rc = 0;
/* Status = HEAP_strdupA2W ( &lpFileNameW, lpFileName );
* @implemented if (!NT_SUCCESS (Status))
*/
BOOL
STDCALL
RemoveFontResourceExA(LPCSTR lpFileName,
DWORD fl,
PVOID pdv
)
{
NTSTATUS Status;
LPWSTR lpFileNameW;
BOOL rc = 0;
/* FIXME the flags */
/* FIXME the pdv */
/* FIXME NtGdiRemoveFontResource handle flags and pdv */
Status = HEAP_strdupA2W ( &lpFileNameW, lpFileName );
if (!NT_SUCCESS (Status))
SetLastError (RtlNtStatusToDosError(Status)); SetLastError (RtlNtStatusToDosError(Status));
else else
{ {
rc = NtGdiRemoveFontResource ( lpFileNameW ); rc = NtGdiRemoveFontResource ( lpFileNameW );
HEAP_free ( lpFileNameW ); HEAP_free ( lpFileNameW );
} }
return rc; return rc;
} }
/*
* @unimplemented
*/
BOOL
STDCALL
RemoveFontResourceExW(LPCWSTR lpFileName,
DWORD fl,
PVOID pdv)
{
/* FIXME the flags */
/* FIXME the pdv */
/* FIXME NtGdiRemoveFontResource handle flags and pdv */
return NtGdiRemoveFontResource ( lpFileName);
}
/*********************************************************************** /***********************************************************************
* GdiGetCharDimensions * GdiGetCharDimensions
* *
@@ -1339,78 +905,6 @@ EnumFontsA (
#endif #endif
} }
#define EfdFontFamilies 3
INT
STDCALL
NewEnumFontFamiliesExW(
HDC hDC,
LPLOGFONTW lpLogfont,
FONTENUMPROCW lpEnumFontFamExProcW,
LPARAM lParam,
DWORD dwFlags)
{
ULONG_PTR idEnum, cbDataSize, cbRetSize;
PENUMFONTDATAW pEfdw;
PBYTE pBuffer;
PBYTE pMax;
INT ret = 1;
/* Open enumeration handle and find out how much memory we need */
idEnum = NtGdiEnumFontOpen(hDC,
EfdFontFamilies,
0,
LF_FACESIZE,
(lpLogfont && lpLogfont->lfFaceName[0])? lpLogfont->lfFaceName : NULL,
lpLogfont? lpLogfont->lfCharSet : DEFAULT_CHARSET,
&cbDataSize);
if (idEnum == 0)
{
return 0;
}
if (cbDataSize == 0)
{
NtGdiEnumFontClose(idEnum);
return 0;
}
/* Allocate memory */
pBuffer = HeapAlloc(GetProcessHeap(), 0, cbDataSize);
if (pBuffer == NULL)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
NtGdiEnumFontClose(idEnum);
return 0;
}
/* Do the enumeration */
if (!NtGdiEnumFontChunk(hDC, idEnum, cbDataSize, &cbRetSize, (PVOID)pBuffer))
{
HeapFree(GetProcessHeap(), 0, pBuffer);
NtGdiEnumFontClose(idEnum);
return 0;
}
/* Get start and end address */
pEfdw = (PENUMFONTDATAW)pBuffer;
pMax = pBuffer + cbDataSize;
/* Iterate through the structures */
while ((PBYTE)pEfdw < pMax && ret)
{
PNTMW_INTERNAL pNtmwi = (PNTMW_INTERNAL)((ULONG_PTR)pEfdw + pEfdw->ulNtmwiOffset);
ret = lpEnumFontFamExProcW(&pEfdw->elfexdv.elfEnumLogfontEx,
&pNtmwi->ntmw,
pEfdw->dwFontType,
lParam);
pEfdw = (PENUMFONTDATAW)((ULONG_PTR)pEfdw + pEfdw->cbSize);
}
/* Release the memory and close handle */
HeapFree(GetProcessHeap(), 0, pBuffer);
NtGdiEnumFontClose(idEnum);
return ret;
}

View File

@@ -43,44 +43,7 @@ BOOL STDCALL LineDDA(INT nXStart, INT nYStart, INT nXEnd, INT nYEnd,
INT cnt; INT cnt;
INT dx = nXEnd - nXStart; INT dx = nXEnd - nXStart;
INT dy = nYEnd - nYStart; INT dy = nYEnd - nYStart;
// optimized for vertical and horizontal lines so we avoid unnecessary math
if(nXStart == nXEnd)
{
// vertical line - use dx,dy as temp variables so we don't waste stack space
if(nYStart < nYEnd)
{
dx = nYStart;
dy = nYEnd;
} else {
dx = nYEnd;
dy = nYStart;
}
for(cnt = dx; cnt <= dy; cnt++)
{
lpLineFunc(nXStart,cnt,lpData);
}
return TRUE;
}
if(nYStart == nYEnd)
{
// horizontal line - use dx,dy as temp variables so we don't waste stack space
if(nXStart < nXEnd)
{
dx = nXStart;
dy = nXEnd;
} else {
dx = nXEnd;
dy = nXStart;
}
for(cnt = dx; cnt <= dy; cnt++)
{
lpLineFunc(cnt, nYStart,lpData);
}
return TRUE;
}
// end of H/V line code
if (dx < 0) { if (dx < 0) {
dx = -dx; xadd = -1; dx = -dx; xadd = -1;
} }

View File

@@ -1,96 +1,5 @@
#include "precomp.h" #include "precomp.h"
/* DEFINES *******************************************************************/
/* PRIVATE DATA **************************************************************/
PMF_ENTRY hMF_List = NULL;
DWORD hMFCount = 0;
/* INTERNAL FUNCTIONS ********************************************************/
BOOL
MF_CreateMFDC ( HGDIOBJ hMDC,
PMETAFILEDC pmfDC )
{
PMF_ENTRY pMFME;
pMFME = LocalAlloc(LMEM_ZEROINIT, sizeof(MF_ENTRY));
if (!pMFME)
{
return FALSE;
}
if (hMF_List == NULL)
{
hMF_List = pMFME;
InitializeListHead(&hMF_List->List);
}
else
InsertTailList(&hMF_List->List, &pMFME->List);
pMFME->hmDC = hMDC;
pMFME->pmfDC = pmfDC;
hMFCount++;
return TRUE;
}
PMETAFILEDC
MF_GetMFDC ( HGDIOBJ hMDC )
{
PMF_ENTRY pMFME = hMF_List;
do
{
if ( pMFME->hmDC == hMDC ) return pMFME->pmfDC;
pMFME = (PMF_ENTRY) pMFME->List.Flink;
}
while ( pMFME != hMF_List );
return NULL;
}
BOOL
MF_DeleteMFDC ( HGDIOBJ hMDC )
{
PMF_ENTRY pMFME = hMF_List;
do
{
if ( pMFME->hmDC == hMDC)
{
RemoveEntryList(&pMFME->List);
LocalFree ( pMFME );
hMFCount--;
if (!hMFCount) hMF_List = NULL;
return TRUE;
}
pMFME = (PMF_ENTRY) pMFME->List.Flink;
}
while ( pMFME != hMF_List );
return FALSE;
}
/* FUNCTIONS *****************************************************************/
/*
* @unimplemented
*/
HMETAFILE
STDCALL
CloseMetaFile(
HDC a0
)
{
return 0;
}
/* /*
* @implemented * @implemented
*/ */
@@ -101,7 +10,7 @@ CopyMetaFileW(
LPCWSTR lpszFile LPCWSTR lpszFile
) )
{ {
return NULL; return NtGdiCopyMetaFile (hmfSrc, lpszFile);
} }
@@ -124,7 +33,8 @@ CopyMetaFileA(
SetLastError (RtlNtStatusToDosError(Status)); SetLastError (RtlNtStatusToDosError(Status));
else else
{ {
rc = CopyMetaFileW( hmfSrc, lpszFileW ); rc = NtGdiCopyMetaFile ( hmfSrc, lpszFileW );
HEAP_free ( lpszFileW ); HEAP_free ( lpszFileW );
} }
@@ -141,50 +51,7 @@ CreateMetaFileW(
LPCWSTR lpszFile LPCWSTR lpszFile
) )
{ {
HANDLE hFile; return NtGdiCreateMetaFile ( lpszFile );
HDC hmDC;
PMETAFILEDC pmfDC = LocalAlloc(LMEM_ZEROINIT, sizeof(METAFILEDC));
if (!pmfDC) return NULL;
pmfDC->mh.mtHeaderSize = sizeof(METAHEADER) / sizeof(WORD);
pmfDC->mh.mtVersion = 0x0300;
pmfDC->mh.mtSize = pmfDC->mh.mtHeaderSize;
if (lpszFile) /* disk based metafile */
{
pmfDC->mh.mtType = METAFILE_DISK;
if(!GetFullPathName( lpszFile,
MAX_PATH,
(LPTSTR) &pmfDC->Filename,
(LPTSTR*) &lpszFile))
{
// MFDRV_DeleteDC( dc->physDev );
return NULL;
}
if ((hFile = CreateFileW(pmfDC->Filename, GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, 0, 0)) == INVALID_HANDLE_VALUE)
{
// MFDRV_DeleteDC( dc->physDev );
return NULL;
}
if (!WriteFile( hFile, &pmfDC->mh, sizeof(pmfDC->mh), NULL, NULL ))
{
// MFDRV_DeleteDC( dc->physDev );
return NULL;
}
pmfDC->hFile = hFile;
}
else /* memory based metafile */
pmfDC->mh.mtType = METAFILE_MEMORY;
hmDC = NtGdiCreateClientObj ( GDI_OBJECT_TYPE_METADC );
MF_CreateMFDC ( hmDC, pmfDC );
return hmDC;
} }
@@ -206,26 +73,14 @@ CreateMetaFileA(
SetLastError (RtlNtStatusToDosError(Status)); SetLastError (RtlNtStatusToDosError(Status));
else else
{ {
rc = CreateMetaFileW( lpszFileW ); rc = NtGdiCreateMetaFile ( lpszFileW );
HEAP_free ( lpszFileW ); HEAP_free ( lpszFileW );
} }
return rc; return rc;
} }
/*
* @unimplemented
*/
BOOL
STDCALL
DeleteMetaFile(
HMETAFILE a0
)
{
return FALSE;
}
/* /*
* @implemented * @implemented
*/ */
@@ -235,7 +90,7 @@ GetMetaFileW(
LPCWSTR lpszMetaFile LPCWSTR lpszMetaFile
) )
{ {
return NULL; return NtGdiGetMetaFile ( lpszMetaFile );
} }
@@ -257,7 +112,8 @@ GetMetaFileA(
SetLastError (RtlNtStatusToDosError(Status)); SetLastError (RtlNtStatusToDosError(Status));
else else
{ {
rc = GetMetaFileW( lpszMetaFileW ); rc = NtGdiGetMetaFile ( lpszMetaFileW );
HEAP_free ( lpszMetaFileW ); HEAP_free ( lpszMetaFileW );
} }
@@ -265,3 +121,199 @@ GetMetaFileA(
} }
/*
* @implemented
*/
HENHMETAFILE
STDCALL
CopyEnhMetaFileW(
HENHMETAFILE hemfSrc,
LPCWSTR lpszFile
)
{
return NtGdiCopyEnhMetaFile ( hemfSrc, lpszFile );
}
/*
* @implemented
*/
HENHMETAFILE
STDCALL
CopyEnhMetaFileA(
HENHMETAFILE hemfSrc,
LPCSTR lpszFile
)
{
NTSTATUS Status;
LPWSTR lpszFileW;
HENHMETAFILE rc = 0;
Status = HEAP_strdupA2W ( &lpszFileW, lpszFile );
if (!NT_SUCCESS (Status))
SetLastError (RtlNtStatusToDosError(Status));
else
{
rc = NtGdiCopyEnhMetaFile ( hemfSrc, lpszFileW );
HEAP_free ( lpszFileW );
}
return rc;
}
/*
* @implemented
*/
HDC
STDCALL
CreateEnhMetaFileW(
HDC hdcRef,
LPCWSTR lpFileName,
CONST RECT *lpRect,
LPCWSTR lpDescription
)
{
return NtGdiCreateEnhMetaFile ( hdcRef, lpFileName, (CONST LPRECT)lpRect, lpDescription );
}
/*
* @implemented
*/
HDC
STDCALL
CreateEnhMetaFileA(
HDC hdcRef,
LPCSTR lpFileName,
CONST RECT *lpRect,
LPCSTR lpDescription
)
{
NTSTATUS Status;
LPWSTR lpFileNameW, lpDescriptionW;
HDC rc = 0;
Status = HEAP_strdupA2W ( &lpFileNameW, lpFileName );
if (!NT_SUCCESS (Status))
SetLastError (RtlNtStatusToDosError(Status));
else
{
Status = HEAP_strdupA2W ( &lpDescriptionW, lpDescription );
if (!NT_SUCCESS (Status))
SetLastError (RtlNtStatusToDosError(Status));
else
{
rc = NtGdiCreateEnhMetaFile (
hdcRef, lpFileNameW, (CONST LPRECT)lpRect, lpDescriptionW );
HEAP_free ( lpDescriptionW );
}
HEAP_free ( lpFileNameW );
}
return rc;
}
/*
* @implemented
*/
HENHMETAFILE
STDCALL
GetEnhMetaFileW(
LPCWSTR lpszMetaFile
)
{
return NtGdiGetEnhMetaFile ( lpszMetaFile );
}
/*
* @implemented
*/
HENHMETAFILE
STDCALL
GetEnhMetaFileA(
LPCSTR lpszMetaFile
)
{
NTSTATUS Status;
LPWSTR lpszMetaFileW;
HENHMETAFILE rc = 0;
Status = HEAP_strdupA2W ( &lpszMetaFileW, lpszMetaFile );
if (!NT_SUCCESS (Status))
SetLastError (RtlNtStatusToDosError(Status));
else
{
rc = NtGdiGetEnhMetaFile ( lpszMetaFileW );
HEAP_free ( lpszMetaFileW );
}
return rc;
}
/*
* @implemented
*/
UINT
STDCALL
GetEnhMetaFileDescriptionW(
HENHMETAFILE hemf,
UINT cchBuffer,
LPWSTR lpszDescription
)
{
return NtGdiGetEnhMetaFileDescription ( hemf, cchBuffer, lpszDescription );
}
/*
* @implemented
*/
UINT
STDCALL
GetEnhMetaFileDescriptionA(
HENHMETAFILE hemf,
UINT cchBuffer,
LPSTR lpszDescription
)
{
NTSTATUS Status;
LPWSTR lpszDescriptionW;
UINT rc;
if ( lpszDescription && cchBuffer )
{
lpszDescriptionW = (LPWSTR)HEAP_alloc ( cchBuffer*sizeof(WCHAR) );
if ( !lpszDescriptionW )
{
SetLastError (RtlNtStatusToDosError(STATUS_NO_MEMORY));
return 0;
}
}
else
lpszDescriptionW = NULL;
rc = NtGdiGetEnhMetaFileDescription ( hemf, cchBuffer, lpszDescriptionW );
if ( lpszDescription && cchBuffer )
{
Status = RtlUnicodeToMultiByteN ( lpszDescription,
cchBuffer,
NULL,
lpszDescriptionW,
cchBuffer );
HEAP_free ( lpszDescriptionW );
if ( !NT_SUCCESS(Status) )
{
SetLastError (RtlNtStatusToDosError(Status));
return 0;
}
}
return rc;
}

View File

@@ -91,25 +91,16 @@ FlattenPath(
/* /*
* @implemented * @implemented
*/ */
INT int
STDCALL STDCALL
GetPath(HDC hdc, GetPath(
LPPOINT pptlBuf, HDC hdc,
LPBYTE pjTypes, LPPOINT a1,
INT cptBuf) LPBYTE a2,
int a3
)
{ {
INT retValue = -1; return NtGdiGetPath ( hdc, a1, a2, a3 );
if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_METADC)
{
SetLastError(ERROR_INVALID_PARAMETER);
}
else
{
retValue = NtGdiGetPath(hdc,pptlBuf,pjTypes,cptBuf);
}
return retValue;
} }
@@ -178,6 +169,20 @@ WidenPath(
return NtGdiWidenPath ( hdc ); return NtGdiWidenPath ( hdc );
} }
/*
* @implemented
*/
BOOL
STDCALL
GetMiterLimit(
HDC hdc,
PFLOAT a1
)
{
return NtGdiGetMiterLimit ( hdc, (PDWORD)a1 );
}
/* /*
* @implemented * @implemented
*/ */

View File

@@ -1,19 +1,6 @@
#include "precomp.h" #include "precomp.h"
/*
* @implemented
*/
int STDCALL
SelectClipRgn(
HDC hdc,
HRGN hrgn
)
{
return ExtSelectClipRgn(hdc, hrgn, RGN_COPY);
}
/* /*
* @implemented * @implemented
*/ */
@@ -24,55 +11,13 @@ GetClipRgn(
HRGN hrgn HRGN hrgn
) )
{ {
return NtGdiGetRandomRgn(hdc, hrgn, 1); HRGN rgn = NtGdiGetClipRgn(hdc);
if(rgn)
{
if(NtGdiCombineRgn(hrgn, rgn, 0, RGN_COPY) != ERROR) return 1;
else
return -1;
}
else return 0;
} }
HRGN
WINAPI
CreatePolygonRgn( const POINT * lppt, int cPoints, int fnPolyFillMode)
{
return (HRGN) NtGdiPolyPolyDraw( (HDC) fnPolyFillMode, (PPOINT) lppt, (PULONG) &cPoints, 1, GdiPolyPolyRgn);
}
HRGN
WINAPI
CreatePolyPolygonRgn( const POINT* lppt,
const INT* lpPolyCounts,
int nCount,
int fnPolyFillMode)
{
return (HRGN) NtGdiPolyPolyDraw( (HDC) fnPolyFillMode, (PPOINT) lppt, (PULONG) lpPolyCounts, (ULONG) nCount, GdiPolyPolyRgn );
}
HRGN
WINAPI
CreateEllipticRgnIndirect(
const RECT *prc
)
{
/* Notes if prc is NULL it will crash on All Windows NT I checked 2000/XP/VISTA */
return NtGdiCreateEllipticRgn(prc->left, prc->top, prc->right, prc->bottom);
}
HRGN
WINAPI
CreateRectRgn(int x1, int y1, int x2,int y2)
{
/* FIXME Some part need be done in user mode */
return NtGdiCreateRectRgn(x1,y1,x2,y2);
}
HRGN
WINAPI
CreateRectRgnIndirect(
const RECT *prc
)
{
/* Notes if prc is NULL it will crash on All Windows NT I checked 2000/XP/VISTA */
return CreateRectRgn(prc->left, prc->top, prc->right, prc->bottom);
}

View File

@@ -43,27 +43,7 @@ TextOutW(
LPCWSTR lpString, LPCWSTR lpString,
int cbString) int cbString)
{ {
return NtGdiExtTextOut(hdc, nXStart, nYStart, 0, NULL, lpString, cbString, NULL); return NtGdiTextOut(hdc, nXStart, nYStart, lpString, cbString);
}
/*
* @unimplemented
*/
int
STDCALL
GetTextCharacterExtra(
HDC hDc
)
{
#if 0
PDC_ATTR Dc_Attr;
if (!GdiGetHandleUserData((HGDIOBJ) hDc, (PVOID) &Dc_Attr)) return 0;
return Dc_Attr->lTextExtra;
#endif
// Do it this way for now.
return GetDCDWord( hDc, GdiGetTextCharExtra, 0);
} }
@@ -72,13 +52,28 @@ GetTextCharacterExtra(
*/ */
int int
STDCALL STDCALL
GetTextCharset(HDC hdc) GetTextCharset(
HDC hdc
)
{ {
/* MSDN docs say this is equivalent */ /* MSDN docs say this is equivalent */
return NtGdiGetTextCharsetInfo(hdc,NULL,0); return GetTextCharsetInfo(hdc, NULL, 0);
} }
/*
* @implemented
*/
int
STDCALL
GetTextCharsetInfo(
HDC hdc,
LPFONTSIGNATURE lpSig,
DWORD dwFlags
)
{
return NtGdiGetTextCharsetInfo(hdc, lpSig, dwFlags);
}
/* /*
@@ -91,14 +86,14 @@ GetTextMetricsA(
LPTEXTMETRICA lptm LPTEXTMETRICA lptm
) )
{ {
TMW_INTERNAL tmwi; TEXTMETRICW tmw;
if (! NtGdiGetTextMetricsW(hdc, &tmwi, sizeof(TMW_INTERNAL))) if (! NtGdiGetTextMetrics(hdc, &tmw))
{ {
return FALSE; return FALSE;
} }
return TextMetricW2A(lptm, &tmwi.TextMetric); return TextMetricW2A(lptm, &tmw);
} }
@@ -112,15 +107,7 @@ GetTextMetricsW(
LPTEXTMETRICW lptm LPTEXTMETRICW lptm
) )
{ {
TMW_INTERNAL tmwi; return NtGdiGetTextMetrics(hdc, lptm);
if (! NtGdiGetTextMetricsW(hdc, &tmwi, sizeof(TMW_INTERNAL)))
{
return FALSE;
}
*lptm = tmwi.TextMetric;
return TRUE;
} }
@@ -182,8 +169,8 @@ GetTextExtentExPointW(
LPSIZE lpSize LPSIZE lpSize
) )
{ {
return NtGdiGetTextExtentExW ( return NtGdiGetTextExtentExPoint (
hdc, (LPWSTR)lpszStr, cchString, nMaxExtent, (PULONG)lpnFit, (PULONG)alpDx, lpSize, 0 ); hdc, lpszStr, cchString, nMaxExtent, lpnFit, alpDx, lpSize );
} }
@@ -211,8 +198,8 @@ GetTextExtentExPointA(
SetLastError (RtlNtStatusToDosError(Status)); SetLastError (RtlNtStatusToDosError(Status));
else else
{ {
rc = NtGdiGetTextExtentExW ( rc = NtGdiGetTextExtentExPoint (
hdc, lpszStrW, cchString, nMaxExtent, (PULONG)lpnFit, (PULONG)alpDx, lpSize, 0 ); hdc, lpszStrW, cchString, nMaxExtent, lpnFit, alpDx, lpSize );
HEAP_free ( lpszStrW ); HEAP_free ( lpszStrW );
} }
@@ -318,22 +305,15 @@ ExtTextOutW(
/* /*
* @implemented * @implemented
*/ */
INT int
STDCALL STDCALL
GetTextFaceW(HDC hDC, GetTextFaceW(
int nCount, HDC a0,
LPWSTR lpFaceName) int a1,
LPWSTR a2
)
{ {
INT retValue = 0; return NtGdiGetTextFace(a0, a1, a2);
if ((!lpFaceName) || (nCount))
{
retValue = NtGdiGetTextFaceW(hDC,nCount,lpFaceName,0);
}
else
{
SetLastError(ERROR_INVALID_PARAMETER);
}
return retValue;
} }
@@ -360,92 +340,4 @@ GetTextFaceA( HDC hdc, INT count, LPSTR name )
return res; return res;
} }
BOOL
STDCALL
GetFontResourceInfoW(
LPCWSTR lpFileName,
DWORD *pdwBufSize,
void* lpBuffer,
DWORD dwType
)
{
BOOL bRet;
UNICODE_STRING NtFileName;
if (!lpFileName || !pdwBufSize || !lpBuffer)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (!RtlDosPathNameToNtPathName_U(lpFileName,
&NtFileName,
NULL,
NULL))
{
SetLastError(ERROR_PATH_NOT_FOUND);
return FALSE;
}
bRet = NtGdiGetFontResourceInfoInternalW(
NtFileName.Buffer,
NtFileName.Length,
1,
*pdwBufSize,
pdwBufSize,
lpBuffer,
dwType);
RtlFreeHeap(RtlGetProcessHeap(), 0, NtFileName.Buffer);
if (!bRet)
{
return FALSE;
}
return TRUE;
}
/*
* @unimplemented
*/
int
STDCALL
SetTextCharacterExtra(
HDC hDC,
int CharExtra
)
{
INT cExtra = 0x80000000;
// PDC_ATTR Dc_Attr;
if (CharExtra == cExtra)
{
SetLastError(ERROR_INVALID_PARAMETER);
return cExtra;
}
#if 0
if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_METADC)
{
return MFDRV_SetTextCharacterExtra( hDC, CharExtra ); // Wine port.
}
if (!GdiGetHandleUserData((HGDIOBJ) hDC, (PVOID) &Dc_Attr)) return cExtra;
if (NtCurrentTeb()->GdiTebBatch.HDC == hDC)
{
if (Dc_Attr->ulDirty_ & DC_FONTTEXT_DIRTY)
{
NtGdiFlush(); // Sync up Dc_Attr from Kernel space.
Dc_Attr->ulDirty_ &= ~(DC_MODE_DIRTY|DC_FONTTEXT_DIRTY);
}
}
cExtra = Dc_Attr->lTextExtra;
Dc_Attr->lTextExtra = CharExtra;
return cExrta;
#endif
// Do this for now.
return GetAndSetDCDWord( hDC, GdiGetSetTextCharExtra, CharExtra, 0, 0, 0 );
}

View File

@@ -383,21 +383,3 @@ LogFontW2A(LPLOGFONTA pA, CONST LOGFONTW *pW)
#undef COPYN #undef COPYN
#undef COPYS #undef COPYS
} }
VOID
STDCALL
EnumLogFontExW2A( LPENUMLOGFONTEXA fontA, CONST ENUMLOGFONTEXW *fontW )
{
LogFontW2A( (LPLOGFONTA)fontA, (CONST LOGFONTW *)fontW );
WideCharToMultiByte( CP_THREAD_ACP, 0, fontW->elfFullName, -1,
(LPSTR) fontA->elfFullName, LF_FULLFACESIZE, NULL, NULL );
fontA->elfFullName[LF_FULLFACESIZE-1] = '\0';
WideCharToMultiByte( CP_THREAD_ACP, 0, fontW->elfStyle, -1,
(LPSTR) fontA->elfStyle, LF_FACESIZE, NULL, NULL );
fontA->elfStyle[LF_FACESIZE-1] = '\0';
WideCharToMultiByte( CP_THREAD_ACP, 0, fontW->elfScript, -1,
(LPSTR) fontA->elfScript, LF_FACESIZE, NULL, NULL );
fontA->elfScript[LF_FACESIZE-1] = '\0';
}

View File

@@ -1,4 +1,4 @@
LANGUAGE LANG_DANISH, SUBLANG_DEFAULT LANGUAGE LANG_DANISH, SUBLANG_NEUTRAL
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
@@ -8,7 +8,7 @@ LANGUAGE LANG_DANISH, SUBLANG_DEFAULT
SELWINDOW DIALOG DISCARDABLE 20, 20, 220, 140 SELWINDOW DIALOG DISCARDABLE 20, 20, 220, 140
STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU WS_SYSMENU
FONT 8, "MS Shell Dlg" FONT 8, "Bitstream Vera Sans"
CAPTION "V<>lg Vindue" CAPTION "V<>lg Vindue"
BEGIN BEGIN
LISTBOX 100, 5, 5, 210, 110, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL LISTBOX 100, 5, 5, 210, 110, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL

View File

@@ -1,6 +1,6 @@
//German translation by Michael Wirth //German translation by Michael Wirth
LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
@@ -10,7 +10,7 @@ LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
SELWINDOW DIALOG DISCARDABLE 20, 20, 220, 140 SELWINDOW DIALOG DISCARDABLE 20, 20, 220, 140
STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU WS_SYSMENU
FONT 8, "MS Shell Dlg" FONT 8, "Bitstream Vera Sans"
CAPTION "Fenster Ausw<73>hlen" CAPTION "Fenster Ausw<73>hlen"
BEGIN BEGIN
LISTBOX 100, 5, 5, 210, 110, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL LISTBOX 100, 5, 5, 210, 110, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL

View File

@@ -8,7 +8,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
SELWINDOW DIALOG DISCARDABLE 20, 20, 220, 140 SELWINDOW DIALOG DISCARDABLE 20, 20, 220, 140
STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU WS_SYSMENU
FONT 8, "MS Shell Dlg" FONT 8, "Bitstream Vera Sans"
CAPTION "Select Window" CAPTION "Select Window"
BEGIN BEGIN
LISTBOX 100, 5, 5, 210, 110, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL LISTBOX 100, 5, 5, 210, 110, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL

View File

@@ -8,7 +8,7 @@ LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL
SELWINDOW DIALOG DISCARDABLE 20, 20, 220, 140 SELWINDOW DIALOG DISCARDABLE 20, 20, 220, 140
STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU WS_SYSMENU
FONT 8, "MS Shell Dlg" FONT 8, "Bitstream Vera Sans"
CAPTION "Selecciones Ventana" CAPTION "Selecciones Ventana"
BEGIN BEGIN
LISTBOX 100, 5, 5, 210, 110, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL LISTBOX 100, 5, 5, 210, 110, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL

View File

@@ -12,7 +12,7 @@ LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL
SELWINDOW DIALOG DISCARDABLE 20, 20, 220, 140 SELWINDOW DIALOG DISCARDABLE 20, 20, 220, 140
STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU WS_SYSMENU
FONT 8, "MS Shell Dlg" FONT 8, "Bitstream Vera Sans"
CAPTION "Select Window" CAPTION "Select Window"
BEGIN BEGIN
LISTBOX 100, 5, 5, 210, 110, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL LISTBOX 100, 5, 5, 210, 110, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL

View File

@@ -2,7 +2,7 @@
* Copyright 2005 Robert Horvath - Hungarian translation - talley at cubeclub.hu * Copyright 2005 Robert Horvath - Hungarian translation - talley at cubeclub.hu
*/ */
LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT LANGUAGE LANG_HUNGARIAN, SUBLANG_NEUTRAL
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
@@ -12,7 +12,7 @@ LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
SELWINDOW DIALOG DISCARDABLE 20, 20, 220, 140 SELWINDOW DIALOG DISCARDABLE 20, 20, 220, 140
STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU WS_SYSMENU
FONT 8, "MS Shell Dlg" FONT 8, "Bitstream Vera Sans"
CAPTION "Select Window" CAPTION "Select Window"
BEGIN BEGIN
LISTBOX 100, 5, 5, 210, 110, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL LISTBOX 100, 5, 5, 210, 110, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL

View File

@@ -8,7 +8,7 @@ LANGUAGE LANG_DUTCH, SUBLANG_NEUTRAL //vertaald door Lionel Lowie
SELWINDOW DIALOG DISCARDABLE 20, 20, 220, 140 SELWINDOW DIALOG DISCARDABLE 20, 20, 220, 140
STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU WS_SYSMENU
FONT 8, "MS Shell Dlg" FONT 8, "Bitstream Vera Sans"
CAPTION "Selecteer venster" CAPTION "Selecteer venster"
BEGIN BEGIN
LISTBOX 100, 5, 5, 210, 110, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL LISTBOX 100, 5, 5, 210, 110, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL

View File

@@ -1,6 +1,6 @@
//Polish translation by Sebastian Gasiorek //Polish translation by Sebastian Gasiorek
LANGUAGE LANG_POLISH, SUBLANG_DEFAULT LANGUAGE LANG_POLISH, SUBLANG_NEUTRAL
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
@@ -10,7 +10,7 @@ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT
SELWINDOW DIALOG DISCARDABLE 20, 20, 220, 140 SELWINDOW DIALOG DISCARDABLE 20, 20, 220, 140
STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU WS_SYSMENU
FONT 8, "MS Shell Dlg" FONT 8, "Bitstream Vera Sans"
CAPTION "Wybieranie okna" CAPTION "Wybieranie okna"
BEGIN BEGIN
LISTBOX 100, 5, 5, 210, 110, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL LISTBOX 100, 5, 5, 210, 110, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL
@@ -41,7 +41,7 @@ EDITMENU MENU LOADONCALL MOVEABLE DISCARDABLE
SYSMENU MENU LOADONCALL MOVEABLE DISCARDABLE SYSMENU MENU LOADONCALL MOVEABLE DISCARDABLE
{ {
MENUITEM "&Przywr<77><EFBFBD>", 61728 MENUITEM "&Przywr<77>c", 61728
MENUITEM "Prz&enie<69>", 61456 MENUITEM "Prz&enie<69>", 61456
MENUITEM "&Rozmiar", 61440 MENUITEM "&Rozmiar", 61440
MENUITEM "&Minimalizuj", 61472 MENUITEM "&Minimalizuj", 61472
@@ -75,4 +75,3 @@ STRINGTABLE
IDS_MDI_MOREWINDOWS, "&Wi<57>cej okien..." IDS_MDI_MOREWINDOWS, "&Wi<57>cej okien..."
} }

View File

@@ -28,7 +28,7 @@ LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL
SELWINDOW DIALOG DISCARDABLE 20, 20, 220, 140 SELWINDOW DIALOG DISCARDABLE 20, 20, 220, 140
STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU WS_SYSMENU
FONT 8, "MS Shell Dlg" FONT 8, "Bitstream Vera Sans"
CAPTION "V<>lj f<>nster" CAPTION "V<>lj f<>nster"
BEGIN BEGIN
LISTBOX 100, 5, 5, 210, 110, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL LISTBOX 100, 5, 5, 210, 110, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL

View File

@@ -16,63 +16,16 @@
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* NOTES
*
* This code was audited for completeness against the documented features
* of Comctl32.dll version 6.0 on Oct. 3, 2004, by Dimitrie O. Paun.
*
* Unless otherwise noted, we believe this code to be complete, as per
* the specification mentioned above.
* If you discover missing features, or bugs, please note them below.
*
* TODO
* Styles
* - BS_NOTIFY: is it complete?
* - BS_RIGHTBUTTON: same as BS_LEFTTEXT
* - BS_TYPEMASK
*
* Messages
* - WM_CHAR: Checks a (manual or automatic) check box on '+' or '=', clears it on '-' key.
* - WM_SETFOCUS: For (manual or automatic) radio buttons, send the parent window BN_CLICKED
* - WM_NCCREATE: Turns any BS_OWNERDRAW button into a BS_PUSHBUTTON button.
* - WM_SYSKEYUP
* - BCM_GETIDEALSIZE
* - BCM_GETIMAGELIST
* - BCM_GETTEXTMARGIN
* - BCM_SETIMAGELIST
* - BCM_SETTEXTMARGIN
*
* Notifications
* - BCN_HOTITEMCHANGE
* - BN_DISABLE
* - BN_PUSHED/BN_HILITE
* + BN_KILLFOCUS: is it OK?
* - BN_PAINT
* + BN_SETFOCUS: is it OK?
* - BN_UNPUSHED/BN_UNHILITE
* - NM_CUSTOMDRAW
*
* Structures/Macros/Definitions
* - BUTTON_IMAGELIST
* - NMBCHOTITEM
* - Button_GetIdealSize
* - Button_GetImageList
* - Button_GetTextMargin
* - Button_SetImageList
* - Button_SetTextMargin
*/ */
#include <user32.h>
#include <wine/debug.h> #include <user32.h>
WINE_DEFAULT_DEBUG_CHANNEL(button);
/* GetWindowLong offsets for window extra information */ /* GetWindowLong offsets for window extra information */
#define STATE_GWL_OFFSET 0 #define STATE_GWL_OFFSET 0
#define HFONT_GWL_OFFSET (sizeof(LONG)) #define HFONT_GWL_OFFSET (sizeof(LONG))
#define HIMAGE_GWL_OFFSET (HFONT_GWL_OFFSET+sizeof(HFONT)) #define HIMAGE_GWL_OFFSET (HFONT_GWL_OFFSET*sizeof(LONG))
#define NB_EXTRA_BYTES (HIMAGE_GWL_OFFSET+sizeof(HANDLE)) #define NB_EXTRA_BYTES (HIMAGE_GWL_OFFSET*sizeof(LONG))
/* Button state values */ /* Button state values */
#define BUTTON_UNCHECKED 0x00 #define BUTTON_UNCHECKED 0x00
@@ -186,7 +139,7 @@ __inline static HFONT get_button_font( HWND hwnd )
__inline static void set_button_font( HWND hwnd, HFONT font ) __inline static void set_button_font( HWND hwnd, HFONT font )
{ {
SetWindowLongPtrW( hwnd, HFONT_GWL_OFFSET, (LONG_PTR)font ); SetWindowLongPtrW( hwnd, HFONT_GWL_OFFSET, (LONG)font );
} }
__inline static UINT get_button_type( LONG window_style ) __inline static UINT get_button_type( LONG window_style )
@@ -355,7 +308,6 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
break; break;
case WM_CAPTURECHANGED: case WM_CAPTURECHANGED:
TRACE("WM_CAPTURECHANGED %p\n", hWnd);
state = get_button_state( hWnd ); state = get_button_state( hWnd );
if (state & BUTTON_BTNPRESSED) if (state & BUTTON_BTNPRESSED)
{ {
@@ -400,7 +352,7 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
if (unicode) DefWindowProcW( hWnd, WM_SETTEXT, wParam, lParam ); if (unicode) DefWindowProcW( hWnd, WM_SETTEXT, wParam, lParam );
else DefWindowProcA( hWnd, WM_SETTEXT, wParam, lParam ); else DefWindowProcA( hWnd, WM_SETTEXT, wParam, lParam );
if (btn_type == BS_GROUPBOX) /* Yes, only for BS_GROUPBOX */ if (btn_type == BS_GROUPBOX) /* Yes, only for BS_GROUPBOX */
NtUserInvalidateRect( hWnd, NULL, TRUE ); InvalidateRect( hWnd, NULL, TRUE );
else else
paint_button( hWnd, btn_type, ODA_DRAWENTIRE ); paint_button( hWnd, btn_type, ODA_DRAWENTIRE );
return 1; /* success. FIXME: check text length */ return 1; /* success. FIXME: check text length */
@@ -415,7 +367,6 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
return (LRESULT)get_button_font( hWnd ); return (LRESULT)get_button_font( hWnd );
case WM_SETFOCUS: case WM_SETFOCUS:
TRACE("WM_SETFOCUS %p\n",hWnd);
set_button_state( hWnd, get_button_state(hWnd) | BUTTON_HASFOCUS ); set_button_state( hWnd, get_button_state(hWnd) | BUTTON_HASFOCUS );
paint_button( hWnd, btn_type, ODA_FOCUS ); paint_button( hWnd, btn_type, ODA_FOCUS );
if (style & BS_NOTIFY) if (style & BS_NOTIFY)
@@ -423,7 +374,6 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
break; break;
case WM_KILLFOCUS: case WM_KILLFOCUS:
TRACE("WM_KILLFOCUS %p\n",hWnd);
state = get_button_state( hWnd ); state = get_button_state( hWnd );
set_button_state( hWnd, state & ~BUTTON_HASFOCUS ); set_button_state( hWnd, state & ~BUTTON_HASFOCUS );
paint_button( hWnd, btn_type, ODA_FOCUS ); paint_button( hWnd, btn_type, ODA_FOCUS );
@@ -436,7 +386,7 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
break; break;
case WM_SYSCOLORCHANGE: case WM_SYSCOLORCHANGE:
NtUserInvalidateRect( hWnd, NULL, FALSE ); InvalidateRect( hWnd, NULL, FALSE );
break; break;
#ifndef __REACTOS__ #ifndef __REACTOS__
@@ -473,8 +423,8 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
return 0; return 0;
} }
oldHbitmap = (HBITMAP)SetWindowLongPtrW( hWnd, HIMAGE_GWL_OFFSET, lParam ); oldHbitmap = (HBITMAP)SetWindowLongPtrW( hWnd, HIMAGE_GWL_OFFSET, lParam );
NtUserInvalidateRect( hWnd, NULL, FALSE ); InvalidateRect( hWnd, NULL, FALSE );
return (LRESULT)oldHbitmap; return (LRESULT)oldHbitmap;
case BM_GETIMAGE: case BM_GETIMAGE:
return GetWindowLongPtrW( hWnd, HIMAGE_GWL_OFFSET ); return GetWindowLongPtrW( hWnd, HIMAGE_GWL_OFFSET );
@@ -869,6 +819,7 @@ static void PB_Paint( HWND hwnd, HDC hDC, UINT action )
SetBkMode(hDC, oldBkMode); SetBkMode(hDC, oldBkMode);
} }
/********************************************************************** /**********************************************************************
* Check Box & Radio Button Functions * Check Box & Radio Button Functions
*/ */
@@ -1102,7 +1053,6 @@ static void UB_Paint( HWND hwnd, HDC hDC, UINT action )
DrawFocusRect( hDC, &rc ); DrawFocusRect( hDC, &rc );
} }
/********************************************************************** /**********************************************************************
* Ownerdrawn Button Functions * Ownerdrawn Button Functions
*/ */

View File

@@ -33,8 +33,9 @@
*/ */
#include <user32.h> #include <user32.h>
#define NDEBUG
#include <debug.h>
#include <wine/debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(combo); WINE_DEFAULT_DEBUG_CHANNEL(combo);
/* bits in the dwKeyData */ /* bits in the dwKeyData */
@@ -147,7 +148,7 @@ static LRESULT COMBO_NCCreate(HWND hwnd, LONG style)
if (COMBO_Init() && (lphc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(HEADCOMBO))) ) if (COMBO_Init() && (lphc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(HEADCOMBO))) )
{ {
lphc->self = hwnd; lphc->self = hwnd;
SetWindowLongPtrW( hwnd, 0, (LONG_PTR)lphc ); SetWindowLongW( hwnd, 0, (LONG)lphc );
/* some braindead apps do try to use scrollbar/border flags */ /* some braindead apps do try to use scrollbar/border flags */
@@ -431,10 +432,6 @@ static void CBCalcPlacement(
lprLB->right = lprLB->left + lphc->droppedWidth; lprLB->right = lprLB->left + lphc->droppedWidth;
} }
/* don't allow negative window width */
if (lprEdit->right < lprEdit->left)
lprEdit->right = lprEdit->left;
TRACE("\ttext\t= (%ld,%ld-%ld,%ld)\n", TRACE("\ttext\t= (%ld,%ld-%ld,%ld)\n",
lprEdit->left, lprEdit->top, lprEdit->right, lprEdit->bottom); lprEdit->left, lprEdit->top, lprEdit->right, lprEdit->bottom);
@@ -909,6 +906,34 @@ static HBRUSH COMBO_PrepareColors(
return hBkgBrush; return hBkgBrush;
} }
/***********************************************************************
* COMBO_EraseBackground
*/
static LRESULT COMBO_EraseBackground(
HWND hwnd,
LPHEADCOMBO lphc,
HDC hParamDC)
{
HBRUSH hBkgBrush;
HDC hDC;
if(lphc->wState & CBF_EDIT)
return TRUE;
hDC = (hParamDC) ? hParamDC
: GetDC(hwnd);
/*
* Retrieve the background brush
*/
hBkgBrush = COMBO_PrepareColors(lphc, hDC);
FillRect(hDC, &lphc->textRect, hBkgBrush);
if (!hParamDC)
ReleaseDC(hwnd, hDC);
return TRUE;
}
/*********************************************************************** /***********************************************************************
* COMBO_Paint * COMBO_Paint
@@ -934,8 +959,6 @@ static LRESULT COMBO_Paint(LPHEADCOMBO lphc, HDC hParamDC)
hBkgBrush = COMBO_PrepareColors(lphc, hDC); hBkgBrush = COMBO_PrepareColors(lphc, hDC);
hPrevBrush = SelectObject( hDC, hBkgBrush ); hPrevBrush = SelectObject( hDC, hBkgBrush );
if (!(lphc->wState & CBF_EDIT))
FillRect(hDC, &lphc->textRect, hBkgBrush);
/* /*
* In non 3.1 look, there is a sunken border on the combobox * In non 3.1 look, there is a sunken border on the combobox
@@ -1215,7 +1238,7 @@ BOOL COMBO_FlipListbox( LPHEADCOMBO lphc, BOOL ok, BOOL bRedrawButton )
*/ */
static void CBRepaintButton( LPHEADCOMBO lphc ) static void CBRepaintButton( LPHEADCOMBO lphc )
{ {
NtUserInvalidateRect(lphc->self, &lphc->buttonRect, TRUE); InvalidateRect(lphc->self, &lphc->buttonRect, TRUE);
UpdateWindow(lphc->self); UpdateWindow(lphc->self);
} }
@@ -1234,9 +1257,7 @@ static void COMBO_SetFocus( LPHEADCOMBO lphc )
/* lphc->wState |= CBF_FOCUSED; */ /* lphc->wState |= CBF_FOCUSED; */
if( !(lphc->wState & CBF_EDIT) ) if( !(lphc->wState & CBF_EDIT) )
{ InvalidateRect(lphc->self, &lphc->textRect, TRUE);
NtUserInvalidateRect(lphc->self, &lphc->textRect, TRUE);
}
CB_NOTIFY( lphc, CBN_SETFOCUS ); CB_NOTIFY( lphc, CBN_SETFOCUS );
lphc->wState |= CBF_FOCUSED; lphc->wState |= CBF_FOCUSED;
@@ -1258,11 +1279,11 @@ static void COMBO_KillFocus( LPHEADCOMBO lphc )
if( CB_GETTYPE(lphc) == CBS_DROPDOWNLIST ) if( CB_GETTYPE(lphc) == CBS_DROPDOWNLIST )
SendMessageW(lphc->hWndLBox, LB_CARETOFF, 0, 0); SendMessageW(lphc->hWndLBox, LB_CARETOFF, 0, 0);
lphc->wState &= ~CBF_FOCUSED; lphc->wState &= ~CBF_FOCUSED;
/* redraw text */ /* redraw text */
if( !(lphc->wState & CBF_EDIT) ) if( !(lphc->wState & CBF_EDIT) )
NtUserInvalidateRect(lphc->self, &lphc->textRect, TRUE); InvalidateRect(lphc->self, &lphc->textRect, TRUE);
CB_NOTIFY( lphc, CBN_KILLFOCUS ); CB_NOTIFY( lphc, CBN_KILLFOCUS );
} }
@@ -1280,12 +1301,12 @@ static LRESULT COMBO_Command( LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd )
switch( HIWORD(wParam) >> 8 ) switch( HIWORD(wParam) >> 8 )
{ {
case (EN_SETFOCUS >> 8): case (EN_SETFOCUS >> 8):
TRACE("[%p]: edit [%p] got focus\n", lphc->self, lphc->hWndEdit ); TRACE("[%p]: edit [%p] got focus\n", lphc->self, lphc->hWndEdit );
COMBO_SetFocus( lphc ); COMBO_SetFocus( lphc );
break; break;
case (EN_KILLFOCUS >> 8): case (EN_KILLFOCUS >> 8):
@@ -1359,7 +1380,7 @@ static LRESULT COMBO_Command( LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd )
SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1)); SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1));
} }
else else
NtUserInvalidateRect(lphc->self, &lphc->textRect, TRUE); InvalidateRect(lphc->self, &lphc->textRect, TRUE);
} }
/* do not roll up if selection is being tracked /* do not roll up if selection is being tracked
@@ -1579,7 +1600,7 @@ static void CBResetPos(
/*********************************************************************** /***********************************************************************
* COMBO_Size * COMBO_Size
*/ */
static void COMBO_Size( LPHEADCOMBO lphc, BOOL bRedraw ) static void COMBO_Size( LPHEADCOMBO lphc )
{ {
CBCalcPlacement(lphc->self, CBCalcPlacement(lphc->self,
lphc, lphc,
@@ -1587,7 +1608,7 @@ static void COMBO_Size( LPHEADCOMBO lphc, BOOL bRedraw )
&lphc->buttonRect, &lphc->buttonRect,
&lphc->droppedRect); &lphc->droppedRect);
CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, bRedraw ); CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, TRUE );
} }
@@ -1681,7 +1702,7 @@ static LRESULT COMBO_SelectString( LPHEADCOMBO lphc, INT start, LPARAM pText, BO
CBUpdateEdit( lphc, index ); CBUpdateEdit( lphc, index );
else else
{ {
NtUserInvalidateRect(lphc->self, &lphc->textRect, TRUE); InvalidateRect(lphc->self, &lphc->textRect, TRUE);
} }
} }
return (LRESULT)index; return (LRESULT)index;
@@ -1820,19 +1841,6 @@ static LRESULT COMBO_GetComboBoxInfo(LPHEADCOMBO lphc, COMBOBOXINFO *pcbi)
return TRUE; return TRUE;
} }
static char *strdupA(LPCSTR str)
{
char *ret;
DWORD len;
if(!str) return NULL;
len = strlen(str);
ret = HeapAlloc(GetProcessHeap(), 0, len + 1);
memcpy(ret, str, len + 1);
return ret;
}
/*********************************************************************** /***********************************************************************
* ComboWndProc_common * ComboWndProc_common
* *
@@ -1843,8 +1851,8 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
{ {
LPHEADCOMBO lphc = (LPHEADCOMBO)GetWindowLongPtrW( hwnd, 0 ); LPHEADCOMBO lphc = (LPHEADCOMBO)GetWindowLongPtrW( hwnd, 0 );
TRACE("[%p]: msg %s wp %08x lp %08lx\n", //TRACE("[%p]: msg %s wp %08x lp %08lx\n",
hwnd, SPY_GetMsgName(message, hwnd), wParam, lParam ); // hwnd, SPY_GetMsgName(message, hwnd), wParam, lParam );
if( lphc || message == WM_NCCREATE ) if( lphc || message == WM_NCCREATE )
switch(message) switch(message)
@@ -1880,15 +1888,15 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
} }
case WM_PRINTCLIENT: case WM_PRINTCLIENT:
if (lParam & PRF_ERASEBKGND)
COMBO_EraseBackground(hwnd, lphc, (HDC)wParam);
/* Fallthrough */ /* Fallthrough */
case WM_PAINT: case WM_PAINT:
/* wParam may contain a valid HDC! */ /* wParam may contain a valid HDC! */
return COMBO_Paint(lphc, (HDC)wParam); return COMBO_Paint(lphc, (HDC)wParam);
case WM_ERASEBKGND: case WM_ERASEBKGND:
/* do all painting in WM_PAINT like Windows does */ return COMBO_EraseBackground(hwnd, lphc, (HDC)wParam);
return 1;
case WM_GETDLGCODE: case WM_GETDLGCODE:
{ {
LRESULT result = DLGC_WANTARROWS | DLGC_WANTCHARS; LRESULT result = DLGC_WANTARROWS | DLGC_WANTCHARS;
@@ -1909,13 +1917,10 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
* get a WM_SIZE. Since we still want to update the Listbox, we have to * get a WM_SIZE. Since we still want to update the Listbox, we have to
* do it here. * do it here.
*/ */
/* we should not force repainting on WM_WINDOWPOSCHANGED, it breaks
* Z-order based painting.
*/
/* fall through */ /* fall through */
case WM_SIZE: case WM_SIZE:
if( lphc->hWndLBox && if( lphc->hWndLBox &&
!(lphc->wState & CBF_NORESIZE) ) COMBO_Size( lphc, message == WM_SIZE ); !(lphc->wState & CBF_NORESIZE) ) COMBO_Size( lphc );
return TRUE; return TRUE;
case WM_SETFONT: case WM_SETFONT:
COMBO_Font( lphc, (HFONT)wParam, (BOOL)lParam ); COMBO_Font( lphc, (HFONT)wParam, (BOOL)lParam );
@@ -1990,7 +1995,7 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
EnableWindow( lphc->hWndLBox, (BOOL)wParam ); EnableWindow( lphc->hWndLBox, (BOOL)wParam );
/* Force the control to repaint when the enabled state changes. */ /* Force the control to repaint when the enabled state changes. */
NtUserInvalidateRect(lphc->self, NULL, TRUE); InvalidateRect(lphc->self, NULL, TRUE);
return TRUE; return TRUE;
case WM_SETREDRAW: case WM_SETREDRAW:
if( wParam ) if( wParam )
@@ -2063,33 +2068,17 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
/* fall through */ /* fall through */
#endif #endif
case CB_ADDSTRING: case CB_ADDSTRING:
if( unicode ) {
{ UINT msg = LB_ADDSTRING;
if( lphc->dwStyle & CBS_LOWERCASE ) if( lphc->dwStyle & CBS_LOWERCASE )
CharLowerW((LPWSTR)lParam); msg = LB_ADDSTRING_LOWER;
else if( lphc->dwStyle & CBS_UPPERCASE ) else if( lphc->dwStyle & CBS_UPPERCASE )
CharUpperW((LPWSTR)lParam); msg = LB_ADDSTRING_UPPER;
return SendMessageW(lphc->hWndLBox, LB_ADDSTRING, 0, lParam); if( unicode )
} return SendMessageW(lphc->hWndLBox, msg, 0, lParam);
else /* unlike the unicode version, the ansi version does not overwrite else
the string if converting case */ return SendMessageA(lphc->hWndLBox, msg, 0, lParam);
{ }
char *string = NULL;
LRESULT ret;
if( lphc->dwStyle & CBS_LOWERCASE )
{
string = strdupA((LPSTR)lParam);
CharLowerA(string);
}
else if( lphc->dwStyle & CBS_UPPERCASE )
{
string = strdupA((LPSTR)lParam);
CharUpperA(string);
}
ret = SendMessageA(lphc->hWndLBox, LB_ADDSTRING, 0, string ? (LPARAM)string : lParam);
HeapFree(GetProcessHeap(), 0, string);
return ret;
}
#ifndef __REACTOS__ #ifndef __REACTOS__
case CB_INSERTSTRING16: case CB_INSERTSTRING16:
wParam = (INT)(INT16)wParam; wParam = (INT)(INT16)wParam;
@@ -2097,22 +2086,17 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
/* fall through */ /* fall through */
#endif #endif
case CB_INSERTSTRING: case CB_INSERTSTRING:
if( unicode ) {
{ UINT msg = LB_INSERTSTRING;
if( lphc->dwStyle & CBS_LOWERCASE ) if( lphc->dwStyle & CBS_LOWERCASE )
CharLowerW((LPWSTR)lParam); msg = LB_INSERTSTRING_LOWER;
else if( lphc->dwStyle & CBS_UPPERCASE ) else if( lphc->dwStyle & CBS_UPPERCASE )
CharUpperW((LPWSTR)lParam); msg = LB_INSERTSTRING_UPPER;
return SendMessageW(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam); if( unicode )
} return SendMessageW(lphc->hWndLBox, msg, 0, lParam);
else else
{ return SendMessageA(lphc->hWndLBox, msg, 0, lParam);
if( lphc->dwStyle & CBS_LOWERCASE ) }
CharLowerA((LPSTR)lParam);
else if( lphc->dwStyle & CBS_UPPERCASE )
CharUpperA((LPSTR)lParam);
return SendMessageA(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam);
}
#ifndef __REACTOS__ #ifndef __REACTOS__
case CB_DELETESTRING16: case CB_DELETESTRING16:
#endif #endif
@@ -2172,7 +2156,7 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
SendMessageW(lphc->hWndEdit, WM_SETTEXT, 0, (LPARAM)empty_stringW); SendMessageW(lphc->hWndEdit, WM_SETTEXT, 0, (LPARAM)empty_stringW);
} }
else else
NtUserInvalidateRect(lphc->self, NULL, TRUE); InvalidateRect(lphc->self, NULL, TRUE);
return TRUE; return TRUE;
case CB_INITSTORAGE: case CB_INITSTORAGE:
return SendMessageW(lphc->hWndLBox, LB_INITSTORAGE, wParam, lParam); return SendMessageW(lphc->hWndLBox, LB_INITSTORAGE, wParam, lParam);
@@ -2261,7 +2245,7 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
if( lphc->wState & CBF_EDIT ) if( lphc->wState & CBF_EDIT )
CBUpdateEdit( lphc, (INT)wParam ); CBUpdateEdit( lphc, (INT)wParam );
else else
NtUserInvalidateRect(lphc->self, &lphc->textRect, TRUE); InvalidateRect(lphc->self, &lphc->textRect, TRUE);
lphc->wState &= ~CBF_SELCHANGE; lphc->wState &= ~CBF_SELCHANGE;
return lParam; return lParam;
#ifndef __REACTOS__ #ifndef __REACTOS__

View File

@@ -18,7 +18,7 @@
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
* NOTES * NOTES
* *
@@ -43,8 +43,8 @@
*/ */
#include <user32.h> #include <user32.h>
#define NDEBUG
#include <wine/debug.h> #include <debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(edit); WINE_DEFAULT_DEBUG_CHANNEL(edit);
WINE_DECLARE_DEBUG_CHANNEL(combo); WINE_DECLARE_DEBUG_CHANNEL(combo);
@@ -141,11 +141,6 @@ typedef struct
#endif #endif
HLOCAL hloc32A; /* alias for ANSI control receiving EM_GETHANDLE HLOCAL hloc32A; /* alias for ANSI control receiving EM_GETHANDLE
or EM_SETHANDLE */ or EM_SETHANDLE */
/*
* IME Data
*/
UINT composition_len; /* length of composition, 0 == no composition */
int composition_start; /* the character position for the composition */
} EDITSTATE; } EDITSTATE;
@@ -208,7 +203,6 @@ static void EDIT_MoveWordForward(EDITSTATE *es, BOOL extend);
static void EDIT_PaintLine(EDITSTATE *es, HDC hdc, INT line, BOOL rev); static void EDIT_PaintLine(EDITSTATE *es, HDC hdc, INT line, BOOL rev);
static INT EDIT_PaintText(EDITSTATE *es, HDC hdc, INT x, INT y, INT line, INT col, INT count, BOOL rev); static INT EDIT_PaintText(EDITSTATE *es, HDC hdc, INT x, INT y, INT line, INT col, INT count, BOOL rev);
static void EDIT_SetCaretPos(EDITSTATE *es, INT pos, BOOL after_wrap); static void EDIT_SetCaretPos(EDITSTATE *es, INT pos, BOOL after_wrap);
static void EDIT_AdjustFormatRect(EDITSTATE *es);
static void EDIT_SetRectNP(EDITSTATE *es, LPRECT lprc); static void EDIT_SetRectNP(EDITSTATE *es, LPRECT lprc);
static void EDIT_UnlockBuffer(EDITSTATE *es, BOOL force); static void EDIT_UnlockBuffer(EDITSTATE *es, BOOL force);
static void EDIT_UpdateScrollInfo(EDITSTATE *es); static void EDIT_UpdateScrollInfo(EDITSTATE *es);
@@ -239,7 +233,7 @@ static void EDIT_EM_SetHandle(EDITSTATE *es, HLOCAL hloc);
static void EDIT_EM_SetHandle16(EDITSTATE *es, HLOCAL16 hloc); static void EDIT_EM_SetHandle16(EDITSTATE *es, HLOCAL16 hloc);
#endif #endif
static void EDIT_EM_SetLimitText(EDITSTATE *es, INT limit); static void EDIT_EM_SetLimitText(EDITSTATE *es, INT limit);
static void EDIT_EM_SetMargins(EDITSTATE *es, INT action, WORD left, WORD right, BOOL repaint); static void EDIT_EM_SetMargins(EDITSTATE *es, INT action, INT left, INT right, BOOL repaint);
static void EDIT_EM_SetPasswordChar(EDITSTATE *es, WCHAR c); static void EDIT_EM_SetPasswordChar(EDITSTATE *es, WCHAR c);
static void EDIT_EM_SetSel(EDITSTATE *es, UINT start, UINT end, BOOL after_wrap); static void EDIT_EM_SetSel(EDITSTATE *es, UINT start, UINT end, BOOL after_wrap);
static BOOL EDIT_EM_SetTabStops(EDITSTATE *es, INT count, LPINT tabs); static BOOL EDIT_EM_SetTabStops(EDITSTATE *es, INT count, LPINT tabs);
@@ -283,7 +277,6 @@ static void EDIT_WM_Timer(EDITSTATE *es);
static LRESULT EDIT_WM_VScroll(EDITSTATE *es, INT action, INT pos); static LRESULT EDIT_WM_VScroll(EDITSTATE *es, INT action, INT pos);
static void EDIT_UpdateText(EDITSTATE *es, LPRECT rc, BOOL bErase); static void EDIT_UpdateText(EDITSTATE *es, LPRECT rc, BOOL bErase);
static void EDIT_UpdateTextRegion(EDITSTATE *es, HRGN hrgn, BOOL bErase); static void EDIT_UpdateTextRegion(EDITSTATE *es, HRGN hrgn, BOOL bErase);
static void EDIT_ImeComposition(HWND hwnd, LPARAM CompFlag, EDITSTATE *es);
LRESULT WINAPI EditWndProcA(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); LRESULT WINAPI EditWndProcA(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT WINAPI EditWndProcW(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); LRESULT WINAPI EditWndProcW(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
@@ -445,7 +438,7 @@ static LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg,
EDITSTATE *es = (EDITSTATE *)GetWindowLongPtrW( hwnd, 0 ); EDITSTATE *es = (EDITSTATE *)GetWindowLongPtrW( hwnd, 0 );
LRESULT result = 0; LRESULT result = 0;
TRACE("hwnd=%p msg=%x (%s) wparam=%x lparam=%lx\n", hwnd, msg, SPY_GetMsgName(msg, hwnd), wParam, lParam); //TRACE("hwnd=%p msg=%x (%s) wparam=%x lparam=%lx\n", hwnd, msg, SPY_GetMsgName(msg, hwnd), wParam, lParam);
if (!es && msg != WM_NCCREATE) if (!es && msg != WM_NCCREATE)
return DefWindowProcT(hwnd, msg, wParam, lParam, unicode); return DefWindowProcT(hwnd, msg, wParam, lParam, unicode);
@@ -802,7 +795,7 @@ static LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg,
/* The following EM_xxx are new to win95 and don't exist for 16 bit */ /* The following EM_xxx are new to win95 and don't exist for 16 bit */
case EM_SETMARGINS: case EM_SETMARGINS:
EDIT_EM_SetMargins(es, (INT)wParam, LOWORD(lParam), HIWORD(lParam), TRUE); EDIT_EM_SetMargins(es, (INT)wParam, (short)LOWORD(lParam), (short)HIWORD(lParam), TRUE);
break; break;
case EM_GETMARGINS: case EM_GETMARGINS:
@@ -1055,52 +1048,6 @@ static LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg,
} }
} }
break; break;
/* IME messages to make the edit control IME aware */
case WM_IME_SETCONTEXT:
break;
case WM_IME_STARTCOMPOSITION:
/*
* FIXME in IME: This message is not always sent like it should be
*/
if (es->selection_start != es->selection_end)
{
static const WCHAR empty_stringW[] = {0};
EDIT_EM_ReplaceSel(es, TRUE, empty_stringW, TRUE, TRUE);
}
es->composition_start = es->selection_end;
es->composition_len = 0;
break;
case WM_IME_COMPOSITION:
if (es->composition_len == 0)
{
if (es->selection_start != es->selection_end)
{
static const WCHAR empty_stringW[] = {0};
EDIT_EM_ReplaceSel(es, TRUE, empty_stringW, TRUE, TRUE);
}
es->composition_start = es->selection_end;
}
EDIT_ImeComposition(hwnd,lParam,es);
break;
case WM_IME_ENDCOMPOSITION:
es->composition_len= 0;
break;
case WM_IME_COMPOSITIONFULL:
break;
case WM_IME_SELECT:
break;
case WM_IME_CONTROL:
break;
default: default:
result = DefWindowProcT(hwnd, msg, wParam, lParam, unicode); result = DefWindowProcT(hwnd, msg, wParam, lParam, unicode);
break; break;
@@ -1108,8 +1055,6 @@ static LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg,
if (es) EDIT_UnlockBuffer(es, FALSE); if (es) EDIT_UnlockBuffer(es, FALSE);
TRACE("hwnd=%p msg=%x (%s) -- 0x%08lx\n", hwnd, msg, SPY_GetMsgName(msg, hwnd), result);
return result; return result;
} }
@@ -1355,7 +1300,7 @@ static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta
es->line_count--; es->line_count--;
} }
} }
else if (delta != 0) else
{ {
while (current_line) while (current_line)
{ {
@@ -1456,9 +1401,17 @@ static void EDIT_CalcLineWidth_SL(EDITSTATE *es)
*/ */
static INT EDIT_CallWordBreakProc(EDITSTATE *es, INT start, INT index, INT count, INT action) static INT EDIT_CallWordBreakProc(EDITSTATE *es, INT start, INT index, INT count, INT action)
{ {
#ifdef __REACTOS__
INT ret; INT ret;
#else
INT ret, iWndsLocks;
#endif
/* To avoid any deadlocks, all the locks on the window structures
must be suspended before the control is passed to the application */
#ifndef __REACTOS__ #ifndef __REACTOS__
iWndsLocks = WIN_SuspendWndsLock();
if (es->word_break_proc16) { if (es->word_break_proc16) {
HGLOBAL16 hglob16; HGLOBAL16 hglob16;
SEGPTR segptr; SEGPTR segptr;
@@ -1511,6 +1464,9 @@ static INT EDIT_CallWordBreakProc(EDITSTATE *es, INT start, INT index, INT count
else else
ret = EDIT_WordBreakProc(es->text + start, index, count, action); ret = EDIT_WordBreakProc(es->text + start, index, count, action);
#ifndef __REACTOS__
WIN_RestoreWndsLock(iWndsLocks);
#endif
return ret; return ret;
} }
@@ -1724,7 +1680,7 @@ static LPWSTR EDIT_GetPasswordPointer_SL(EDITSTATE *es)
* *
* Initially the edit control allocates a HLOCAL32 buffer * Initially the edit control allocates a HLOCAL32 buffer
* (32 bit linear memory handler). However, 16 bit application * (32 bit linear memory handler). However, 16 bit application
* might send an EM_GETHANDLE message and expect a HLOCAL16 (16 bit SEG:OFF * might send a EM_GETHANDLE message and expect a HLOCAL16 (16 bit SEG:OFF
* handler). From that moment on we have to keep using this 16 bit memory * handler). From that moment on we have to keep using this 16 bit memory
* handler, because it is supposed to be valid at all times after EM_GETHANDLE. * handler, because it is supposed to be valid at all times after EM_GETHANDLE.
* What we do is create a HLOCAL16 buffer, copy the text, and do pointer * What we do is create a HLOCAL16 buffer, copy the text, and do pointer
@@ -1890,7 +1846,7 @@ static void EDIT_ML_InvalidateText(EDITSTATE *es, INT start, INT end)
* *
* EDIT_InvalidateText * EDIT_InvalidateText
* *
* Invalidate the text from offset start up to, but not including, * Invalidate the text from offset start upto, but not including,
* offset end. Useful for (re)painting the selection. * offset end. Useful for (re)painting the selection.
* Regions outside the linewidth are not invalidated. * Regions outside the linewidth are not invalidated.
* end == -1 means end == TextLength. * end == -1 means end == TextLength.
@@ -2298,9 +2254,6 @@ static INT EDIT_PaintText(EDITSTATE *es, HDC dc, INT x, INT y, INT line, INT col
{ {
COLORREF BkColor; COLORREF BkColor;
COLORREF TextColor; COLORREF TextColor;
LOGFONTW underline_font;
HFONT hUnderline = 0;
HFONT old_font = 0;
INT ret; INT ret;
INT li; INT li;
INT BkMode; INT BkMode;
@@ -2312,20 +2265,9 @@ static INT EDIT_PaintText(EDITSTATE *es, HDC dc, INT x, INT y, INT line, INT col
BkColor = GetBkColor(dc); BkColor = GetBkColor(dc);
TextColor = GetTextColor(dc); TextColor = GetTextColor(dc);
if (rev) { if (rev) {
if (es->composition_len == 0)
{
SetBkColor(dc, GetSysColor(COLOR_HIGHLIGHT)); SetBkColor(dc, GetSysColor(COLOR_HIGHLIGHT));
SetTextColor(dc, GetSysColor(COLOR_HIGHLIGHTTEXT)); SetTextColor(dc, GetSysColor(COLOR_HIGHLIGHTTEXT));
SetBkMode( dc, OPAQUE); SetBkMode( dc, OPAQUE);
}
else
{
HFONT current = GetCurrentObject(dc,OBJ_FONT);
GetObjectW(current,sizeof(LOGFONTW),&underline_font);
underline_font.lfUnderline = TRUE;
hUnderline = CreateFontIndirectW(&underline_font);
old_font = SelectObject(dc,hUnderline);
}
} }
li = EDIT_EM_LineIndex(es, line); li = EDIT_EM_LineIndex(es, line);
if (es->style & ES_MULTILINE) { if (es->style & ES_MULTILINE) {
@@ -2340,19 +2282,9 @@ static INT EDIT_PaintText(EDITSTATE *es, HDC dc, INT x, INT y, INT line, INT col
HeapFree(GetProcessHeap(), 0, text); HeapFree(GetProcessHeap(), 0, text);
} }
if (rev) { if (rev) {
if (es->composition_len == 0)
{
SetBkColor(dc, BkColor); SetBkColor(dc, BkColor);
SetTextColor(dc, TextColor); SetTextColor(dc, TextColor);
SetBkMode( dc, BkMode); SetBkMode( dc, BkMode);
}
else
{
if (old_font)
SelectObject(dc,old_font);
if (hUnderline)
DeleteObject(hUnderline);
}
} }
return ret; return ret;
} }
@@ -2476,6 +2408,9 @@ static void EDIT_SetRectNP(EDITSTATE *es, LPRECT rc)
*/ */
static void EDIT_UnlockBuffer(EDITSTATE *es, BOOL force) static void EDIT_UnlockBuffer(EDITSTATE *es, BOOL force)
{ {
#ifndef __REACTOS__
HINSTANCE16 hInstance = GetWindowLongW( es->hwndSelf, GWL_HINSTANCE );
#endif
/* Edit window might be already destroyed */ /* Edit window might be already destroyed */
if(!IsWindow(es->hwndSelf)) if(!IsWindow(es->hwndSelf))
@@ -2496,12 +2431,11 @@ static void EDIT_UnlockBuffer(EDITSTATE *es, BOOL force)
if (force || (es->lock_count == 1)) { if (force || (es->lock_count == 1)) {
if (es->hloc32W) { if (es->hloc32W) {
CHAR *textA = NULL; CHAR *textA = NULL;
#ifndef __REACTOS__
BOOL _16bit = FALSE;
#endif
UINT countA = 0; UINT countA = 0;
UINT countW = strlenW(es->text) + 1; UINT countW = strlenW(es->text) + 1;
#ifndef __REACTOS__
STACK16FRAME* stack16 = NULL;
HANDLE16 oldDS = 0;
#endif
if(es->hloc32A) if(es->hloc32A)
{ {
@@ -2618,7 +2552,7 @@ static void EDIT_UpdateScrollInfo(EDITSTATE *es)
* *
* Find the beginning of words. * Find the beginning of words.
* Note: unlike the specs for a WordBreakProc, this function only * Note: unlike the specs for a WordBreakProc, this function only
* allows to be called without linebreaks between s[0] up to * allows to be called without linebreaks between s[0] upto
* s[count - 1]. Remember it is only called * s[count - 1]. Remember it is only called
* internally, so we can decide this for ourselves. * internally, so we can decide this for ourselves.
* *
@@ -3072,7 +3006,7 @@ static BOOL EDIT_EM_LineScroll_internal(EDITSTATE *es, INT dx, INT dy)
dx = es->text_width - x_offset_in_pixels; dx = es->text_width - x_offset_in_pixels;
nyoff = max(0, es->y_offset + dy); nyoff = max(0, es->y_offset + dy);
if (nyoff >= es->line_count - lines_per_page) if (nyoff >= es->line_count - lines_per_page)
nyoff = max(0, es->line_count - lines_per_page); nyoff = max(0,es->line_count - lines_per_page);
dy = (es->y_offset - nyoff) * es->line_height; dy = (es->y_offset - nyoff) * es->line_height;
if (dx || dy) { if (dx || dy) {
RECT rc1; RECT rc1;
@@ -3535,6 +3469,10 @@ static void EDIT_EM_ScrollCaret(EDITSTATE *es)
*/ */
static void EDIT_EM_SetHandle(EDITSTATE *es, HLOCAL hloc) static void EDIT_EM_SetHandle(EDITSTATE *es, HLOCAL hloc)
{ {
#ifndef __REACTOS__
HINSTANCE16 hInstance = GetWindowLongW( es->hwndSelf, GWL_HINSTANCE );
#endif
if (!(es->style & ES_MULTILINE)) if (!(es->style & ES_MULTILINE))
return; return;
@@ -3715,24 +3653,9 @@ static void EDIT_EM_SetLimitText(EDITSTATE *es, INT limit)
* of the char's width as the margin, but this is not how Windows handles this. * of the char's width as the margin, but this is not how Windows handles this.
* For all other fonts Windows sets the margins to zero. * For all other fonts Windows sets the margins to zero.
* *
* FIXME - When EC_USEFONTINFO is used the margins only change if the
* edit control is equal to or larger than a certain size.
* Interestingly if one subtracts both the left and right margins from
* this size one always seems to get an even number. The extents of
* the (four character) string "'**'" match this quite closely, so
* we'll use this until we come up with a better idea.
*/ */
static int calc_min_set_margin_size(HDC dc, INT left, INT right)
{
WCHAR magic_string[] = {'\'','*','*','\'', 0};
SIZE sz;
GetTextExtentPointW(dc, magic_string, sizeof(magic_string)/sizeof(WCHAR) - 1, &sz);
return sz.cx + left + right;
}
static void EDIT_EM_SetMargins(EDITSTATE *es, INT action, static void EDIT_EM_SetMargins(EDITSTATE *es, INT action,
WORD left, WORD right, BOOL repaint) INT left, INT right, BOOL repaint)
{ {
TEXTMETRICW tm; TEXTMETRICW tm;
INT default_left_margin = 0; /* in pixels */ INT default_left_margin = 0; /* in pixels */
@@ -3745,17 +3668,9 @@ static void EDIT_EM_SetMargins(EDITSTATE *es, INT action,
GetTextMetricsW(dc, &tm); GetTextMetricsW(dc, &tm);
/* The default margins are only non zero for TrueType or Vector fonts */ /* The default margins are only non zero for TrueType or Vector fonts */
if (tm.tmPitchAndFamily & ( TMPF_VECTOR | TMPF_TRUETYPE )) { if (tm.tmPitchAndFamily & ( TMPF_VECTOR | TMPF_TRUETYPE )) {
int min_size;
RECT rc;
/* This must be calculated more exactly! But how? */ /* This must be calculated more exactly! But how? */
default_left_margin = tm.tmAveCharWidth / 2; default_left_margin = tm.tmAveCharWidth / 3;
default_right_margin = tm.tmAveCharWidth / 2; default_right_margin = tm.tmAveCharWidth / 3;
min_size = calc_min_set_margin_size(dc, default_left_margin, default_right_margin);
GetClientRect(es->hwndSelf, &rc);
if(rc.right - rc.left < min_size) {
default_left_margin = es->left_margin;
default_right_margin = es->right_margin;
}
} }
SelectObject(dc, old_font); SelectObject(dc, old_font);
ReleaseDC(es->hwndSelf, dc); ReleaseDC(es->hwndSelf, dc);
@@ -4227,7 +4142,7 @@ static LRESULT EDIT_WM_Create(EDITSTATE *es, LPCWSTR name)
EDIT_SetRectNP(es, &clientRect); EDIT_SetRectNP(es, &clientRect);
if (name && *name) { if (name && *name) {
EDIT_EM_ReplaceSel(es, FALSE, name, FALSE, FALSE); EDIT_EM_ReplaceSel(es, FALSE, name, FALSE, TRUE);
/* if we insert text to the editline, the text scrolls out /* if we insert text to the editline, the text scrolls out
* of the window, as the caret is placed after the insert * of the window, as the caret is placed after the insert
* pos normally; thus we reset es->selection... to 0 and * pos normally; thus we reset es->selection... to 0 and
@@ -4327,6 +4242,7 @@ static INT EDIT_WM_GetText(EDITSTATE *es, INT count, LPWSTR dst, BOOL unicode)
} }
} }
/********************************************************************* /*********************************************************************
* *
* WM_HSCROLL * WM_HSCROLL
@@ -4790,7 +4706,7 @@ static LRESULT EDIT_WM_NCCreate(HWND hwnd, LPCREATESTRUCTW lpcs, BOOL unicode)
if (!(es = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*es)))) if (!(es = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*es))))
return FALSE; return FALSE;
SetWindowLongPtrW( hwnd, 0, (LONG_PTR)es ); SetWindowLongPtrW( hwnd, 0, (LONG)es );
/* /*
* Note: since the EDITSTATE has not been fully initialized yet, * Note: since the EDITSTATE has not been fully initialized yet,
@@ -5386,138 +5302,5 @@ static void EDIT_UpdateText(EDITSTATE *es, LPRECT rc, BOOL bErase)
es->flags &= ~EF_UPDATE; es->flags &= ~EF_UPDATE;
EDIT_NOTIFY_PARENT(es, EN_UPDATE); EDIT_NOTIFY_PARENT(es, EN_UPDATE);
} }
NtUserInvalidateRect(es->hwndSelf, rc, bErase); InvalidateRect(es->hwndSelf, rc, bErase);
}
/********************************************************************
*
* The Following code is to handle inline editing from IMEs
*/
static void EDIT_GetCompositionStr(HWND hwnd, LPARAM CompFlag, EDITSTATE *es)
{
DWORD dwBufLen;
LPWSTR lpCompStr = NULL;
HIMC hIMC;
LPSTR lpCompStrAttr = NULL;
DWORD dwBufLenAttr;
if (!(hIMC = ImmGetContext(hwnd)))
return;
dwBufLen = ImmGetCompositionStringW(hIMC, GCS_COMPSTR, NULL, 0);
if (dwBufLen <= 0)
{
ImmReleaseContext(hwnd, hIMC);
return;
}
lpCompStr = HeapAlloc(GetProcessHeap(),0,dwBufLen);
if (!lpCompStr)
{
ERR("Unable to allocate IME CompositionString\n");
ImmReleaseContext(hwnd,hIMC);
return;
}
ImmGetCompositionStringW(hIMC, GCS_COMPSTR, lpCompStr, dwBufLen);
lpCompStr[dwBufLen/sizeof(WCHAR)] = 0;
if (CompFlag & GCS_COMPATTR)
{
/*
* We do not use the attributes yet. it would tell us what characters
* are in transition and which are converted or decided upon
*/
dwBufLenAttr = ImmGetCompositionStringW(hIMC, GCS_COMPATTR, NULL, 0);
if (dwBufLenAttr)
{
dwBufLenAttr ++;
lpCompStrAttr = HeapAlloc(GetProcessHeap(),0,dwBufLenAttr);
if (!lpCompStrAttr)
{
ERR("Unable to allocate IME Attribute String\n");
HeapFree(GetProcessHeap(),0,lpCompStr);
ImmReleaseContext(hwnd,hIMC);
return;
}
ImmGetCompositionStringW(hIMC,GCS_COMPATTR, lpCompStrAttr,
dwBufLenAttr);
lpCompStrAttr[dwBufLenAttr] = 0;
}
else
lpCompStrAttr = NULL;
}
/* check for change in composition start */
if (es->selection_end < es->composition_start)
es->composition_start = es->selection_end;
/* replace existing selection string */
es->selection_start = es->composition_start;
if (es->composition_len > 0)
es->selection_end = es->composition_start + es->composition_len;
else
es->selection_end = es->selection_start;
EDIT_EM_ReplaceSel(es, FALSE, lpCompStr, TRUE, TRUE);
es->composition_len = abs(es->composition_start - es->selection_end);
es->selection_start = es->composition_start;
es->selection_end = es->selection_start + es->composition_len;
HeapFree(GetProcessHeap(),0,lpCompStrAttr);
HeapFree(GetProcessHeap(),0,lpCompStr);
ImmReleaseContext(hwnd,hIMC);
}
static void EDIT_GetResultStr(HWND hwnd, EDITSTATE *es)
{
DWORD dwBufLen;
LPWSTR lpResultStr;
HIMC hIMC;
if ( !(hIMC = ImmGetContext(hwnd)))
return;
dwBufLen = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, NULL, 0);
if (dwBufLen <= 0)
{
ImmReleaseContext(hwnd, hIMC);
return;
}
lpResultStr = HeapAlloc(GetProcessHeap(),0, dwBufLen);
if (!lpResultStr)
{
ERR("Unable to alloc buffer for IME string\n");
ImmReleaseContext(hwnd, hIMC);
return;
}
ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, lpResultStr, dwBufLen);
lpResultStr[dwBufLen/sizeof(WCHAR)] = 0;
/* check for change in composition start */
if (es->selection_end < es->composition_start)
es->composition_start = es->selection_end;
es->selection_start = es->composition_start;
es->selection_end = es->composition_start + es->composition_len;
EDIT_EM_ReplaceSel(es, TRUE, lpResultStr, TRUE, TRUE);
es->composition_start = es->selection_end;
es->composition_len = 0;
HeapFree(GetProcessHeap(),0,lpResultStr);
ImmReleaseContext(hwnd, hIMC);
}
static void EDIT_ImeComposition(HWND hwnd, LPARAM CompFlag, EDITSTATE *es)
{
if (CompFlag & GCS_RESULTSTR)
EDIT_GetResultStr(hwnd,es);
if (CompFlag & GCS_COMPSTR)
EDIT_GetCompositionStr(hwnd, CompFlag, es);
} }

View File

@@ -20,8 +20,6 @@
#include <user32.h> #include <user32.h>
#include <wine/debug.h>
#ifdef __REACTOS__ #ifdef __REACTOS__
#define MAKEINTATOMW(atom) ((LPCWSTR)((ULONG_PTR)((WORD)(atom)))) #define MAKEINTATOMW(atom) ((LPCWSTR)((ULONG_PTR)((WORD)(atom))))
#define ICONTITLE_CLASS_ATOM MAKEINTATOMW(32772) #define ICONTITLE_CLASS_ATOM MAKEINTATOMW(32772)
@@ -55,7 +53,7 @@ const struct builtin_class_descr ICONTITLE_builtin_class =
HWND ICONTITLE_Create( HWND owner ) HWND ICONTITLE_Create( HWND owner )
{ {
HWND hWnd; HWND hWnd;
HINSTANCE instance = (HINSTANCE)GetWindowLongPtrA( owner, GWLP_HINSTANCE ); HINSTANCE instance = (HINSTANCE)GetWindowLongA( owner, GWL_HINSTANCE );
LONG style = WS_CLIPSIBLINGS; LONG style = WS_CLIPSIBLINGS;
if (!IsWindowEnabled(owner)) style |= WS_DISABLED; if (!IsWindowEnabled(owner)) style |= WS_DISABLED;
@@ -144,7 +142,7 @@ static BOOL ICONTITLE_Paint( HWND hwnd, HWND owner, HDC hDC, BOOL bActive )
{ {
if( GetWindowLongA( hwnd, GWL_STYLE ) & WS_CHILD ) if( GetWindowLongA( hwnd, GWL_STYLE ) & WS_CHILD )
{ {
hBrush = (HBRUSH) GetClassLongPtrW(hwnd, GCLP_HBRBACKGROUND); hBrush = (HBRUSH) GetClassLongA(hwnd, GCL_HBRBACKGROUND);
if( hBrush ) if( hBrush )
{ {
INT level; INT level;

View File

@@ -19,10 +19,8 @@
*/ */
#include <user32.h> #include <user32.h>
#define NDEBUG
#include <wine/debug.h> #include <debug.h>
WINE_DECLARE_DEBUG_CHANNEL(combo);
WINE_DEFAULT_DEBUG_CHANNEL(listbox);
/* Start of hack section -------------------------------- */ /* Start of hack section -------------------------------- */
@@ -386,7 +384,7 @@ static LRESULT LISTBOX_SetTopItem( LB_DESCR *descr, INT index,
else else
scroll = FALSE; scroll = FALSE;
} }
if (!scroll) NtUserInvalidateRect( descr->self, NULL, TRUE ); if (!scroll) InvalidateRect( descr->self, NULL, TRUE );
descr->top_item = index; descr->top_item = index;
LISTBOX_UpdateScroll( descr ); LISTBOX_UpdateScroll( descr );
return LB_OKAY; return LB_OKAY;
@@ -408,7 +406,7 @@ static void LISTBOX_UpdatePage( LB_DESCR *descr )
if (page_size == descr->page_size) return; if (page_size == descr->page_size) return;
descr->page_size = page_size; descr->page_size = page_size;
if (descr->style & LBS_MULTICOLUMN) if (descr->style & LBS_MULTICOLUMN)
NtUserInvalidateRect( descr->self, NULL, TRUE ); InvalidateRect( descr->self, NULL, TRUE );
LISTBOX_SetTopItem( descr, descr->top_item, FALSE ); LISTBOX_SetTopItem( descr, descr->top_item, FALSE );
} }
@@ -463,7 +461,7 @@ static void LISTBOX_UpdateSize( LB_DESCR *descr )
/* Invalidate the focused item so it will be repainted correctly */ /* Invalidate the focused item so it will be repainted correctly */
if (LISTBOX_GetItemRect( descr, descr->focus_item, &rect ) == 1) if (LISTBOX_GetItemRect( descr, descr->focus_item, &rect ) == 1)
{ {
NtUserInvalidateRect( descr->self, &rect, FALSE ); InvalidateRect( descr->self, &rect, FALSE );
} }
} }
@@ -685,7 +683,7 @@ static void LISTBOX_SetRedraw( LB_DESCR *descr, BOOL on )
descr->style &= ~LBS_NOREDRAW; descr->style &= ~LBS_NOREDRAW;
if (descr->style & LBS_DISPLAYCHANGED) if (descr->style & LBS_DISPLAYCHANGED)
{ /* page was changed while setredraw false, refresh automatically */ { /* page was changed while setredraw false, refresh automatically */
NtUserInvalidateRect(descr->self, NULL, TRUE); InvalidateRect(descr->self, NULL, TRUE);
if ((descr->top_item + descr->page_size) > descr->nb_items) if ((descr->top_item + descr->page_size) > descr->nb_items)
{ /* reset top of page if less than number of items/page */ { /* reset top of page if less than number of items/page */
descr->top_item = descr->nb_items - descr->page_size; descr->top_item = descr->nb_items - descr->page_size;
@@ -1198,14 +1196,14 @@ static void LISTBOX_InvalidateItems( LB_DESCR *descr, INT index )
return; return;
} }
rect.bottom = descr->height; rect.bottom = descr->height;
NtUserInvalidateRect( descr->self, &rect, TRUE ); InvalidateRect( descr->self, &rect, TRUE );
if (descr->style & LBS_MULTICOLUMN) if (descr->style & LBS_MULTICOLUMN)
{ {
/* Repaint the other columns */ /* Repaint the other columns */
rect.left = rect.right; rect.left = rect.right;
rect.right = descr->width; rect.right = descr->width;
rect.top = 0; rect.top = 0;
NtUserInvalidateRect( descr->self, &rect, TRUE ); InvalidateRect( descr->self, &rect, TRUE );
} }
} }
} }
@@ -1215,7 +1213,7 @@ static void LISTBOX_InvalidateItemRect( LB_DESCR *descr, INT index )
RECT rect; RECT rect;
if (LISTBOX_GetItemRect( descr, index, &rect ) == 1) if (LISTBOX_GetItemRect( descr, index, &rect ) == 1)
NtUserInvalidateRect( descr->self, &rect, TRUE ); InvalidateRect( descr->self, &rect, TRUE );
} }
/*********************************************************************** /***********************************************************************
@@ -1242,9 +1240,6 @@ static LRESULT LISTBOX_GetItemHeight( LB_DESCR *descr, INT index )
static LRESULT LISTBOX_SetItemHeight( LB_DESCR *descr, INT index, static LRESULT LISTBOX_SetItemHeight( LB_DESCR *descr, INT index,
INT height, BOOL repaint ) INT height, BOOL repaint )
{ {
if (height > MAXBYTE)
return -1;
if (!height) height = 1; if (!height) height = 1;
if (descr->style & LBS_OWNERDRAWVARIABLE) if (descr->style & LBS_OWNERDRAWVARIABLE)
@@ -1267,7 +1262,7 @@ static LRESULT LISTBOX_SetItemHeight( LB_DESCR *descr, INT index,
LISTBOX_UpdatePage( descr ); LISTBOX_UpdatePage( descr );
LISTBOX_UpdateScroll( descr ); LISTBOX_UpdateScroll( descr );
if (repaint) if (repaint)
NtUserInvalidateRect( descr->self, 0, TRUE ); InvalidateRect( descr->self, 0, TRUE );
} }
return LB_OKAY; return LB_OKAY;
} }
@@ -1292,12 +1287,12 @@ static void LISTBOX_SetHorizontalPos( LB_DESCR *descr, INT pos )
RECT rect; RECT rect;
/* Invalidate the focused item so it will be repainted correctly */ /* Invalidate the focused item so it will be repainted correctly */
if (LISTBOX_GetItemRect( descr, descr->focus_item, &rect ) == 1) if (LISTBOX_GetItemRect( descr, descr->focus_item, &rect ) == 1)
NtUserInvalidateRect( descr->self, &rect, TRUE ); InvalidateRect( descr->self, &rect, TRUE );
ScrollWindowEx( descr->self, diff, 0, NULL, NULL, 0, NULL, ScrollWindowEx( descr->self, diff, 0, NULL, NULL, 0, NULL,
SW_INVALIDATE | SW_ERASE | SW_SCROLLCHILDREN ); SW_INVALIDATE | SW_ERASE | SW_SCROLLCHILDREN );
} }
else else
NtUserInvalidateRect( descr->self, NULL, TRUE ); InvalidateRect( descr->self, NULL, TRUE );
} }
@@ -1441,13 +1436,11 @@ static LRESULT LISTBOX_SelectItemRange( LB_DESCR *descr, INT first,
/* A few sanity checks */ /* A few sanity checks */
if (descr->style & LBS_NOSEL) return LB_ERR; if (descr->style & LBS_NOSEL) return LB_ERR;
if ((last == -1) && (descr->nb_items == 0)) return LB_OKAY;
if (!(descr->style & LBS_MULTIPLESEL)) return LB_ERR; if (!(descr->style & LBS_MULTIPLESEL)) return LB_ERR;
if (last == -1) last = descr->nb_items - 1;
if (!descr->nb_items) return LB_OKAY; if ((first < 0) || (first >= descr->nb_items)) return LB_ERR;
if ((last < 0) || (last >= descr->nb_items)) return LB_ERR;
if (last == -1 || last >= descr->nb_items) last = descr->nb_items - 1;
if (first < 0) first = 0;
if (last < first) return LB_OKAY;
if (on) /* Turn selection on */ if (on) /* Turn selection on */
{ {
@@ -1824,7 +1817,7 @@ static LRESULT LISTBOX_SetCount( LB_DESCR *descr, INT count )
else if (count < descr->nb_items) else if (count < descr->nb_items)
{ {
while (count < descr->nb_items) while (count < descr->nb_items)
if ((ret = LISTBOX_RemoveItem( descr, (descr->nb_items - 1) )) < 0) if ((ret = LISTBOX_RemoveItem( descr, -1 )) < 0)
return ret; return ret;
} }
return LB_OKAY; return LB_OKAY;
@@ -1985,7 +1978,8 @@ static LRESULT LISTBOX_HandleHScroll( LB_DESCR *descr, WORD scrollReq, WORD pos
descr->top_item + page * descr->page_size, TRUE ); descr->top_item + page * descr->page_size, TRUE );
break; break;
case SB_THUMBPOSITION: case SB_THUMBPOSITION:
LISTBOX_SetTopItem( descr, pos*descr->page_size, TRUE ); LISTBOX_SetTopItem( descr, pos*descr->page_size,
TRUE );
break; break;
case SB_THUMBTRACK: case SB_THUMBTRACK:
info.cbSize = sizeof(info); info.cbSize = sizeof(info);
@@ -2209,6 +2203,7 @@ static LRESULT LISTBOX_HandleLButtonDownCombo( LB_DESCR *pDescr,
/* Check Vertical scroll bar */ /* Check Vertical scroll bar */
if (style & WS_VSCROLL) if (style & WS_VSCROLL)
{ {
clientRect.right += GetSystemMetrics(SM_CXVSCROLL); clientRect.right += GetSystemMetrics(SM_CXVSCROLL);
if (PtInRect( &clientRect, mousePos )) if (PtInRect( &clientRect, mousePos ))
nHitTestType = HTVSCROLL; nHitTestType = HTVSCROLL;
@@ -2636,8 +2631,8 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg,
} }
if (descr->style & LBS_COMBOBOX) lphc = descr->lphc; if (descr->style & LBS_COMBOBOX) lphc = descr->lphc;
TRACE("[%p]: msg %s wp %08x lp %08lx\n", //TRACE("[%p]: msg %s wp %08x lp %08lx\n",
hwnd, SPY_GetMsgName(msg, hwnd), wParam, lParam ); // hwnd, SPY_GetMsgName(msg, hwnd), wParam, lParam );
switch(msg) switch(msg)
{ {
#ifndef __REACTOS__ #ifndef __REACTOS__
@@ -2646,7 +2641,7 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg,
case LB_RESETCONTENT: case LB_RESETCONTENT:
LISTBOX_ResetContent( descr ); LISTBOX_ResetContent( descr );
LISTBOX_UpdateScroll( descr ); LISTBOX_UpdateScroll( descr );
NtUserInvalidateRect( descr->self, NULL, TRUE ); InvalidateRect( descr->self, NULL, TRUE );
return 0; return 0;
#ifndef __REACTOS__ #ifndef __REACTOS__
@@ -3158,7 +3153,7 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg,
return LISTBOX_Destroy( descr ); return LISTBOX_Destroy( descr );
case WM_ENABLE: case WM_ENABLE:
NtUserInvalidateRect( hwnd, NULL, TRUE ); InvalidateRect( hwnd, NULL, TRUE );
return 0; return 0;
case WM_SETREDRAW: case WM_SETREDRAW:
@@ -3168,11 +3163,10 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg,
case WM_GETDLGCODE: case WM_GETDLGCODE:
return DLGC_WANTARROWS | DLGC_WANTCHARS; return DLGC_WANTARROWS | DLGC_WANTCHARS;
case WM_PRINTCLIENT:
case WM_PAINT: case WM_PAINT:
{ {
PAINTSTRUCT ps; PAINTSTRUCT ps;
HDC hdc = ( wParam ) ? ((HDC)wParam) : BeginPaint( descr->self, &ps ); HDC hdc = ( wParam ) ? ((HDC)wParam) : BeginPaint( hwnd, &ps );
ret = LISTBOX_Paint( descr, hdc ); ret = LISTBOX_Paint( descr, hdc );
if( !wParam ) EndPaint( hwnd, &ps ); if( !wParam ) EndPaint( hwnd, &ps );
} }
@@ -3184,7 +3178,7 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg,
return (LRESULT)descr->font; return (LRESULT)descr->font;
case WM_SETFONT: case WM_SETFONT:
LISTBOX_SetFont( descr, (HFONT)wParam ); LISTBOX_SetFont( descr, (HFONT)wParam );
if (lParam) NtUserInvalidateRect( hwnd, 0, TRUE ); if (lParam) InvalidateRect( hwnd, 0, TRUE );
return 0; return 0;
case WM_SETFOCUS: case WM_SETFOCUS:
descr->in_focus = TRUE; descr->in_focus = TRUE;

View File

@@ -11,8 +11,6 @@
#include <user32.h> #include <user32.h>
#include <wine/debug.h>
static void RegisterBuiltinClass(const struct builtin_class_descr *Descr) static void RegisterBuiltinClass(const struct builtin_class_descr *Descr)
{ {
WNDCLASSEXW wc; WNDCLASSEXW wc;
@@ -46,13 +44,15 @@ static void RegisterBuiltinClass(const struct builtin_class_descr *Descr)
RtlInitUnicodeString(&ClassName, Descr->name); RtlInitUnicodeString(&ClassName, Descr->name);
} }
NtUserRegisterClassEx( NtUserRegisterClassExWOW(
&wc, &wc,
&ClassName, &ClassName,
&ClassName,
&MenuName, &MenuName,
Descr->procA, Descr->procA,
REGISTERCLASS_SYSTEM, REGISTERCLASS_SYSTEM,
NULL); 0,
0);
} }
/*********************************************************************** /***********************************************************************

View File

@@ -31,9 +31,9 @@
/* INCLUDES *******************************************************************/ /* INCLUDES *******************************************************************/
#include <user32.h> #include <user32.h>
#define NDEBUG
#include <debug.h>
#include <wine/debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(scrollbar);
/* GLOBAL VARIABLES ***********************************************************/ /* GLOBAL VARIABLES ***********************************************************/
@@ -729,7 +729,7 @@ IntScrollHandleKbdEvent(
WPARAM wParam /* [in] Variable input including enable state */, WPARAM wParam /* [in] Variable input including enable state */,
LPARAM lParam /* [in] Variable input including input point */) LPARAM lParam /* [in] Variable input including input point */)
{ {
TRACE("Wnd=%p wParam=%d lParam=%ld\n", Wnd, wParam, lParam); DPRINT("Wnd=%p wParam=%d lParam=%ld\n", Wnd, wParam, lParam);
/* hide caret on first KEYDOWN to prevent flicker */ /* hide caret on first KEYDOWN to prevent flicker */
if (0 == (lParam & PFD_DOUBLEBUFFER_DONTCARE)) if (0 == (lParam & PFD_DOUBLEBUFFER_DONTCARE))
@@ -1079,7 +1079,7 @@ static void IntScrollCreateScrollBar(
Info.nTrackPos = 0; Info.nTrackPos = 0;
NtUserSetScrollInfo(Wnd, SB_CTL, &Info, FALSE); NtUserSetScrollInfo(Wnd, SB_CTL, &Info, FALSE);
TRACE("hwnd=%p lpCreate=%p\n", Wnd, lpCreate); DPRINT("hwnd=%p lpCreate=%p\n", Wnd, lpCreate);
#if 0 /* FIXME */ #if 0 /* FIXME */
if (lpCreate->style & WS_DISABLED) if (lpCreate->style & WS_DISABLED)
@@ -1357,7 +1357,7 @@ ScrollBarWndProc(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Rect.bottom = Rect.top + ThumbSize; Rect.bottom = Rect.top + ThumbSize;
} }
HideCaret(Wnd); HideCaret(Wnd);
NtUserInvalidateRect(Wnd, &Rect, FALSE); InvalidateRect(Wnd, &Rect, FALSE);
DestroyCaret(); DestroyCaret();
} }
break; break;
@@ -1445,14 +1445,14 @@ ScrollBarWndProc(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
case 0x00ed: case 0x00ed:
case 0x00ee: case 0x00ee:
case 0x00ef: case 0x00ef:
WARN("unknown Win32 msg %04x wp=%08x lp=%08lx\n", DPRINT("unknown Win32 msg %04x wp=%08x lp=%08lx\n",
Msg, wParam, lParam ); Msg, wParam, lParam );
break; break;
default: default:
if (WM_USER <= Msg) if (WM_USER <= Msg)
{ {
WARN("unknown msg %04x wp=%04x lp=%08lx\n", Msg, wParam, lParam); DPRINT("unknown msg %04x wp=%04x lp=%08lx\n", Msg, wParam, lParam);
} }
return DefWindowProcW(Wnd, Msg, wParam, lParam ); return DefWindowProcW(Wnd, Msg, wParam, lParam );
} }
@@ -1503,7 +1503,7 @@ GetScrollInfo(HWND Wnd, INT SBType, LPSCROLLINFO Info)
INT STDCALL INT STDCALL
GetScrollPos(HWND Wnd, INT Bar) GetScrollPos(HWND Wnd, INT Bar)
{ {
TRACE("Wnd=%p Bar=%d\n", Wnd, Bar); DPRINT("Wnd=%p Bar=%d\n", Wnd, Bar);
/* Refer SB_CTL requests to the window */ /* Refer SB_CTL requests to the window */
if (SB_CTL == Bar) if (SB_CTL == Bar)
@@ -1522,7 +1522,7 @@ GetScrollPos(HWND Wnd, INT Bar)
BOOL STDCALL BOOL STDCALL
GetScrollRange(HWND Wnd, int Bar, LPINT MinPos, LPINT MaxPos) GetScrollRange(HWND Wnd, int Bar, LPINT MinPos, LPINT MaxPos)
{ {
TRACE("Wnd=%x Bar=%d Min=%p Max=%p\n", Wnd, Bar, MinPos, MaxPos); DPRINT("Wnd=%x Bar=%d Min=%p Max=%p\n", Wnd, Bar, MinPos, MaxPos);
/* Refer SB_CTL requests to the window */ /* Refer SB_CTL requests to the window */
if (SB_CTL == Bar) if (SB_CTL == Bar)

View File

@@ -16,44 +16,19 @@
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* NOTES
*
* This code was audited for completeness against the documented features
* of Comctl32.dll version 6.0 on Oct. 4, 2004, by Dimitrie O. Paun.
*
* Unless otherwise noted, we believe this code to be complete, as per
* the specification mentioned above.
* If you discover missing features, or bugs, please note them below.
*
* Notes:
* - Windows XP introduced new behavior: The background of centered
* icons and bitmaps is painted differently. This is only done if
* a manifest is present.
* Because it has not yet been decided how to implement the two
* different modes in Wine, only the Windows XP mode is implemented.
* - Controls with SS_SIMPLE but without SS_NOPREFIX:
* The text should not be changed. Windows doesn't clear the
* client rectangle, so the new text must be larger than the old one.
* - The SS_RIGHTJUST style is currently not implemented by Windows
* (or it does something different than documented).
*
* TODO:
* - Animated cursors
*/ */
#include <user32.h> #include <user32.h>
#include <wine/debug.h> #ifndef __REACTOS__
WINE_DEFAULT_DEBUG_CHANNEL(static); WINE_DEFAULT_DEBUG_CHANNEL(static);
#endif
static void STATIC_PaintOwnerDrawfn( HWND hwnd, HDC hdc, DWORD style ); static void STATIC_PaintOwnerDrawfn( HWND hwnd, HDC hdc, DWORD style );
static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style ); static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style );
static void STATIC_PaintRectfn( HWND hwnd, HDC hdc, DWORD style ); static void STATIC_PaintRectfn( HWND hwnd, HDC hdc, DWORD style );
static void STATIC_PaintIconfn( HWND hwnd, HDC hdc, DWORD style ); static void STATIC_PaintIconfn( HWND hwnd, HDC hdc, DWORD style );
static void STATIC_PaintBitmapfn( HWND hwnd, HDC hdc, DWORD style ); static void STATIC_PaintBitmapfn( HWND hwnd, HDC hdc, DWORD style );
//static void STATIC_PaintEnhMetafn( HWND hwnd, HDC hdc, DWORD style );
static void STATIC_PaintEtchedfn( HWND hwnd, HDC hdc, DWORD style ); static void STATIC_PaintEtchedfn( HWND hwnd, HDC hdc, DWORD style );
static LRESULT WINAPI StaticWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); static LRESULT WINAPI StaticWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
static LRESULT WINAPI StaticWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); static LRESULT WINAPI StaticWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
@@ -84,8 +59,8 @@ static pfPaint staticPaintFunc[SS_TYPEMASK+1] =
STATIC_PaintTextfn, /* SS_LEFTNOWORDWRAP */ STATIC_PaintTextfn, /* SS_LEFTNOWORDWRAP */
STATIC_PaintOwnerDrawfn, /* SS_OWNERDRAW */ STATIC_PaintOwnerDrawfn, /* SS_OWNERDRAW */
STATIC_PaintBitmapfn, /* SS_BITMAP */ STATIC_PaintBitmapfn, /* SS_BITMAP */
NULL, /* STATIC_PaintEnhMetafn, SS_ENHMETAFILE */ NULL, /* SS_ENHMETAFILE */
STATIC_PaintEtchedfn, /* SS_ETCHEDHORZ */ STATIC_PaintEtchedfn, /* SS_ETCHEDHORIZ */
STATIC_PaintEtchedfn, /* SS_ETCHEDVERT */ STATIC_PaintEtchedfn, /* SS_ETCHEDVERT */
STATIC_PaintEtchedfn, /* SS_ETCHEDFRAME */ STATIC_PaintEtchedfn, /* SS_ETCHEDFRAME */
}; };
@@ -119,23 +94,24 @@ const struct builtin_class_descr STATIC_builtin_class =
/*********************************************************************** /***********************************************************************
* STATIC_SetIcon * STATIC_SetIcon
* *
* Set the icon for an SS_ICON control. Modified for ReactOS * Set the icon for an SS_ICON control.
*/ */
static HICON STATIC_SetIcon( HWND hwnd, HICON hicon, DWORD style ) static HICON STATIC_SetIcon( HWND hwnd, HICON hicon, DWORD style )
{ {
#ifdef __REACTOS__
HICON prevIcon; HICON prevIcon;
ICONINFO info;
if ((style & SS_TYPEMASK) != SS_ICON) return 0; if ((style & SS_TYPEMASK) != SS_ICON) return 0;
if (hicon && (!GetIconInfo(hicon, &info))) { prevIcon = (HICON)SetWindowLongA( hwnd, HICON_GWL_OFFSET, (LONG)hicon );
WARN("hicon != 0, but info == 0\n"); if (hicon && !(style & SS_CENTERIMAGE))
return 0;
}
prevIcon = (HICON)SetWindowLongPtrW( hwnd, HICON_GWL_OFFSET, (LONG_PTR)hicon );
if (hicon && !(style & SS_CENTERIMAGE) && !(style & SS_REALSIZECONTROL))
{ {
ICONINFO info;
BITMAP bm; BITMAP bm;
if (!GetIconInfo(hicon, &info))
{
return 0;
}
if (!GetObjectW(info.hbmColor, sizeof(BITMAP), &bm)) if (!GetObjectW(info.hbmColor, sizeof(BITMAP), &bm))
{ {
return 0; return 0;
@@ -144,12 +120,30 @@ static HICON STATIC_SetIcon( HWND hwnd, HICON hicon, DWORD style )
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER ); SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER );
} }
return prevIcon; return prevIcon;
#else
HICON prevIcon;
CURSORICONINFO *info = hicon?(CURSORICONINFO *) GlobalLock16(HICON_16(hicon)):NULL;
if ((style & SS_TYPEMASK) != SS_ICON) return 0;
if (hicon && !info) {
ERR("huh? hicon!=0, but info=0???\n");
return 0;
}
prevIcon = (HICON)SetWindowLongA( hwnd, HICON_GWL_OFFSET, (LONG)hicon );
if (hicon && !(style & SS_CENTERIMAGE))
{
SetWindowPos( hwnd, 0, 0, 0, info->nWidth, info->nHeight,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER );
GlobalUnlock16(HICON_16(hicon));
}
return prevIcon;
#endif
} }
/*********************************************************************** /***********************************************************************
* STATIC_SetBitmap * STATIC_SetBitmap
* *
* Set the bitmap for an SS_BITMAP control. Modified for ReactOS * Set the bitmap for an SS_BITMAP control.
*/ */
static HBITMAP STATIC_SetBitmap( HWND hwnd, HBITMAP hBitmap, DWORD style ) static HBITMAP STATIC_SetBitmap( HWND hwnd, HBITMAP hBitmap, DWORD style )
{ {
@@ -157,11 +151,15 @@ static HBITMAP STATIC_SetBitmap( HWND hwnd, HBITMAP hBitmap, DWORD style )
if ((style & SS_TYPEMASK) != SS_BITMAP) return 0; if ((style & SS_TYPEMASK) != SS_BITMAP) return 0;
if (hBitmap && GetObjectType(hBitmap) != OBJ_BITMAP) { if (hBitmap && GetObjectType(hBitmap) != OBJ_BITMAP) {
ERR("huh? hBitmap!=0, but not bitmap\n"); #ifdef __REACTOS__
return 0; OutputDebugStringA("huh? hBitmap!=0, but not bitmap\n");
#else
ERR("huh? hBitmap!=0, but not bitmap\n");
#endif
return 0;
} }
hOldBitmap = (HBITMAP)SetWindowLongPtrW( hwnd, HICON_GWL_OFFSET, (LONG_PTR)hBitmap ); hOldBitmap = (HBITMAP)SetWindowLongA( hwnd, HICON_GWL_OFFSET, (LONG)hBitmap );
if (hBitmap && !(style & SS_CENTERIMAGE) && !(style & SS_REALSIZECONTROL)) if (hBitmap && !(style & SS_CENTERIMAGE))
{ {
BITMAP bm; BITMAP bm;
GetObjectW(hBitmap, sizeof(bm), &bm); GetObjectW(hBitmap, sizeof(bm), &bm);
@@ -171,69 +169,17 @@ static HBITMAP STATIC_SetBitmap( HWND hwnd, HBITMAP hBitmap, DWORD style )
return hOldBitmap; return hOldBitmap;
} }
/***********************************************************************
* STATIC_SetEnhMetaFile
*
* Set the enhanced metafile for an SS_ENHMETAFILE control.
*/
//static HENHMETAFILE STATIC_SetEnhMetaFile( HWND hwnd, HENHMETAFILE hEnhMetaFile, DWORD style )
//{
// if ((style & SS_TYPEMASK) != SS_ENHMETAFILE) return 0;
// if (hEnhMetaFile && GetObjectType(hEnhMetaFile) != OBJ_ENHMETAFILE) {
// WARN("hEnhMetaFile != 0, but it's not an enhanced metafile\n");
// return 0;
// }
// return (HENHMETAFILE)SetWindowLongPtrW( hwnd, HICON_GWL_OFFSET, (LONG_PTR)hEnhMetaFile );
//}
/***********************************************************************
* STATIC_GetImage
*
* Gets the bitmap for an SS_BITMAP control, the icon/cursor for an
* SS_ICON control or the enhanced metafile for an SS_ENHMETAFILE control.
*/
static HANDLE STATIC_GetImage( HWND hwnd, WPARAM wParam, DWORD style )
{
switch(style & SS_TYPEMASK)
{
case SS_ICON:
if ((wParam != IMAGE_ICON) &&
(wParam != IMAGE_CURSOR)) return NULL;
break;
case SS_BITMAP:
if (wParam != IMAGE_BITMAP) return NULL;
break;
case SS_ENHMETAFILE:
if (wParam != IMAGE_ENHMETAFILE) return NULL;
break;
default:
return NULL;
}
return (HANDLE)GetWindowLongPtrW( hwnd, HICON_GWL_OFFSET );
}
/*********************************************************************** /***********************************************************************
* STATIC_LoadIconA * STATIC_LoadIconA
* *
* Load the icon for an SS_ICON control. * Load the icon for an SS_ICON control.
*/ */
static HICON STATIC_LoadIconA( HWND hwnd, LPCSTR name, DWORD style ) static HICON STATIC_LoadIconA( HWND hwnd, LPCSTR name )
{ {
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE ); HINSTANCE hInstance = (HINSTANCE)GetWindowLongA( hwnd, GWL_HINSTANCE );
if ((style & SS_REALSIZEIMAGE) != 0) HICON hicon = LoadIconA( hInstance, name );
{ if (!hicon) hicon = LoadIconA( 0, name );
return LoadImageA(hInstance, name, IMAGE_ICON, 0, 0, LR_SHARED);
}
else
{
HICON hicon = LoadIconA( hInstance, name );
if (!hicon) hicon = LoadCursorA( hInstance, name );
if (!hicon) hicon = LoadIconA( 0, name );
/* Windows doesn't try to load a standard cursor,
probably because most IDs for standard cursors conflict
with the IDs for standard icons anyway */
return hicon; return hicon;
}
} }
/*********************************************************************** /***********************************************************************
@@ -241,23 +187,12 @@ static HICON STATIC_LoadIconA( HWND hwnd, LPCSTR name, DWORD style )
* *
* Load the icon for an SS_ICON control. * Load the icon for an SS_ICON control.
*/ */
static HICON STATIC_LoadIconW( HWND hwnd, LPCWSTR name, DWORD style ) static HICON STATIC_LoadIconW( HWND hwnd, LPCWSTR name )
{ {
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE ); HINSTANCE hInstance = (HINSTANCE)GetWindowLongA( hwnd, GWL_HINSTANCE );
if ((style & SS_REALSIZEIMAGE) != 0) HICON hicon = LoadIconW( hInstance, name );
{ if (!hicon) hicon = LoadIconW( 0, name );
return LoadImageW(hInstance, name, IMAGE_ICON, 0, 0, LR_SHARED); return hicon;
}
else
{
HICON hicon = LoadIconW( hInstance, name );
if (!hicon) hicon = LoadCursorW( hInstance, name );
if (!hicon) hicon = LoadIconW( 0, name );
/* Windows doesn't try to load a standard cursor,
probably because most IDs for standard cursors conflict
with the IDs for standard icons anyway */
return hicon;
}
} }
/*********************************************************************** /***********************************************************************
@@ -267,9 +202,11 @@ static HICON STATIC_LoadIconW( HWND hwnd, LPCWSTR name, DWORD style )
*/ */
static HBITMAP STATIC_LoadBitmapA( HWND hwnd, LPCSTR name ) static HBITMAP STATIC_LoadBitmapA( HWND hwnd, LPCSTR name )
{ {
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE ); HINSTANCE hInstance = (HINSTANCE)GetWindowLongA( hwnd, GWL_HINSTANCE );
/* Windows doesn't try to load OEM Bitmaps (hInstance == NULL) */ HBITMAP hbitmap = LoadBitmapA( hInstance, name );
return LoadBitmapA( hInstance, name ); if (!hbitmap) /* Try OEM icon (FIXME: is this right?) */
hbitmap = LoadBitmapA( 0, name );
return hbitmap;
} }
/*********************************************************************** /***********************************************************************
@@ -279,9 +216,11 @@ static HBITMAP STATIC_LoadBitmapA( HWND hwnd, LPCSTR name )
*/ */
static HBITMAP STATIC_LoadBitmapW( HWND hwnd, LPCWSTR name ) static HBITMAP STATIC_LoadBitmapW( HWND hwnd, LPCWSTR name )
{ {
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE ); HINSTANCE hInstance = (HINSTANCE)GetWindowLongA( hwnd, GWL_HINSTANCE );
/* Windows doesn't try to load OEM Bitmaps (hInstance == NULL) */ HBITMAP hbitmap = LoadBitmapW( hInstance, name );
return LoadBitmapW( hInstance, name ); if (!hbitmap) /* Try OEM icon (FIXME: is this right?) */
hbitmap = LoadBitmapW( 0, name );
return hbitmap;
} }
/*********************************************************************** /***********************************************************************
@@ -304,48 +243,13 @@ static VOID STATIC_TryPaintFcn(HWND hwnd, LONG full_style)
} }
} }
static HBRUSH STATIC_SendWmCtlColorStatic(HWND hwnd, HDC hdc) static VOID STATIC_InitColours()
{
HBRUSH hBrush = (HBRUSH) SendMessageW( GetParent(hwnd),
WM_CTLCOLORSTATIC, (WPARAM)hdc, (LPARAM)hwnd );
if (!hBrush) /* did the app forget to call DefWindowProc ? */
{
/* FIXME: DefWindowProc should return different colors if a
manifest is present */
hBrush = (HBRUSH)DefWindowProcW(GetParent(hwnd), WM_CTLCOLORSTATIC,
(WPARAM)hdc, (LPARAM)hwnd);
}
return hBrush;
}
static VOID STATIC_InitColours(void)
{ {
color_3ddkshadow = GetSysColor(COLOR_3DDKSHADOW); color_3ddkshadow = GetSysColor(COLOR_3DDKSHADOW);
color_3dshadow = GetSysColor(COLOR_3DSHADOW); color_3dshadow = GetSysColor(COLOR_3DSHADOW);
color_3dhighlight = GetSysColor(COLOR_3DHIGHLIGHT); color_3dhighlight = GetSysColor(COLOR_3DHIGHLIGHT);
} }
/***********************************************************************
* hasTextStyle
*
* Tests if the control displays text.
*/
static BOOL hasTextStyle( DWORD style )
{
switch(style & SS_TYPEMASK)
{
case SS_SIMPLE:
case SS_LEFT:
case SS_LEFTNOWORDWRAP:
case SS_CENTER:
case SS_RIGHT:
case SS_OWNERDRAW:
return TRUE;
}
return FALSE;
}
/*********************************************************************** /***********************************************************************
* StaticWndProc_common * StaticWndProc_common
*/ */
@@ -353,7 +257,7 @@ static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
LPARAM lParam, BOOL unicode ) LPARAM lParam, BOOL unicode )
{ {
LRESULT lResult = 0; LRESULT lResult = 0;
LONG full_style = GetWindowLongW( hwnd, GWL_STYLE ); LONG full_style = GetWindowLongA( hwnd, GWL_STYLE );
LONG style = full_style & SS_TYPEMASK; LONG style = full_style & SS_TYPEMASK;
switch (uMsg) switch (uMsg)
@@ -361,7 +265,11 @@ static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
case WM_CREATE: case WM_CREATE:
if (style < 0L || style > SS_TYPEMASK) if (style < 0L || style > SS_TYPEMASK)
{ {
#ifdef __REACTOS__
OutputDebugStringA("Unknown style\n");
#else
ERR("Unknown style 0x%02lx\n", style ); ERR("Unknown style 0x%02lx\n", style );
#endif
return -1; return -1;
} }
STATIC_InitColours(); STATIC_InitColours();
@@ -382,7 +290,6 @@ static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
else return unicode ? DefWindowProcW(hwnd, uMsg, wParam, lParam) : else return unicode ? DefWindowProcW(hwnd, uMsg, wParam, lParam) :
DefWindowProcA(hwnd, uMsg, wParam, lParam); DefWindowProcA(hwnd, uMsg, wParam, lParam);
case WM_PRINTCLIENT:
case WM_PAINT: case WM_PAINT:
{ {
PAINTSTRUCT ps; PAINTSTRUCT ps;
@@ -394,97 +301,86 @@ static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
break; break;
case WM_ENABLE: case WM_ENABLE:
STATIC_TryPaintFcn( hwnd, full_style ); InvalidateRect(hwnd, NULL, TRUE);
if (full_style & SS_NOTIFY) {
if (wParam) {
SendMessageW( GetParent(hwnd), WM_COMMAND,
MAKEWPARAM( GetWindowLongPtrW(hwnd,GWLP_ID), STN_ENABLE ), (LPARAM)hwnd);
}
else {
SendMessageW( GetParent(hwnd), WM_COMMAND,
MAKEWPARAM( GetWindowLongPtrW(hwnd,GWLP_ID), STN_DISABLE ), (LPARAM)hwnd);
}
}
break; break;
case WM_SYSCOLORCHANGE: case WM_SYSCOLORCHANGE:
STATIC_InitColours(); STATIC_InitColours();
STATIC_TryPaintFcn( hwnd, full_style ); InvalidateRect(hwnd, NULL, TRUE);
break; break;
case WM_NCCREATE: case WM_NCCREATE:
{ if (full_style & SS_SUNKEN)
LPCSTR textA; SetWindowLongA( hwnd, GWL_EXSTYLE,
LPCWSTR textW; GetWindowLongA( hwnd, GWL_EXSTYLE ) | WS_EX_STATICEDGE );
if (full_style & SS_SUNKEN)
SetWindowLongW( hwnd, GWL_EXSTYLE,
GetWindowLongW( hwnd, GWL_EXSTYLE ) | WS_EX_STATICEDGE );
if(unicode)
{
textA = NULL;
textW = ((LPCREATESTRUCTW)lParam)->lpszName;
}
else
{
textA = ((LPCREATESTRUCTA)lParam)->lpszName;
textW = NULL;
}
switch (style) {
case SS_ICON:
{
HICON hIcon;
if(unicode)
hIcon = STATIC_LoadIconW(hwnd, textW, full_style);
else
hIcon = STATIC_LoadIconA(hwnd, textA, full_style);
STATIC_SetIcon(hwnd, hIcon, full_style);
}
break;
case SS_BITMAP:
{
HBITMAP hBitmap;
if(unicode)
hBitmap = STATIC_LoadBitmapW(hwnd, textW);
else
hBitmap = STATIC_LoadBitmapA(hwnd, textA);
STATIC_SetBitmap(hwnd, hBitmap, full_style);
}
break;
}
/* SS_ENHMETAFILE: Despite what MSDN says, Windows does not load
the enhanced metafile that was specified as the window text. */
}
return unicode ? DefWindowProcW(hwnd, uMsg, wParam, lParam) :
DefWindowProcA(hwnd, uMsg, wParam, lParam);
if(unicode)
lParam = (LPARAM)(((LPCREATESTRUCTW)lParam)->lpszName);
else
lParam = (LPARAM)(((LPCREATESTRUCTA)lParam)->lpszName);
/* fall through */
case WM_SETTEXT: case WM_SETTEXT:
if (hasTextStyle( full_style )) switch (style) {
case SS_ICON:
{
HICON hIcon;
if(unicode)
hIcon = STATIC_LoadIconW(hwnd, (LPCWSTR)lParam);
else
hIcon = STATIC_LoadIconA(hwnd, (LPCSTR)lParam);
/* FIXME : should we also return the previous hIcon here ??? */
STATIC_SetIcon(hwnd, hIcon, full_style);
break;
}
case SS_BITMAP:
{
HBITMAP hBitmap;
if(unicode)
hBitmap = STATIC_LoadBitmapW(hwnd, (LPCWSTR)lParam);
else
hBitmap = STATIC_LoadBitmapA(hwnd, (LPCSTR)lParam);
STATIC_SetBitmap(hwnd, hBitmap, full_style);
break;
}
case SS_LEFT:
case SS_CENTER:
case SS_RIGHT:
case SS_SIMPLE:
case SS_LEFTNOWORDWRAP:
{ {
if (HIWORD(lParam)) if (HIWORD(lParam))
{ {
if(unicode) if(unicode)
lResult = DefWindowProcW( hwnd, uMsg, wParam, lParam ); lResult = DefWindowProcW( hwnd, WM_SETTEXT, wParam, lParam );
else else
lResult = DefWindowProcA( hwnd, uMsg, wParam, lParam ); lResult = DefWindowProcA( hwnd, WM_SETTEXT, wParam, lParam );
STATIC_TryPaintFcn( hwnd, full_style );
} }
if (uMsg == WM_SETTEXT)
STATIC_TryPaintFcn( hwnd, full_style );
break;
} }
break; default:
if (HIWORD(lParam))
{
if(unicode)
lResult = DefWindowProcW( hwnd, WM_SETTEXT, wParam, lParam );
else
lResult = DefWindowProcA( hwnd, WM_SETTEXT, wParam, lParam );
}
if(uMsg == WM_SETTEXT)
InvalidateRect(hwnd, NULL, TRUE);
}
return 1; /* success. FIXME: check text length */
case WM_SETFONT: case WM_SETFONT:
if (hasTextStyle( full_style )) if ((style == SS_ICON) || (style == SS_BITMAP)) return 0;
{ SetWindowLongA( hwnd, HFONT_GWL_OFFSET, wParam );
SetWindowLongPtrW( hwnd, HFONT_GWL_OFFSET, wParam );
if (LOWORD(lParam)) if (LOWORD(lParam))
STATIC_TryPaintFcn( hwnd, full_style ); InvalidateRect( hwnd, NULL, TRUE );
}
break; break;
case WM_GETFONT: case WM_GETFONT:
return GetWindowLongPtrW( hwnd, HFONT_GWL_OFFSET ); return GetWindowLongA( hwnd, HFONT_GWL_OFFSET );
case WM_NCHITTEST: case WM_NCHITTEST:
if (full_style & SS_NOTIFY) if (full_style & SS_NOTIFY)
@@ -499,41 +395,38 @@ static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
case WM_NCLBUTTONDOWN: case WM_NCLBUTTONDOWN:
if (full_style & SS_NOTIFY) if (full_style & SS_NOTIFY)
SendMessageW( GetParent(hwnd), WM_COMMAND, SendMessageW( GetParent(hwnd), WM_COMMAND,
MAKEWPARAM( GetWindowLongPtrW(hwnd,GWLP_ID), STN_CLICKED ), (LPARAM)hwnd); MAKEWPARAM( GetWindowLongW(hwnd,GWL_ID), STN_CLICKED ), (LPARAM)hwnd);
return 0; return 0;
case WM_LBUTTONDBLCLK: case WM_LBUTTONDBLCLK:
case WM_NCLBUTTONDBLCLK: case WM_NCLBUTTONDBLCLK:
if (full_style & SS_NOTIFY) if (full_style & SS_NOTIFY)
SendMessageW( GetParent(hwnd), WM_COMMAND, SendMessageW( GetParent(hwnd), WM_COMMAND,
MAKEWPARAM( GetWindowLongPtrW(hwnd,GWLP_ID), STN_DBLCLK ), (LPARAM)hwnd); MAKEWPARAM( GetWindowLongW(hwnd,GWL_ID), STN_DBLCLK ), (LPARAM)hwnd);
return 0; return 0;
case STM_GETIMAGE: case STM_GETIMAGE:
return (LRESULT)STATIC_GetImage( hwnd, wParam, full_style );
#ifndef __REACTOS__ #ifndef __REACTOS__
case STM_GETICON16: case STM_GETICON16:
#endif #endif
case STM_GETICON: case STM_GETICON:
return (LRESULT)STATIC_GetImage( hwnd, IMAGE_ICON, full_style ); return GetWindowLongA( hwnd, HICON_GWL_OFFSET );
case STM_SETIMAGE: case STM_SETIMAGE:
switch(wParam) { switch(wParam) {
case IMAGE_BITMAP: case IMAGE_BITMAP:
lResult = (LRESULT)STATIC_SetBitmap( hwnd, (HBITMAP)lParam, full_style ); lResult = (LRESULT)STATIC_SetBitmap( hwnd, (HBITMAP)lParam, full_style );
break; break;
// case IMAGE_ENHMETAFILE:
// lResult = (LRESULT)STATIC_SetEnhMetaFile( hwnd, (HENHMETAFILE)lParam, full_style );
// break;
case IMAGE_ICON: case IMAGE_ICON:
case IMAGE_CURSOR:
lResult = (LRESULT)STATIC_SetIcon( hwnd, (HICON)lParam, full_style ); lResult = (LRESULT)STATIC_SetIcon( hwnd, (HICON)lParam, full_style );
break; break;
default: default:
#ifndef __REACTOS__
FIXME("STM_SETIMAGE: Unhandled type %x\n", wParam); FIXME("STM_SETIMAGE: Unhandled type %x\n", wParam);
#endif
break; break;
} }
STATIC_TryPaintFcn( hwnd, full_style ); InvalidateRect( hwnd, NULL, TRUE );
break; break;
#ifndef __REACTOS__ #ifndef __REACTOS__
@@ -541,7 +434,7 @@ static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
#endif #endif
case STM_SETICON: case STM_SETICON:
lResult = (LRESULT)STATIC_SetIcon( hwnd, (HICON)wParam, full_style ); lResult = (LRESULT)STATIC_SetIcon( hwnd, (HICON)wParam, full_style );
STATIC_TryPaintFcn( hwnd, full_style ); InvalidateRect( hwnd, NULL, TRUE );
break; break;
default: default:
@@ -572,31 +465,27 @@ static LRESULT WINAPI StaticWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
static void STATIC_PaintOwnerDrawfn( HWND hwnd, HDC hdc, DWORD style ) static void STATIC_PaintOwnerDrawfn( HWND hwnd, HDC hdc, DWORD style )
{ {
DRAWITEMSTRUCT dis; DRAWITEMSTRUCT dis;
HFONT font, oldFont = NULL; LONG id = GetWindowLongA( hwnd, GWL_ID );
UINT id = (UINT)GetWindowLongPtrW( hwnd, GWLP_ID );
dis.CtlType = ODT_STATIC; dis.CtlType = ODT_STATIC;
dis.CtlID = id; dis.CtlID = id;
dis.itemID = 0; dis.itemID = 0;
dis.itemAction = ODA_DRAWENTIRE; dis.itemAction = ODA_DRAWENTIRE;
dis.itemState = IsWindowEnabled(hwnd) ? 0 : ODS_DISABLED; dis.itemState = 0;
dis.hwndItem = hwnd; dis.hwndItem = hwnd;
dis.hDC = hdc; dis.hDC = hdc;
dis.itemData = 0; dis.itemData = 0;
GetClientRect( hwnd, &dis.rcItem ); GetClientRect( hwnd, &dis.rcItem );
font = (HFONT)GetWindowLongPtrW( hwnd, HFONT_GWL_OFFSET );
if (font) oldFont = SelectObject( hdc, font );
SendMessageW( GetParent(hwnd), WM_CTLCOLORSTATIC, (WPARAM)hdc, (LPARAM)hwnd ); SendMessageW( GetParent(hwnd), WM_CTLCOLORSTATIC, (WPARAM)hdc, (LPARAM)hwnd );
SendMessageW( GetParent(hwnd), WM_DRAWITEM, id, (LPARAM)&dis ); SendMessageW( GetParent(hwnd), WM_DRAWITEM, id, (LPARAM)&dis );
if (font) SelectObject( hdc, oldFont );
} }
static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style ) static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style )
{ {
RECT rc; RECT rc;
HBRUSH hBrush; HBRUSH hBrush;
HFONT hFont, hOldFont = NULL; HFONT hFont;
WORD wFormat; WORD wFormat;
INT len; INT len;
WCHAR *text; WCHAR *text;
@@ -618,11 +507,11 @@ static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style )
break; break;
case SS_SIMPLE: case SS_SIMPLE:
wFormat = DT_LEFT | DT_SINGLELINE; wFormat = DT_LEFT | DT_SINGLELINE | DT_VCENTER;
break; break;
case SS_LEFTNOWORDWRAP: case SS_LEFTNOWORDWRAP:
wFormat = DT_LEFT | DT_EXPANDTABS; wFormat = DT_LEFT | DT_EXPANDTABS | DT_VCENTER;
break; break;
default: default:
@@ -630,56 +519,28 @@ static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style )
} }
if (style & SS_NOPREFIX) if (style & SS_NOPREFIX)
wFormat |= DT_NOPREFIX; wFormat |= DT_NOPREFIX;
if (style & SS_CENTERIMAGE)
wFormat |= DT_VCENTER;
if ((style & SS_TYPEMASK) != SS_SIMPLE) if ((hFont = (HFONT)GetWindowLongA( hwnd, HFONT_GWL_OFFSET ))) SelectObject( hdc, hFont );
{
if (style & SS_CENTERIMAGE) if ((style & SS_NOPREFIX) || ((style & SS_TYPEMASK) != SS_SIMPLE))
wFormat |= DT_SINGLELINE | DT_VCENTER;
if (style & SS_EDITCONTROL)
wFormat |= DT_EDITCONTROL;
if (style & SS_ENDELLIPSIS)
wFormat |= DT_SINGLELINE | DT_END_ELLIPSIS;
if (style & SS_PATHELLIPSIS)
wFormat |= DT_SINGLELINE | DT_PATH_ELLIPSIS;
if (style & SS_WORDELLIPSIS)
wFormat |= DT_SINGLELINE | DT_WORD_ELLIPSIS;
}
if ((hFont = (HFONT)GetWindowLongPtrW( hwnd, HFONT_GWL_OFFSET )))
hOldFont = (HFONT)SelectObject( hdc, hFont );
/* SS_SIMPLE controls: WM_CTLCOLORSTATIC is sent, but the returned
brush is not used */
hBrush = STATIC_SendWmCtlColorStatic(hwnd, hdc);
if ((style & SS_TYPEMASK) != SS_SIMPLE)
{ {
hBrush = (HBRUSH)SendMessageW( GetParent(hwnd), WM_CTLCOLORSTATIC,
(WPARAM)hdc, (LPARAM)hwnd );
if (!hBrush) /* did the app forget to call defwindowproc ? */
hBrush = (HBRUSH)DefWindowProcW(GetParent(hwnd), WM_CTLCOLORSTATIC,
(WPARAM)hdc, (LPARAM)hwnd);
FillRect( hdc, &rc, hBrush ); FillRect( hdc, &rc, hBrush );
if (!IsWindowEnabled(hwnd)) SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT));
} }
if (!IsWindowEnabled(hwnd)) SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT));
if (!(len = SendMessageW( hwnd, WM_GETTEXTLENGTH, 0, 0 ))) return; if (!(len = SendMessageW( hwnd, WM_GETTEXTLENGTH, 0, 0 ))) return;
if (!(text = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) ))) return; if (!(text = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) ))) return;
SendMessageW( hwnd, WM_GETTEXT, len + 1, (LPARAM)text ); SendMessageW( hwnd, WM_GETTEXT, len + 1, (LPARAM)text );
if (((style & SS_TYPEMASK) == SS_SIMPLE) && (style & SS_NOPREFIX))
{
/* Windows uses the faster ExtTextOut() to draw the text and
to paint the whole client rectangle with the text background
color. Reference: "Static Controls" by Kyle Marsh, 1992 */
ExtTextOutW( hdc, rc.left, rc.top, ETO_CLIPPED | ETO_OPAQUE,
&rc, text, len, NULL );
}
else
{
DrawTextW( hdc, text, -1, &rc, wFormat ); DrawTextW( hdc, text, -1, &rc, wFormat );
}
HeapFree( GetProcessHeap(), 0, text ); HeapFree( GetProcessHeap(), 0, text );
if (hFont)
SelectObject( hdc, hOldFont );
} }
static void STATIC_PaintRectfn( HWND hwnd, HDC hdc, DWORD style ) static void STATIC_PaintRectfn( HWND hwnd, HDC hdc, DWORD style )
@@ -721,114 +582,84 @@ static void STATIC_PaintRectfn( HWND hwnd, HDC hdc, DWORD style )
DeleteObject( hBrush ); DeleteObject( hBrush );
} }
/* Modified for ReactOS */
static void STATIC_PaintIconfn( HWND hwnd, HDC hdc, DWORD style ) static void STATIC_PaintIconfn( HWND hwnd, HDC hdc, DWORD style )
{ {
RECT rc, iconRect; RECT rc;
HBRUSH hbrush; HBRUSH hbrush;
HICON hIcon; HICON hIcon;
ICONINFO info; INT x, y;
GetClientRect( hwnd, &rc ); GetClientRect( hwnd, &rc );
hbrush = STATIC_SendWmCtlColorStatic(hwnd, hdc); hbrush = (HBRUSH)SendMessageW( GetParent(hwnd), WM_CTLCOLORSTATIC,
(WPARAM)hdc, (LPARAM)hwnd );
FillRect( hdc, &rc, hbrush );
hIcon = (HICON)GetWindowLongPtrW( hwnd, HICON_GWL_OFFSET ); hIcon = (HICON)GetWindowLongPtrW( hwnd, HICON_GWL_OFFSET );
if (!hIcon || (!GetIconInfo(hIcon, &info))) if (style & SS_CENTERIMAGE)
{ {
FillRect(hdc, &rc, hbrush); #ifndef __REACTOS__
CURSORICONINFO *info = hIcon ? (CURSORICONINFO *)GlobalLock16(HICON_16(hIcon)) : NULL;
x = (rc.right - rc.left)/2 - (info ? info->nWidth/2 : 0);
y = (rc.bottom - rc.top)/2 - (info ? info->nHeight/2 : 0);
#else
ICONINFO info;
BITMAP bm;
if (!GetIconInfo(hIcon, &info))
return;
if (!GetObjectW(info.hbmColor, sizeof(BITMAP), &bm))
return;
x = (rc.right - rc.left)/2 - bm.bmWidth/2;
y = (rc.bottom - rc.top)/2 - bm.bmHeight/2;
#endif
} }
else else
{ {
BITMAP bm; x = rc.left;
if (!GetObjectW(info.hbmColor, sizeof(BITMAP), &bm)) return; y = rc.top;
if (style & SS_CENTERIMAGE)
{
iconRect.left = (rc.right - rc.left) / 2 - bm.bmWidth / 2;
iconRect.top = (rc.bottom - rc.top) / 2 - bm.bmHeight / 2;
iconRect.right = iconRect.left + bm.bmWidth;
iconRect.bottom = iconRect.top + bm.bmHeight;
}
else
iconRect = rc;
FillRect( hdc, &rc, hbrush );
DrawIconEx( hdc, iconRect.left, iconRect.top, hIcon, iconRect.right - iconRect.left,
iconRect.bottom - iconRect.top, 0, NULL, DI_NORMAL );
} }
if (hIcon)
DrawIcon( hdc, x, y, hIcon );
} }
static void STATIC_PaintBitmapfn(HWND hwnd, HDC hdc, DWORD style ) static void STATIC_PaintBitmapfn(HWND hwnd, HDC hdc, DWORD style )
{ {
HDC hMemDC; HDC hMemDC;
HBITMAP hBitmap, oldbitmap; HBITMAP hBitmap, oldbitmap;
HBRUSH hbrush;
/* message is still sent, even if the returned brush is not used */ /* message is still sent, even if the returned brush is not used */
hbrush = STATIC_SendWmCtlColorStatic(hwnd, hdc); SendMessageW( GetParent(hwnd), WM_CTLCOLORSTATIC,
(WPARAM)hdc, (LPARAM)hwnd );
if ((hBitmap = (HBITMAP)GetWindowLongPtrW( hwnd, HICON_GWL_OFFSET )) if ((hBitmap = (HBITMAP)GetWindowLongA( hwnd, HICON_GWL_OFFSET )))
&& (GetObjectType(hBitmap) == OBJ_BITMAP)
&& (hMemDC = CreateCompatibleDC( hdc )))
{ {
BITMAP bm; BITMAP bm;
RECT rcClient; INT x, y;
LOGBRUSH brush;
GetObjectW(hBitmap, sizeof(bm), &bm); if(GetObjectType(hBitmap) != OBJ_BITMAP) return;
oldbitmap = SelectObject(hMemDC, hBitmap); if (!(hMemDC = CreateCompatibleDC( hdc ))) return;
GetObjectW(hBitmap, sizeof(bm), &bm);
/* Set the background color for monochrome bitmaps oldbitmap = SelectObject(hMemDC, hBitmap);
to the color of the background brush */
if (GetObjectW( hbrush, sizeof(brush), &brush ))
{
if (brush.lbStyle == BS_SOLID)
SetBkColor(hdc, brush.lbColor);
}
GetClientRect(hwnd, &rcClient);
if (style & SS_CENTERIMAGE) if (style & SS_CENTERIMAGE)
{ {
INT x, y; RECT rcClient;
GetClientRect(hwnd, &rcClient);
x = (rcClient.right - rcClient.left)/2 - bm.bmWidth/2; x = (rcClient.right - rcClient.left)/2 - bm.bmWidth/2;
y = (rcClient.bottom - rcClient.top)/2 - bm.bmHeight/2; y = (rcClient.bottom - rcClient.top)/2 - bm.bmHeight/2;
FillRect( hdc, &rcClient, hbrush );
BitBlt(hdc, x, y, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0,
SRCCOPY);
} }
else else
{ {
StretchBlt(hdc, 0, 0, rcClient.right - rcClient.left, x = 0;
rcClient.bottom - rcClient.top, hMemDC, y = 0;
0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
} }
SelectObject(hMemDC, oldbitmap); BitBlt(hdc, x, y, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0,
DeleteDC(hMemDC); SRCCOPY);
} SelectObject(hMemDC, oldbitmap);
else DeleteDC(hMemDC);
{
RECT rcClient;
GetClientRect( hwnd, &rcClient );
FillRect( hdc, &rcClient, hbrush );
} }
} }
//static void STATIC_PaintEnhMetafn(HWND hwnd, HDC hdc, DWORD style )
//{
// HENHMETAFILE hEnhMetaFile;
// RECT rc;
// HBRUSH hbrush;
//
// GetClientRect(hwnd, &rc);
// hbrush = STATIC_SendWmCtlColorStatic(hwnd, hdc);
// FillRect(hdc, &rc, hbrush);
// if ((hEnhMetaFile = (HENHMETAFILE)GetWindowLongPtrW( hwnd, HICON_GWL_OFFSET )))
// {
// /* The control's current font is not selected into the
// device context! */
// if (GetObjectType(hEnhMetaFile) == OBJ_ENHMETAFILE)
// PlayEnhMetaFile(hdc, hEnhMetaFile, &rc);
// }
//}
static void STATIC_PaintEtchedfn( HWND hwnd, HDC hdc, DWORD style ) static void STATIC_PaintEtchedfn( HWND hwnd, HDC hdc, DWORD style )
{ {
RECT rc; RECT rc;

View File

@@ -1,3 +1,5 @@
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
/* /*
* DDEML library * DDEML library
* *
@@ -38,7 +40,7 @@
* - a popup window (InstanceClass) is created for each instance. * - a popup window (InstanceClass) is created for each instance.
* - this window is used to receive all the DDEML events (server registration, * - this window is used to receive all the DDEML events (server registration,
* conversation confirmation...). See the WM_WDML_???? messages for details * conversation confirmation...). See the WM_WDML_???? messages for details
* + when registering a server (DdeNameService) a WDML_SERVER is created * + when registring a server (DdeNameService) a WDML_SERVER is created
* - a popup window (ServerNameClass) is created * - a popup window (ServerNameClass) is created
* + a conversation is represented by two WDML_CONV structures: * + a conversation is represented by two WDML_CONV structures:
* - one on the client side, the other one on the server side * - one on the client side, the other one on the server side
@@ -127,7 +129,6 @@ typedef struct tagWDML_CONV
struct tagWDML_INSTANCE* instance; struct tagWDML_INSTANCE* instance;
HSZ hszService; /* pmt used for connection */ HSZ hszService; /* pmt used for connection */
HSZ hszTopic; /* pmt used for connection */ HSZ hszTopic; /* pmt used for connection */
UINT magic; /* magic number to check validity */
UINT afCmd; /* service name flag */ UINT afCmd; /* service name flag */
CONVCONTEXT convContext; CONVCONTEXT convContext;
HWND hwndClient; /* source of conversation (ClientConvClass) */ HWND hwndClient; /* source of conversation (ClientConvClass) */
@@ -138,8 +139,6 @@ typedef struct tagWDML_CONV
DWORD wConvst; /* same values as convinfo.wConvst */ DWORD wConvst; /* same values as convinfo.wConvst */
} WDML_CONV; } WDML_CONV;
#define WDML_CONV_MAGIC 0xbabe1234
/* DDE_LINK struct defines hot, warm, and cold links */ /* DDE_LINK struct defines hot, warm, and cold links */
typedef struct tagWDML_LINK { typedef struct tagWDML_LINK {
struct tagWDML_LINK* next; /* to link all the active links */ struct tagWDML_LINK* next; /* to link all the active links */
@@ -156,7 +155,7 @@ typedef struct tagWDML_INSTANCE
DWORD threadID; /* needed to keep instance linked to a unique thread */ DWORD threadID; /* needed to keep instance linked to a unique thread */
BOOL monitor; /* have these two as full Booleans cos they'll be tested frequently */ BOOL monitor; /* have these two as full Booleans cos they'll be tested frequently */
BOOL clientOnly; /* bit wasteful of space but it will be faster */ BOOL clientOnly; /* bit wasteful of space but it will be faster */
BOOL unicode; /* Flag to indicate Win32 API used to initialise */ BOOL unicode; /* Flag to indicate Win32 API used to initialise */
BOOL win16; /* flag to indicate Win16 API used to initialize */ BOOL win16; /* flag to indicate Win16 API used to initialize */
HSZNode* nodeList; /* for cleaning upon exit */ HSZNode* nodeList; /* for cleaning upon exit */
PFNCALLBACK callback; PFNCALLBACK callback;
@@ -174,7 +173,7 @@ extern CRITICAL_SECTION WDML_CritSect; /* protection for instance list */
/* header for the DDE Data objects */ /* header for the DDE Data objects */
typedef struct tagDDE_DATAHANDLE_HEAD typedef struct tagDDE_DATAHANDLE_HEAD
{ {
WORD cfFormat; short cfFormat;
WORD bAppOwned; WORD bAppOwned;
} DDE_DATAHANDLE_HEAD; } DDE_DATAHANDLE_HEAD;
@@ -189,7 +188,7 @@ typedef enum {
extern HDDEDATA WDML_InvokeCallback(WDML_INSTANCE* pInst, UINT uType, UINT uFmt, HCONV hConv, extern HDDEDATA WDML_InvokeCallback(WDML_INSTANCE* pInst, UINT uType, UINT uFmt, HCONV hConv,
HSZ hsz1, HSZ hsz2, HDDEDATA hdata, HSZ hsz1, HSZ hsz2, HDDEDATA hdata,
ULONG_PTR dwData1, ULONG_PTR dwData2); DWORD dwData1, DWORD dwData2);
extern HDDEDATA WDML_InvokeCallback16(PFNCALLBACK pfn, UINT uType, UINT uFmt, HCONV hConv, extern HDDEDATA WDML_InvokeCallback16(PFNCALLBACK pfn, UINT uType, UINT uFmt, HCONV hConv,
HSZ hsz1, HSZ hsz2, HDDEDATA hdata, HSZ hsz1, HSZ hsz2, HDDEDATA hdata,
DWORD dwData1, DWORD dwData2); DWORD dwData1, DWORD dwData2);
@@ -236,20 +235,20 @@ extern BOOL WDML_IsAppOwned(HDDEDATA hDdeData);
extern WDML_INSTANCE* WDML_GetInstance(DWORD InstId); extern WDML_INSTANCE* WDML_GetInstance(DWORD InstId);
extern WDML_INSTANCE* WDML_GetInstanceFromWnd(HWND hWnd); extern WDML_INSTANCE* WDML_GetInstanceFromWnd(HWND hWnd);
/* broadcasting to DDE windows */ /* broadcasting to DDE windows */
extern void WDML_BroadcastDDEWindows(LPCWSTR clsName, UINT uMsg, extern void WDML_BroadcastDDEWindows(const char* clsName, UINT uMsg,
WPARAM wParam, LPARAM lParam); WPARAM wParam, LPARAM lParam);
extern void WDML_NotifyThreadExit(DWORD tid); extern void WDML_NotifyThreadExit(DWORD tid);
static inline void WDML_ExtractAck(WORD status, DDEACK* da) static __inline void WDML_ExtractAck(WORD status, DDEACK* da)
{ {
*da = *((DDEACK*)&status); *da = *((DDEACK*)&status);
} }
extern const WCHAR WDML_szEventClass[]; /* class of window for events (aka instance) */ extern const char WDML_szEventClass[]; /* class of window for events (aka instance) */
extern const char WDML_szServerConvClassA[]; /* ANSI class of window for server side conv */ extern const char WDML_szServerConvClassA[]; /* class of window for server side conv (ansi) */
extern const WCHAR WDML_szServerConvClassW[]; /* unicode class of window for server side conv */ extern const WCHAR WDML_szServerConvClassW[]; /* class of window for server side conv (unicode) */
extern const char WDML_szClientConvClassA[]; /* ANSI class of window for client side conv */ extern const char WDML_szClientConvClassA[]; /* class of window for client side conv (ansi) */
extern const WCHAR WDML_szClientConvClassW[]; /* unicode class of window for client side conv */ extern const WCHAR WDML_szClientConvClassW[]; /* class of window for client side conv (unicode) */
#define WM_WDML_REGISTER (WM_USER + 0x200) #define WM_WDML_REGISTER (WM_USER + 0x200)
#define WM_WDML_UNREGISTER (WM_USER + 0x201) #define WM_WDML_UNREGISTER (WM_USER + 0x201)
@@ -263,7 +262,7 @@ extern const WCHAR WDML_szClientConvClassW[]; /* unicode class of window for cli
*/ */
#define GWL_WDML_INSTANCE (0) #define GWL_WDML_INSTANCE (0)
#define GWL_WDML_CONVERSATION (sizeof(ULONG_PTR)) #define GWL_WDML_CONVERSATION (4)
#define GWL_WDML_SERVER (sizeof(ULONG_PTR)) #define GWL_WDML_SERVER (4)
#endif /* __WINE_DDEML_PRIVATE_H */ #endif /* __WINE_DDEML_PRIVATE_H */

View File

@@ -17,6 +17,6 @@ MenuCleanup(VOID);
VOID VOID
MenuTrackMouseMenuBar(HWND hWnd, ULONG Ht, POINT Pt); MenuTrackMouseMenuBar(HWND hWnd, ULONG Ht, POINT Pt);
VOID VOID
MenuTrackKbdMenuBar(HWND hWnd, UINT wParam, WCHAR wChar); MenuTrackKbdMenuBar(HWND hWnd, ULONG wParam, ULONG Key);
#endif /* __LIB_USER32_INCLUDE_MENU_H */ #endif /* __LIB_USER32_INCLUDE_MENU_H */

View File

@@ -9,7 +9,6 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
/* C Headers */ /* C Headers */
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
@@ -33,6 +32,7 @@
#include <win32k/callback.h> #include <win32k/callback.h>
/* WINE Headers */ /* WINE Headers */
#include <wine/debug.h>
#include <wine/unicode.h> #include <wine/unicode.h>
/* Internal User32 Headers */ /* Internal User32 Headers */
@@ -41,6 +41,4 @@
/* FIXME: Use ntgdi.h then cleanup... */ /* FIXME: Use ntgdi.h then cleanup... */
HGDIOBJ STDCALL NtGdiSelectObject(HDC hDC, HGDIOBJ hGDIObj); HGDIOBJ STDCALL NtGdiSelectObject(HDC hDC, HGDIOBJ hGDIObj);
BOOL STDCALL NtGdiPatBlt(HDC hdcDst, INT x, INT y, INT cx, INT cy, DWORD rop4); BOOL STDCALL NtGdiPatBlt(HDC hdcDst, INT x, INT y, INT cx, INT cy, DWORD rop4);
LONG STDCALL GdiGetCharDimensions(HDC, LPTEXTMETRICW, LONG *); DWORD STDCALL GdiGetCharDimensions(HDC, LPTEXTMETRICW, DWORD *);
BOOL FASTCALL IsMetaFile(HDC);

View File

@@ -76,13 +76,8 @@
#define NtUserSetCaretBlinkTime(uMSeconds) \ #define NtUserSetCaretBlinkTime(uMSeconds) \
(BOOL)NtUserCallOneParam((DWORD)uMSeconds, ONEPARAM_ROUTINE_SETCARETBLINKTIME) (BOOL)NtUserCallOneParam((DWORD)uMSeconds, ONEPARAM_ROUTINE_SETCARETBLINKTIME)
#define NtUserRegisterUserModule(hInstance) \
(BOOL)NtUserCallOneParam((DWORD)hInstance, ONEPARAM_ROUTINE_REGISTERUSERMODULE)
/*
#define NtUserEnumClipboardFormats(format) \ #define NtUserEnumClipboardFormats(format) \
(UINT)NtUserCallOneParam(format, ONEPARAM_ROUTINE_ENUMCLIPBOARDFORMATS) (UINT)NtUserCallOneParam(format, ONEPARAM_ROUTINE_ENUMCLIPBOARDFORMATS)
*/
#define NtUserWindowFromDC(hDC) \ #define NtUserWindowFromDC(hDC) \
(HWND)NtUserCallOneParam((DWORD)hDC, ONEPARAM_ROUTINE_WINDOWFROMDC) (HWND)NtUserCallOneParam((DWORD)hDC, ONEPARAM_ROUTINE_WINDOWFROMDC)
@@ -119,35 +114,20 @@
#define NtUserShowCursor(bShow) \ #define NtUserShowCursor(bShow) \
NtUserCallOneParam((DWORD)bShow, ONEPARAM_ROUTINE_SHOWCURSOR) NtUserCallOneParam((DWORD)bShow, ONEPARAM_ROUTINE_SHOWCURSOR)
#define ShowCaret(hwnd) \
NtUserShowCaret(hwnd)
#define HideCaret(hwnd) \
NtUserHideCaret(hwnd)
/* Internal Thread Data */ /* Internal Thread Data */
extern HINSTANCE User32Instance; extern HINSTANCE User32Instance;
/* Critical Section*/
extern RTL_CRITICAL_SECTION User32Crit;
typedef struct _USER32_TRACKINGLIST {
TRACKMOUSEEVENT tme;
POINT pos; /* center of hover rectangle */
UINT_PTR timer;
} USER32_TRACKINGLIST,*PUSER32_TRACKINGLIST;
typedef struct _USER32_THREAD_DATA typedef struct _USER32_THREAD_DATA
{ {
MSG LastMessage; MSG LastMessage;
HKL KeyboardLayoutHandle; HKL KeyboardLayoutHandle;
USER32_TRACKINGLIST tracking_info; /* TrackMouseEvent stuff */
} USER32_THREAD_DATA, *PUSER32_THREAD_DATA; } USER32_THREAD_DATA, *PUSER32_THREAD_DATA;
PUSER32_THREAD_DATA User32GetThreadData(); PUSER32_THREAD_DATA User32GetThreadData();
DEVMODEW * DEVMODEW *
STDCALL STDCALL
GdiConvertToDevmodeW(DEVMODEA *dm); GdiConvertToDevmodeW(DEVMODEA *dm);
@@ -175,48 +155,5 @@ extern void SPY_ExitMessage(INT iFlag, HWND hwnd, UINT msg,
extern int SPY_Init(void); extern int SPY_Init(void);
/* Validate window handle types */
#define VALIDATE_TYPE_FREE 0
#define VALIDATE_TYPE_WIN 1
#define VALIDATE_TYPE_MENU 2
#define VALIDATE_TYPE_CURSOR 3
#define VALIDATE_TYPE_MWPOS 4
#define VALIDATE_TYPE_HOOK 5
#define VALIDATE_TYPE_CALLPROC 7
#define VALIDATE_TYPE_ACCEL 8
#define VALIDATE_TYPE_MONITOR 12
#define FIRST_USER_HANDLE 0x0020 /* first possible value for low word of user handle */
#define LAST_USER_HANDLE 0xffef /* last possible value for low word of user handle */
#define NB_USER_HANDLES ((LAST_USER_HANDLE - FIRST_USER_HANDLE + 1) >> 1)
#define USER_HANDLE_TO_INDEX(hwnd) ((LOWORD(hwnd) - FIRST_USER_HANDLE) >> 1)
#define USER_HEADER_TO_BODY(ObjectHeader) \
((PVOID)(((PUSER_OBJECT_HEADER)ObjectHeader) + 1))
#define USER_BODY_TO_HEADER(ObjectBody) \
((PUSER_OBJECT_HEADER)(((PUSER_OBJECT_HEADER)ObjectBody) - 1))
typedef struct _USER_HANDLE_ENTRY
{
void *ptr; /* pointer to object */
PW32THREADINFO pti; // pointer to Win32ThreadInfo
unsigned short type; /* object type (0 if free) */
unsigned short generation; /* generation counter */
} USER_HANDLE_ENTRY, * PUSER_HANDLE_ENTRY;
typedef struct _USER_HANDLE_TABLE
{
PUSER_HANDLE_ENTRY handles;
PUSER_HANDLE_ENTRY freelist;
int nb_handles;
int allocated_handles;
} USER_HANDLE_TABLE, * PUSER_HANDLE_TABLE;
extern PUSER_HANDLE_TABLE gHandleTable;
PUSER_HANDLE_ENTRY FASTCALL GetUser32Handle(HANDLE);
PVOID FASTCALL ValidateHandle(HANDLE, UINT);
#endif #endif
/* EOF */ /* EOF */

View File

@@ -48,18 +48,3 @@ SCROLL_HitTest( HWND hwnd, INT nBar, POINT pt, BOOL bDragging );
LRESULT FASTCALL IntCallWindowProcW(BOOL IsAnsiProc, WNDPROC WndProc, LRESULT FASTCALL IntCallWindowProcW(BOOL IsAnsiProc, WNDPROC WndProc,
HWND hWnd, UINT Msg, WPARAM wParam, HWND hWnd, UINT Msg, WPARAM wParam,
LPARAM lParam); LPARAM lParam);
HWND STDCALL
User32CreateWindowEx(DWORD dwExStyle,
LPCSTR lpClassName,
LPCSTR lpWindowName,
DWORD dwStyle,
int x,
int y,
int nWidth,
int nHeight,
HWND hWndParent,
HMENU hMenu,
HINSTANCE hInstance,
LPVOID lpParam,
BOOL Unicode);

View File

@@ -6,7 +6,6 @@
* Copyright 1999 Keith Matthews * Copyright 1999 Keith Matthews
* Copyright 2000 Corel * Copyright 2000 Corel
* Copyright 2001 Eric Pouech * Copyright 2001 Eric Pouech
* Copyright 2003, 2004, 2005 Dmitry Timoshkov
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@@ -24,8 +23,8 @@
*/ */
#include <user32.h> #include <user32.h>
#define NDEBUG
#include <wine/debug.h> #include <debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(ddeml); WINE_DEFAULT_DEBUG_CHANNEL(ddeml);
@@ -34,14 +33,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(ddeml);
#define HSZ2ATOM(hsz) ((ATOM) (ULONG_PTR)(hsz)) #define HSZ2ATOM(hsz) ((ATOM) (ULONG_PTR)(hsz))
static WDML_INSTANCE* WDML_InstanceList = NULL; static WDML_INSTANCE* WDML_InstanceList = NULL;
static LONG WDML_MaxInstanceID = 0; /* OK for present, have to worry about wrap-around later */ static DWORD WDML_MaxInstanceID = 0; /* OK for present, have to worry about wrap-around later */
const WCHAR WDML_szEventClass[] = {'D','d','e','E','v','e','n','t','C','l','a','s','s',0}; const char WDML_szEventClass[] = "DdeEventClass";
static CRITICAL_SECTION_DEBUG critsect_debug = static CRITICAL_SECTION_DEBUG critsect_debug =
{ {
0, 0, &WDML_CritSect, 0, 0, &WDML_CritSect,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { (DWORD_PTR)(__FILE__ ": WDML_CritSect") } 0, 0, { 0, (DWORD)(__FILE__ ": WDML_CritSect") }
}; };
CRITICAL_SECTION WDML_CritSect = { &critsect_debug, -1, 0, 0, 0, 0 }; CRITICAL_SECTION WDML_CritSect = { &critsect_debug, -1, 0, 0, 0, 0 };
@@ -193,7 +192,7 @@ LPARAM WINAPI ReuseDDElParam(LPARAM lParam, UINT msgIn, UINT msgOut,
params[0] = uiLo; params[0] = uiLo;
params[1] = uiHi; params[1] = uiHi;
TRACE("Reusing pack %08x %08x\n", uiLo, uiHi); TRACE("Reusing pack %08x %08x\n", uiLo, uiHi);
GlobalUnlock( (HGLOBAL)lParam ); GlobalLock( (HGLOBAL)lParam );
return lParam; return lParam;
case WM_DDE_EXECUTE: case WM_DDE_EXECUTE:
@@ -247,7 +246,7 @@ BOOL WINAPI DdeSetQualityOfService(HWND hwndClient, CONST SECURITY_QUALITY_OF_SE
*/ */
static void WDML_IncrementInstanceId(WDML_INSTANCE* pInstance) static void WDML_IncrementInstanceId(WDML_INSTANCE* pInstance)
{ {
DWORD id = InterlockedIncrement(&WDML_MaxInstanceID); DWORD id = InterlockedIncrement((PLONG)&WDML_MaxInstanceID);
pInstance->instanceID = id; pInstance->instanceID = id;
TRACE("New instance id %ld allocated\n", id); TRACE("New instance id %ld allocated\n", id);
@@ -316,7 +315,7 @@ static LRESULT CALLBACK WDML_EventProc(HWND hwndEvent, UINT uMsg, WPARAM wParam,
} }
break; break;
default: default:
return DefWindowProcW(hwndEvent, uMsg, wParam, lParam); return DefWindowProcA(hwndEvent, uMsg, wParam, lParam);
} }
return 0; return 0;
} }
@@ -332,7 +331,7 @@ UINT WDML_Initialize(LPDWORD pidInst, PFNCALLBACK pfnCallback,
WDML_INSTANCE* pInstance; WDML_INSTANCE* pInstance;
WDML_INSTANCE* reference_inst; WDML_INSTANCE* reference_inst;
UINT ret; UINT ret;
WNDCLASSEXW wndclass; WNDCLASSEXA wndclass;
TRACE("(%p,%p,0x%lx,%ld)\n", TRACE("(%p,%p,0x%lx,%ld)\n",
pidInst, pfnCallback, afCmd, ulRes); pidInst, pfnCallback, afCmd, ulRes);
@@ -383,7 +382,7 @@ UINT WDML_Initialize(LPDWORD pidInst, PFNCALLBACK pfnCallback,
(pInstance->CBFflags & CBF_FAIL_ALLSVRXACTIONS) == CBF_FAIL_ALLSVRXACTIONS; (pInstance->CBFflags & CBF_FAIL_ALLSVRXACTIONS) == CBF_FAIL_ALLSVRXACTIONS;
} }
TRACE("instance created - checking validity\n"); TRACE("instance created - checking validity \n");
if (*pidInst == 0) if (*pidInst == 0)
{ {
@@ -469,7 +468,7 @@ UINT WDML_Initialize(LPDWORD pidInst, PFNCALLBACK pfnCallback,
wndclass.style = 0; wndclass.style = 0;
wndclass.lpfnWndProc = WDML_EventProc; wndclass.lpfnWndProc = WDML_EventProc;
wndclass.cbClsExtra = 0; wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = sizeof(ULONG_PTR); wndclass.cbWndExtra = sizeof(DWORD);
wndclass.hInstance = 0; wndclass.hInstance = 0;
wndclass.hIcon = 0; wndclass.hIcon = 0;
wndclass.hCursor = 0; wndclass.hCursor = 0;
@@ -478,13 +477,13 @@ UINT WDML_Initialize(LPDWORD pidInst, PFNCALLBACK pfnCallback,
wndclass.lpszClassName = WDML_szEventClass; wndclass.lpszClassName = WDML_szEventClass;
wndclass.hIconSm = 0; wndclass.hIconSm = 0;
RegisterClassExW(&wndclass); RegisterClassExA(&wndclass);
pInstance->hwndEvent = CreateWindowW(WDML_szEventClass, NULL, pInstance->hwndEvent = CreateWindowA(WDML_szEventClass, NULL,
WS_POPUP, 0, 0, 0, 0, WS_POPUP, 0, 0, 0, 0,
0, 0, 0, 0); 0, 0, 0, 0);
SetWindowLongPtrW(pInstance->hwndEvent, GWL_WDML_INSTANCE, (ULONG_PTR)pInstance); SetWindowLongA(pInstance->hwndEvent, GWL_WDML_INSTANCE, (DWORD)pInstance);
TRACE("New application instance processing finished OK\n"); TRACE("New application instance processing finished OK\n");
} }
@@ -568,8 +567,6 @@ UINT WDML_Initialize(LPDWORD pidInst, PFNCALLBACK pfnCallback,
/****************************************************************************** /******************************************************************************
* DdeInitializeA (USER32.@) * DdeInitializeA (USER32.@)
*
* See DdeInitializeW.
*/ */
UINT WINAPI DdeInitializeA(LPDWORD pidInst, PFNCALLBACK pfnCallback, UINT WINAPI DdeInitializeA(LPDWORD pidInst, PFNCALLBACK pfnCallback,
DWORD afCmd, DWORD ulRes) DWORD afCmd, DWORD ulRes)
@@ -705,7 +702,7 @@ void WDML_NotifyThreadDetach(void)
*/ */
HDDEDATA WDML_InvokeCallback(WDML_INSTANCE* pInstance, UINT uType, UINT uFmt, HCONV hConv, HDDEDATA WDML_InvokeCallback(WDML_INSTANCE* pInstance, UINT uType, UINT uFmt, HCONV hConv,
HSZ hsz1, HSZ hsz2, HDDEDATA hdata, HSZ hsz1, HSZ hsz2, HDDEDATA hdata,
ULONG_PTR dwData1, ULONG_PTR dwData2) DWORD dwData1, DWORD dwData2)
{ {
HDDEDATA ret; HDDEDATA ret;
@@ -753,7 +750,7 @@ WDML_INSTANCE* WDML_GetInstance(DWORD instId)
*/ */
WDML_INSTANCE* WDML_GetInstanceFromWnd(HWND hWnd) WDML_INSTANCE* WDML_GetInstanceFromWnd(HWND hWnd)
{ {
return (WDML_INSTANCE*)GetWindowLongPtrW(hWnd, GWL_WDML_INSTANCE); return (WDML_INSTANCE*)GetWindowLongA(hWnd, GWL_WDML_INSTANCE);
} }
/****************************************************************************** /******************************************************************************
@@ -1052,11 +1049,11 @@ static HSZ WDML_CreateString(WDML_INSTANCE* pInstance, LPCVOID ptr, int codepage
{ {
case CP_WINANSI: case CP_WINANSI:
hsz = ATOM2HSZ(AddAtomA(ptr)); hsz = ATOM2HSZ(AddAtomA(ptr));
TRACE("added atom %s with HSZ %p,\n", debugstr_a(ptr), hsz); TRACE("added atom %s with HSZ %p, \n", debugstr_a(ptr), hsz);
break; break;
case CP_WINUNICODE: case CP_WINUNICODE:
hsz = ATOM2HSZ(AddAtomW(ptr)); hsz = ATOM2HSZ(AddAtomW(ptr));
TRACE("added atom %s with HSZ %p,\n", debugstr_w(ptr), hsz); TRACE("added atom %s with HSZ %p, \n", debugstr_w(ptr), hsz);
break; break;
default: default:
ERR("Unknown code page %d\n", codepage); ERR("Unknown code page %d\n", codepage);
@@ -1069,7 +1066,9 @@ static HSZ WDML_CreateString(WDML_INSTANCE* pInstance, LPCVOID ptr, int codepage
/***************************************************************** /*****************************************************************
* DdeCreateStringHandleA [USER32.@] * DdeCreateStringHandleA [USER32.@]
* *
* See DdeCreateStringHandleW. * RETURNS
* Success: String handle
* Failure: 0
*/ */
HSZ WINAPI DdeCreateStringHandleA(DWORD idInst, LPCSTR psz, INT codepage) HSZ WINAPI DdeCreateStringHandleA(DWORD idInst, LPCSTR psz, INT codepage)
{ {
@@ -1125,16 +1124,15 @@ HSZ WINAPI DdeCreateStringHandleW(DWORD idInst, LPCWSTR psz, INT codepage)
/***************************************************************** /*****************************************************************
* DdeFreeStringHandle (USER32.@) * DdeFreeStringHandle (USER32.@)
* RETURNS * RETURNS: success: nonzero
* success: nonzero * fail: zero
* fail: zero
*/ */
BOOL WINAPI DdeFreeStringHandle(DWORD idInst, HSZ hsz) BOOL WINAPI DdeFreeStringHandle(DWORD idInst, HSZ hsz)
{ {
WDML_INSTANCE* pInstance; WDML_INSTANCE* pInstance;
BOOL ret = FALSE; BOOL ret = FALSE;
TRACE("(%ld,%p):\n", idInst, hsz); TRACE("(%ld,%p): \n", idInst, hsz);
EnterCriticalSection(&WDML_CritSect); EnterCriticalSection(&WDML_CritSect);
@@ -1152,16 +1150,15 @@ BOOL WINAPI DdeFreeStringHandle(DWORD idInst, HSZ hsz)
/***************************************************************** /*****************************************************************
* DdeKeepStringHandle (USER32.@) * DdeKeepStringHandle (USER32.@)
* *
* RETURNS * RETURNS: success: nonzero
* success: nonzero * fail: zero
* fail: zero
*/ */
BOOL WINAPI DdeKeepStringHandle(DWORD idInst, HSZ hsz) BOOL WINAPI DdeKeepStringHandle(DWORD idInst, HSZ hsz)
{ {
WDML_INSTANCE* pInstance; WDML_INSTANCE* pInstance;
BOOL ret = FALSE; BOOL ret = FALSE;
TRACE("(%ld,%p):\n", idInst, hsz); TRACE("(%ld,%p): \n", idInst, hsz);
EnterCriticalSection(&WDML_CritSect); EnterCriticalSection(&WDML_CritSect);
@@ -1181,11 +1178,7 @@ BOOL WINAPI DdeKeepStringHandle(DWORD idInst, HSZ hsz)
* Compares the value of two string handles. This comparison is * Compares the value of two string handles. This comparison is
* not case sensitive. * not case sensitive.
* *
* PARAMS * Returns:
* hsz1 [I] Handle to the first string
* hsz2 [I] Handle to the second string
*
* RETURNS
* -1 The value of hsz1 is zero or less than hsz2 * -1 The value of hsz1 is zero or less than hsz2
* 0 The values of hsz 1 and 2 are the same or both zero. * 0 The values of hsz 1 and 2 are the same or both zero.
* 1 The value of hsz2 is zero of less than hsz1 * 1 The value of hsz2 is zero of less than hsz1
@@ -1261,13 +1254,9 @@ HDDEDATA WINAPI DdeCreateDataHandle(DWORD idInst, LPBYTE pSrc, DWORD cb, DWORD c
DDE_DATAHANDLE_HEAD* pDdh; DDE_DATAHANDLE_HEAD* pDdh;
WCHAR psz[MAX_BUFFER_LEN]; WCHAR psz[MAX_BUFFER_LEN];
if (!GetAtomNameW(HSZ2ATOM(hszItem), psz, MAX_BUFFER_LEN)) GetAtomNameW(HSZ2ATOM(hszItem), psz, MAX_BUFFER_LEN);
{
psz[0] = HSZ2ATOM(hszItem);
psz[1] = 0;
}
TRACE("(%ld,%p,cb %ld, cbOff %ld,%p <%s>,fmt %04x,%x)\n", TRACE("(%ld,%p,cb %ld, cbOff %ld,%p <%s>,%x,%x)\n",
idInst, pSrc, cb, cbOff, hszItem, debugstr_w(psz), wFmt, afCmd); idInst, pSrc, cb, cbOff, hszItem, debugstr_w(psz), wFmt, afCmd);
if (afCmd != 0 && afCmd != HDATA_APPOWNED) if (afCmd != 0 && afCmd != HDATA_APPOWNED)
@@ -1297,7 +1286,6 @@ HDDEDATA WINAPI DdeCreateDataHandle(DWORD idInst, LPBYTE pSrc, DWORD cb, DWORD c
} }
GlobalUnlock(hMem); GlobalUnlock(hMem);
TRACE("=> %p\n", hMem);
return (HDDEDATA)hMem; return (HDDEDATA)hMem;
} }
@@ -1405,7 +1393,7 @@ LPBYTE WINAPI DdeAccessData(HDDEDATA hData, LPDWORD pcbDataSize)
{ {
*pcbDataSize = GlobalSize(hMem) - sizeof(DDE_DATAHANDLE_HEAD); *pcbDataSize = GlobalSize(hMem) - sizeof(DDE_DATAHANDLE_HEAD);
} }
TRACE("=> %p (%lu) fmt %04x\n", pDdh + 1, GlobalSize(hMem) - sizeof(DDE_DATAHANDLE_HEAD), pDdh->cfFormat); TRACE("=> %p (%lu)\n", pDdh + 1, GlobalSize(hMem) - sizeof(DDE_DATAHANDLE_HEAD));
return (LPBYTE)(pDdh + 1); return (LPBYTE)(pDdh + 1);
} }
@@ -1480,8 +1468,8 @@ HDDEDATA WDML_Global2DataHandle(HGLOBAL hMem, WINE_DDEHEAD* p)
switch (pDd->cfFormat) switch (pDd->cfFormat)
{ {
default: default:
FIXME("Unsupported format (%04x) for data %p, passing raw information\n", FIXME("Unsupported format (%d) for data... assuming raw information\n",
pDd->cfFormat, hMem); pDd->cfFormat);
/* fall thru */ /* fall thru */
case 0: case 0:
case CF_TEXT: case CF_TEXT:
@@ -1539,8 +1527,7 @@ HGLOBAL WDML_DataHandle2Global(HDDEDATA hDdeData, BOOL fResponse, BOOL fRelease,
switch (pDdh->cfFormat) switch (pDdh->cfFormat)
{ {
default: default:
FIXME("Unsupported format (%04x) for data %p, passing raw information\n", FIXME("Unsupported format (%d) for data... passing raw information\n", pDdh->cfFormat);
pDdh->cfFormat, hDdeData);
/* fall thru */ /* fall thru */
case 0: case 0:
case CF_TEXT: case CF_TEXT:
@@ -1557,7 +1544,7 @@ HGLOBAL WDML_DataHandle2Global(HDDEDATA hDdeData, BOOL fResponse, BOOL fRelease,
DWORD count; DWORD count;
HBITMAP hbmp = *(HBITMAP*)(pDdh + 1); HBITMAP hbmp = *(HBITMAP*)(pDdh + 1);
if (GetObjectW(hbmp, sizeof(bmp), &bmp)) if (GetObjectA(hbmp, sizeof(bmp), &bmp))
{ {
count = bmp.bmWidthBytes * bmp.bmHeight; count = bmp.bmWidthBytes * bmp.bmHeight;
hMem = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, hMem = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE,
@@ -1600,20 +1587,18 @@ HGLOBAL WDML_DataHandle2Global(HDDEDATA hDdeData, BOOL fResponse, BOOL fRelease,
*/ */
WDML_SERVER* WDML_AddServer(WDML_INSTANCE* pInstance, HSZ hszService, HSZ hszTopic) WDML_SERVER* WDML_AddServer(WDML_INSTANCE* pInstance, HSZ hszService, HSZ hszTopic)
{ {
static const WCHAR fmtW[] = {'%','s','(','0','x','%','0','8','l','x',')',0};
WDML_SERVER* pServer; WDML_SERVER* pServer;
WCHAR buf1[256]; char buf1[256];
WCHAR buf2[256]; char buf2[256];
pServer = (WDML_SERVER*)HeapAlloc(GetProcessHeap(), 0, sizeof(WDML_SERVER)); pServer = (WDML_SERVER*)HeapAlloc(GetProcessHeap(), 0, sizeof(WDML_SERVER));
if (pServer == NULL) return NULL; if (pServer == NULL) return NULL;
pServer->hszService = hszService; WDML_IncHSZ(pInstance, pServer->hszService = hszService);
WDML_IncHSZ(pInstance, hszService);
DdeQueryStringW(pInstance->instanceID, hszService, buf1, 256, CP_WINUNICODE); DdeQueryStringA(pInstance->instanceID, hszService, buf1, sizeof(buf1), CP_WINANSI);
snprintfW(buf2, 256, fmtW, buf1, GetCurrentProcessId()); _snprintf(buf2, sizeof(buf2), "%s(0x%08lx)", buf1, GetCurrentProcessId());
pServer->hszServiceSpec = DdeCreateStringHandleW(pInstance->instanceID, buf2, CP_WINUNICODE); pServer->hszServiceSpec = DdeCreateStringHandleA(pInstance->instanceID, buf2, CP_WINANSI);
pServer->atomService = WDML_MakeAtomFromHsz(pServer->hszService); pServer->atomService = WDML_MakeAtomFromHsz(pServer->hszService);
pServer->atomServiceSpec = WDML_MakeAtomFromHsz(pServer->hszServiceSpec); pServer->atomServiceSpec = WDML_MakeAtomFromHsz(pServer->hszServiceSpec);
@@ -1653,7 +1638,7 @@ void WDML_RemoveServer(WDML_INSTANCE* pInstance, HSZ hszService, HSZ hszTopic)
{ {
WDML_RemoveConv(pConv, WDML_SERVER_SIDE); WDML_RemoveConv(pConv, WDML_SERVER_SIDE);
/* don't care about return code (whether client window is present or not) */ /* don't care about return code (whether client window is present or not) */
PostMessageW(pConv->hwndClient, WM_DDE_TERMINATE, (WPARAM)pConv->hwndServer, 0); PostMessageA(pConv->hwndClient, WM_DDE_TERMINATE, (WPARAM)pConv->hwndServer, 0L);
} }
} }
if (pServer == pInstance->servers) if (pServer == pInstance->servers)
@@ -1726,7 +1711,6 @@ WDML_CONV* WDML_AddConv(WDML_INSTANCE* pInstance, WDML_SIDE side,
pConv->instance = pInstance; pConv->instance = pInstance;
WDML_IncHSZ(pInstance, pConv->hszService = hszService); WDML_IncHSZ(pInstance, pConv->hszService = hszService);
WDML_IncHSZ(pInstance, pConv->hszTopic = hszTopic); WDML_IncHSZ(pInstance, pConv->hszTopic = hszTopic);
pConv->magic = WDML_CONV_MAGIC;
pConv->hwndServer = hwndServer; pConv->hwndServer = hwndServer;
pConv->hwndClient = hwndClient; pConv->hwndClient = hwndClient;
pConv->transactions = NULL; pConv->transactions = NULL;
@@ -1801,7 +1785,7 @@ void WDML_RemoveConv(WDML_CONV* pRef, WDML_SIDE side)
* this would help the wndProc do appropriate handling upon a WM_DESTROY message * this would help the wndProc do appropriate handling upon a WM_DESTROY message
*/ */
hWnd = (side == WDML_CLIENT_SIDE) ? pRef->hwndClient : pRef->hwndServer; hWnd = (side == WDML_CLIENT_SIDE) ? pRef->hwndClient : pRef->hwndServer;
SetWindowLongPtrW(hWnd, GWL_WDML_CONVERSATION, 0); SetWindowLongA(hWnd, GWL_WDML_CONVERSATION, 0);
DestroyWindow((side == WDML_CLIENT_SIDE) ? pRef->hwndClient : pRef->hwndServer); DestroyWindow((side == WDML_CLIENT_SIDE) ? pRef->hwndClient : pRef->hwndServer);
@@ -1820,7 +1804,7 @@ void WDML_RemoveConv(WDML_CONV* pRef, WDML_SIDE side)
{ {
pPrev->next = pCurrent->next; pPrev->next = pCurrent->next;
} }
pCurrent->magic = 0;
HeapFree(GetProcessHeap(), 0, pCurrent); HeapFree(GetProcessHeap(), 0, pCurrent);
break; break;
} }
@@ -1898,14 +1882,14 @@ WDML_CONV* WDML_GetConv(HCONV hConv, BOOL checkConnected)
WDML_CONV* pConv = (WDML_CONV*)hConv; WDML_CONV* pConv = (WDML_CONV*)hConv;
/* FIXME: should do better checking */ /* FIXME: should do better checking */
if (pConv == NULL || pConv->magic != WDML_CONV_MAGIC) return NULL; if (pConv == NULL) return NULL;
if (checkConnected && !(pConv->wStatus & ST_CONNECTED)) if (checkConnected && !(pConv->wStatus & ST_CONNECTED))
{ {
FIXME("found conv but ain't connected\n"); FIXME("found conv but ain't connected\n");
return NULL; return NULL;
} }
if (!pConv->instance || GetCurrentThreadId() != pConv->instance->threadID) if (GetCurrentThreadId() != pConv->instance->threadID)
{ {
FIXME("wrong thread ID\n"); FIXME("wrong thread ID\n");
return NULL; return NULL;
@@ -1921,7 +1905,7 @@ WDML_CONV* WDML_GetConv(HCONV hConv, BOOL checkConnected)
*/ */
WDML_CONV* WDML_GetConvFromWnd(HWND hWnd) WDML_CONV* WDML_GetConvFromWnd(HWND hWnd)
{ {
return (WDML_CONV*)GetWindowLongPtrW(hWnd, GWL_WDML_CONVERSATION); return (WDML_CONV*)GetWindowLongA(hWnd, GWL_WDML_CONVERSATION);
} }
/****************************************************************** /******************************************************************
@@ -1955,7 +1939,7 @@ BOOL WDML_PostAck(WDML_CONV* pConv, WDML_SIDE side, WORD appRetCode,
lParam = (lParam) ? ReuseDDElParam(lParam, oldMsg, WM_DDE_ACK, *(WORD*)&ddeAck, pmt) : lParam = (lParam) ? ReuseDDElParam(lParam, oldMsg, WM_DDE_ACK, *(WORD*)&ddeAck, pmt) :
PackDDElParam(WM_DDE_ACK, *(WORD*)&ddeAck, pmt); PackDDElParam(WM_DDE_ACK, *(WORD*)&ddeAck, pmt);
if (!PostMessageW(to, WM_DDE_ACK, (WPARAM)from, lParam)) if (!PostMessageA(to, WM_DDE_ACK, (WPARAM)from, lParam))
{ {
pConv->wStatus &= ~ST_CONNECTED; pConv->wStatus &= ~ST_CONNECTED;
FreeDDElParam(WM_DDE_ACK, lParam); FreeDDElParam(WM_DDE_ACK, lParam);
@@ -2017,7 +2001,7 @@ static BOOL WDML_GetLocalConvInfo(WDML_CONV* pConv, CONVINFO* ci, DWORD id)
WDML_LINK* pLink; WDML_LINK* pLink;
WDML_SIDE side; WDML_SIDE side;
ci->hConvPartner = (pConv->wStatus & ST_ISLOCAL) ? (HCONV)((ULONG_PTR)pConv | 1) : 0; ci->hConvPartner = (pConv->wStatus & ST_ISLOCAL) ? (HCONV)((DWORD)pConv | 1) : 0;
ci->hszSvcPartner = pConv->hszService; ci->hszSvcPartner = pConv->hszService;
ci->hszServiceReq = pConv->hszService; /* FIXME: they shouldn't be the same, should they ? */ ci->hszServiceReq = pConv->hszService; /* FIXME: they shouldn't be the same, should they ? */
ci->hszTopic = pConv->hszTopic; ci->hszTopic = pConv->hszTopic;
@@ -2086,7 +2070,6 @@ static BOOL WDML_GetLocalConvInfo(WDML_CONV* pConv, CONVINFO* ci, DWORD id)
/****************************************************************** /******************************************************************
* DdeQueryConvInfo (USER32.@) * DdeQueryConvInfo (USER32.@)
* *
* FIXME: Set last DDE error on failure.
*/ */
UINT WINAPI DdeQueryConvInfo(HCONV hConv, DWORD id, PCONVINFO lpConvInfo) UINT WINAPI DdeQueryConvInfo(HCONV hConv, DWORD id, PCONVINFO lpConvInfo)
{ {
@@ -2105,20 +2088,18 @@ UINT WINAPI DdeQueryConvInfo(HCONV hConv, DWORD id, PCONVINFO lpConvInfo)
EnterCriticalSection(&WDML_CritSect); EnterCriticalSection(&WDML_CritSect);
pConv = WDML_GetConv(hConv, FALSE); pConv = WDML_GetConv(hConv, FALSE);
if (pConv != NULL) if (pConv != NULL && !WDML_GetLocalConvInfo(pConv, &ci, id))
{ {
if (!WDML_GetLocalConvInfo(pConv, &ci, id)) ret = 0;
ret = 0;
} }
else else if ((DWORD)hConv & 1)
{ {
if ((ULONG_PTR)hConv & 1) pConv = WDML_GetConv((HCONV)((DWORD)hConv & ~1), FALSE);
{ if (pConv != NULL)
pConv = WDML_GetConv((HCONV)((ULONG_PTR)hConv & ~1), FALSE); {
if (pConv != NULL) FIXME("Request on remote conversation information is not implemented yet\n");
FIXME("Request on remote conversation information is not implemented yet\n"); ret = 0;
} }
ret = 0;
} }
LeaveCriticalSection(&WDML_CritSect); LeaveCriticalSection(&WDML_CritSect);
if (ret != 0) if (ret != 0)
@@ -2352,7 +2333,7 @@ BOOL WDML_UnQueueTransaction(WDML_CONV* pConv, WDML_XACT* pXAct)
void WDML_FreeTransaction(WDML_INSTANCE* pInstance, WDML_XACT* pXAct, BOOL doFreePmt) void WDML_FreeTransaction(WDML_INSTANCE* pInstance, WDML_XACT* pXAct, BOOL doFreePmt)
{ {
/* free pmt(s) in pXAct too. check against one for not deleting TRUE return values */ /* free pmt(s) in pXAct too. check against one for not deleting TRUE return values */
if (doFreePmt && (ULONG_PTR)pXAct->hMem > 1) if (doFreePmt && (DWORD)pXAct->hMem > 1)
{ {
GlobalFree(pXAct->hMem); GlobalFree(pXAct->hMem);
} }
@@ -2387,7 +2368,7 @@ WDML_XACT* WDML_FindTransaction(WDML_CONV* pConv, DWORD tid)
struct tagWDML_BroadcastPmt struct tagWDML_BroadcastPmt
{ {
LPCWSTR clsName; LPCSTR clsName;
UINT uMsg; UINT uMsg;
WPARAM wParam; WPARAM wParam;
LPARAM lParam; LPARAM lParam;
@@ -2401,12 +2382,12 @@ struct tagWDML_BroadcastPmt
static BOOL CALLBACK WDML_BroadcastEnumProc(HWND hWnd, LPARAM lParam) static BOOL CALLBACK WDML_BroadcastEnumProc(HWND hWnd, LPARAM lParam)
{ {
struct tagWDML_BroadcastPmt* s = (struct tagWDML_BroadcastPmt*)lParam; struct tagWDML_BroadcastPmt* s = (struct tagWDML_BroadcastPmt*)lParam;
WCHAR buffer[128]; char buffer[128];
if (GetClassNameW(hWnd, buffer, 128) > 0 && if (GetClassNameA(hWnd, buffer, sizeof(buffer)) > 0 &&
lstrcmpiW(buffer, s->clsName) == 0) strcmp(buffer, s->clsName) == 0)
{ {
PostMessageW(hWnd, s->uMsg, s->wParam, s->lParam); PostMessageA(hWnd, s->uMsg, s->wParam, s->lParam);
} }
return TRUE; return TRUE;
} }
@@ -2416,7 +2397,7 @@ static BOOL CALLBACK WDML_BroadcastEnumProc(HWND hWnd, LPARAM lParam)
* *
* *
*/ */
void WDML_BroadcastDDEWindows(LPCWSTR clsName, UINT uMsg, WPARAM wParam, LPARAM lParam) void WDML_BroadcastDDEWindows(const char* clsName, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
struct tagWDML_BroadcastPmt s; struct tagWDML_BroadcastPmt s;

View File

@@ -6,7 +6,6 @@
* Copyright 1999 Keith Matthews * Copyright 1999 Keith Matthews
* Copyright 2000 Corel * Copyright 2000 Corel
* Copyright 2001 Eric Pouech * Copyright 2001 Eric Pouech
* Copyright 2004, 2005 Dmitry Timoshkov
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@@ -24,8 +23,8 @@
*/ */
#include <user32.h> #include <user32.h>
#define NDEBUG
#include <wine/debug.h> #include <debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(ddeml); WINE_DEFAULT_DEBUG_CHANNEL(ddeml);
@@ -114,48 +113,48 @@ HCONV WINAPI DdeConnect(DWORD idInst, HSZ hszService, HSZ hszTopic,
if (pInstance->unicode) if (pInstance->unicode)
{ {
WNDCLASSEXW wndclass; WNDCLASSEXW wndclass;
wndclass.cbSize = sizeof(wndclass); wndclass.cbSize = sizeof(wndclass);
wndclass.style = 0; wndclass.style = 0;
wndclass.lpfnWndProc = WDML_ClientProc; wndclass.lpfnWndProc = WDML_ClientProc;
wndclass.cbClsExtra = 0; wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 2 * sizeof(ULONG_PTR); wndclass.cbWndExtra = 2 * sizeof(DWORD);
wndclass.hInstance = 0; wndclass.hInstance = 0;
wndclass.hIcon = 0; wndclass.hIcon = 0;
wndclass.hCursor = 0; wndclass.hCursor = 0;
wndclass.hbrBackground = 0; wndclass.hbrBackground = 0;
wndclass.lpszMenuName = NULL; wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = WDML_szClientConvClassW; wndclass.lpszClassName = WDML_szClientConvClassW;
wndclass.hIconSm = 0; wndclass.hIconSm = 0;
RegisterClassExW(&wndclass); RegisterClassExW(&wndclass);
hwndClient = CreateWindowW(WDML_szClientConvClassW, NULL, WS_POPUP, 0, 0, 0, 0, 0, 0, 0, 0); hwndClient = CreateWindowW(WDML_szClientConvClassW, NULL, WS_POPUP, 0, 0, 0, 0, 0, 0, 0, 0);
} }
else else
{ {
WNDCLASSEXA wndclass; WNDCLASSEXA wndclass;
wndclass.cbSize = sizeof(wndclass); wndclass.cbSize = sizeof(wndclass);
wndclass.style = 0; wndclass.style = 0;
wndclass.lpfnWndProc = WDML_ClientProc; wndclass.lpfnWndProc = WDML_ClientProc;
wndclass.cbClsExtra = 0; wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 2 * sizeof(ULONG_PTR); wndclass.cbWndExtra = 2 * sizeof(DWORD);
wndclass.hInstance = 0; wndclass.hInstance = 0;
wndclass.hIcon = 0; wndclass.hIcon = 0;
wndclass.hCursor = 0; wndclass.hCursor = 0;
wndclass.hbrBackground = 0; wndclass.hbrBackground = 0;
wndclass.lpszMenuName = NULL; wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = WDML_szClientConvClassA; wndclass.lpszClassName = WDML_szClientConvClassA;
wndclass.hIconSm = 0; wndclass.hIconSm = 0;
RegisterClassExA(&wndclass); RegisterClassExA(&wndclass);
hwndClient = CreateWindowA(WDML_szClientConvClassA, NULL, WS_POPUP, 0, 0, 0, 0, 0, 0, 0, 0); hwndClient = CreateWindowA(WDML_szClientConvClassA, NULL, WS_POPUP, 0, 0, 0, 0, 0, 0, 0, 0);
} }
SetWindowLongPtrW(hwndClient, GWL_WDML_INSTANCE, (ULONG_PTR)pInstance); SetWindowLongA(hwndClient, GWL_WDML_INSTANCE, (DWORD)pInstance);
if (hszService) if (hszService)
{ {
@@ -188,7 +187,7 @@ HCONV WINAPI DdeConnect(DWORD idInst, HSZ hszService, HSZ hszTopic,
pConv = WDML_GetConvFromWnd(hwndClient); pConv = WDML_GetConvFromWnd(hwndClient);
if (pConv == NULL || pConv->hwndServer == 0) if (pConv == NULL || pConv->hwndServer == 0)
{ {
WARN("Done with INITIATE, but no Server window available\n"); ERR("Done with INITIATE, but no Server window available\n");
pConv = NULL; pConv = NULL;
goto theEnd; goto theEnd;
} }
@@ -246,7 +245,7 @@ HCONV WINAPI DdeReconnect(HCONV hConv)
HWND hwndServer = pConv->hwndServer; HWND hwndServer = pConv->hwndServer;
ATOM aSrv, aTpc; ATOM aSrv, aTpc;
SetWindowLongPtrW(pConv->hwndClient, GWL_WDML_CONVERSATION, 0); SetWindowLongA(pConv->hwndClient, GWL_WDML_CONVERSATION, 0);
aSrv = WDML_MakeAtomFromHsz(pConv->hszService); aSrv = WDML_MakeAtomFromHsz(pConv->hszService);
aTpc = WDML_MakeAtomFromHsz(pConv->hszTopic); aTpc = WDML_MakeAtomFromHsz(pConv->hszTopic);
@@ -255,7 +254,7 @@ HCONV WINAPI DdeReconnect(HCONV hConv)
LeaveCriticalSection(&WDML_CritSect); LeaveCriticalSection(&WDML_CritSect);
/* note: sent messages shall not use packing */ /* note: sent messages shall not use packing */
ret = SendMessageW(hwndServer, WM_DDE_INITIATE, (WPARAM)hwndClient, ret = SendMessageA(hwndServer, WM_DDE_INITIATE, (WPARAM)hwndClient,
MAKELPARAM(aSrv, aTpc)); MAKELPARAM(aSrv, aTpc));
EnterCriticalSection(&WDML_CritSect); EnterCriticalSection(&WDML_CritSect);
@@ -285,7 +284,7 @@ HCONV WINAPI DdeReconnect(HCONV hConv)
else else
{ {
/* reset the conversation as it was */ /* reset the conversation as it was */
SetWindowLongPtrW(pConv->hwndClient, GWL_WDML_CONVERSATION, (ULONG_PTR)pConv); SetWindowLongA(pConv->hwndClient, GWL_WDML_CONVERSATION, (DWORD)pConv);
} }
} }
} }
@@ -342,7 +341,7 @@ static WDML_XACT* WDML_ClientQueueAdvise(WDML_CONV* pConv, UINT wType, UINT wFmt
* *
* handles the reply to an advise request * handles the reply to an advise request
*/ */
static WDML_QUEUE_STATE WDML_HandleAdviseReply(WDML_CONV* pConv, MSG* msg, WDML_XACT* pXAct, DWORD *ack) static WDML_QUEUE_STATE WDML_HandleAdviseReply(WDML_CONV* pConv, MSG* msg, WDML_XACT* pXAct)
{ {
DDEACK ddeAck; DDEACK ddeAck;
UINT_PTR uiLo, uiHi; UINT_PTR uiLo, uiHi;
@@ -362,7 +361,6 @@ static WDML_QUEUE_STATE WDML_HandleAdviseReply(WDML_CONV* pConv, MSG* msg, WDML_
GlobalDeleteAtom(uiHi); GlobalDeleteAtom(uiHi);
FreeDDElParam(WM_DDE_ACK, msg->lParam); FreeDDElParam(WM_DDE_ACK, msg->lParam);
if (ack) *ack = uiLo;
WDML_ExtractAck(uiLo, &ddeAck); WDML_ExtractAck(uiLo, &ddeAck);
if (ddeAck.fAck) if (ddeAck.fAck)
@@ -428,7 +426,7 @@ static WDML_XACT* WDML_ClientQueueUnadvise(WDML_CONV* pConv, UINT wFmt, HSZ hszI
* *
* *
*/ */
static WDML_QUEUE_STATE WDML_HandleUnadviseReply(WDML_CONV* pConv, MSG* msg, WDML_XACT* pXAct, DWORD *ack) static WDML_QUEUE_STATE WDML_HandleUnadviseReply(WDML_CONV* pConv, MSG* msg, WDML_XACT* pXAct)
{ {
DDEACK ddeAck; DDEACK ddeAck;
UINT_PTR uiLo, uiHi; UINT_PTR uiLo, uiHi;
@@ -448,7 +446,6 @@ static WDML_QUEUE_STATE WDML_HandleUnadviseReply(WDML_CONV* pConv, MSG* msg, WDM
FreeDDElParam(WM_DDE_ACK, msg->lParam); FreeDDElParam(WM_DDE_ACK, msg->lParam);
GlobalDeleteAtom(uiHi); GlobalDeleteAtom(uiHi);
if (ack) *ack = uiLo;
WDML_ExtractAck(uiLo, &ddeAck); WDML_ExtractAck(uiLo, &ddeAck);
TRACE("WM_DDE_ACK received while waiting for a timeout\n"); TRACE("WM_DDE_ACK received while waiting for a timeout\n");
@@ -500,7 +497,7 @@ static WDML_XACT* WDML_ClientQueueRequest(WDML_CONV* pConv, UINT wFmt, HSZ hszIt
* *
* *
*/ */
static WDML_QUEUE_STATE WDML_HandleRequestReply(WDML_CONV* pConv, MSG* msg, WDML_XACT* pXAct, DWORD *ack) static WDML_QUEUE_STATE WDML_HandleRequestReply(WDML_CONV* pConv, MSG* msg, WDML_XACT* pXAct)
{ {
DDEACK ddeAck; DDEACK ddeAck;
WINE_DDEHEAD wdh; WINE_DDEHEAD wdh;
@@ -516,7 +513,6 @@ static WDML_QUEUE_STATE WDML_HandleRequestReply(WDML_CONV* pConv, MSG* msg, WDML
UnpackDDElParam(WM_DDE_ACK, msg->lParam, &uiLo, &uiHi); UnpackDDElParam(WM_DDE_ACK, msg->lParam, &uiLo, &uiHi);
FreeDDElParam(WM_DDE_ACK, msg->lParam); FreeDDElParam(WM_DDE_ACK, msg->lParam);
GlobalDeleteAtom(uiHi); GlobalDeleteAtom(uiHi);
if (ack) *ack = uiLo;
WDML_ExtractAck(uiLo, &ddeAck); WDML_ExtractAck(uiLo, &ddeAck);
pXAct->hDdeData = 0; pXAct->hDdeData = 0;
if (ddeAck.fAck) if (ddeAck.fAck)
@@ -569,11 +565,8 @@ static HGLOBAL WDML_BuildExecuteCommand(WDML_CONV* pConv, LPCVOID pData, DWORD c
BOOL clientUnicode, serverUnicode; BOOL clientUnicode, serverUnicode;
DWORD memSize; DWORD memSize;
clientUnicode = pConv->instance->unicode; clientUnicode = IsWindowUnicode(pConv->hwndClient);
TRACE("client %p uses unicode = %d\n", pConv->hwndClient, clientUnicode); serverUnicode = IsWindowUnicode(pConv->hwndServer);
/* FIXME: how exactly Windows determines what to use for the server side? */
serverUnicode = IsWindowUnicode(pConv->hwndServer) && IsWindowUnicode(pConv->hwndClient);
TRACE("server %p uses unicode = %d\n", pConv->hwndServer, serverUnicode);
if (clientUnicode == serverUnicode) if (clientUnicode == serverUnicode)
{ {
@@ -587,7 +580,7 @@ static HGLOBAL WDML_BuildExecuteCommand(WDML_CONV* pConv, LPCVOID pData, DWORD c
} }
else else
{ {
memSize = MultiByteToWideChar( CP_ACP, 0, pData, cbData, NULL, 0) * sizeof(WCHAR); memSize = MultiByteToWideChar( CP_ACP, 0, pData, cbData, NULL, 0);
} }
} }
@@ -595,7 +588,7 @@ static HGLOBAL WDML_BuildExecuteCommand(WDML_CONV* pConv, LPCVOID pData, DWORD c
if (hMem) if (hMem)
{ {
LPSTR pDst; PCHAR pDst;
pDst = GlobalLock(hMem); pDst = GlobalLock(hMem);
if (pDst) if (pDst)
@@ -612,7 +605,7 @@ static HGLOBAL WDML_BuildExecuteCommand(WDML_CONV* pConv, LPCVOID pData, DWORD c
} }
else else
{ {
MultiByteToWideChar( CP_ACP, 0, pData, cbData, (LPWSTR)pDst, memSize/sizeof(WCHAR)); MultiByteToWideChar( CP_ACP, 0, pData, cbData, (LPWSTR)pDst, memSize);
} }
} }
@@ -668,7 +661,7 @@ static WDML_XACT* WDML_ClientQueueExecute(WDML_CONV* pConv, LPCVOID pData, DWORD
* *
* *
*/ */
static WDML_QUEUE_STATE WDML_HandleExecuteReply(WDML_CONV* pConv, MSG* msg, WDML_XACT* pXAct, DWORD *ack) static WDML_QUEUE_STATE WDML_HandleExecuteReply(WDML_CONV* pConv, MSG* msg, WDML_XACT* pXAct)
{ {
DDEACK ddeAck; DDEACK ddeAck;
UINT_PTR uiLo, uiHi; UINT_PTR uiLo, uiHi;
@@ -686,13 +679,9 @@ static WDML_QUEUE_STATE WDML_HandleExecuteReply(WDML_CONV* pConv, MSG* msg, WDML
return WDML_QS_PASS; return WDML_QS_PASS;
} }
if (ack) *ack = uiLo;
WDML_ExtractAck(uiLo, &ddeAck); WDML_ExtractAck(uiLo, &ddeAck);
pXAct->hDdeData = (HDDEDATA)(UINT_PTR)ddeAck.fAck; pXAct->hDdeData = (HDDEDATA)(UINT_PTR)ddeAck.fAck;
TRACE("hDdeData = %p\n", pXAct->hDdeData);
pConv->instance->lastError = (pXAct->hDdeData != 0) ? DMLERR_NO_ERROR : DMLERR_NOTPROCESSED;
return WDML_QS_HANDLED; return WDML_QS_HANDLED;
} }
@@ -748,8 +737,9 @@ static WDML_XACT* WDML_ClientQueuePoke(WDML_CONV* pConv, LPCVOID pData, DWORD cb
* *
* *
*/ */
static WDML_QUEUE_STATE WDML_HandlePokeReply(WDML_CONV* pConv, MSG* msg, WDML_XACT* pXAct, DWORD *ack) static WDML_QUEUE_STATE WDML_HandlePokeReply(WDML_CONV* pConv, MSG* msg, WDML_XACT* pXAct)
{ {
DDEACK ddeAck;
UINT_PTR uiLo, uiHi; UINT_PTR uiLo, uiHi;
HSZ hsz; HSZ hsz;
@@ -767,7 +757,7 @@ static WDML_QUEUE_STATE WDML_HandlePokeReply(WDML_CONV* pConv, MSG* msg, WDML_XA
FreeDDElParam(WM_DDE_ACK, msg->lParam); FreeDDElParam(WM_DDE_ACK, msg->lParam);
GlobalDeleteAtom(uiHi); GlobalDeleteAtom(uiHi);
if (ack) *ack = uiLo; WDML_ExtractAck(uiLo, &ddeAck);
GlobalFree(pXAct->hMem); GlobalFree(pXAct->hMem);
pXAct->hDdeData = (HDDEDATA)TRUE; pXAct->hDdeData = (HDDEDATA)TRUE;
@@ -902,7 +892,7 @@ static WDML_QUEUE_STATE WDML_HandleIncomingTerminate(WDML_CONV* pConv, MSG* msg,
if (pConv->wStatus & ST_CONNECTED) if (pConv->wStatus & ST_CONNECTED)
{ {
/* don't care about result code (if server exists or not) */ /* don't care about result code (if server exists or not) */
PostMessageW(pConv->hwndServer, WM_DDE_TERMINATE, (WPARAM)pConv->hwndClient, 0L); PostMessageA(pConv->hwndServer, WM_DDE_TERMINATE, (WPARAM)pConv->hwndClient, 0L);
pConv->wStatus &= ~ST_CONNECTED; pConv->wStatus &= ~ST_CONNECTED;
} }
/* have to keep connection around to allow reconnection */ /* have to keep connection around to allow reconnection */
@@ -914,7 +904,7 @@ static WDML_QUEUE_STATE WDML_HandleIncomingTerminate(WDML_CONV* pConv, MSG* msg,
* *
* handles any incoming reply, and try to match to an already sent request * handles any incoming reply, and try to match to an already sent request
*/ */
static WDML_QUEUE_STATE WDML_HandleReply(WDML_CONV* pConv, MSG* msg, HDDEDATA* hdd, DWORD *ack) static WDML_QUEUE_STATE WDML_HandleReply(WDML_CONV* pConv, MSG* msg, HDDEDATA* hdd)
{ {
WDML_XACT* pXAct = pConv->transactions; WDML_XACT* pXAct = pConv->transactions;
WDML_QUEUE_STATE qs; WDML_QUEUE_STATE qs;
@@ -925,19 +915,19 @@ static WDML_QUEUE_STATE WDML_HandleReply(WDML_CONV* pConv, MSG* msg, HDDEDATA* h
switch (pXAct->ddeMsg) switch (pXAct->ddeMsg)
{ {
case WM_DDE_ADVISE: case WM_DDE_ADVISE:
qs = WDML_HandleAdviseReply(pConv, msg, pXAct, ack); qs = WDML_HandleAdviseReply(pConv, msg, pXAct);
break; break;
case WM_DDE_UNADVISE: case WM_DDE_UNADVISE:
qs = WDML_HandleUnadviseReply(pConv, msg, pXAct, ack); qs = WDML_HandleUnadviseReply(pConv, msg, pXAct);
break; break;
case WM_DDE_EXECUTE: case WM_DDE_EXECUTE:
qs = WDML_HandleExecuteReply(pConv, msg, pXAct, ack); qs = WDML_HandleExecuteReply(pConv, msg, pXAct);
break; break;
case WM_DDE_REQUEST: case WM_DDE_REQUEST:
qs = WDML_HandleRequestReply(pConv, msg, pXAct, ack); qs = WDML_HandleRequestReply(pConv, msg, pXAct);
break; break;
case WM_DDE_POKE: case WM_DDE_POKE:
qs = WDML_HandlePokeReply(pConv, msg, pXAct, ack); qs = WDML_HandlePokeReply(pConv, msg, pXAct);
break; break;
case WM_DDE_TERMINATE: case WM_DDE_TERMINATE:
qs = WDML_HandleTerminateReply(pConv, msg, pXAct); qs = WDML_HandleTerminateReply(pConv, msg, pXAct);
@@ -1003,7 +993,7 @@ static WDML_QUEUE_STATE WDML_HandleReply(WDML_CONV* pConv, MSG* msg, HDDEDATA* h
* waits until an answer for a sent request is received * waits until an answer for a sent request is received
* time out is also handled. only used for synchronous transactions * time out is also handled. only used for synchronous transactions
*/ */
static HDDEDATA WDML_SyncWaitTransactionReply(HCONV hConv, DWORD dwTimeout, WDML_XACT* pXAct, DWORD *ack) static HDDEDATA WDML_SyncWaitTransactionReply(HCONV hConv, DWORD dwTimeout, WDML_XACT* pXAct)
{ {
DWORD dwTime; DWORD dwTime;
DWORD err; DWORD err;
@@ -1022,47 +1012,33 @@ static HDDEDATA WDML_SyncWaitTransactionReply(HCONV hConv, DWORD dwTimeout, WDML
if (MsgWaitForMultipleObjects(0, NULL, FALSE, if (MsgWaitForMultipleObjects(0, NULL, FALSE,
dwTimeout - dwTime, QS_POSTMESSAGE) == WAIT_OBJECT_0) dwTimeout - dwTime, QS_POSTMESSAGE) == WAIT_OBJECT_0)
{ {
BOOL ret = FALSE;
MSG msg; MSG msg;
WDML_CONV* pConv;
HDDEDATA hdd;
while (PeekMessageW(&msg, 0, WM_DDE_FIRST, WM_DDE_LAST, PM_REMOVE)) EnterCriticalSection(&WDML_CritSect);
pConv = WDML_GetConv(hConv, FALSE);
if (pConv == NULL)
{ {
WDML_CONV *pConv; LeaveCriticalSection(&WDML_CritSect);
HDDEDATA hdd; /* conversation no longer available... return failure */
break;
EnterCriticalSection(&WDML_CritSect); }
while (PeekMessageA(&msg, pConv->hwndClient, WM_DDE_FIRST, WM_DDE_LAST, PM_REMOVE))
pConv = WDML_GetConv(hConv, FALSE); {
if (pConv == NULL) /* check that either pXAct has been processed or no more xActions are pending */
{ ret = (pConv->transactions == pXAct);
LeaveCriticalSection(&WDML_CritSect); ret = WDML_HandleReply(pConv, &msg, &hdd) == WDML_QS_HANDLED &&
/* conversation no longer available... return failure */ (pConv->transactions == NULL || ret);
return 0; if (ret) break;
} }
if (msg.hwnd == pConv->hwndClient) LeaveCriticalSection(&WDML_CritSect);
{ if (ret)
/* check that either pXAct has been processed or no more xActions are pending */ {
BOOL ret = (pConv->transactions == pXAct); return hdd;
if (WDML_HandleReply(pConv, &msg, &hdd, ack) == WDML_QS_HANDLED) }
{
TRACE("WDML_HandleReply returned WDML_QS_HANDLED\n");
ret = TRUE;
}
else
ret = (pConv->transactions == NULL || ret);
if (ret)
{
pConv->instance->lastError = hdd ? DMLERR_NO_ERROR : DMLERR_NOTPROCESSED;
LeaveCriticalSection(&WDML_CritSect);
return hdd;
}
}
else
{
LeaveCriticalSection(&WDML_CritSect);
DispatchMessageW(&msg);
}
}
} }
} }
@@ -1108,7 +1084,7 @@ HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData, DWORD cbData, HCONV hConv, HS
if (hConv == 0) if (hConv == 0)
{ {
WARN("Invalid conversation handle NULL\n"); ERR("Invalid conversation handle\n");
return 0; return 0;
} }
@@ -1124,7 +1100,11 @@ HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData, DWORD cbData, HCONV hConv, HS
switch (wType) switch (wType)
{ {
case XTYP_EXECUTE: case XTYP_EXECUTE:
/* Windows simply ignores hszItem and wFmt in this case */ if (hszItem != 0 || wFmt != 0)
{
pConv->instance->lastError = DMLERR_INVALIDPARAMETER;
goto theError;
}
pXAct = WDML_ClientQueueExecute(pConv, pData, cbData); pXAct = WDML_ClientQueueExecute(pConv, pData, cbData);
break; break;
case XTYP_POKE: case XTYP_POKE:
@@ -1172,7 +1152,7 @@ HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData, DWORD cbData, HCONV hConv, HS
WDML_QueueTransaction(pConv, pXAct); WDML_QueueTransaction(pConv, pXAct);
if (!PostMessageW(pConv->hwndServer, pXAct->ddeMsg, (WPARAM)pConv->hwndClient, pXAct->lParam)) if (!PostMessageA(pConv->hwndServer, pXAct->ddeMsg, (WPARAM)pConv->hwndClient, pXAct->lParam))
{ {
WARN("Failed posting message %x to %p (error=0x%lx)\n", WARN("Failed posting message %x to %p (error=0x%lx)\n",
pXAct->ddeMsg, pConv->hwndServer, GetLastError()); pXAct->ddeMsg, pConv->hwndServer, GetLastError());
@@ -1196,10 +1176,14 @@ HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData, DWORD cbData, HCONV hConv, HS
{ {
DWORD count, i; DWORD count, i;
if (pdwResult)
{
*pdwResult = 0L;
}
count = WDML_CritSect.RecursionCount; count = WDML_CritSect.RecursionCount;
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
LeaveCriticalSection(&WDML_CritSect); LeaveCriticalSection(&WDML_CritSect);
hDdeData = WDML_SyncWaitTransactionReply((HCONV)pConv, dwTimeout, pXAct, pdwResult); hDdeData = WDML_SyncWaitTransactionReply((HCONV)pConv, dwTimeout, pXAct);
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
EnterCriticalSection(&WDML_CritSect); EnterCriticalSection(&WDML_CritSect);
} }
@@ -1220,7 +1204,7 @@ BOOL WINAPI DdeAbandonTransaction(DWORD idInst, HCONV hConv, DWORD idTransaction
WDML_CONV* pConv; WDML_CONV* pConv;
WDML_XACT* pXAct; WDML_XACT* pXAct;
TRACE("(%08lx,%p,%08lx);\n", idInst, hConv, idTransaction); TRACE("(%08lx,%p,%08ld);\n", idInst, hConv, idTransaction);
EnterCriticalSection(&WDML_CritSect); EnterCriticalSection(&WDML_CritSect);
if ((pInstance = WDML_GetInstance(idInst))) if ((pInstance = WDML_GetInstance(idInst)))
@@ -1272,8 +1256,6 @@ static LRESULT CALLBACK WDML_ClientProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPA
WDML_CONV* pConv = NULL; WDML_CONV* pConv = NULL;
HSZ hszSrv, hszTpc; HSZ hszSrv, hszTpc;
TRACE("%p %04x %08x %08lx\n", hwnd, iMsg, wParam , lParam);
if (iMsg == WM_DDE_ACK && if (iMsg == WM_DDE_ACK &&
/* in the initial WM_INITIATE sendmessage */ /* in the initial WM_INITIATE sendmessage */
((pConv = WDML_GetConvFromWnd(hwnd)) == NULL || pConv->wStatus == XST_INIT1)) ((pConv = WDML_GetConvFromWnd(hwnd)) == NULL || pConv->wStatus == XST_INIT1))
@@ -1292,7 +1274,7 @@ static LRESULT CALLBACK WDML_ClientProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPA
/* we already have started the conv with a server, drop other replies */ /* we already have started the conv with a server, drop other replies */
GlobalDeleteAtom(uiLo); GlobalDeleteAtom(uiLo);
GlobalDeleteAtom(uiHi); GlobalDeleteAtom(uiHi);
PostMessageW((HWND)wParam, WM_DDE_TERMINATE, (WPARAM)hwnd, 0); PostMessageA((HWND)wParam, WM_DDE_TERMINATE, (WPARAM)hwnd, 0);
return 0; return 0;
} }
@@ -1303,15 +1285,15 @@ static LRESULT CALLBACK WDML_ClientProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPA
pConv = WDML_AddConv(pInstance, WDML_CLIENT_SIDE, hszSrv, hszTpc, hwnd, (HWND)wParam); pConv = WDML_AddConv(pInstance, WDML_CLIENT_SIDE, hszSrv, hszTpc, hwnd, (HWND)wParam);
SetWindowLongPtrW(hwnd, GWL_WDML_CONVERSATION, (ULONG_PTR)pConv); SetWindowLongA(hwnd, GWL_WDML_CONVERSATION, (DWORD)pConv);
pConv->wStatus |= ST_CONNECTED; pConv->wStatus |= ST_CONNECTED;
pConv->wConvst = XST_INIT1; pConv->wConvst = XST_INIT1;
/* check if server is handled by DDEML */ /* check if server is handled by DDEML */
if ((GetClassNameA((HWND)wParam, buf, sizeof(buf)) && if ((GetClassNameA((HWND)wParam, buf, sizeof(buf)) &&
lstrcmpiA(buf, WDML_szServerConvClassA) == 0) || strcmp(buf, WDML_szServerConvClassA) == 0) ||
(GetClassNameW((HWND)wParam, (LPWSTR)buf, sizeof(buf)/sizeof(WCHAR)) && (GetClassNameW((HWND)wParam, (LPWSTR)buf, sizeof(buf)/sizeof(WCHAR)) &&
lstrcmpiW((LPWSTR)buf, WDML_szServerConvClassW) == 0)) lstrcmpW((LPWSTR)buf, WDML_szServerConvClassW) == 0))
{ {
pConv->wStatus |= ST_ISLOCAL; pConv->wStatus |= ST_ISLOCAL;
} }
@@ -1341,15 +1323,15 @@ static LRESULT CALLBACK WDML_ClientProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPA
msg.wParam = wParam; msg.wParam = wParam;
msg.lParam = lParam; msg.lParam = lParam;
WDML_HandleReply(pConv, &msg, &hdd, NULL); WDML_HandleReply(pConv, &msg, &hdd);
} }
LeaveCriticalSection(&WDML_CritSect); LeaveCriticalSection(&WDML_CritSect);
return 0; return 0;
} }
return IsWindowUnicode(hwnd) ? DefWindowProcW(hwnd, iMsg, wParam, lParam) : return (IsWindowUnicode(hwnd)) ?
DefWindowProcA(hwnd, iMsg, wParam, lParam); DefWindowProcW(hwnd, iMsg, wParam, lParam) : DefWindowProcA(hwnd, iMsg, wParam, lParam);
} }
/***************************************************************** /*****************************************************************
@@ -1366,7 +1348,7 @@ BOOL WINAPI DdeDisconnect(HCONV hConv)
if (hConv == 0) if (hConv == 0)
{ {
WARN("DdeDisconnect(): hConv = 0\n"); ERR("DdeDisconnect(): hConv = 0\n");
return FALSE; return FALSE;
} }
@@ -1383,9 +1365,9 @@ BOOL WINAPI DdeDisconnect(HCONV hConv)
count = WDML_CritSect.RecursionCount; count = WDML_CritSect.RecursionCount;
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
LeaveCriticalSection(&WDML_CritSect); LeaveCriticalSection(&WDML_CritSect);
if (PostMessageW(pConv->hwndServer, pXAct->ddeMsg, if (PostMessageA(pConv->hwndServer, pXAct->ddeMsg,
(WPARAM)pConv->hwndClient, pXAct->lParam)) (WPARAM)pConv->hwndClient, pXAct->lParam))
WDML_SyncWaitTransactionReply(hConv, 10000, pXAct, NULL); WDML_SyncWaitTransactionReply(hConv, 10000, pXAct);
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
EnterCriticalSection(&WDML_CritSect); EnterCriticalSection(&WDML_CritSect);
ret = TRUE; ret = TRUE;

View File

@@ -6,7 +6,6 @@
* Copyright 1999 Keith Matthews * Copyright 1999 Keith Matthews
* Copyright 2000 Corel * Copyright 2000 Corel
* Copyright 2001 Eric Pouech * Copyright 2001 Eric Pouech
* Copyright 2003, 2004, 2005 Dmitry Timoshkov
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@@ -24,12 +23,12 @@
*/ */
#include <user32.h> #include <user32.h>
#define NDEBUG
#include <wine/debug.h> #include <debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(ddeml); WINE_DEFAULT_DEBUG_CHANNEL(ddeml);
static const WCHAR szServerNameClass[] = {'D','d','e','S','e','r','v','e','r','N','a','m','e',0}; static const char szServerNameClassA[] = "DdeServerNameAnsi";
const char WDML_szServerConvClassA[] = "DdeServerConvAnsi"; const char WDML_szServerConvClassA[] = "DdeServerConvAnsi";
const WCHAR WDML_szServerConvClassW[] = {'D','d','e','S','e','r','v','e','r','C','o','n','v','U','n','i','c','o','d','e',0}; const WCHAR WDML_szServerConvClassW[] = {'D','d','e','S','e','r','v','e','r','C','o','n','v','U','n','i','c','o','d','e',0};
@@ -122,7 +121,7 @@ BOOL WINAPI DdePostAdvise(DWORD idInst, HSZ hszTopic, HSZ hszItem)
goto theError; goto theError;
} }
if (!PostMessageW(pConv->hwndClient, WM_DDE_DATA, (WPARAM)pConv->hwndServer, if (!PostMessageA(pConv->hwndClient, WM_DDE_DATA, (WPARAM)pConv->hwndServer,
PackDDElParam(WM_DDE_DATA, (UINT_PTR)hItemData, atom))) PackDDElParam(WM_DDE_DATA, (UINT_PTR)hItemData, atom)))
{ {
ERR("post message failed\n"); ERR("post message failed\n");
@@ -163,7 +162,7 @@ HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd)
WDML_INSTANCE* pInstance; WDML_INSTANCE* pInstance;
HDDEDATA hDdeData; HDDEDATA hDdeData;
HWND hwndServer; HWND hwndServer;
WNDCLASSEXW wndclass; WNDCLASSEXA wndclass;
hDdeData = NULL; hDdeData = NULL;
@@ -223,25 +222,25 @@ HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd)
wndclass.style = 0; wndclass.style = 0;
wndclass.lpfnWndProc = WDML_ServerNameProc; wndclass.lpfnWndProc = WDML_ServerNameProc;
wndclass.cbClsExtra = 0; wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 2 * sizeof(ULONG_PTR); wndclass.cbWndExtra = 2 * sizeof(DWORD);
wndclass.hInstance = 0; wndclass.hInstance = 0;
wndclass.hIcon = 0; wndclass.hIcon = 0;
wndclass.hCursor = 0; wndclass.hCursor = 0;
wndclass.hbrBackground = 0; wndclass.hbrBackground = 0;
wndclass.lpszMenuName = NULL; wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = szServerNameClass; wndclass.lpszClassName = szServerNameClassA;
wndclass.hIconSm = 0; wndclass.hIconSm = 0;
RegisterClassExW(&wndclass); RegisterClassExA(&wndclass);
LeaveCriticalSection(&WDML_CritSect); LeaveCriticalSection(&WDML_CritSect);
hwndServer = CreateWindowW(szServerNameClass, NULL, hwndServer = CreateWindowA(szServerNameClassA, NULL,
WS_POPUP, 0, 0, 0, 0, WS_POPUP, 0, 0, 0, 0,
0, 0, 0, 0); 0, 0, 0, 0);
EnterCriticalSection(&WDML_CritSect); EnterCriticalSection(&WDML_CritSect);
SetWindowLongPtrW(hwndServer, GWL_WDML_INSTANCE, (ULONG_PTR)pInstance); SetWindowLongA(hwndServer, GWL_WDML_INSTANCE, (DWORD)pInstance);
SetWindowLongPtrW(hwndServer, GWL_WDML_SERVER, (ULONG_PTR)pServer); SetWindowLongA(hwndServer, GWL_WDML_SERVER, (DWORD)pServer);
TRACE("Created nameServer=%p for instance=%08lx\n", hwndServer, idInst); TRACE("Created nameServer=%p for instance=%08lx\n", hwndServer, idInst);
pServer->hwndServer = hwndServer; pServer->hwndServer = hwndServer;
@@ -309,7 +308,7 @@ static WDML_CONV* WDML_CreateServerConv(WDML_INSTANCE* pInstance, HWND hwndClien
wndclass.style = 0; wndclass.style = 0;
wndclass.lpfnWndProc = WDML_ServerConvProc; wndclass.lpfnWndProc = WDML_ServerConvProc;
wndclass.cbClsExtra = 0; wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 2 * sizeof(ULONG_PTR); wndclass.cbWndExtra = 2 * sizeof(DWORD);
wndclass.hInstance = 0; wndclass.hInstance = 0;
wndclass.hIcon = 0; wndclass.hIcon = 0;
wndclass.hCursor = 0; wndclass.hCursor = 0;
@@ -332,7 +331,7 @@ static WDML_CONV* WDML_CreateServerConv(WDML_INSTANCE* pInstance, HWND hwndClien
wndclass.style = 0; wndclass.style = 0;
wndclass.lpfnWndProc = WDML_ServerConvProc; wndclass.lpfnWndProc = WDML_ServerConvProc;
wndclass.cbClsExtra = 0; wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 2 * sizeof(ULONG_PTR); wndclass.cbWndExtra = 2 * sizeof(DWORD);
wndclass.hInstance = 0; wndclass.hInstance = 0;
wndclass.hIcon = 0; wndclass.hIcon = 0;
wndclass.hCursor = 0; wndclass.hCursor = 0;
@@ -355,12 +354,12 @@ static WDML_CONV* WDML_CreateServerConv(WDML_INSTANCE* pInstance, HWND hwndClien
hwndClient, hwndServerConv); hwndClient, hwndServerConv);
if (pConv) if (pConv)
{ {
SetWindowLongPtrW(hwndServerConv, GWL_WDML_INSTANCE, (ULONG_PTR)pInstance); SetWindowLongA(hwndServerConv, GWL_WDML_INSTANCE, (DWORD)pInstance);
SetWindowLongPtrW(hwndServerConv, GWL_WDML_CONVERSATION, (ULONG_PTR)pConv); SetWindowLongA(hwndServerConv, GWL_WDML_CONVERSATION, (DWORD)pConv);
/* this should be the only place using SendMessage for WM_DDE_ACK */ /* this should be the only place using SendMessage for WM_DDE_ACK */
/* note: sent messages shall not use packing */ /* note: sent messages shall not use packing */
SendMessageW(hwndClient, WM_DDE_ACK, (WPARAM)hwndServerConv, SendMessageA(hwndClient, WM_DDE_ACK, (WPARAM)hwndServerConv,
MAKELPARAM(WDML_MakeAtomFromHsz(hszApp), WDML_MakeAtomFromHsz(hszTopic))); MAKELPARAM(WDML_MakeAtomFromHsz(hszApp), WDML_MakeAtomFromHsz(hszTopic)));
/* we assume we're connected since we've sent an answer... /* we assume we're connected since we've sent an answer...
* I'm not sure what we can do... it doesn't look like the return value * I'm not sure what we can do... it doesn't look like the return value
@@ -426,9 +425,9 @@ static LRESULT CALLBACK WDML_ServerNameProc(HWND hwndServer, UINT iMsg, WPARAM w
* handled under DDEML, and if so build a default context * handled under DDEML, and if so build a default context
*/ */
if ((GetClassNameA(hwndClient, buf, sizeof(buf)) && if ((GetClassNameA(hwndClient, buf, sizeof(buf)) &&
lstrcmpiA(buf, WDML_szClientConvClassA) == 0) || strcmp(buf, WDML_szClientConvClassA) == 0) ||
(GetClassNameW(hwndClient, (LPWSTR)buf, sizeof(buf)/sizeof(WCHAR)) && (GetClassNameW(hwndClient, (LPWSTR)buf, sizeof(buf)/sizeof(WCHAR)) &&
lstrcmpiW((LPWSTR)buf, WDML_szClientConvClassW) == 0)) lstrcmpW((LPWSTR)buf, WDML_szClientConvClassW) == 0))
{ {
pcc = &cc; pcc = &cc;
memset(pcc, 0, sizeof(*pcc)); memset(pcc, 0, sizeof(*pcc));
@@ -441,15 +440,15 @@ static LRESULT CALLBACK WDML_ServerNameProc(HWND hwndServer, UINT iMsg, WPARAM w
} }
else if (hszApp && hszTop) else if (hszApp && hszTop)
{ {
WDML_SERVER* pServer = (WDML_SERVER*)GetWindowLongPtrW(hwndServer, GWL_WDML_SERVER); WDML_SERVER* pServer = (WDML_SERVER*)GetWindowLongA(hwndServer, GWL_WDML_SERVER);
/* check filters for name service */ /* check filters for name service */
if (!pServer->filterOn || DdeCmpStringHandles(pServer->hszService, hszApp) == 0) if (!pServer->filterOn || DdeCmpStringHandles(pServer->hszService, hszApp) == 0)
{ {
/* pass on to the callback */ /* pass on to the callback */
hDdeData = WDML_InvokeCallback(pInstance, XTYP_CONNECT, hDdeData = WDML_InvokeCallback(pInstance, XTYP_CONNECT,
0, 0, hszTop, hszApp, 0, (ULONG_PTR)pcc, self); 0, 0, hszTop, hszApp, 0, (DWORD)pcc, self);
if ((ULONG_PTR)hDdeData) if ((UINT)hDdeData)
{ {
pConv = WDML_CreateServerConv(pInstance, hwndClient, hwndServer, pConv = WDML_CreateServerConv(pInstance, hwndClient, hwndServer,
hszApp, hszTop); hszApp, hszTop);
@@ -457,7 +456,7 @@ static LRESULT CALLBACK WDML_ServerNameProc(HWND hwndServer, UINT iMsg, WPARAM w
{ {
if (pcc) pConv->wStatus |= ST_ISLOCAL; if (pcc) pConv->wStatus |= ST_ISLOCAL;
WDML_InvokeCallback(pInstance, XTYP_CONNECT_CONFIRM, 0, (HCONV)pConv, WDML_InvokeCallback(pInstance, XTYP_CONNECT_CONFIRM, 0, (HCONV)pConv,
hszTop, hszApp, 0, (ULONG_PTR)pcc, self); hszTop, hszApp, 0, (DWORD)pcc, self);
} }
} }
} }
@@ -466,14 +465,14 @@ static LRESULT CALLBACK WDML_ServerNameProc(HWND hwndServer, UINT iMsg, WPARAM w
{ {
/* pass on to the callback */ /* pass on to the callback */
hDdeData = WDML_InvokeCallback(pInstance, XTYP_WILDCONNECT, hDdeData = WDML_InvokeCallback(pInstance, XTYP_WILDCONNECT,
0, 0, hszTop, hszApp, 0, (ULONG_PTR)pcc, self); 0, 0, hszTop, hszApp, 0, (DWORD)pcc, self);
if (hDdeData == (HDDEDATA)CBR_BLOCK) if (hDdeData == (HDDEDATA)CBR_BLOCK)
{ {
/* MS doc is not consistent here */ /* MS doc is not consistent here */
FIXME("CBR_BLOCK returned for WILDCONNECT\n"); FIXME("CBR_BLOCK returned for WILDCONNECT\n");
} }
else if ((ULONG_PTR)hDdeData != 0) else if ((UINT)hDdeData != 0)
{ {
HSZPAIR* hszp; HSZPAIR* hszp;
@@ -489,7 +488,7 @@ static LRESULT CALLBACK WDML_ServerNameProc(HWND hwndServer, UINT iMsg, WPARAM w
{ {
if (pcc) pConv->wStatus |= ST_ISLOCAL; if (pcc) pConv->wStatus |= ST_ISLOCAL;
WDML_InvokeCallback(pInstance, XTYP_CONNECT_CONFIRM, 0, (HCONV)pConv, WDML_InvokeCallback(pInstance, XTYP_CONNECT_CONFIRM, 0, (HCONV)pConv,
hszp[i].hszTopic, hszp[i].hszSvc, 0, (ULONG_PTR)pcc, self); hszp[i].hszTopic, hszp[i].hszSvc, 0, (DWORD)pcc, self);
} }
} }
DdeUnaccessData(hDdeData); DdeUnaccessData(hDdeData);
@@ -501,6 +500,7 @@ static LRESULT CALLBACK WDML_ServerNameProc(HWND hwndServer, UINT iMsg, WPARAM w
return 0; return 0;
case WM_DDE_REQUEST: case WM_DDE_REQUEST:
FIXME("WM_DDE_REQUEST message received!\n"); FIXME("WM_DDE_REQUEST message received!\n");
return 0; return 0;
@@ -519,11 +519,10 @@ static LRESULT CALLBACK WDML_ServerNameProc(HWND hwndServer, UINT iMsg, WPARAM w
case WM_DDE_TERMINATE: case WM_DDE_TERMINATE:
FIXME("WM_DDE_TERMINATE message received!\n"); FIXME("WM_DDE_TERMINATE message received!\n");
return 0; return 0;
default:
break;
} }
return DefWindowProcW(hwndServer, iMsg, wParam, lParam); return DefWindowProcA(hwndServer, iMsg, wParam, lParam);
} }
/****************************************************************** /******************************************************************
@@ -552,7 +551,7 @@ static WDML_XACT* WDML_ServerQueueRequest(WDML_CONV* pConv, LPARAM lParam)
static WDML_QUEUE_STATE WDML_ServerHandleRequest(WDML_CONV* pConv, WDML_XACT* pXAct) static WDML_QUEUE_STATE WDML_ServerHandleRequest(WDML_CONV* pConv, WDML_XACT* pXAct)
{ {
HDDEDATA hDdeData = 0; HDDEDATA hDdeData = 0;
BOOL fAck = TRUE; WDML_QUEUE_STATE ret = WDML_QS_HANDLED;
if (!(pConv->instance->CBFflags & CBF_FAIL_REQUESTS)) if (!(pConv->instance->CBFflags & CBF_FAIL_REQUESTS))
{ {
@@ -564,33 +563,27 @@ static WDML_QUEUE_STATE WDML_ServerHandleRequest(WDML_CONV* pConv, WDML_XACT* pX
switch ((ULONG_PTR)hDdeData) switch ((ULONG_PTR)hDdeData)
{ {
case 0: case 0:
TRACE("No data returned from the Callback\n"); WDML_PostAck(pConv, WDML_SERVER_SIDE, 0, FALSE, FALSE, pXAct->atom,
fAck = FALSE; pXAct->lParam, WM_DDE_REQUEST);
break; break;
case (ULONG_PTR)CBR_BLOCK: case (ULONG_PTR)CBR_BLOCK:
return WDML_QS_BLOCK; ret = WDML_QS_BLOCK;
break;
default: default:
{ {
HGLOBAL hMem = WDML_DataHandle2Global(hDdeData, TRUE, FALSE, FALSE, FALSE); HGLOBAL hMem = WDML_DataHandle2Global(hDdeData, TRUE, FALSE, FALSE, FALSE);
if (!PostMessageW(pConv->hwndClient, WM_DDE_DATA, (WPARAM)pConv->hwndServer, if (!PostMessageA(pConv->hwndClient, WM_DDE_DATA, (WPARAM)pConv->hwndServer,
ReuseDDElParam(pXAct->lParam, WM_DDE_REQUEST, WM_DDE_DATA, ReuseDDElParam(pXAct->lParam, WM_DDE_REQUEST, WM_DDE_DATA,
(UINT_PTR)hMem, (UINT_PTR)pXAct->atom))) (UINT_PTR)hMem, (UINT_PTR)pXAct->atom)))
{ {
DdeFreeDataHandle(hDdeData); DdeFreeDataHandle(hDdeData);
GlobalFree(hMem); GlobalFree(hMem);
fAck = FALSE;
} }
} }
break; break;
} }
WDML_PostAck(pConv, WDML_SERVER_SIDE, 0, FALSE, fAck, pXAct->atom, pXAct->lParam, WM_DDE_REQUEST);
WDML_DecHSZ(pConv->instance, pXAct->hszItem); WDML_DecHSZ(pConv->instance, pXAct->hszItem);
return ret;
return WDML_QS_HANDLED;
} }
/****************************************************************** /******************************************************************
@@ -629,8 +622,8 @@ static WDML_QUEUE_STATE WDML_ServerHandleAdvise(WDML_CONV* pConv, WDML_XACT* pXA
UINT uType; UINT uType;
WDML_LINK* pLink; WDML_LINK* pLink;
DDEADVISE* pDdeAdvise; DDEADVISE* pDdeAdvise;
HDDEDATA hDdeData = 0; HDDEDATA hDdeData;
BOOL fAck = TRUE; BOOL fAck;
pDdeAdvise = (DDEADVISE*)GlobalLock(pXAct->hMem); pDdeAdvise = (DDEADVISE*)GlobalLock(pXAct->hMem);
uType = XTYP_ADVSTART | uType = XTYP_ADVSTART |
@@ -642,18 +635,15 @@ static WDML_QUEUE_STATE WDML_ServerHandleAdvise(WDML_CONV* pConv, WDML_XACT* pXA
hDdeData = WDML_InvokeCallback(pConv->instance, XTYP_ADVSTART, pDdeAdvise->cfFormat, hDdeData = WDML_InvokeCallback(pConv->instance, XTYP_ADVSTART, pDdeAdvise->cfFormat,
(HCONV)pConv, pConv->hszTopic, pXAct->hszItem, 0, 0, 0); (HCONV)pConv, pConv->hszTopic, pXAct->hszItem, 0, 0, 0);
} }
else
switch ((ULONG_PTR)hDdeData)
{ {
case 0: hDdeData = 0;
TRACE("No data returned from the Callback\n"); }
fAck = FALSE;
break;
case (ULONG_PTR)CBR_BLOCK: if ((UINT)hDdeData)
return WDML_QS_BLOCK; {
fAck = TRUE;
default:
/* billx: first to see if the link is already created. */ /* billx: first to see if the link is already created. */
pLink = WDML_FindLink(pConv->instance, (HCONV)pConv, WDML_SERVER_SIDE, pLink = WDML_FindLink(pConv->instance, (HCONV)pConv, WDML_SERVER_SIDE,
pXAct->hszItem, TRUE, pDdeAdvise->cfFormat); pXAct->hszItem, TRUE, pDdeAdvise->cfFormat);
@@ -669,7 +659,11 @@ static WDML_QUEUE_STATE WDML_ServerHandleAdvise(WDML_CONV* pConv, WDML_XACT* pXA
WDML_AddLink(pConv->instance, (HCONV)pConv, WDML_SERVER_SIDE, WDML_AddLink(pConv->instance, (HCONV)pConv, WDML_SERVER_SIDE,
uType, pXAct->hszItem, pDdeAdvise->cfFormat); uType, pXAct->hszItem, pDdeAdvise->cfFormat);
} }
break; }
else
{
TRACE("No data returned from the Callback\n");
fAck = FALSE;
} }
GlobalUnlock(pXAct->hMem); GlobalUnlock(pXAct->hMem);
@@ -787,11 +781,8 @@ static WDML_QUEUE_STATE WDML_ServerHandleExecute(WDML_CONV* pConv, WDML_XACT* pX
pConv->hszTopic, 0, hDdeData, 0L, 0L); pConv->hszTopic, 0, hDdeData, 0L, 0L);
} }
switch ((ULONG_PTR)hDdeData) switch ((UINT)hDdeData)
{ {
case (ULONG_PTR)CBR_BLOCK:
return WDML_QS_BLOCK;
case DDE_FACK: case DDE_FACK:
fAck = TRUE; fAck = TRUE;
break; break;
@@ -799,7 +790,7 @@ static WDML_QUEUE_STATE WDML_ServerHandleExecute(WDML_CONV* pConv, WDML_XACT* pX
fBusy = TRUE; fBusy = TRUE;
break; break;
default: default:
FIXME("Unsupported returned value %p\n", hDdeData); WARN("Bad result code\n");
/* fall through */ /* fall through */
case DDE_FNOTPROCESSED: case DDE_FNOTPROCESSED:
break; break;
@@ -918,7 +909,7 @@ static WDML_QUEUE_STATE WDML_ServerHandleTerminate(WDML_CONV* pConv, WDML_XACT*
WDML_InvokeCallback(pConv->instance, XTYP_DISCONNECT, 0, (HCONV)pConv, 0, 0, WDML_InvokeCallback(pConv->instance, XTYP_DISCONNECT, 0, (HCONV)pConv, 0, 0,
0, 0, (pConv->wStatus & ST_ISSELF) ? 1 : 0); 0, 0, (pConv->wStatus & ST_ISSELF) ? 1 : 0);
} }
PostMessageW(pConv->hwndClient, WM_DDE_TERMINATE, (WPARAM)pConv->hwndServer, 0); PostMessageA(pConv->hwndClient, WM_DDE_TERMINATE, (WPARAM)pConv->hwndServer, 0);
WDML_RemoveConv(pConv, WDML_SERVER_SIDE); WDML_RemoveConv(pConv, WDML_SERVER_SIDE);
return WDML_QS_HANDLED; return WDML_QS_HANDLED;
@@ -983,8 +974,6 @@ static LRESULT CALLBACK WDML_ServerConvProc(HWND hwndServer, UINT iMsg, WPARAM w
WDML_CONV* pConv; WDML_CONV* pConv;
WDML_XACT* pXAct = NULL; WDML_XACT* pXAct = NULL;
TRACE("%p %04x %08x %08lx\n", hwndServer, iMsg, wParam , lParam);
if (iMsg == WM_DESTROY) if (iMsg == WM_DESTROY)
{ {
EnterCriticalSection(&WDML_CritSect); EnterCriticalSection(&WDML_CritSect);

View File

@@ -11,9 +11,6 @@
#include <user32.h> #include <user32.h>
#include <wine/debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(user32);
#define DESKTOP_CLASS_ATOM MAKEINTATOMA(32769) /* Desktop */ #define DESKTOP_CLASS_ATOM MAKEINTATOMA(32769) /* Desktop */
static LRESULT WINAPI DesktopWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ); static LRESULT WINAPI DesktopWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam );
@@ -36,36 +33,12 @@ LRESULT
WINAPI WINAPI
DesktopWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) DesktopWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
{ {
FIXME("Desktop Class Atom!\n"); DPRINT1("Desktop Class Atom!\n");
if (message == WM_NCCREATE) return TRUE; if (message == WM_NCCREATE) return TRUE;
return 0; /* all other messages are ignored */ return 0; /* all other messages are ignored */
} }
VOID
STDCALL
LogFontA2W(LPLOGFONTW pW, CONST LOGFONTA *pA)
{
#define COPYS(f,len) MultiByteToWideChar ( CP_THREAD_ACP, 0, pA->f, len, pW->f, len )
#define COPYN(f) pW->f = pA->f
COPYN(lfHeight);
COPYN(lfWidth);
COPYN(lfEscapement);
COPYN(lfOrientation);
COPYN(lfWeight);
COPYN(lfItalic);
COPYN(lfUnderline);
COPYN(lfStrikeOut);
COPYN(lfCharSet);
COPYN(lfOutPrecision);
COPYN(lfClipPrecision);
COPYN(lfQuality);
COPYN(lfPitchAndFamily);
COPYS(lfFaceName,LF_FACESIZE);
#undef COPYN
#undef COPYS
}
VOID VOID
STDCALL STDCALL
@@ -121,113 +94,48 @@ SystemParametersInfoA(UINT uiAction,
{ {
switch (uiAction) switch (uiAction)
{ {
case SPI_GETHIGHCONTRAST: case SPI_SETDOUBLECLKWIDTH:
case SPI_SETHIGHCONTRAST: case SPI_SETDOUBLECLKHEIGHT:
case SPI_GETSOUNDSENTRY: case SPI_SETDOUBLECLICKTIME:
case SPI_SETSOUNDSENTRY: case SPI_SETGRADIENTCAPTIONS:
case SPI_SETFONTSMOOTHING:
case SPI_SETFOCUSBORDERHEIGHT:
case SPI_SETFOCUSBORDERWIDTH:
case SPI_SETWORKAREA:
case SPI_GETWORKAREA:
case SPI_GETFONTSMOOTHING:
case SPI_GETGRADIENTCAPTIONS:
case SPI_GETFOCUSBORDERHEIGHT:
case SPI_GETFOCUSBORDERWIDTH:
{ {
/* FIXME: Support this accessibility SPI actions */ return NtUserSystemParametersInfo(uiAction, uiParam, pvParam, fWinIni);
FIXME("FIXME: Unsupported SPI Code: %lx \n",uiAction );
return FALSE;
} }
case SPI_GETNONCLIENTMETRICS: case SPI_GETNONCLIENTMETRICS:
{ {
LPNONCLIENTMETRICSA pnclma = (LPNONCLIENTMETRICSA)pvParam; LPNONCLIENTMETRICSA nclma = (LPNONCLIENTMETRICSA)pvParam;
NONCLIENTMETRICSW nclmw; NONCLIENTMETRICSW nclmw;
if(pnclma->cbSize != sizeof(NONCLIENTMETRICSA))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
nclmw.cbSize = sizeof(NONCLIENTMETRICSW); nclmw.cbSize = sizeof(NONCLIENTMETRICSW);
if (!SystemParametersInfoW(uiAction, sizeof(NONCLIENTMETRICSW), if (!SystemParametersInfoW(uiAction, sizeof(NONCLIENTMETRICSW),
&nclmw, fWinIni)) &nclmw, fWinIni))
return FALSE; return FALSE;
pnclma->iBorderWidth = nclmw.iBorderWidth; nclma->iBorderWidth = nclmw.iBorderWidth;
pnclma->iScrollWidth = nclmw.iScrollWidth; nclma->iScrollWidth = nclmw.iScrollWidth;
pnclma->iScrollHeight = nclmw.iScrollHeight; nclma->iScrollHeight = nclmw.iScrollHeight;
pnclma->iCaptionWidth = nclmw.iCaptionWidth; nclma->iCaptionWidth = nclmw.iCaptionWidth;
pnclma->iCaptionHeight = nclmw.iCaptionHeight; nclma->iCaptionHeight = nclmw.iCaptionHeight;
pnclma->iSmCaptionWidth = nclmw.iSmCaptionWidth; nclma->iSmCaptionWidth = nclmw.iSmCaptionWidth;
pnclma->iSmCaptionHeight = nclmw.iSmCaptionHeight; nclma->iSmCaptionHeight = nclmw.iSmCaptionHeight;
pnclma->iMenuWidth = nclmw.iMenuWidth; nclma->iMenuWidth = nclmw.iMenuWidth;
pnclma->iMenuHeight = nclmw.iMenuHeight; nclma->iMenuHeight = nclmw.iMenuHeight;
LogFontW2A(&(pnclma->lfCaptionFont), &(nclmw.lfCaptionFont)); LogFontW2A(&(nclma->lfCaptionFont), &(nclmw.lfCaptionFont));
LogFontW2A(&(pnclma->lfSmCaptionFont), &(nclmw.lfSmCaptionFont)); LogFontW2A(&(nclma->lfSmCaptionFont), &(nclmw.lfSmCaptionFont));
LogFontW2A(&(pnclma->lfMenuFont), &(nclmw.lfMenuFont)); LogFontW2A(&(nclma->lfMenuFont), &(nclmw.lfMenuFont));
LogFontW2A(&(pnclma->lfStatusFont), &(nclmw.lfStatusFont)); LogFontW2A(&(nclma->lfStatusFont), &(nclmw.lfStatusFont));
LogFontW2A(&(pnclma->lfMessageFont), &(nclmw.lfMessageFont)); LogFontW2A(&(nclma->lfMessageFont), &(nclmw.lfMessageFont));
return TRUE; return TRUE;
} }
case SPI_SETNONCLIENTMETRICS:
{
LPNONCLIENTMETRICSA pnclma = (LPNONCLIENTMETRICSA)pvParam;
NONCLIENTMETRICSW nclmw;
if(pnclma->cbSize != sizeof(NONCLIENTMETRICSA))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
nclmw.cbSize = sizeof(NONCLIENTMETRICSW);
nclmw.iBorderWidth = pnclma->iBorderWidth;
nclmw.iScrollWidth = pnclma->iScrollWidth;
nclmw.iScrollHeight = pnclma->iScrollHeight;
nclmw.iCaptionWidth = pnclma->iCaptionWidth;
nclmw.iCaptionHeight = pnclma->iCaptionHeight;
nclmw.iSmCaptionWidth = pnclma->iSmCaptionWidth;
nclmw.iSmCaptionHeight = pnclma->iSmCaptionHeight;
nclmw.iMenuWidth = pnclma->iMenuWidth;
nclmw.iMenuHeight = pnclma->iMenuHeight;
LogFontA2W(&(nclmw.lfCaptionFont), &(pnclma->lfCaptionFont));
LogFontA2W(&(nclmw.lfSmCaptionFont), &(pnclma->lfSmCaptionFont));
LogFontA2W(&(nclmw.lfMenuFont), &(pnclma->lfMenuFont));
LogFontA2W(&(nclmw.lfStatusFont), &(pnclma->lfStatusFont));
LogFontA2W(&(nclmw.lfMessageFont), &(pnclma->lfMessageFont));
return SystemParametersInfoW(uiAction, sizeof(NONCLIENTMETRICSW),
&nclmw, fWinIni);
}
case SPI_GETICONMETRICS:
{
LPICONMETRICSA picma = (LPICONMETRICSA)pvParam;
ICONMETRICSW icmw;
if(picma->cbSize != sizeof(ICONMETRICSA))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
icmw.cbSize = sizeof(ICONMETRICSW);
if (!SystemParametersInfoW(uiAction, sizeof(ICONMETRICSW),
&icmw, fWinIni))
return FALSE;
picma->iHorzSpacing = icmw.iHorzSpacing;
picma->iVertSpacing = icmw.iVertSpacing;
picma->iTitleWrap = icmw.iTitleWrap;
LogFontW2A(&(picma->lfFont), &(icmw.lfFont));
return TRUE;
}
case SPI_SETICONMETRICS:
{
LPICONMETRICSA picma = (LPICONMETRICSA)pvParam;
ICONMETRICSW icmw;
if(picma->cbSize != sizeof(ICONMETRICSA))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
icmw.cbSize = sizeof(ICONMETRICSW);
icmw.iHorzSpacing = picma->iHorzSpacing;
icmw.iVertSpacing = picma->iVertSpacing;
icmw.iTitleWrap = picma->iTitleWrap;
LogFontA2W(&(icmw.lfFont), &(picma->lfFont));
return SystemParametersInfoW(uiAction, sizeof(ICONMETRICSW),
&icmw, fWinIni);
}
case SPI_GETICONTITLELOGFONT: case SPI_GETICONTITLELOGFONT:
{ {
LOGFONTW lfw; LOGFONTW lfw;
@@ -236,13 +144,6 @@ SystemParametersInfoA(UINT uiAction,
LogFontW2A(pvParam, &lfw); LogFontW2A(pvParam, &lfw);
return TRUE; return TRUE;
} }
case SPI_SETICONTITLELOGFONT:
{
LPLOGFONTA plfa = (LPLOGFONTA)pvParam;
LOGFONTW lfw;
LogFontA2W(&lfw,plfa);
return SystemParametersInfoW(uiAction, 0, &lfw, fWinIni);
}
case SPI_GETDESKWALLPAPER: case SPI_GETDESKWALLPAPER:
{ {
HKEY hKey; HKEY hKey;
@@ -329,7 +230,8 @@ SystemParametersInfoA(UINT uiAction,
return Ret; return Ret;
} }
} }
return NtUserSystemParametersInfo(uiAction, uiParam, pvParam, fWinIni);
return FALSE;
} }
@@ -344,15 +246,6 @@ SystemParametersInfoW(UINT uiAction,
{ {
switch(uiAction) switch(uiAction)
{ {
case SPI_GETHIGHCONTRAST:
case SPI_SETHIGHCONTRAST:
case SPI_GETSOUNDSENTRY:
case SPI_SETSOUNDSENTRY:
{
/* FIXME: Support this accessibility SPI actions */
FIXME("FIXME: Unsupported SPI Code: %lx \n",uiAction );
return FALSE;
}
case SPI_GETDESKWALLPAPER: case SPI_GETDESKWALLPAPER:
{ {
HKEY hKey; HKEY hKey;

View File

@@ -29,9 +29,8 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <user32.h> #include <user32.h>
#define NDEBUG
#include <wine/debug.h> #include <debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(user32);
#define SIZEOF_DEVMODEA_300 124 #define SIZEOF_DEVMODEA_300 124
#define SIZEOF_DEVMODEA_400 148 #define SIZEOF_DEVMODEA_400 148
@@ -68,27 +67,25 @@ EnumDisplayDevicesA(
iDevNum, iDevNum,
&DisplayDeviceW, &DisplayDeviceW,
dwFlags ); dwFlags );
if (!rc)
{ /* Copy result from DisplayDeviceW to lpDisplayDevice */
/* Copy result from DisplayDeviceW to lpDisplayDevice */ lpDisplayDevice->StateFlags = DisplayDeviceW.StateFlags;
lpDisplayDevice->StateFlags = DisplayDeviceW.StateFlags; WideCharToMultiByte(CP_ACP,0,
WideCharToMultiByte(CP_ACP,0, DisplayDeviceW.DeviceName,wcslen(DisplayDeviceW.DeviceName),
DisplayDeviceW.DeviceName,wcslen(DisplayDeviceW.DeviceName), lpDisplayDevice->DeviceName,sizeof(lpDisplayDevice->DeviceName) / sizeof(lpDisplayDevice->DeviceName[0]),
lpDisplayDevice->DeviceName,sizeof(lpDisplayDevice->DeviceName) / sizeof(lpDisplayDevice->DeviceName[0]), NULL,NULL);
NULL,NULL); WideCharToMultiByte(CP_ACP,0,
WideCharToMultiByte(CP_ACP,0, DisplayDeviceW.DeviceString,wcslen(DisplayDeviceW.DeviceString),
DisplayDeviceW.DeviceString,wcslen(DisplayDeviceW.DeviceString), lpDisplayDevice->DeviceString,sizeof(lpDisplayDevice->DeviceString) / sizeof(lpDisplayDevice->DeviceString[0]),
lpDisplayDevice->DeviceString,sizeof(lpDisplayDevice->DeviceString) / sizeof(lpDisplayDevice->DeviceString[0]), NULL,NULL);
NULL,NULL); WideCharToMultiByte(CP_ACP,0,
WideCharToMultiByte(CP_ACP,0, DisplayDeviceW.DeviceID,wcslen(DisplayDeviceW.DeviceID),
DisplayDeviceW.DeviceID,wcslen(DisplayDeviceW.DeviceID), lpDisplayDevice->DeviceID,sizeof(lpDisplayDevice->DeviceID) / sizeof(lpDisplayDevice->DeviceID[0]),
lpDisplayDevice->DeviceID,sizeof(lpDisplayDevice->DeviceID) / sizeof(lpDisplayDevice->DeviceID[0]), NULL,NULL);
NULL,NULL); WideCharToMultiByte(CP_ACP,0,
WideCharToMultiByte(CP_ACP,0, DisplayDeviceW.DeviceKey,wcslen(DisplayDeviceW.DeviceKey),
DisplayDeviceW.DeviceKey,wcslen(DisplayDeviceW.DeviceKey), lpDisplayDevice->DeviceKey,sizeof(lpDisplayDevice->DeviceKey) / sizeof(lpDisplayDevice->DeviceKey[0]),
lpDisplayDevice->DeviceKey,sizeof(lpDisplayDevice->DeviceKey) / sizeof(lpDisplayDevice->DeviceKey[0]), NULL,NULL);
NULL,NULL);
}
RtlFreeUnicodeString ( &Device ); RtlFreeUnicodeString ( &Device );
@@ -118,6 +115,8 @@ EnumDisplayDevicesW(
lpDisplayDevice, lpDisplayDevice,
dwFlags ); dwFlags );
//RtlFreeUnicodeString ( &Device );
return rc; return rc;
} }
@@ -219,8 +218,6 @@ EnumDisplaySettingsExA(
rc = NtUserEnumDisplaySettings ( &DeviceName, iModeNum, &lpDevModeW, rc = NtUserEnumDisplaySettings ( &DeviceName, iModeNum, &lpDevModeW,
dwFlags ); dwFlags );
if (!rc)
goto done;
#define COPYS(f,len) WideCharToMultiByte( CP_THREAD_ACP, 0, lpDevModeW.f, len, (LPSTR)lpDevMode->f, len, NULL, NULL ) #define COPYS(f,len) WideCharToMultiByte( CP_THREAD_ACP, 0, lpDevModeW.f, len, (LPSTR)lpDevMode->f, len, NULL, NULL )
#define COPYN(f) lpDevMode->f = lpDevModeW.f #define COPYN(f) lpDevMode->f = lpDevModeW.f
@@ -369,7 +366,7 @@ GetMonitorInfoA(
NULL, NULL); NULL, NULL);
if (res == 0) if (res == 0)
{ {
WARN("WideCharToMultiByte() failed!\n"); DPRINT("WideCharToMultiByte() failed!\n");
return FALSE; return FALSE;
} }
} }
@@ -508,6 +505,9 @@ ChangeDisplaySettingsExW(
rc = NtUserChangeDisplaySettings ( pDeviceName, lpDevMode, hwnd, dwflags, lParam ); rc = NtUserChangeDisplaySettings ( pDeviceName, lpDevMode, hwnd, dwflags, lParam );
if (lpszDeviceName != NULL)
RtlFreeUnicodeString ( pDeviceName );
return rc; return rc;
} }

View File

@@ -1,11 +1,9 @@
#include <user32.h> #include <user32.h>
#define NDEBUG
#include <wine/debug.h> #include <debug.h>
static ULONG User32TlsIndex; static ULONG User32TlsIndex;
HINSTANCE User32Instance; HINSTANCE User32Instance;
PUSER_HANDLE_TABLE gHandleTable = NULL;
PUSER32_THREAD_DATA PUSER32_THREAD_DATA
User32GetThreadData() User32GetThreadData()
@@ -51,11 +49,7 @@ Init(VOID)
(PVOID)User32SetupDefaultCursors; (PVOID)User32SetupDefaultCursors;
NtCurrentTeb()->ProcessEnvironmentBlock->KernelCallbackTable[USER32_CALLBACK_HOOKPROC] = NtCurrentTeb()->ProcessEnvironmentBlock->KernelCallbackTable[USER32_CALLBACK_HOOKPROC] =
(PVOID)User32CallHookProcFromKernel; (PVOID)User32CallHookProcFromKernel;
{
PW32THREADINFO ti = (PW32THREADINFO)NtCurrentTeb()->Win32ThreadInfo;
PW32PROCESSINFO pi = ti->pi;
gHandleTable = (PUSER_HANDLE_TABLE) pi->UserHandleTable;
}
/* Allocate an index for user32 thread local data. */ /* Allocate an index for user32 thread local data. */
User32TlsIndex = TlsAlloc(); User32TlsIndex = TlsAlloc();
if (User32TlsIndex != TLS_OUT_OF_INDEXES) if (User32TlsIndex != TLS_OUT_OF_INDEXES)
@@ -99,9 +93,6 @@ DllMain(
{ {
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:
User32Instance = hInstanceDll; User32Instance = hInstanceDll;
if (!NtUserRegisterUserModule(hInstanceDll))
return FALSE;
hProcessHeap = RtlGetProcessHeap(); hProcessHeap = RtlGetProcessHeap();
if (!Init()) if (!Init())
return FALSE; return FALSE;
@@ -110,10 +101,6 @@ DllMain(
Cleanup(); Cleanup();
return FALSE; return FALSE;
} }
/* Initialize message spying */
if (!SPY_Init()) return FALSE;
break; break;
case DLL_THREAD_ATTACH: case DLL_THREAD_ATTACH:

View File

@@ -9,8 +9,6 @@
#include <user32.h> #include <user32.h>
#include <wine/debug.h>
/* /*
* Sequence of events: * Sequence of events:
* *

View File

@@ -23,8 +23,8 @@
*/ */
#include <user32.h> #include <user32.h>
#define NDEBUG
#include <wine/debug.h> #include <debug.h>
/* Start of Hack section */ /* Start of Hack section */

View File

@@ -30,8 +30,6 @@
#include <user32.h> #include <user32.h>
#include <wine/debug.h>
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
/* /*
@@ -115,271 +113,3 @@ UpdatePerUserSystemParameters(
{ {
return NtUserUpdatePerUserSystemParameters(dwReserved, bEnable); return NtUserUpdatePerUserSystemParameters(dwReserved, bEnable);
} }
PW32THREADINFO
GetW32ThreadInfo(VOID)
{
PW32THREADINFO ti;
ti = (PW32THREADINFO)NtCurrentTeb()->Win32ThreadInfo;
if (ti == NULL)
{
/* create the W32THREADINFO structure */
NtUserGetThreadState(THREADSTATE_GETTHREADINFO);
ti = (PW32THREADINFO)NtCurrentTeb()->Win32ThreadInfo;
}
return ti;
}
PW32PROCESSINFO
GetW32ProcessInfo(VOID)
{
PW32THREADINFO ti;
PW32PROCESSINFO pi = NULL;
ti = GetW32ThreadInfo();
if (ti != NULL)
{
pi = ti->pi;
}
return pi;
}
/*
* GetUserObjectSecurity
*
* Retrieves security information for user object specified
* with handle 'hObject'. Descriptor returned in self-relative
* format.
*
* Arguments:
* 1) hObject - handle to an object to retrieve information for
* 2) pSecurityInfo - type of information to retrieve
* 3) pSecurityDescriptor - buffer which receives descriptor
* 4) dwLength - size, in bytes, of buffer 'pSecurityDescriptor'
* 5) pdwLengthNeeded - reseives actual size of descriptor
*
* Return Vaules:
* TRUE on success
* FALSE on failure, call GetLastError() for more information
*/
/*
* @implemented
*/
BOOL
WINAPI
GetUserObjectSecurity(
IN HANDLE hObject,
IN PSECURITY_INFORMATION pSecurityInfo,
OUT PSECURITY_DESCRIPTOR pSecurityDescriptor,
IN DWORD dwLength,
OUT PDWORD pdwLengthNeeded
)
{
DWORD dwWin32Error;
NTSTATUS Status;
Status = NtQuerySecurityObject(
hObject, // Object Handle
*pSecurityInfo, // Security Information
pSecurityDescriptor,// Security Descriptor
dwLength, // Buffer Length
pdwLengthNeeded // Actual Length
);
if ( ! NT_SUCCESS( Status ) ) {
dwWin32Error = RtlNtStatusToDosError( Status );
NtCurrentTeb()->LastErrorValue = dwWin32Error;
return FALSE;
}
return TRUE;
}
/*
* SetUserObjectSecurity
*
* Sets new security descriptor to user object specified by
* handle 'hObject'. Descriptor must be in self-relative format.
*
* Arguments:
* 1) hObject - handle to an object to set information for
* 2) pSecurityInfo - type of information to apply
* 3) pSecurityDescriptor - buffer which descriptor to set
*
* Return Vaules:
* TRUE on success
* FALSE on failure, call GetLastError() for more information
*/
/*
* @implemented
*/
BOOL
WINAPI
SetUserObjectSecurity(
IN HANDLE hObject,
IN PSECURITY_INFORMATION pSecurityInfo,
IN PSECURITY_DESCRIPTOR pSecurityDescriptor
)
{
DWORD dwWin32Error;
NTSTATUS Status;
Status = NtSetSecurityObject(
hObject, // Object Handle
*pSecurityInfo, // Security Information
pSecurityDescriptor // Security Descriptor
);
if ( ! NT_SUCCESS( Status ) ) {
dwWin32Error = RtlNtStatusToDosError( Status );
NtCurrentTeb()->LastErrorValue = dwWin32Error;
return FALSE;
}
return TRUE;
}
/*
* @implemented
*/
BOOL
STDCALL
EndTask(
HWND hWnd,
BOOL fShutDown,
BOOL fForce)
{
SendMessageW(hWnd, WM_CLOSE, 0, 0);
if (IsWindow(hWnd))
{
if (fForce)
return DestroyWindow(hWnd);
else
return FALSE;
}
return TRUE;
}
/*
* @implemented
*/
BOOL
STDCALL
IsGUIThread(
BOOL bConvert)
{
PW32THREADINFO ti = (PW32THREADINFO)NtCurrentTeb()->Win32ThreadInfo;
if (ti == NULL)
{
if(bConvert)
{
NtUserGetThreadState(THREADSTATE_GETTHREADINFO);
if ((PW32THREADINFO)NtCurrentTeb()->Win32ThreadInfo) return TRUE;
else
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
}
return FALSE;
}
else
return TRUE;
}
BOOL
FASTCALL
IsMetaFile(HDC hDc)
{
DWORD Type = GetObjectType((HGDIOBJ) hDc);
switch(Type)
{
case OBJ_METADC:
case OBJ_METAFILE:
case OBJ_ENHMETADC:
case OBJ_ENHMETAFILE:
return TRUE;
}
return FALSE;
}
PUSER_HANDLE_ENTRY
FASTCALL
GetUser32Handle(HANDLE handle)
{
PUSER_HANDLE_TABLE ht = gHandleTable;
USHORT generation;
DPRINT1("Main Handle Table %x\n", ht);
INT Index = (((UINT)handle & 0xffff) - FIRST_USER_HANDLE) >> 1;
if (Index < 0 || Index >= ht->nb_handles) return NULL;
if (!ht->handles[Index].type) return NULL;
generation = (UINT)handle >> 16;
if (generation == ht->handles[Index].generation || !generation || generation == 0xffff)
return &ht->handles[Index];
return NULL;
}
//
// Validate Handle and return the pointer to the object.
//
PVOID
FASTCALL
ValidateHandle(HANDLE handle, UINT uType)
{
PW32CLIENTINFO ClientInfo = GetWin32ClientInfo();
if (uType == VALIDATE_TYPE_WIN)
{
if (handle == ClientInfo->hWND) return ClientInfo->pvWND;
}
PUSER_HANDLE_ENTRY pEntry = GetUser32Handle(handle);
// Must have an entry and must be the same type!
if ( (!pEntry) || (pEntry->type != uType) )
{
switch ( uType )
{ // Test (with wine too) confirms these results!
case VALIDATE_TYPE_WIN:
SetLastError(ERROR_INVALID_WINDOW_HANDLE);
break;
case VALIDATE_TYPE_MENU:
SetLastError(ERROR_INVALID_MENU_HANDLE);
break;
case VALIDATE_TYPE_CURSOR:
SetLastError(ERROR_INVALID_CURSOR_HANDLE);
break;
case VALIDATE_TYPE_MWPOS:
SetLastError(ERROR_INVALID_DWP_HANDLE);
break;
case VALIDATE_TYPE_HOOK:
SetLastError(ERROR_INVALID_HOOK_HANDLE);
break;
case VALIDATE_TYPE_ACCEL:
SetLastError(ERROR_INVALID_ACCEL_HANDLE);
break;
default:
SetLastError(ERROR_INVALID_HANDLE);
}
return NULL;
}
if (!(NtUserValidateHandleSecure(handle, FALSE))) return NULL;
return pEntry->ptr;
}

View File

@@ -29,9 +29,8 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <user32.h> #include <user32.h>
#define NDEBUG
#include <wine/debug.h> #include <debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(user32);
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
@@ -97,7 +96,7 @@ GetUserObjectInformationA(
LPWSTR buffer; LPWSTR buffer;
BOOL ret = TRUE; BOOL ret = TRUE;
TRACE("GetUserObjectInformationA(%x %d %x %d %x)\n", hObj, nIndex, DPRINT("GetUserObjectInformationA(%x %d %x %d %x)\n", hObj, nIndex,
pvInfo, nLength, lpnLengthNeeded); pvInfo, nLength, lpnLengthNeeded);
if (nIndex != UOI_NAME && nIndex != UOI_TYPE) if (nIndex != UOI_NAME && nIndex != UOI_TYPE)
@@ -144,7 +143,7 @@ GetUserObjectInformationW(
DWORD nLength, DWORD nLength,
LPDWORD lpnLengthNeeded) LPDWORD lpnLengthNeeded)
{ {
TRACE("GetUserObjectInformationW(%x %d %x %d %x)\n", hObj, nIndex, DPRINT("GetUserObjectInformationW(%x %d %x %d %x)\n", hObj, nIndex,
pvInfo, nLength, lpnLengthNeeded); pvInfo, nLength, lpnLengthNeeded);
return NtUserGetObjectInformation(hObj, nIndex, pvInfo, nLength, lpnLengthNeeded); return NtUserGetObjectInformation(hObj, nIndex, pvInfo, nLength, lpnLengthNeeded);
} }

View File

@@ -1,25 +1,10 @@
#include <user32.h> #include <user32.h>
#include <wine/debug.h>
#ifndef _CFGMGR32_H_
#define CR_SUCCESS 0x00000000
#define CR_OUT_OF_MEMORY 0x00000002
#define CR_INVALID_POINTER 0x00000003
#define CR_INVALID_DATA 0x0000001F
#endif
typedef DWORD STDCALL (*CMP_REGNOTIFY) (HANDLE, LPVOID, DWORD, PULONG);
typedef DWORD STDCALL (*CMP_UNREGNOTIFY) (ULONG );
/* FIXME: Currently IsBadWritePtr is implemented using VirtualQuery which /* FIXME: Currently IsBadWritePtr is implemented using VirtualQuery which
does not seem to work properly for stack address space. */ does not seem to work properly for stack address space. */
/* kill `left-hand operand of comma expression has no effect' warning */ /* kill `left-hand operand of comma expression has no effect' warning */
#define IsBadWritePtr(lp, n) ((DWORD)lp==n?0:0) #define IsBadWritePtr(lp, n) ((DWORD)lp==n?0:0)
static HINSTANCE hSetupApi = NULL;
BOOL STDCALL _InternalLoadString BOOL STDCALL _InternalLoadString
( (
HINSTANCE hInstance, HINSTANCE hInstance,
@@ -111,71 +96,63 @@ int STDCALL LoadStringA
int nBufferMax int nBufferMax
) )
{ {
UNICODE_STRING wstrResStr; UNICODE_STRING wstrResStr;
ANSI_STRING strBuf; ANSI_STRING strBuf;
INT retSize; INT retSize;
/* parameter validation */ /* parameter validation */
if if
( (
(nBufferMax < 1) || (nBufferMax < 1) ||
(IsBadWritePtr(lpBuffer, nBufferMax * sizeof(lpBuffer[0]))) (IsBadWritePtr(lpBuffer, nBufferMax * sizeof(lpBuffer[0])))
) )
{ {
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return 0; return 0;
} }
/* get the UNICODE_STRING descriptor of the in-memory image of the string */ /* get the UNICODE_STRING descriptor of the in-memory image of the string */
if(!_InternalLoadString(hInstance, uID, &wstrResStr)) if(!_InternalLoadString(hInstance, uID, &wstrResStr))
{ /* failure */
/* failure */ return 0;
return 0;
}
/* /*
convert the string. The Unicode string may be in UTF-16 (multi-byte), so we convert the string. The Unicode string may be in UTF-16 (multi-byte), so we
don't alter wstrResStr.Length, and let RtlUnicodeStringToAnsiString truncate don't alter wstrResStr.Length, and let RtlUnicodeStringToAnsiString truncate
it, if necessary it, if necessary
*/ */
strBuf.Length = 0; strBuf.Length = 0;
strBuf.MaximumLength = nBufferMax * sizeof(CHAR); strBuf.MaximumLength = nBufferMax * sizeof(CHAR);
strBuf.Buffer = lpBuffer; strBuf.Buffer = lpBuffer;
retSize = WideCharToMultiByte(CP_ACP, 0, wstrResStr.Buffer, retSize = WideCharToMultiByte(CP_ACP, 0, wstrResStr.Buffer, wstrResStr.Length / sizeof(WCHAR), strBuf.Buffer, strBuf.MaximumLength, NULL, NULL);
wstrResStr.Length / sizeof(WCHAR),
strBuf.Buffer, strBuf.MaximumLength, NULL, NULL);
if(!retSize) if(!retSize)
{ /* failure */
/* failure */ return 0;
return 0; else
} strBuf.Length = retSize;
else
{
strBuf.Length = retSize;
}
/* the ANSI string may not be null-terminated */ /* the ANSI string may not be null-terminated */
if(strBuf.Length >= strBuf.MaximumLength) if(strBuf.Length >= strBuf.MaximumLength)
{ {
/* length greater than the buffer? whatever */ /* length greater than the buffer? whatever */
int nStringLen = strBuf.MaximumLength / sizeof(CHAR) - 1; int nStringLen = strBuf.MaximumLength / sizeof(CHAR) - 1;
/* zero the last character in the buffer */ /* zero the last character in the buffer */
strBuf.Buffer[nStringLen] = 0; strBuf.Buffer[nStringLen] = 0;
/* success */ /* success */
return nStringLen; return nStringLen;
} }
else else
{ {
/* zero the last character in the string */ /* zero the last character in the string */
strBuf.Buffer[strBuf.Length / sizeof(CHAR)] = 0; strBuf.Buffer[strBuf.Length / sizeof(CHAR)] = 0;
/* success */ /* success */
return strBuf.Length / sizeof(CHAR); return strBuf.Length / sizeof(CHAR);
} }
} }
@@ -190,141 +167,41 @@ int STDCALL LoadStringW
int nBufferMax int nBufferMax
) )
{ {
UNICODE_STRING wstrResStr; UNICODE_STRING wstrResStr;
int nStringLen; int nStringLen;
/* parameter validation */ /* parameter validation */
if if
( (
(nBufferMax < 1) || (nBufferMax < 1) ||
((nBufferMax > 0) && IsBadWritePtr(lpBuffer, nBufferMax * sizeof(lpBuffer[0]))) || (IsBadWritePtr(lpBuffer, nBufferMax * sizeof(lpBuffer[0])))
/* undocumented: If nBufferMax is 0, LoadStringW will copy a pointer to the )
in-memory image of the string to the specified buffer and return the length {
of the string in WCHARs */ SetLastError(ERROR_INVALID_PARAMETER);
((nBufferMax == 0) && IsBadWritePtr(lpBuffer, sizeof(lpBuffer))) return 0;
) }
{
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
/* get the UNICODE_STRING descriptor of the in-memory image of the string */ /* get the UNICODE_STRING descriptor of the in-memory image of the string */
if(!_InternalLoadString(hInstance, uID, &wstrResStr)) if(!_InternalLoadString(hInstance, uID, &wstrResStr))
{ /* failure */
/* failure */ return 0;
return 0;
}
/* get the length in characters */ /* get the length in characters */
nStringLen = wstrResStr.Length / sizeof(WCHAR); nStringLen = wstrResStr.Length / sizeof(WCHAR);
if (nBufferMax > 0) /* the buffer must be enough to contain the string and the null terminator */
{ if(nBufferMax < (nStringLen + 1))
/* the buffer must be enough to contain the string and the null terminator */ /* otherwise, the string is truncated */
if(nBufferMax < (nStringLen + 1)) nStringLen = nBufferMax - 1;
{
/* otherwise, the string is truncated */
nStringLen = nBufferMax - 1;
}
/* copy the string */ /* copy the string */
memcpy(lpBuffer, wstrResStr.Buffer, nStringLen * sizeof(WCHAR)); memcpy(lpBuffer, wstrResStr.Buffer, nStringLen * sizeof(WCHAR));
/* null-terminate it */ /* null-terminate it */
lpBuffer[nStringLen] = 0; lpBuffer[nStringLen] = 0;
}
else
{
*((LPWSTR*)lpBuffer) = wstrResStr.Buffer;
}
/* success */
return nStringLen;
}
/* success */
/* return nStringLen;
* @implemented
*/
HDEVNOTIFY
STDCALL
RegisterDeviceNotificationW(
HANDLE hRecipient,
LPVOID NotificationFilter,
DWORD Flags
)
{
DWORD ConfigRet = 0;
CMP_REGNOTIFY RegNotify = NULL;
HDEVNOTIFY hDevNotify = NULL;
if ( hSetupApi == NULL ) hSetupApi = LoadLibraryA("SETUPAPI.DLL");
if ( hSetupApi == NULL ) return NULL;
RegNotify = (CMP_REGNOTIFY) GetProcAddress ( hSetupApi, "CMP_RegisterNotification");
if (RegNotify == NULL)
{
FreeLibrary ( hSetupApi );
hSetupApi = NULL;
return NULL;
}
ConfigRet = RegNotify ( hRecipient, NotificationFilter, Flags, (PULONG) &hDevNotify);
if (ConfigRet != CR_SUCCESS)
{
switch (ConfigRet)
{
case CR_OUT_OF_MEMORY:
SetLastError (ERROR_NOT_ENOUGH_MEMORY);
break;
case CR_INVALID_POINTER:
SetLastError (ERROR_INVALID_PARAMETER);
break;
case CR_INVALID_DATA:
SetLastError (ERROR_INVALID_DATA);
break;
default:
SetLastError (ERROR_SERVICE_SPECIFIC_ERROR);
break;
}
}
return hDevNotify;
}
/*
* @implemented
*/
BOOL
STDCALL
UnregisterDeviceNotification(
HDEVNOTIFY Handle)
{
DWORD ConfigRet = 0;
CMP_UNREGNOTIFY UnRegNotify = NULL;
if ( hSetupApi == NULL ) hSetupApi = LoadLibraryA("SETUPAPI.DLL");
if ( hSetupApi == NULL ) return FALSE;
UnRegNotify = (CMP_UNREGNOTIFY) GetProcAddress ( hSetupApi, "CMP_UnregisterNotification");
if (UnRegNotify == NULL)
{
FreeLibrary ( hSetupApi );
hSetupApi = NULL;
return FALSE;
}
ConfigRet = UnRegNotify ( (ULONG) Handle );
if (ConfigRet != CR_SUCCESS)
{
switch (ConfigRet)
{
case CR_INVALID_POINTER:
SetLastError (ERROR_INVALID_PARAMETER);
break;
case CR_INVALID_DATA:
SetLastError (ERROR_INVALID_DATA);
break;
default:
SetLastError (ERROR_SERVICE_SPECIFIC_ERROR);
break;
}
return FALSE;
}
return TRUE;
} }
/* EOF */ /* EOF */

View File

@@ -2,8 +2,6 @@
#include <user32.h> #include <user32.h>
#include <wine/debug.h>
typedef struct tagHEAP_STRING_POOLA typedef struct tagHEAP_STRING_POOLA
{ {
char* data; char* data;

View File

@@ -11,8 +11,8 @@
*/ */
#include <user32.h> #include <user32.h>
#define NDEBUG
#include <wine/debug.h> #include <debug.h>
/* /*
* @unimplemented * @unimplemented
@@ -105,6 +105,19 @@ LockWorkStation(VOID)
} }
/*
* @unimplemented
*/
BOOL
STDCALL
UnregisterDeviceNotification(
HDEVNOTIFY Handle)
{
UNIMPLEMENTED;
return FALSE;
}
/* /*
* @unimplemented * @unimplemented
*/ */
@@ -134,6 +147,31 @@ SetDebugErrorLevel( DWORD dwLevel )
DbgPrint("(%ld): stub\n", dwLevel); DbgPrint("(%ld): stub\n", dwLevel);
} }
/* EOF */
/*
* @implemented
*/
BOOL
STDCALL
EndTask(
HWND hWnd,
BOOL fShutDown,
BOOL fForce)
{
SendMessageW(hWnd, WM_CLOSE, 0, 0);
if (IsWindow(hWnd))
{
if (fForce)
return DestroyWindow(hWnd);
else
return FALSE;
}
return TRUE;
}
/* /*
* @unimplemented * @unimplemented
@@ -233,8 +271,37 @@ DragObject(
return NtUserDragObject(hwnd1, hwnd2, u1, dw1, hc1); return NtUserDragObject(hwnd1, hwnd2, u1, dw1, hc1);
} }
/*
* @unimplemented
*/
BOOL
STDCALL
GetUserObjectSecurity(
HANDLE hObj,
PSECURITY_INFORMATION pSIRequested,
PSECURITY_DESCRIPTOR pSID,
DWORD nLength,
LPDWORD lpnLengthNeeded
)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @unimplemented
*/
BOOL
STDCALL
SetUserObjectSecurity(
HANDLE hObj,
PSECURITY_INFORMATION pSIRequested,
PSECURITY_DESCRIPTOR pSID
)
{
UNIMPLEMENTED;
return FALSE;
}
/* /*
* @unimplemented * @unimplemented
@@ -255,7 +322,7 @@ WINAPI
SetSysColorsTemp( SetSysColorsTemp(
const COLORREF *pPens, const COLORREF *pPens,
const HBRUSH *pBrushes, const HBRUSH *pBrushes,
INT n INT n
) )
{ {
UNIMPLEMENTED; UNIMPLEMENTED;
@@ -317,6 +384,21 @@ ClientThreadSetup ( VOID )
return FALSE; return FALSE;
} }
/*
* @unimplemented
*/
HDEVNOTIFY
STDCALL
RegisterDeviceNotificationW(
HANDLE hRecipient,
LPVOID NotificationFilter,
DWORD Flags
)
{
UNIMPLEMENTED;
return FALSE;
}
/* /*
* @unimplemented * @unimplemented
*/ */
@@ -366,6 +448,21 @@ CsrBroadcastSystemMessageExW(
return FALSE; return FALSE;
} }
/*
* @unimplemented
*/
HDEVNOTIFY
STDCALL
RegisterDeviceNotificationA(
HANDLE hRecipient,
LPVOID NotificationFilter,
DWORD Flags
)
{
UNIMPLEMENTED;
return FALSE;
}
/* /*
* @unimplemented * @unimplemented
*/ */
@@ -496,6 +593,18 @@ GetRegisteredRawInputDevices(
return FALSE; return FALSE;
} }
/*
* @unimplemented
*/
BOOL
STDCALL
IsGUIThread(
BOOL bConvert)
{
UNIMPLEMENTED;
return FALSE;
}
/* /*
* @unimplemented * @unimplemented
*/ */

View File

@@ -30,7 +30,6 @@
#include <user32.h> #include <user32.h>
#include <wine/debug.h>
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/

View File

@@ -30,8 +30,6 @@
#include <user32.h> #include <user32.h>
#include <wine/debug.h>
/* WinHelp internal structure */ /* WinHelp internal structure */
typedef struct typedef struct
{ {

View File

@@ -11,8 +11,6 @@
#include <user32.h> #include <user32.h>
#include <wine/debug.h>
/* /*
* @implemented * @implemented
*/ */
@@ -73,7 +71,7 @@ CreateWindowStationW(LPWSTR lpwinsta,
return NtUserCreateWindowStation(&WindowStationName, return NtUserCreateWindowStation(&WindowStationName,
dwDesiredAccess, dwDesiredAccess,
lpsa, 0, 0, 0, 0); lpsa, 0, 0, 0);
} }
/* /*

View File

@@ -33,11 +33,6 @@
#include <user32.h> #include <user32.h>
#include <wine/debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(string);
#define WPRINTF_LEFTALIGN 0x0001 /* Align output on the left ('-' prefix) */ #define WPRINTF_LEFTALIGN 0x0001 /* Align output on the left ('-' prefix) */
#define WPRINTF_PREFIX_HEX 0x0002 /* Prefix hex with 0x ('#' prefix) */ #define WPRINTF_PREFIX_HEX 0x0002 /* Prefix hex with 0x ('#' prefix) */
#define WPRINTF_ZEROPAD 0x0004 /* Pad with zeros ('0' prefix) */ #define WPRINTF_ZEROPAD 0x0004 /* Pad with zeros ('0' prefix) */
@@ -487,7 +482,7 @@ static INT wvsnprintfW( LPWSTR buffer, UINT maxlen, LPCWSTR spec, va_list args )
* wvsprintfA (USER32.@) * wvsprintfA (USER32.@)
* @implemented * @implemented
*/ */
INT WINAPI wvsprintfA( LPSTR buffer, LPCSTR spec, va_list args ) INT STDCALL wvsprintfA( LPSTR buffer, LPCSTR spec, va_list args )
{ {
INT res = wvsnprintfA( buffer, 1024, spec, args ); INT res = wvsnprintfA( buffer, 1024, spec, args );
return ( res == -1 ) ? 1024 : res; return ( res == -1 ) ? 1024 : res;
@@ -498,7 +493,7 @@ INT WINAPI wvsprintfA( LPSTR buffer, LPCSTR spec, va_list args )
* wvsprintfW (USER32.@) * wvsprintfW (USER32.@)
* @implemented * @implemented
*/ */
INT WINAPI wvsprintfW( LPWSTR buffer, LPCWSTR spec, va_list args ) INT STDCALL wvsprintfW( LPWSTR buffer, LPCWSTR spec, va_list args )
{ {
INT res = wvsnprintfW( buffer, 1024, spec, args ); INT res = wvsnprintfW( buffer, 1024, spec, args );
return ( res == -1 ) ? 1024 : res; return ( res == -1 ) ? 1024 : res;
@@ -508,7 +503,7 @@ INT WINAPI wvsprintfW( LPWSTR buffer, LPCWSTR spec, va_list args )
* wsprintfA (USER32.@) * wsprintfA (USER32.@)
* @implemented * @implemented
*/ */
INT WINAPIV wsprintfA( LPSTR buffer, LPCSTR spec, ... ) INT CDECL wsprintfA( LPSTR buffer, LPCSTR spec, ... )
{ {
va_list valist; va_list valist;
INT res; INT res;
@@ -523,7 +518,7 @@ INT WINAPIV wsprintfA( LPSTR buffer, LPCSTR spec, ... )
* wsprintfW (USER32.@) * wsprintfW (USER32.@)
* @implemented * @implemented
*/ */
INT WINAPIV wsprintfW( LPWSTR buffer, LPCWSTR spec, ... ) INT CDECL wsprintfW( LPWSTR buffer, LPCWSTR spec, ... )
{ {
va_list valist; va_list valist;
INT res; INT res;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 518 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 326 B

View File

@@ -1,7 +1,7 @@
LIBRARY user32.dll LIBRARY user32.dll
EXPORTS EXPORTS
ActivateKeyboardLayout@8=NtUserActivateKeyboardLayout@8 ActivateKeyboardLayout@8
AdjustWindowRect@12 AdjustWindowRect@12
AdjustWindowRectEx@16 AdjustWindowRectEx@16
AlignRects@16 AlignRects@16
@@ -85,7 +85,7 @@ CreateCursor@28
CreateDesktopA@24 CreateDesktopA@24
CreateDesktopW@24 CreateDesktopW@24
CreateDialogIndirectParamA@20 CreateDialogIndirectParamA@20
CreateDialogIndirectParamAorW@24 CreateDialogIndirectParamAorW@20
CreateDialogIndirectParamW@20 CreateDialogIndirectParamW@20
CreateDialogParamA@20 CreateDialogParamA@20
CreateDialogParamW@20 CreateDialogParamW@20
@@ -158,7 +158,7 @@ DestroyMenu@4
DestroyWindow@4 DestroyWindow@4
;DeviceEventWorker ;DeviceEventWorker
DialogBoxIndirectParamA@20 DialogBoxIndirectParamA@20
DialogBoxIndirectParamAorW@24 DialogBoxIndirectParamAorW@20
DialogBoxIndirectParamW@20 DialogBoxIndirectParamW@20
DialogBoxParamA@20 DialogBoxParamA@20
DialogBoxParamW@20 DialogBoxParamW@20
@@ -295,7 +295,7 @@ GetKeyNameTextA@12
GetKeyNameTextW@12 GetKeyNameTextW@12
GetKeyState@4 GetKeyState@4
GetKeyboardLayout@4 GetKeyboardLayout@4
GetKeyboardLayoutList@8=NtUserGetKeyboardLayoutList@8 GetKeyboardLayoutList@8
GetKeyboardLayoutNameA@4 GetKeyboardLayoutNameA@4
GetKeyboardLayoutNameW@4 GetKeyboardLayoutNameW@4
GetKeyboardState@4 GetKeyboardState@4
@@ -387,7 +387,7 @@ GetWindowThreadProcessId@8
GetWindowWord@8 GetWindowWord@8
GrayStringA@36 GrayStringA@36
GrayStringW@36 GrayStringW@36
HideCaret@4=NtUserHideCaret@4 HideCaret@4
HiliteMenuItem@16 HiliteMenuItem@16
IMPGetIMEA@8 IMPGetIMEA@8
IMPGetIMEW@8 IMPGetIMEW@8
@@ -407,7 +407,7 @@ InsertMenuItemW@16
InsertMenuW@20 InsertMenuW@20
InternalGetWindowText@12 InternalGetWindowText@12
IntersectRect@12 IntersectRect@12
InvalidateRect@12=NtUserInvalidateRect@12 InvalidateRect@12
InvalidateRgn@12 InvalidateRgn@12
InvertRect@8 InvertRect@8
IsCharAlphaA@4 IsCharAlphaA@4
@@ -549,7 +549,7 @@ RegisterClassExW@4
RegisterClassW@4 RegisterClassW@4
RegisterClipboardFormatA@4 RegisterClipboardFormatA@4
RegisterClipboardFormatW@4 RegisterClipboardFormatW@4
RegisterDeviceNotificationA@12=RegisterDeviceNotificationW@12 RegisterDeviceNotificationA@12
RegisterDeviceNotificationW@12 RegisterDeviceNotificationW@12
RegisterHotKey@16 RegisterHotKey@16
RegisterLogonProcess@8 RegisterLogonProcess@8
@@ -662,7 +662,7 @@ SetWindowsHookA@8
SetWindowsHookExA@16 SetWindowsHookExA@16
SetWindowsHookExW@16 SetWindowsHookExW@16
SetWindowsHookW@8 SetWindowsHookW@8
ShowCaret@4=NtUserShowCaret@4 ShowCaret@4
ShowCursor@4 ShowCursor@4
ShowOwnedPopups@8 ShowOwnedPopups@8
ShowScrollBar@12 ShowScrollBar@12
@@ -697,13 +697,13 @@ UnhookWinEvent@4
UnhookWindowsHook@8 UnhookWindowsHook@8
UnhookWindowsHookEx@4 UnhookWindowsHookEx@4
UnionRect@12 UnionRect@12
UnloadKeyboardLayout@4=NtUserUnloadKeyboardLayout@4 UnloadKeyboardLayout@4
UnlockWindowStation@4 UnlockWindowStation@4
UnpackDDElParam@16 UnpackDDElParam@16
UnregisterClassA@8 UnregisterClassA@8
UnregisterClassW@8 UnregisterClassW@8
UnregisterDeviceNotification@4 UnregisterDeviceNotification@4
UnregisterHotKey@8=NtUserUnregisterHotKey@8 UnregisterHotKey@8
UnregisterMessagePumpHook@0 UnregisterMessagePumpHook@0
UnregisterUserApiHook@0 UnregisterUserApiHook@0
UpdateLayeredWindow@36 UpdateLayeredWindow@36

View File

@@ -13,9 +13,7 @@
<library>gdi32</library> <library>gdi32</library>
<library>kernel32</library> <library>kernel32</library>
<library>advapi32</library> <library>advapi32</library>
<library>imm32</library>
<library>win32ksys</library> <library>win32ksys</library>
<directory name="include"> <directory name="include">
<pch>user32.h</pch> <pch>user32.h</pch>
</directory> </directory>
@@ -71,7 +69,6 @@
<file>paint.c</file> <file>paint.c</file>
<file>prop.c</file> <file>prop.c</file>
<file>rect.c</file> <file>rect.c</file>
<file>spy.c</file>
<file>text.c</file> <file>text.c</file>
<file>window.c</file> <file>window.c</file>
<file>winpos.c</file> <file>winpos.c</file>

View File

@@ -19,26 +19,6 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// Cursors // Cursors
// //
/* New cursor resources */
100 CURSOR "resources/ocr_normal.cur"
101 CURSOR "resources/ocr_ibeam.cur"
102 CURSOR "resources/ocr_wait.cur"
103 CURSOR "resources/ocr_cross.cur"
104 CURSOR "resources/ocr_up.cur"
105 CURSOR "resources/ocr_sizenwse.cur"
106 CURSOR "resources/ocr_sizenesw.cur"
107 CURSOR "resources/ocr_sizewe.cur"
108 CURSOR "resources/ocr_sizens.cur"
109 CURSOR "resources/ocr_sizeall.cur"
110 CURSOR "resources/ocr_no.cur"
111 CURSOR "resources/ocr_appstarting.cur"
112 CURSOR "resources/ocr_help.cur"
113 CURSOR "resources/ocr_pen.cur"
114 CURSOR "resources/ocr_hand.cur"
115 CURSOR "resources/ocr_icon.cur"
116 CURSOR "resources/ocr_cdautostart.cur"
/* Compatible cursor resources (will be removed) */
32512 CURSOR "resources/ocr_normal.cur" 32512 CURSOR "resources/ocr_normal.cur"
32513 CURSOR "resources/ocr_ibeam.cur" 32513 CURSOR "resources/ocr_ibeam.cur"
32514 CURSOR "resources/ocr_wait.cur" 32514 CURSOR "resources/ocr_wait.cur"
@@ -83,19 +63,13 @@ OBM_MNARROW BITMAP "resources/obm_mnarrow.bmp"
// Languages // Languages
// //
#include "En.rc"
#include "Da.rc" #include "Da.rc"
#include "De.rc" #include "De.rc"
#include "En.rc"
#include "Es.rc"
#include "Fr.rc" #include "Fr.rc"
#include "Hu.rc"
#include "Id.rc"
#include "Ja.rc"
#include "Nl.rc" #include "Nl.rc"
#include "No.rc"
#include "Pl.rc" #include "Pl.rc"
#include "Ru.rc" #include "Ja.rc"
#include "Sk.rc"
#include "Sv.rc" #include "Sv.rc"
#include "Uk.rc" #include "Hu.rc"
#include "Gr.rc" #include "Es.rc"

View File

@@ -31,8 +31,6 @@
#include <user32.h> #include <user32.h>
#include <wine/debug.h>
/* this is the 8 byte accel struct used in Win32 resources (internal only) */ /* this is the 8 byte accel struct used in Win32 resources (internal only) */
typedef struct typedef struct
{ {
@@ -187,9 +185,6 @@ BOOL WINAPI DestroyAcceleratorTable(HACCEL hAccel)
U32_ACCEL_CACHE_ENTRY ** ppEntry; U32_ACCEL_CACHE_ENTRY ** ppEntry;
ULONG_PTR nUsage = 0; ULONG_PTR nUsage = 0;
if (!hAccel)
return FALSE;
EnterCriticalSection(&U32AccelCacheLock); EnterCriticalSection(&U32AccelCacheLock);
/* see if this accelerator table has been cached */ /* see if this accelerator table has been cached */
@@ -233,7 +228,7 @@ HACCEL WINAPI LoadAcceleratorsW(HINSTANCE hInstance, LPCWSTR lpTableName)
return U32LoadAccelerators return U32LoadAccelerators
( (
hInstance, hInstance,
FindResourceExW(hInstance, (LPCWSTR) RT_ACCELERATOR, lpTableName, 0) FindResourceExW(hInstance, MAKEINTRESOURCEW(RT_ACCELERATOR), lpTableName, 0)
); );
} }
@@ -245,7 +240,7 @@ HACCEL WINAPI LoadAcceleratorsA(HINSTANCE hInstance, LPCSTR lpTableName)
{ {
HRSRC Accel; HRSRC Accel;
Accel = FindResourceExA(hInstance, (LPCSTR) RT_ACCELERATOR, lpTableName, 0); Accel = FindResourceExA(hInstance, MAKEINTRESOURCEA(RT_ACCELERATOR), lpTableName, 0);
if (NULL == Accel) if (NULL == Accel)
{ {
return NULL; return NULL;
@@ -284,8 +279,6 @@ int WINAPI CopyAcceleratorTableW
*/ */
HACCEL WINAPI CreateAcceleratorTableW(LPACCEL lpaccl, int cEntries) HACCEL WINAPI CreateAcceleratorTableW(LPACCEL lpaccl, int cEntries)
{ {
if (!cEntries || !lpaccl) return (HACCEL)0;
return NtUserCreateAcceleratorTable(lpaccl, cEntries); return NtUserCreateAcceleratorTable(lpaccl, cEntries);
} }
@@ -331,8 +324,6 @@ HACCEL WINAPI CreateAcceleratorTableA(LPACCEL lpaccl, int cEntries)
{ {
int i; int i;
if (!cEntries || !lpaccl) return (HACCEL)0;
for(i = 0; i < cEntries; ++ i) for(i = 0; i < cEntries; ++ i)
if(!lpaccl[i].fVirt) if(!lpaccl[i].fVirt)
{ {

View File

@@ -30,9 +30,6 @@
#include <user32.h> #include <user32.h>
#include <wine/debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(user32);
#include "pshpack1.h" #include "pshpack1.h"
typedef struct { typedef struct {
@@ -187,8 +184,9 @@ LoadCursorIconImage(
UINT fuLoad, UINT fuLoad,
ULONG uType) ULONG uType)
{ {
HRSRC hResInfo;
HANDLE hResource; HANDLE hResource;
HANDLE h2Resource;
HANDLE hfRes;
HANDLE hFile; HANDLE hFile;
HANDLE hSection; HANDLE hSection;
CURSORICONFILEDIR *IconDIR; CURSORICONFILEDIR *IconDIR;
@@ -211,64 +209,54 @@ LoadCursorIconImage(
if (hinst == NULL) if (hinst == NULL)
hinst = User32Instance; hinst = User32Instance;
hResInfo = FindResourceW(hinst, lpszName, hResource = hfRes = FindResourceW(hinst, lpszName,
Icon ? RT_GROUP_ICON : RT_GROUP_CURSOR); Icon ? RT_GROUP_ICON : RT_GROUP_CURSOR);
if (hResInfo == NULL) if (hResource == NULL)
return NULL; return NULL;
hResource = LoadResource(hinst, hResInfo); if (fuLoad & LR_SHARED)
{
hIcon = NtUserFindExistingCursorIcon(hinst, (HRSRC)hfRes, width, height);
if (hIcon)
return hIcon;
}
hResource = LoadResource(hinst, hResource);
if (hResource == NULL) if (hResource == NULL)
return NULL; return NULL;
IconResDir = LockResource(hResource); IconResDir = LockResource(hResource);
if (IconResDir == NULL) if (IconResDir == NULL)
{
return NULL; return NULL;
}
/* Find the best fitting in the IconResDir for this resolution */ /*
* Find the best fitting in the IconResDir for this resolution
*/
id = LookupIconIdFromDirectoryEx((PBYTE)IconResDir, Icon, width, height, id = LookupIconIdFromDirectoryEx((PBYTE)IconResDir, Icon, width, height,
fuLoad & (LR_DEFAULTCOLOR | LR_MONOCHROME)); fuLoad & (LR_DEFAULTCOLOR | LR_MONOCHROME));
hResInfo = FindResourceW(hinst, MAKEINTRESOURCEW(id), h2Resource = FindResourceW(hinst, MAKEINTRESOURCEW(id),
Icon ? (LPCWSTR) RT_ICON : Icon ? MAKEINTRESOURCEW(RT_ICON) :
(LPCWSTR) RT_CURSOR); MAKEINTRESOURCEW(RT_CURSOR));
if (hResInfo == NULL) if (h2Resource == NULL)
{
return NULL; return NULL;
}
/* Now we have found the icon we want to load. hResource = LoadResource(hinst, h2Resource);
* Let's see if we already loaded it */
if (fuLoad & LR_SHARED)
{
hIcon = NtUserFindExistingCursorIcon(hinst, hResInfo, 0, 0);
if (hIcon)
{
return hIcon;
}
}
hResource = LoadResource(hinst, hResInfo);
if (hResource == NULL) if (hResource == NULL)
{
return NULL; return NULL;
}
ResIcon = LockResource(hResource); ResIcon = LockResource(hResource);
if (ResIcon == NULL) if (ResIcon == NULL)
{
return NULL; return NULL;
}
hIcon = CreateIconFromResourceEx((PBYTE)ResIcon, hIcon = CreateIconFromResourceEx((PBYTE)ResIcon,
SizeofResource(hinst, hResInfo), SizeofResource(hinst, h2Resource),
Icon, 0x00030000, width, height, Icon, 0x00030000, width, height,
fuLoad & (LR_DEFAULTCOLOR | LR_MONOCHROME)); fuLoad & (LR_DEFAULTCOLOR | LR_MONOCHROME));
if (hIcon && 0 != (fuLoad & LR_SHARED)) if (hIcon && 0 != (fuLoad & LR_SHARED))
{ {
NtUserSetCursorIconData((HICON)hIcon, NULL, NULL, hinst, hResInfo, NtUserSetCursorIconData((HICON)hIcon, NULL, NULL, hinst, (HRSRC)hfRes,
(HRSRC)NULL); (HRSRC)NULL);
} }
@@ -572,211 +560,46 @@ CopyImage(
IN INT desiredy, IN INT desiredy,
IN UINT flags) IN UINT flags)
{ {
/* HBITMAP res;
* BUGS BITMAP bm;
* Only Windows NT 4.0 supports the LR_COPYRETURNORG flag for bitmaps,
* all other versions (95/2000/XP have been tested) ignore it.
*
* NOTES
* If LR_CREATEDIBSECTION is absent, the copy will be monochrome for
* a monochrome source bitmap or if LR_MONOCHROME is present, otherwise
* the copy will have the same depth as the screen.
* The content of the image will only be copied if the bit depth of the
* original image is compatible with the bit depth of the screen, or
* if the source is a DIB section.
* The LR_MONOCHROME flag is ignored if LR_CREATEDIBSECTION is present.
*/
switch (type) switch (type)
{ {
case IMAGE_BITMAP: case IMAGE_BITMAP:
{ {
HBITMAP res = NULL; DbgPrint("WARNING: Incomplete implementation of CopyImage!\n");
DIBSECTION ds; /*
int objSize; * FIXME: Support flags LR_COPYDELETEORG, LR_COPYFROMRESOURCE,
BITMAPINFO * bi; * LR_COPYRETURNORG, LR_CREATEDIBSECTION and LR_MONOCHROME.
*/
objSize = GetObjectW( hnd, sizeof(ds), &ds ); if (!GetObjectW(hnd, sizeof(bm), &bm))
if (!objSize) return 0; return NULL;
if ((desiredx < 0) || (desiredy < 0)) return 0; bm.bmBits = NULL;
if ((res = CreateBitmapIndirect(&bm)))
if (flags & LR_COPYFROMRESOURCE)
{ {
FIXME("FIXME: The flag LR_COPYFROMRESOURCE is not implemented for bitmaps\n"); char *buf = HeapAlloc(GetProcessHeap(), 0, bm.bmWidthBytes * bm.bmHeight);
if (buf == NULL)
{
DeleteObject(res);
return NULL;
}
GetBitmapBits(hnd, bm.bmWidthBytes * bm.bmHeight, buf);
SetBitmapBits(res, bm.bmWidthBytes * bm.bmHeight, buf);
HeapFree(GetProcessHeap(), 0, buf);
} }
if (desiredx == 0) desiredx = ds.dsBm.bmWidth;
if (desiredy == 0) desiredy = ds.dsBm.bmHeight;
/* Allocate memory for a BITMAPINFOHEADER structure and a
color table. The maximum number of colors in a color table
is 256 which corresponds to a bitmap with depth 8.
Bitmaps with higher depths don't have color tables. */
bi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
if (!bi) return 0;
bi->bmiHeader.biSize = sizeof(bi->bmiHeader);
bi->bmiHeader.biPlanes = ds.dsBm.bmPlanes;
bi->bmiHeader.biBitCount = ds.dsBm.bmBitsPixel;
bi->bmiHeader.biCompression = BI_RGB;
if (flags & LR_CREATEDIBSECTION)
{
/* Create a DIB section. LR_MONOCHROME is ignored */
void * bits;
HDC dc = CreateCompatibleDC(NULL);
if (objSize == sizeof(DIBSECTION))
{
/* The source bitmap is a DIB.
Get its attributes to create an exact copy */
memcpy(bi, &ds.dsBmih, sizeof(BITMAPINFOHEADER));
}
/* Get the color table or the color masks */
GetDIBits(dc, hnd, 0, ds.dsBm.bmHeight, NULL, bi, DIB_RGB_COLORS);
bi->bmiHeader.biWidth = desiredx;
bi->bmiHeader.biHeight = desiredy;
bi->bmiHeader.biSizeImage = 0;
res = CreateDIBSection(dc, bi, DIB_RGB_COLORS, &bits, NULL, 0);
DeleteDC(dc);
}
else
{
/* Create a device-dependent bitmap */
BOOL monochrome = (flags & LR_MONOCHROME);
if (objSize == sizeof(DIBSECTION))
{
/* The source bitmap is a DIB section.
Get its attributes */
HDC dc = CreateCompatibleDC(NULL);
bi->bmiHeader.biSize = sizeof(bi->bmiHeader);
bi->bmiHeader.biBitCount = ds.dsBm.bmBitsPixel;
GetDIBits(dc, hnd, 0, ds.dsBm.bmHeight, NULL, bi, DIB_RGB_COLORS);
DeleteDC(dc);
if (!monochrome && ds.dsBm.bmBitsPixel == 1)
{
/* Look if the colors of the DIB are black and white */
monochrome =
(bi->bmiColors[0].rgbRed == 0xff
&& bi->bmiColors[0].rgbGreen == 0xff
&& bi->bmiColors[0].rgbBlue == 0xff
&& bi->bmiColors[0].rgbReserved == 0
&& bi->bmiColors[1].rgbRed == 0
&& bi->bmiColors[1].rgbGreen == 0
&& bi->bmiColors[1].rgbBlue == 0
&& bi->bmiColors[1].rgbReserved == 0)
||
(bi->bmiColors[0].rgbRed == 0
&& bi->bmiColors[0].rgbGreen == 0
&& bi->bmiColors[0].rgbBlue == 0
&& bi->bmiColors[0].rgbReserved == 0
&& bi->bmiColors[1].rgbRed == 0xff
&& bi->bmiColors[1].rgbGreen == 0xff
&& bi->bmiColors[1].rgbBlue == 0xff
&& bi->bmiColors[1].rgbReserved == 0);
}
}
else if (!monochrome)
{
monochrome = ds.dsBm.bmBitsPixel == 1;
}
if (monochrome)
{
res = CreateBitmap(desiredx, desiredy, 1, 1, NULL);
}
else
{
HDC screenDC = GetDC(NULL);
res = CreateCompatibleBitmap(screenDC, desiredx, desiredy);
ReleaseDC(NULL, screenDC);
}
}
if (res)
{
/* Only copy the bitmap if it's a DIB section or if it's
compatible to the screen */
BOOL copyContents;
if (objSize == sizeof(DIBSECTION))
{
copyContents = TRUE;
}
else
{
HDC screenDC = GetDC(NULL);
int screen_depth = GetDeviceCaps(screenDC, BITSPIXEL);
ReleaseDC(NULL, screenDC);
copyContents = (ds.dsBm.bmBitsPixel == 1 || ds.dsBm.bmBitsPixel == screen_depth);
}
if (copyContents)
{
/* The source bitmap may already be selected in a device context,
use GetDIBits/StretchDIBits and not StretchBlt */
HDC dc;
void * bits;
dc = CreateCompatibleDC(NULL);
bi->bmiHeader.biWidth = ds.dsBm.bmWidth;
bi->bmiHeader.biHeight = ds.dsBm.bmHeight;
bi->bmiHeader.biSizeImage = 0;
bi->bmiHeader.biClrUsed = 0;
bi->bmiHeader.biClrImportant = 0;
/* Fill in biSizeImage */
GetDIBits(dc, hnd, 0, ds.dsBm.bmHeight, NULL, bi, DIB_RGB_COLORS);
bits = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, bi->bmiHeader.biSizeImage);
if (bits)
{
HBITMAP oldBmp;
/* Get the image bits of the source bitmap */
GetDIBits(dc, hnd, 0, ds.dsBm.bmHeight, bits, bi, DIB_RGB_COLORS);
/* Copy it to the destination bitmap */
oldBmp = SelectObject(dc, res);
StretchDIBits(dc, 0, 0, desiredx, desiredy,
0, 0, ds.dsBm.bmWidth, ds.dsBm.bmHeight,
bits, bi, DIB_RGB_COLORS, SRCCOPY);
SelectObject(dc, oldBmp);
HeapFree(GetProcessHeap(), 0, bits);
}
DeleteDC(dc);
}
if (flags & LR_COPYDELETEORG)
{
DeleteObject(hnd);
}
}
HeapFree(GetProcessHeap(), 0, bi);
return res; return res;
} }
case IMAGE_ICON: case IMAGE_ICON:
{ {
static BOOL IconMsgDisplayed = FALSE; static BOOL IconMsgDisplayed = FALSE;
/* FIXME: support loading the image as shared from an instance */ /* FIXME: support loading the image as shared from an instance */
if (!IconMsgDisplayed) if (!IconMsgDisplayed)
{ {
FIXME("FIXME: CopyImage doesn't support IMAGE_ICON correctly!\n"); DbgPrint("FIXME: CopyImage doesn't support IMAGE_ICON correctly!\n");
IconMsgDisplayed = TRUE; IconMsgDisplayed = TRUE;
} }
return CopyIcon(hnd); return CopyIcon(hnd);
// return CURSORICON_ExtCopy(hnd,type, desiredx, desiredy, flags);
} }
case IMAGE_CURSOR: case IMAGE_CURSOR:
@@ -785,16 +608,12 @@ CopyImage(
/* FIXME: support loading the image as shared from an instance */ /* FIXME: support loading the image as shared from an instance */
if (!IconMsgDisplayed) if (!IconMsgDisplayed)
{ {
FIXME("FIXME: CopyImage doesn't support IMAGE_CURSOR correctly!\n"); DbgPrint("FIXME: CopyImage doesn't support IMAGE_CURSOR correctly!\n");
IconMsgDisplayed = TRUE; IconMsgDisplayed = TRUE;
} }
/* Should call CURSORICON_ExtCopy but more testing
* needs to be done before we change this
*/
if (flags) FIXME("FIXME: Flags are ignored\n");
return CopyCursor(hnd); return CopyCursor(hnd);
} }
} }
return NULL; return NULL;
} }

View File

@@ -30,7 +30,6 @@
#include <user32.h> #include <user32.h>
#include <wine/debug.h>
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
void DrawCaret(HWND hWnd, PTHRDCARETINFO CaretInfo) void DrawCaret(HWND hWnd, PTHRDCARETINFO CaretInfo)
@@ -103,6 +102,16 @@ GetCaretPos(LPPOINT lpPoint)
} }
/*
* @implemented
*/
BOOL STDCALL
HideCaret(HWND hWnd)
{
return NtUserShowCaret(hWnd, FALSE);
}
/* /*
* @implemented * @implemented
*/ */
@@ -124,4 +133,13 @@ SetCaretPos(int X,
} }
/*
* @implemented
*/
BOOL STDCALL
ShowCaret(HWND hWnd)
{
return NtUserShowCaret(hWnd, TRUE);
}
/* EOF */ /* EOF */

View File

@@ -1,8 +1,8 @@
/* $Id$ /* $Id$
* *
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll * PROJECT: ReactOS user32.dll
* COPYRIGHT: GPL - See COPYING in the top level directory * FILE: lib/user32/windows/class.c
* FILE: dll/win32/user32/windows/class.c
* PURPOSE: Window classes * PURPOSE: Window classes
* PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net) * PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
* UPDATE HISTORY: * UPDATE HISTORY:
@@ -11,10 +11,117 @@
#include <user32.h> #include <user32.h>
#include <wine/debug.h> static BOOL GetClassInfoExCommon(
WINE_DEFAULT_DEBUG_CHANNEL(user32); HINSTANCE hInst,
LPCWSTR lpszClass,
LPWNDCLASSEXW lpwcx,
BOOL unicode)
{
LPWSTR str;
UNICODE_STRING str2, str3;
WNDCLASSEXW w;
BOOL retval;
NTSTATUS Status;
if ( !lpszClass || !lpwcx )
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if(IS_ATOM(lpszClass))
str = (LPWSTR)lpszClass;
else
{
extern BOOL ControlsInitialized;
if (unicode)
{
str = HEAP_strdupW ( lpszClass, wcslen(lpszClass) );
if ( !str )
{
SetLastError (ERROR_OUTOFMEMORY);
return FALSE;
}
}
else
{
Status = HEAP_strdupAtoW(&str, (LPCSTR)lpszClass, NULL);
if (! NT_SUCCESS(Status))
{
SetLastError(RtlNtStatusToDosError(Status));
return FALSE;
}
}
/* Register built-in controls if not already done */
if ( !ControlsInitialized )
{
ControlsInitialized = ControlsInit(str);
}
}
str2.Length = str3.Length = 0;
str2.MaximumLength = str3.MaximumLength = 255;
str2.Buffer = (PWSTR)HEAP_alloc ( str2.MaximumLength * sizeof(WCHAR) );
if ( !str2.Buffer )
{
SetLastError (ERROR_OUTOFMEMORY);
if ( !IS_ATOM(str) )
HEAP_free ( str );
return FALSE;
}
str3.Buffer = (PWSTR)HEAP_alloc ( str3.MaximumLength * sizeof(WCHAR) );
if ( !str3.Buffer )
{
SetLastError (ERROR_OUTOFMEMORY);
HEAP_free ( str2.Buffer );
if ( !IS_ATOM(str) )
HEAP_free ( str );
return FALSE;
}
w.lpszMenuName = (LPCWSTR)&str2;
w.lpszClassName = (LPCWSTR)&str3;
/* get info about system classes? */
if (!hInst) hInst = User32Instance;
retval = (BOOL)NtUserGetClassInfo(hInst, str, &w, TRUE, 0);
w.hInstance = (hInst == User32Instance) ? 0 : hInst;
if ( !IS_ATOM(str) )
HEAP_free(str);
RtlCopyMemory ( lpwcx, &w, sizeof(WNDCLASSEXW) );
if ( !IS_INTRESOURCE(w.lpszMenuName) && w.lpszMenuName )
{
if (unicode)
lpwcx->lpszMenuName = heap_string_poolW ( str2.Buffer, str2.Length );
else
((LPWNDCLASSEXA) lpwcx)->lpszMenuName = heap_string_poolA ( str2.Buffer, str2.Length );
}
if ( !IS_ATOM(w.lpszClassName) && w.lpszClassName )
{
if (unicode)
lpwcx->lpszClassName = heap_string_poolW ( str3.Buffer, str3.Length );
else
((LPWNDCLASSEXA) lpwcx)->lpszClassName = heap_string_poolA ( str3.Buffer, str3.Length );
}
HEAP_free ( str2.Buffer );
HEAP_free ( str3.Buffer );
return retval;
}
extern BOOL ControlsInitialized;
/* /*
* @implemented * @implemented
@@ -22,63 +129,11 @@ extern BOOL ControlsInitialized;
BOOL BOOL
STDCALL STDCALL
GetClassInfoExA( GetClassInfoExA(
HINSTANCE hInstance, HINSTANCE hinst,
LPCSTR lpszClass, LPCSTR lpszClass,
LPWNDCLASSEXA lpwcx) LPWNDCLASSEXA lpwcx)
{ {
UNICODE_STRING ClassName = {0}; return GetClassInfoExCommon(hinst, (LPWSTR)lpszClass, (LPWNDCLASSEXW)lpwcx, FALSE);
BOOL Ret;
TRACE("%p class/atom: %s/%04x %p\n", hInstance,
IS_ATOM(lpszClass) ? NULL : lpszClass,
IS_ATOM(lpszClass) ? lpszClass : 0,
lpwcx);
//HACKHACK: This is ROS-specific and should go away
lpwcx->cbSize = sizeof(*lpwcx);
if (hInstance == User32Instance)
{
hInstance = NULL;
}
if (lpszClass == NULL)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (IS_ATOM(lpszClass))
{
ClassName.Buffer = (PWSTR)((ULONG_PTR)lpszClass);
}
else
{
if (!RtlCreateUnicodeStringFromAsciiz(&ClassName,
lpszClass))
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
}
/* Register built-in controls if not already done */
if (! ControlsInitialized)
{
ControlsInitialized = ControlsInit(ClassName.Buffer);
}
Ret = NtUserGetClassInfo(hInstance,
&ClassName,
(LPWNDCLASSEXW)lpwcx,
TRUE);
if (!IS_ATOM(lpszClass))
{
RtlFreeUnicodeString(&ClassName);
}
return Ret;
} }
@@ -88,51 +143,11 @@ GetClassInfoExA(
BOOL BOOL
STDCALL STDCALL
GetClassInfoExW( GetClassInfoExW(
HINSTANCE hInstance, HINSTANCE hinst,
LPCWSTR lpszClass, LPCWSTR lpszClass,
LPWNDCLASSEXW lpwcx) LPWNDCLASSEXW lpwcx)
{ {
UNICODE_STRING ClassName = {0}; return GetClassInfoExCommon(hinst, lpszClass, lpwcx, TRUE);
TRACE("%p class/atom: %S/%04x %p\n", hInstance,
IS_ATOM(lpszClass) ? NULL : lpszClass,
IS_ATOM(lpszClass) ? lpszClass : 0,
lpwcx);
//HACKHACK: This is ROS-specific and should go away
lpwcx->cbSize = sizeof(*lpwcx);
if (hInstance == User32Instance)
{
hInstance = NULL;
}
if (lpszClass == NULL)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (IS_ATOM(lpszClass))
{
ClassName.Buffer = (PWSTR)((ULONG_PTR)lpszClass);
}
else
{
RtlInitUnicodeString(&ClassName,
lpszClass);
}
/* Register built-in controls if not already done */
if (! ControlsInitialized)
{
ControlsInitialized = ControlsInit(ClassName.Buffer);
}
return NtUserGetClassInfo(hInstance,
&ClassName,
lpwcx,
FALSE);
} }
@@ -146,25 +161,21 @@ GetClassInfoA(
LPCSTR lpClassName, LPCSTR lpClassName,
LPWNDCLASSA lpWndClass) LPWNDCLASSA lpWndClass)
{ {
WNDCLASSEXA wcex; WNDCLASSEXA w;
BOOL retval; BOOL retval;
retval = GetClassInfoExA(hInstance, lpClassName, &wcex); if ( !lpClassName || !lpWndClass )
if (retval) {
{ SetLastError(ERROR_INVALID_PARAMETER);
lpWndClass->style = wcex.style; return FALSE;
lpWndClass->lpfnWndProc = wcex.lpfnWndProc; }
lpWndClass->cbClsExtra = wcex.cbClsExtra;
lpWndClass->cbWndExtra = wcex.cbWndExtra;
lpWndClass->hInstance = wcex.hInstance;
lpWndClass->hIcon = wcex.hIcon;
lpWndClass->hCursor = wcex.hCursor;
lpWndClass->hbrBackground = wcex.hbrBackground;
lpWndClass->lpszMenuName = wcex.lpszMenuName;
lpWndClass->lpszClassName = wcex.lpszClassName;
}
return retval; retval = GetClassInfoExA(hInstance,lpClassName,&w);
if (retval)
{
RtlCopyMemory ( lpWndClass, &w.style, sizeof(WNDCLASSA) );
}
return retval;
} }
/* /*
@@ -177,34 +188,27 @@ GetClassInfoW(
LPCWSTR lpClassName, LPCWSTR lpClassName,
LPWNDCLASSW lpWndClass) LPWNDCLASSW lpWndClass)
{ {
WNDCLASSEXW wcex; WNDCLASSEXW w;
BOOL retval; BOOL retval;
retval = GetClassInfoExW(hInstance, lpClassName, &wcex); if(!lpClassName || !lpWndClass)
if (retval) {
{ SetLastError(ERROR_INVALID_PARAMETER);
lpWndClass->style = wcex.style; return FALSE;
lpWndClass->lpfnWndProc = wcex.lpfnWndProc; }
lpWndClass->cbClsExtra = wcex.cbClsExtra;
lpWndClass->cbWndExtra = wcex.cbWndExtra; retval = GetClassInfoExW(hInstance,lpClassName,&w);
lpWndClass->hInstance = wcex.hInstance; RtlCopyMemory (lpWndClass,&w.style,sizeof(WNDCLASSW));
lpWndClass->hIcon = wcex.hIcon; return retval;
lpWndClass->hCursor = wcex.hCursor;
lpWndClass->hbrBackground = wcex.hbrBackground;
lpWndClass->lpszMenuName = wcex.lpszMenuName;
lpWndClass->lpszClassName = wcex.lpszClassName;
}
return retval;
} }
/* /*
* @implemented * @implemented
*/ */
DWORD STDCALL DWORD STDCALL
GetClassLongA(HWND hWnd, int nIndex) GetClassLongA(HWND hWnd, int nIndex)
{ {
TRACE("%p %d\n", hWnd, nIndex);
switch (nIndex) switch (nIndex)
{ {
case GCL_HBRBACKGROUND: case GCL_HBRBACKGROUND:
@@ -215,6 +219,16 @@ GetClassLongA(HWND hWnd, int nIndex)
return hBrush; return hBrush;
} }
case GCL_MENUNAME:
{
PUNICODE_STRING Name;
Name = (PUNICODE_STRING)NtUserGetClassLong(hWnd, nIndex, TRUE);
if (IS_INTRESOURCE(Name))
return (DWORD)Name;
else
return (DWORD)heap_string_poolA(Name->Buffer, Name->Length);
}
default: default:
return NtUserGetClassLong(hWnd, nIndex, TRUE); return NtUserGetClassLong(hWnd, nIndex, TRUE);
} }
@@ -226,8 +240,6 @@ GetClassLongA(HWND hWnd, int nIndex)
DWORD STDCALL DWORD STDCALL
GetClassLongW ( HWND hWnd, int nIndex ) GetClassLongW ( HWND hWnd, int nIndex )
{ {
TRACE("%p %d\n", hWnd, nIndex);
switch (nIndex) switch (nIndex)
{ {
case GCL_HBRBACKGROUND: case GCL_HBRBACKGROUND:
@@ -238,6 +250,16 @@ GetClassLongW ( HWND hWnd, int nIndex )
return hBrush; return hBrush;
} }
case GCL_MENUNAME:
{
PUNICODE_STRING Name;
Name = (PUNICODE_STRING)NtUserGetClassLong(hWnd, nIndex, FALSE);
if (IS_INTRESOURCE(Name))
return (DWORD)Name;
else
return (DWORD)heap_string_poolW(Name->Buffer, Name->Length);
}
default: default:
return NtUserGetClassLong(hWnd, nIndex, FALSE); return NtUserGetClassLong(hWnd, nIndex, FALSE);
} }
@@ -253,22 +275,25 @@ GetClassNameA(
LPSTR lpClassName, LPSTR lpClassName,
int nMaxCount) int nMaxCount)
{ {
ANSI_STRING ClassName; int result;
int Result; LPWSTR ClassNameW;
NTSTATUS Status;
ClassName.MaximumLength = nMaxCount; if(!lpClassName)
ClassName.Buffer = lpClassName; return 0;
Result = NtUserGetClassName(hWnd, ClassNameW = HEAP_alloc ( (nMaxCount+1)*sizeof(WCHAR) );
(PUNICODE_STRING)&ClassName,
TRUE);
TRACE("%p class/atom: %s/%04x %x\n", hWnd, result = NtUserGetClassName ( hWnd, ClassNameW, nMaxCount );
IS_ATOM(lpClassName) ? NULL : lpClassName,
IS_ATOM(lpClassName) ? lpClassName : 0,
nMaxCount);
return Result; Status = HEAP_strcpyWtoA ( lpClassName, ClassNameW, result );
HEAP_free ( ClassNameW );
if ( !NT_SUCCESS(Status) )
return 0;
return result;
} }
@@ -282,22 +307,7 @@ GetClassNameW(
LPWSTR lpClassName, LPWSTR lpClassName,
int nMaxCount) int nMaxCount)
{ {
UNICODE_STRING ClassName; return NtUserGetClassName(hWnd, lpClassName, nMaxCount);
int Result;
ClassName.MaximumLength = nMaxCount;
ClassName.Buffer = lpClassName;
Result = NtUserGetClassName(hWnd,
&ClassName,
FALSE);
TRACE("%p class/atom: %S/%04x %x\n", hWnd,
IS_ATOM(lpClassName) ? NULL : lpClassName,
IS_ATOM(lpClassName) ? lpClassName : 0,
nMaxCount);
return Result;
} }
@@ -313,8 +323,6 @@ GetClassWord(
* NOTE: Obsoleted in 32-bit windows * NOTE: Obsoleted in 32-bit windows
*/ */
{ {
TRACE("%p %x\n", hWnd, nIndex);
if ((nIndex < 0) && (nIndex != GCW_ATOM)) if ((nIndex < 0) && (nIndex != GCW_ATOM))
return 0; return 0;
@@ -423,12 +431,12 @@ CreateSmallIcon(HICON StdIcon)
SmallIconHeight = GetSystemMetrics(SM_CYSMICON); SmallIconHeight = GetSystemMetrics(SM_CYSMICON);
if (! GetIconInfo(StdIcon, &StdInfo)) if (! GetIconInfo(StdIcon, &StdInfo))
{ {
ERR("Failed to get icon info for icon 0x%x\n", StdIcon); DPRINT1("Failed to get icon info for icon 0x%x\n", StdIcon);
goto cleanup; goto cleanup;
} }
if (! GetObjectW(StdInfo.hbmMask, sizeof(BITMAP), &StdBitmapInfo)) if (! GetObjectW(StdInfo.hbmMask, sizeof(BITMAP), &StdBitmapInfo))
{ {
ERR("Failed to get bitmap info for icon 0x%x bitmap 0x%x\n", DPRINT1("Failed to get bitmap info for icon 0x%x bitmap 0x%x\n",
StdIcon, StdInfo.hbmColor); StdIcon, StdInfo.hbmColor);
goto cleanup; goto cleanup;
} }
@@ -445,71 +453,71 @@ CreateSmallIcon(HICON StdIcon)
hInfoDc = CreateICW(NULL, NULL, NULL, NULL); hInfoDc = CreateICW(NULL, NULL, NULL, NULL);
if (NULL == hInfoDc) if (NULL == hInfoDc)
{ {
ERR("Failed to create info DC\n"); DPRINT1("Failed to create info DC\n");
goto cleanup; goto cleanup;
} }
hSourceDc = CreateCompatibleDC(NULL); hSourceDc = CreateCompatibleDC(NULL);
if (NULL == hSourceDc) if (NULL == hSourceDc)
{ {
ERR("Failed to create source DC\n"); DPRINT1("Failed to create source DC\n");
goto cleanup; goto cleanup;
} }
hDestDc = CreateCompatibleDC(NULL); hDestDc = CreateCompatibleDC(NULL);
if (NULL == hDestDc) if (NULL == hDestDc)
{ {
ERR("Failed to create dest DC\n"); DPRINT1("Failed to create dest DC\n");
goto cleanup; goto cleanup;
} }
OldSourceBitmap = SelectObject(hSourceDc, StdInfo.hbmColor); OldSourceBitmap = SelectObject(hSourceDc, StdInfo.hbmColor);
if (NULL == OldSourceBitmap) if (NULL == OldSourceBitmap)
{ {
ERR("Failed to select source color bitmap\n"); DPRINT1("Failed to select source color bitmap\n");
goto cleanup; goto cleanup;
} }
SmallInfo.hbmColor = CreateCompatibleBitmap(hInfoDc, SmallIconWidth, SmallInfo.hbmColor = CreateCompatibleBitmap(hInfoDc, SmallIconWidth,
SmallIconHeight); SmallIconHeight);
if (NULL == SmallInfo.hbmColor) if (NULL == SmallInfo.hbmColor)
{ {
ERR("Failed to create color bitmap\n"); DPRINT1("Failed to create color bitmap\n");
goto cleanup; goto cleanup;
} }
OldDestBitmap = SelectObject(hDestDc, SmallInfo.hbmColor); OldDestBitmap = SelectObject(hDestDc, SmallInfo.hbmColor);
if (NULL == OldDestBitmap) if (NULL == OldDestBitmap)
{ {
ERR("Failed to select dest color bitmap\n"); DPRINT1("Failed to select dest color bitmap\n");
goto cleanup; goto cleanup;
} }
if (! StretchBlt(hDestDc, 0, 0, SmallIconWidth, SmallIconHeight, if (! StretchBlt(hDestDc, 0, 0, SmallIconWidth, SmallIconHeight,
hSourceDc, 0, 0, StdBitmapInfo.bmWidth, hSourceDc, 0, 0, StdBitmapInfo.bmWidth,
StdBitmapInfo.bmHeight, SRCCOPY)) StdBitmapInfo.bmHeight, SRCCOPY))
{ {
ERR("Failed to stretch color bitmap\n"); DPRINT1("Failed to stretch color bitmap\n");
goto cleanup; goto cleanup;
} }
if (NULL == SelectObject(hSourceDc, StdInfo.hbmMask)) if (NULL == SelectObject(hSourceDc, StdInfo.hbmMask))
{ {
ERR("Failed to select source mask bitmap\n"); DPRINT1("Failed to select source mask bitmap\n");
goto cleanup; goto cleanup;
} }
SmallInfo.hbmMask = CreateBitmap(SmallIconWidth, SmallIconHeight, 1, 1, SmallInfo.hbmMask = CreateBitmap(SmallIconWidth, SmallIconHeight, 1, 1,
NULL); NULL);
if (NULL == SmallInfo.hbmMask) if (NULL == SmallInfo.hbmMask)
{ {
ERR("Failed to create mask bitmap\n"); DPRINT1("Failed to create mask bitmap\n");
goto cleanup; goto cleanup;
} }
if (NULL == SelectObject(hDestDc, SmallInfo.hbmMask)) if (NULL == SelectObject(hDestDc, SmallInfo.hbmMask))
{ {
ERR("Failed to select dest mask bitmap\n"); DPRINT1("Failed to select dest mask bitmap\n");
goto cleanup; goto cleanup;
} }
if (! StretchBlt(hDestDc, 0, 0, SmallIconWidth, SmallIconHeight, if (! StretchBlt(hDestDc, 0, 0, SmallIconWidth, SmallIconHeight,
hSourceDc, 0, 0, StdBitmapInfo.bmWidth, hSourceDc, 0, 0, StdBitmapInfo.bmWidth,
StdBitmapInfo.bmHeight, SRCCOPY)) StdBitmapInfo.bmHeight, SRCCOPY))
{ {
ERR("Failed to stretch mask bitmap\n"); DPRINT1("Failed to stretch mask bitmap\n");
goto cleanup; goto cleanup;
} }
@@ -519,7 +527,7 @@ CreateSmallIcon(HICON StdIcon)
SmallIcon = CreateIconIndirect(&SmallInfo); SmallIcon = CreateIconIndirect(&SmallInfo);
if (NULL == SmallIcon) if (NULL == SmallIcon)
{ {
ERR("Failed to create icon\n"); DPRINT1("Failed to create icon\n");
goto cleanup; goto cleanup;
} }
@@ -565,8 +573,8 @@ RegisterClassExA(CONST WNDCLASSEXA *lpwcx)
RTL_ATOM Atom; RTL_ATOM Atom;
WNDCLASSEXA WndClass; WNDCLASSEXA WndClass;
UNICODE_STRING ClassName; UNICODE_STRING ClassName;
UNICODE_STRING MenuName = {0}; UNICODE_STRING MenuName;
HMENU hMenu = NULL; HMENU hMenu;
if (lpwcx == NULL || lpwcx->cbSize != sizeof(WNDCLASSEXA) || if (lpwcx == NULL || lpwcx->cbSize != sizeof(WNDCLASSEXA) ||
lpwcx->cbClsExtra < 0 || lpwcx->cbWndExtra < 0 || lpwcx->cbClsExtra < 0 || lpwcx->cbWndExtra < 0 ||
@@ -601,22 +609,17 @@ RegisterClassExA(CONST WNDCLASSEXA *lpwcx)
WndClass.hIconSm = CreateSmallIcon(WndClass.hIcon); WndClass.hIconSm = CreateSmallIcon(WndClass.hIcon);
} }
if (WndClass.lpszMenuName != NULL) if HIWORD(lpwcx->lpszMenuName)
{ {
if (!IS_INTRESOURCE(WndClass.lpszMenuName)) hMenu = 0;
{ RtlCreateUnicodeStringFromAsciiz(&MenuName, WndClass.lpszMenuName);
if (WndClass.lpszMenuName[0]) }
{ else
RtlCreateUnicodeStringFromAsciiz(&MenuName, WndClass.lpszMenuName); {
} MenuName.Length =
} MenuName.MaximumLength = 0;
else MenuName.Buffer = (LPWSTR)WndClass.lpszMenuName;
{ hMenu = LoadMenuA(WndClass.hInstance, lpwcx->lpszMenuName);
MenuName.Buffer = (LPWSTR)WndClass.lpszMenuName;
}
if (MenuName.Buffer != NULL)
hMenu = LoadMenuA(WndClass.hInstance, WndClass.lpszMenuName);
} }
if (IS_ATOM(WndClass.lpszClassName)) if (IS_ATOM(WndClass.lpszClassName))
@@ -624,24 +627,22 @@ RegisterClassExA(CONST WNDCLASSEXA *lpwcx)
ClassName.Length = ClassName.Length =
ClassName.MaximumLength = 0; ClassName.MaximumLength = 0;
ClassName.Buffer = (LPWSTR)WndClass.lpszClassName; ClassName.Buffer = (LPWSTR)WndClass.lpszClassName;
} } else
else
{ {
RtlCreateUnicodeStringFromAsciiz(&ClassName, WndClass.lpszClassName); RtlCreateUnicodeStringFromAsciiz(&ClassName, WndClass.lpszClassName);
} }
Atom = NtUserRegisterClassEx((WNDCLASSEXW*)&WndClass, Atom = NtUserRegisterClassExWOW(
&ClassName, (WNDCLASSEXW*)&WndClass,
&MenuName, &ClassName,
NULL, &ClassName,
REGISTERCLASS_ANSI, &MenuName,
hMenu); NULL,
REGISTERCLASS_ANSI,
0,
hMenu);
TRACE("atom=%04x wndproc=%p hinst=%p bg=%p style=%08x clsExt=%d winExt=%d class=%p\n", if (!IS_ATOM(WndClass.lpszMenuName))
Atom, lpwcx->lpfnWndProc, lpwcx->hInstance, lpwcx->hbrBackground,
lpwcx->style, lpwcx->cbClsExtra, lpwcx->cbWndExtra, WndClass);
if (!IS_INTRESOURCE(WndClass.lpszMenuName))
RtlFreeUnicodeString(&MenuName); RtlFreeUnicodeString(&MenuName);
if (!IS_ATOM(WndClass.lpszClassName)) if (!IS_ATOM(WndClass.lpszClassName))
RtlFreeUnicodeString(&ClassName); RtlFreeUnicodeString(&ClassName);
@@ -655,11 +656,10 @@ RegisterClassExA(CONST WNDCLASSEXA *lpwcx)
ATOM STDCALL ATOM STDCALL
RegisterClassExW(CONST WNDCLASSEXW *lpwcx) RegisterClassExW(CONST WNDCLASSEXW *lpwcx)
{ {
ATOM Atom;
WNDCLASSEXW WndClass; WNDCLASSEXW WndClass;
UNICODE_STRING ClassName; UNICODE_STRING ClassName;
UNICODE_STRING MenuName = {0}; UNICODE_STRING MenuName;
HMENU hMenu = NULL; HMENU hMenu;
if (lpwcx == NULL || lpwcx->cbSize != sizeof(WNDCLASSEXW) || if (lpwcx == NULL || lpwcx->cbSize != sizeof(WNDCLASSEXW) ||
lpwcx->cbClsExtra < 0 || lpwcx->cbWndExtra < 0 || lpwcx->cbClsExtra < 0 || lpwcx->cbWndExtra < 0 ||
@@ -694,22 +694,17 @@ RegisterClassExW(CONST WNDCLASSEXW *lpwcx)
WndClass.hIconSm = CreateSmallIcon(WndClass.hIcon); WndClass.hIconSm = CreateSmallIcon(WndClass.hIcon);
} }
if (WndClass.lpszMenuName != NULL) if HIWORD(lpwcx->lpszMenuName)
{ {
if (!IS_INTRESOURCE(WndClass.lpszMenuName)) hMenu = 0;
{ RtlInitUnicodeString(&MenuName, WndClass.lpszMenuName);
if (WndClass.lpszMenuName[0]) }
{ else
RtlInitUnicodeString(&MenuName, WndClass.lpszMenuName); {
} MenuName.Length =
} MenuName.MaximumLength = 0;
else MenuName.Buffer = (LPWSTR)WndClass.lpszMenuName;
{ hMenu = LoadMenuW(WndClass.hInstance, lpwcx->lpszMenuName);
MenuName.Buffer = (LPWSTR)WndClass.lpszMenuName;
}
if (MenuName.Buffer != NULL)
hMenu = LoadMenuW(WndClass.hInstance, WndClass.lpszMenuName);
} }
if (IS_ATOM(WndClass.lpszClassName)) if (IS_ATOM(WndClass.lpszClassName))
@@ -717,24 +712,20 @@ RegisterClassExW(CONST WNDCLASSEXW *lpwcx)
ClassName.Length = ClassName.Length =
ClassName.MaximumLength = 0; ClassName.MaximumLength = 0;
ClassName.Buffer = (LPWSTR)WndClass.lpszClassName; ClassName.Buffer = (LPWSTR)WndClass.lpszClassName;
} } else
else
{ {
RtlInitUnicodeString(&ClassName, WndClass.lpszClassName); RtlInitUnicodeString(&ClassName, WndClass.lpszClassName);
} }
Atom = (ATOM)NtUserRegisterClassEx(&WndClass, return (ATOM)NtUserRegisterClassExWOW(
&ClassName, &WndClass,
&MenuName, &ClassName,
NULL, &ClassName,
0, &MenuName,
hMenu); NULL,
0,
TRACE("atom=%04x wndproc=%p hinst=%p bg=%p style=%08x clsExt=%d winExt=%d class=%p\n", 0,
Atom, lpwcx->lpfnWndProc, lpwcx->hInstance, lpwcx->hbrBackground, hMenu);
lpwcx->style, lpwcx->cbClsExtra, lpwcx->cbWndExtra, WndClass);
return Atom;
} }
/* /*
@@ -778,67 +769,42 @@ RegisterClassW(CONST WNDCLASSW *lpWndClass)
*/ */
DWORD DWORD
STDCALL STDCALL
SetClassLongA (HWND hWnd, SetClassLongA (
int nIndex, HWND hWnd,
LONG dwNewLong) int nIndex,
LONG dwNewLong)
{ {
PSTR lpStr = (PSTR)dwNewLong; UNICODE_STRING str2buf;
UNICODE_STRING Value = {0}; PUNICODE_STRING str;
BOOL Allocated = FALSE; PUNICODE_STRING str2 = &str2buf;
DWORD Ret;
TRACE("%p %d %lx\n", hWnd, nIndex, dwNewLong); if ( nIndex != GCL_MENUNAME )
{
return NtUserSetClassLong ( hWnd, nIndex, dwNewLong, TRUE );
}
if ( IS_INTRESOURCE(dwNewLong) )
{
str2 = (PUNICODE_STRING)dwNewLong;
}
else
{
RtlCreateUnicodeStringFromAsciiz ( &str2buf,(LPSTR)dwNewLong );
}
/* FIXME - portability!!!! */ str = (PUNICODE_STRING)NtUserSetClassLong(hWnd, nIndex, (DWORD)str2, TRUE);
if (nIndex == GCL_MENUNAME && lpStr != NULL) if ( !IS_INTRESOURCE(dwNewLong) )
{ {
if (!IS_INTRESOURCE(lpStr)) RtlFreeUnicodeString ( str2 );
{ }
if (!RtlCreateUnicodeStringFromAsciiz(&Value, if ( IS_INTRESOURCE(str) )
lpStr)) {
{ return (DWORD)str;
SetLastError(ERROR_NOT_ENOUGH_MEMORY); }
return 0; else
} {
return (DWORD)heap_string_poolA ( str->Buffer, str->Length );
Allocated = TRUE; }
}
else
Value.Buffer = (PWSTR)lpStr;
dwNewLong = (LONG)&Value;
}
else if (nIndex == GCW_ATOM && lpStr != NULL)
{
if (!IS_ATOM(lpStr))
{
if (!RtlCreateUnicodeStringFromAsciiz(&Value,
lpStr))
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return 0;
}
Allocated = TRUE;
}
else
Value.Buffer = (PWSTR)lpStr;
dwNewLong = (LONG)&Value;
}
Ret = (DWORD)NtUserSetClassLong(hWnd,
nIndex,
dwNewLong,
TRUE);
if (Allocated)
{
RtlFreeUnicodeString(&Value);
}
return Ret;
} }
@@ -847,46 +813,42 @@ SetClassLongA (HWND hWnd,
*/ */
DWORD DWORD
STDCALL STDCALL
SetClassLongW(HWND hWnd, SetClassLongW(
int nIndex, HWND hWnd,
LONG dwNewLong) int nIndex,
LONG dwNewLong)
{ {
PWSTR lpStr = (PWSTR)dwNewLong; UNICODE_STRING str2buf;
UNICODE_STRING Value = {0}; PUNICODE_STRING str;
PUNICODE_STRING str2 = &str2buf;
TRACE("%p %d %lx\n", hWnd, nIndex, dwNewLong); if (nIndex != GCL_MENUNAME )
{
return NtUserSetClassLong ( hWnd, nIndex, dwNewLong, FALSE );
}
if ( IS_INTRESOURCE(dwNewLong) )
{
str2 = (PUNICODE_STRING)dwNewLong;
}
else
{
RtlCreateUnicodeString ( &str2buf, (LPWSTR)dwNewLong );
}
/* FIXME - portability!!!! */ str = (PUNICODE_STRING)NtUserSetClassLong(hWnd, nIndex, (DWORD)str2, TRUE);
if (nIndex == GCL_MENUNAME && lpStr != NULL) if ( !IS_INTRESOURCE(dwNewLong) )
{ {
if (!IS_INTRESOURCE(lpStr)) RtlFreeUnicodeString(str2);
{ }
RtlInitUnicodeString(&Value, if ( IS_INTRESOURCE(str) )
lpStr); {
} return (DWORD)str;
else }
Value.Buffer = lpStr; else
{
dwNewLong = (LONG)&Value; return (DWORD)heap_string_poolW ( str->Buffer, str->Length );
} }
else if (nIndex == GCW_ATOM && lpStr != NULL)
{
if (!IS_ATOM(lpStr))
{
RtlInitUnicodeString(&Value,
lpStr);
}
else
Value.Buffer = lpStr;
dwNewLong = (LONG)&Value;
}
return (DWORD)NtUserSetClassLong(hWnd,
nIndex,
dwNewLong,
FALSE);
} }
@@ -906,7 +868,7 @@ SetClassWord(
if ((nIndex < 0) && (nIndex != GCW_ATOM)) if ((nIndex < 0) && (nIndex != GCW_ATOM))
return 0; return 0;
return (WORD) SetClassLongW ( hWnd, nIndex, wNewWord ); return (WORD) NtUserSetClassLong ( hWnd, nIndex, wNewWord, TRUE );
} }
@@ -947,37 +909,28 @@ UnregisterClassA(
LPCSTR lpClassName, LPCSTR lpClassName,
HINSTANCE hInstance) HINSTANCE hInstance)
{ {
UNICODE_STRING ClassName = {0}; LPWSTR ClassName;
NTSTATUS Status; NTSTATUS Status;
BOOL Ret; BOOL Result;
TRACE("class/atom: %s/%04x %p\n", if(!IS_ATOM(lpClassName))
IS_ATOM(lpClassName) ? NULL : lpClassName, {
IS_ATOM(lpClassName) ? lpClassName : 0, Status = HEAP_strdupAtoW(&ClassName, lpClassName, NULL);
hInstance); if(!NT_SUCCESS(Status))
if (!IS_ATOM(lpClassName))
{ {
Status = HEAP_strdupAtoW(&ClassName.Buffer, lpClassName, NULL); SetLastError(RtlNtStatusToDosError(Status));
if (!NT_SUCCESS(Status)) return FALSE;
{
SetLastError(RtlNtStatusToDosError(Status));
return FALSE;
}
RtlInitUnicodeString(&ClassName,
ClassName.Buffer);
} }
else }
ClassName.Buffer = (PWSTR)((ULONG_PTR)lpClassName); else
ClassName = (LPWSTR)lpClassName;
Ret = NtUserUnregisterClass(&ClassName, Result = (BOOL)NtUserUnregisterClass((LPCWSTR)ClassName, hInstance, 0);
hInstance);
if(!IS_ATOM(lpClassName) && ClassName.Buffer != NULL) if(ClassName && !IS_ATOM(lpClassName))
HEAP_free(ClassName.Buffer); HEAP_free(ClassName);
return Ret; return Result;
} }
@@ -990,23 +943,7 @@ UnregisterClassW(
LPCWSTR lpClassName, LPCWSTR lpClassName,
HINSTANCE hInstance) HINSTANCE hInstance)
{ {
UNICODE_STRING ClassName = {0}; return (BOOL)NtUserUnregisterClass(lpClassName, hInstance, 0);
TRACE("class/atom: %S/%04x %p\n",
IS_ATOM(lpClassName) ? NULL : lpClassName,
IS_ATOM(lpClassName) ? lpClassName : 0,
hInstance);
if (!IS_ATOM(lpClassName))
{
RtlInitUnicodeString(&ClassName,
lpClassName);
}
else
ClassName.Buffer = (PWSTR)((ULONG_PTR)lpClassName);
return NtUserUnregisterClass(&ClassName,
hInstance);
} }
/* EOF */ /* EOF */

View File

@@ -1,25 +1,37 @@
/*
* ReactOS kernel
* Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id$ /* $Id$
* *
* PROJECT: ReactOS user32.dll * PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/clipboard.c * FILE: lib/user32/windows/clipboard.c
* PURPOSE: Input * PURPOSE: Input
* PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net) * PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
* Pablo Borobia <pborobia@gmail.com>
* UPDATE HISTORY: * UPDATE HISTORY:
* 09-05-2001 CSH Created * 09-05-2001 CSH Created
*
*/ */
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <user32.h> #include <user32.h>
#define NDEBUG #define NDEBUG
#include <debug.h>
#include <wine/debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(user32);
#define QUERY_SIZE 0
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
@@ -29,8 +41,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(user32);
BOOL STDCALL BOOL STDCALL
OpenClipboard(HWND hWndNewOwner) OpenClipboard(HWND hWndNewOwner)
{ {
BOOL ret = NtUserOpenClipboard(hWndNewOwner, 0); return NtUserOpenClipboard(hWndNewOwner, 0);
return ret;
} }
/* /*
@@ -39,9 +50,7 @@ OpenClipboard(HWND hWndNewOwner)
BOOL STDCALL BOOL STDCALL
CloseClipboard(VOID) CloseClipboard(VOID)
{ {
BOOL ret; return NtUserCloseClipboard();
ret = NtUserCloseClipboard();
return ret;
} }
/* /*
@@ -50,8 +59,7 @@ CloseClipboard(VOID)
INT STDCALL INT STDCALL
CountClipboardFormats(VOID) CountClipboardFormats(VOID)
{ {
INT ret = NtUserCountClipboardFormats(); return NtUserCountClipboardFormats();
return ret;
} }
/* /*
@@ -60,7 +68,7 @@ CountClipboardFormats(VOID)
BOOL STDCALL BOOL STDCALL
EmptyClipboard(VOID) EmptyClipboard(VOID)
{ {
return NtUserEmptyClipboard(); return NtUserEmptyClipboard();
} }
/* /*
@@ -69,8 +77,7 @@ EmptyClipboard(VOID)
UINT STDCALL UINT STDCALL
EnumClipboardFormats(UINT format) EnumClipboardFormats(UINT format)
{ {
UINT ret = NtUserEnumClipboardFormats(format); return NtUserEnumClipboardFormats(format);
return ret;
} }
/* /*
@@ -79,31 +86,7 @@ EnumClipboardFormats(UINT format)
HANDLE STDCALL HANDLE STDCALL
GetClipboardData(UINT uFormat) GetClipboardData(UINT uFormat)
{ {
HGLOBAL hGlobal = NULL; return NtUserGetClipboardData(uFormat, 0);
PVOID pGlobal = NULL;
DWORD size = 0;
/* dealing with bitmap object */
if (uFormat != CF_BITMAP)
{
size = (DWORD)NtUserGetClipboardData(uFormat, QUERY_SIZE);
if (size)
{
hGlobal = GlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE, size);
pGlobal = GlobalLock(hGlobal);
size = (DWORD)NtUserGetClipboardData(uFormat, (DWORD)pGlobal);
GlobalUnlock(hGlobal);
}
}
else
{
hGlobal = NtUserGetClipboardData(CF_BITMAP, !QUERY_SIZE);
}
return hGlobal;
} }
/* /*
@@ -112,32 +95,28 @@ GetClipboardData(UINT uFormat)
INT STDCALL INT STDCALL
GetClipboardFormatNameA(UINT format, LPSTR lpszFormatName, int cchMaxCount) GetClipboardFormatNameA(UINT format, LPSTR lpszFormatName, int cchMaxCount)
{ {
LPWSTR lpBuffer; LPWSTR lpBuffer;
UNICODE_STRING FormatName; UNICODE_STRING FormatName;
INT Length; INT Length;
ANSI_STRING ClassName;
ClassName.MaximumLength = cchMaxCount;
ClassName.Buffer = lpszFormatName;
lpBuffer = HEAP_alloc(cchMaxCount * sizeof(WCHAR)); lpBuffer = HEAP_alloc(cchMaxCount * sizeof(WCHAR));
if (!lpBuffer)
if (!lpBuffer) {
{ SetLastError(ERROR_OUTOFMEMORY);
SetLastError(ERROR_OUTOFMEMORY); return 0;
return 0; }
}
FormatName.Length = 0; FormatName.Length = 0;
FormatName.MaximumLength = cchMaxCount * sizeof(WCHAR); FormatName.MaximumLength = cchMaxCount * sizeof(WCHAR);
FormatName.Buffer = lpBuffer; FormatName.Buffer = lpBuffer;
/* we need a UNICODE string */
Length = NtUserGetClipboardFormatName(format, &FormatName, cchMaxCount); Length = NtUserGetClipboardFormatName(format, &FormatName, cchMaxCount);
DPRINT("GetClipboardFormatNameA(%x): %S\n", format, lpBuffer);
HEAP_strcpyWtoA(lpszFormatName, lpBuffer, Length);
HEAP_free(lpBuffer);
DPRINT("GetClipboardFormatNameA(%x): returning %s\n", format, lpszFormatName);
HEAP_strcpyWtoA(lpszFormatName, FormatName.Buffer, Length); return Length;
return strlen(lpszFormatName);
} }
/* /*
@@ -146,15 +125,15 @@ GetClipboardFormatNameA(UINT format, LPSTR lpszFormatName, int cchMaxCount)
INT STDCALL INT STDCALL
GetClipboardFormatNameW(UINT format, LPWSTR lpszFormatName, INT cchMaxCount) GetClipboardFormatNameW(UINT format, LPWSTR lpszFormatName, INT cchMaxCount)
{ {
UNICODE_STRING FormatName; UNICODE_STRING FormatName;
ULONG Ret; ULONG Ret;
FormatName.Length = 0; FormatName.Length = 0;
FormatName.MaximumLength = cchMaxCount * sizeof(WCHAR); FormatName.MaximumLength = cchMaxCount * sizeof(WCHAR);
FormatName.Buffer = (PWSTR)lpszFormatName; FormatName.Buffer = (PWSTR)lpszFormatName;
Ret = NtUserGetClipboardFormatName(format, &FormatName, cchMaxCount); Ret = NtUserGetClipboardFormatName(format, &FormatName, cchMaxCount);
return Ret; DPRINT("GetClipboardFormatNameW(%x): returning %S\n", format, lpszFormatName);
return Ret;
} }
/* /*
@@ -199,8 +178,7 @@ GetOpenClipboardWindow(VOID)
INT STDCALL INT STDCALL
GetPriorityClipboardFormat(UINT *paFormatPriorityList, INT cFormats) GetPriorityClipboardFormat(UINT *paFormatPriorityList, INT cFormats)
{ {
INT ret = NtUserGetPriorityClipboardFormat(paFormatPriorityList, cFormats); return NtUserGetPriorityClipboardFormat(paFormatPriorityList, cFormats);
return ret;
} }
/* /*
@@ -209,41 +187,18 @@ GetPriorityClipboardFormat(UINT *paFormatPriorityList, INT cFormats)
BOOL STDCALL BOOL STDCALL
IsClipboardFormatAvailable(UINT format) IsClipboardFormatAvailable(UINT format)
{ {
BOOL ret = NtUserIsClipboardFormatAvailable(format); return NtUserIsClipboardFormatAvailable(format);
return ret;
} }
/* /*
* @implemented * @implemented
*/ */
UINT STDCALL UINT STDCALL
RegisterClipboardFormatA(LPCSTR lpszFormat) RegisterClipboardFormatA(LPCSTR lpszFormat)
{ {
UINT ret = 0; ULONG Ret = RegisterWindowMessageA(lpszFormat);
UNICODE_STRING usFormat = {0}; DPRINT("RegisterClipboardFormatA(%s) - %x\n", lpszFormat, Ret);
return Ret;
if (lpszFormat == NULL)
{
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
/* check for "" */
if (*lpszFormat == 0) //NULL
{
SetLastError(ERROR_INVALID_NAME);
return 0;
}
ret = RtlCreateUnicodeStringFromAsciiz(&usFormat, lpszFormat);
if (ret)
{
ret = NtUserRegisterClipboardFormat(&usFormat); //(LPCWSTR)
RtlFreeUnicodeString(&usFormat);
}
return ret;
} }
/* /*
@@ -252,47 +207,9 @@ RegisterClipboardFormatA(LPCSTR lpszFormat)
UINT STDCALL UINT STDCALL
RegisterClipboardFormatW(LPCWSTR lpszFormat) RegisterClipboardFormatW(LPCWSTR lpszFormat)
{ {
UINT ret = 0; ULONG Ret = RegisterWindowMessageW(lpszFormat);
UNICODE_STRING usFormat = {0}; DPRINT("RegisterClipboardFormatW(%S) - %x\n", lpszFormat, Ret);
return Ret;
if (lpszFormat == NULL)
{
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
/* check for "" */
if (*lpszFormat == 0) //NULL
{
SetLastError(ERROR_INVALID_NAME);
return 0;
}
RtlInitUnicodeString(&usFormat, lpszFormat);
ret = NtUserRegisterClipboardFormat(&usFormat);
return ret;
}
HGLOBAL renderLocale (DWORD Locale)
{
DWORD* pLocale;
HGLOBAL hGlobal;
hGlobal = GlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE, sizeof(DWORD));
if(!hGlobal)
{
return hGlobal;
}
pLocale = (DWORD*)GlobalLock(hGlobal);
*pLocale = Locale;
GlobalUnlock(hGlobal);
return hGlobal;
} }
/* /*
@@ -301,54 +218,7 @@ HGLOBAL renderLocale (DWORD Locale)
HANDLE STDCALL HANDLE STDCALL
SetClipboardData(UINT uFormat, HANDLE hMem) SetClipboardData(UINT uFormat, HANDLE hMem)
{ {
DWORD size; return NtUserSetClipboardData(uFormat, hMem, 0);
LPVOID pMem;
HANDLE ret = NULL;
if (hMem == NULL)
{
return NtUserSetClipboardData(uFormat, 0, 0);
}
if (uFormat == CF_BITMAP)
{
/* GlobalLock should return 0 for GDI handles
pMem = GlobalLock(hMem);
if (pMem)
{
// not a GDI handle
GlobalUnlock(hMem);
return ret;
}
else
{
*/
/* check if this GDI handle is a HBITMAP */
/* GetObject for HBITMAP not implemented in ReactOS */
//if (GetObject(hMem, 0, NULL) == sifeof(BITMAP))
//{
return NtUserSetClipboardData(CF_BITMAP, hMem, 0);
//}
/*}*/
}
size = GlobalSize(hMem);
pMem = GlobalLock(hMem);
if ((pMem) && (size))
{
size = GlobalSize(hMem);
ret = NtUserSetClipboardData(uFormat, pMem, size);
//should i unlock hMem?
GlobalUnlock(hMem);
}
else
{
ERR("SetClipboardData failed\n");
}
return ret;
} }
/* /*
@@ -368,35 +238,3 @@ ChangeClipboardChain(HWND hWndRemove, HWND hWndNewNext)
{ {
return NtUserChangeClipboardChain(hWndRemove, hWndNewNext); return NtUserChangeClipboardChain(hWndRemove, hWndNewNext);
} }
/*
* @unimplemented
*/
BOOL STDCALL
AddClipboardFormatListener(HWND hwnd)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @unimplemented
*/
BOOL STDCALL
RemoveClipboardFormatListener(HWND hwnd)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @unimplemented
*/
BOOL STDCALL
GetUpdatedClipboardFormats(
PUINT lpuiFormats,
UINT cFormats,
PUINT pcFormatsOut)
{
UNIMPLEMENTED;
return FALSE;
}

View File

@@ -29,8 +29,8 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <user32.h> #include <user32.h>
#define NDEBUG
#include <wine/debug.h> #include <debug.h>
#undef CopyCursor #undef CopyCursor
@@ -72,7 +72,7 @@ CopyCursor(HCURSOR pcur)
{ {
ICONINFO IconInfo; ICONINFO IconInfo;
if(GetIconInfo((HANDLE)pcur, &IconInfo)) if(NtUserGetCursorIconInfo((HANDLE)pcur, &IconInfo))
{ {
return (HCURSOR)NtUserCreateCursorIconHandle(&IconInfo, FALSE); return (HCURSOR)NtUserCreateCursorIconHandle(&IconInfo, FALSE);
} }
@@ -153,7 +153,7 @@ CreateCursor(HINSTANCE hInst,
BOOL STDCALL BOOL STDCALL
DestroyCursor(HCURSOR hCursor) DestroyCursor(HCURSOR hCursor)
{ {
return (BOOL)NtUserDestroyCursor((HANDLE)hCursor, 0); return (BOOL)NtUserDestroyCursorIcon((HANDLE)hCursor, 0);
} }

View File

@@ -30,8 +30,6 @@
#include <user32.h> #include <user32.h>
#include <wine/debug.h>
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
/* /*
@@ -72,8 +70,6 @@ GetWindowDC(
} }
BOOL STDCALL GdiReleaseDC(HDC hdc);
/* /*
* @implemented * @implemented
*/ */
@@ -83,14 +79,7 @@ ReleaseDC(
HWND hWnd, HWND hWnd,
HDC hDC) HDC hDC)
{ {
// From msdn: if the DC was not released return zero. return NtUserReleaseDC(hWnd, hDC);
// if the DC was released return one.
if (!hDC) return FALSE; // Null hDC return zero.
GdiReleaseDC ( hDC ); // Release locals.
// Win 3.1 throw back, hWnd is ignored and not used.
return NtUserCallOneParam( (DWORD) hDC, ONEPARAM_ROUTINE_RELEASEDC);
} }

View File

@@ -12,9 +12,8 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <user32.h> #include <user32.h>
#define NDEBUG
#include <wine/debug.h> #include <debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(user32);
#ifndef WM_SETVISIBLE #ifndef WM_SETVISIBLE
#define WM_SETVISIBLE 9 #define WM_SETVISIBLE 9
@@ -38,12 +37,8 @@ HPEN SysPens[NUM_SYSCOLORS] = {0};
HBRUSH SysBrushes[NUM_SYSCOLORS] = {0}; HBRUSH SysBrushes[NUM_SYSCOLORS] = {0};
/* Bits in the dwKeyData */ /* Bits in the dwKeyData */
#define KEYDATA_ALT 0x2000 #define KEYDATA_ALT 0x2000
#define KEYDATA_PREVSTATE 0x4000
static short iF10Key = 0;
static short iMenuSysKey = 0;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
void void
@@ -197,25 +192,12 @@ UserGetInsideRectNC(HWND hWnd, RECT *rect)
VOID VOID
DefWndSetRedraw(HWND hWnd, WPARAM wParam) DefWndSetRedraw(HWND hWnd, WPARAM wParam)
{ {
LONG Style = GetWindowLong(hWnd, GWL_STYLE); if ((BOOL) wParam && 0 == (GetWindowLong(hWnd, GWL_STYLE) & WS_VISIBLE))
/* Content can be redrawn after a change. */
if (wParam)
{ {
if (!(Style & WS_VISIBLE)) /* Not Visible */ ShowWindow(hWnd, SW_NORMAL);
{
SetWindowLong(hWnd, GWL_STYLE, WS_VISIBLE);
}
} }
else /* Content cannot be redrawn after a change. */
{ UNIMPLEMENTED;
if (Style & WS_VISIBLE) /* Visible */
{
RedrawWindow( hWnd, NULL, 0, RDW_ALLCHILDREN | RDW_VALIDATE );
Style &= ~WS_VISIBLE;
SetWindowLong(hWnd, GWL_STYLE, Style); /* clear bits */
}
}
return;
} }
@@ -767,10 +749,9 @@ DefWndTrackScrollBar(HWND Wnd, WPARAM wParam, POINT Pt)
LRESULT LRESULT
DefWndHandleSysCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) DefWndHandleSysCommand(HWND hWnd, WPARAM wParam, POINT Pt)
{ {
WINDOWPLACEMENT wp; WINDOWPLACEMENT wp;
POINT Pt;
switch (wParam & 0xfff0) switch (wParam & 0xfff0)
{ {
@@ -806,24 +787,16 @@ DefWndHandleSysCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
SendMessageA(hWnd, WM_CLOSE, 0, 0); SendMessageA(hWnd, WM_CLOSE, 0, 0);
break; break;
case SC_MOUSEMENU: case SC_MOUSEMENU:
{ MenuTrackMouseMenuBar(hWnd, wParam & 0x000f, Pt);
Pt.x = (short)LOWORD(lParam);
Pt.y = (short)HIWORD(lParam);
MenuTrackMouseMenuBar(hWnd, wParam & 0x000f, Pt);
}
break; break;
case SC_KEYMENU: case SC_KEYMENU:
MenuTrackKbdMenuBar(hWnd, wParam, (WCHAR)lParam); MenuTrackKbdMenuBar(hWnd, wParam, Pt.x);
break; break;
case SC_VSCROLL: case SC_VSCROLL:
case SC_HSCROLL: case SC_HSCROLL:
{ DefWndTrackScrollBar(hWnd, wParam, Pt);
Pt.x = (short)LOWORD(lParam);
Pt.y = (short)HIWORD(lParam);
DefWndTrackScrollBar(hWnd, wParam, Pt);
}
break; break;
default: default:
/* FIXME: Implement */ /* FIXME: Implement */
UNIMPLEMENTED; UNIMPLEMENTED;
@@ -949,71 +922,12 @@ DefWndControlColor(HDC hDC, UINT ctlType)
return GetSysColorBrush(COLOR_WINDOW); return GetSysColorBrush(COLOR_WINDOW);
} }
static void DefWndPrint( HWND hwnd, HDC hdc, ULONG uFlags)
{
/*
* Visibility flag.
*/
if ( (uFlags & PRF_CHECKVISIBLE) &&
!IsWindowVisible(hwnd) )
return;
/*
* Unimplemented flags.
*/
if ( (uFlags & PRF_CHILDREN) ||
(uFlags & PRF_OWNED) ||
(uFlags & PRF_NONCLIENT) )
{
FIXME("WM_PRINT message with unsupported flags\n");
}
/*
* Background
*/
if ( uFlags & PRF_ERASEBKGND)
SendMessageW(hwnd, WM_ERASEBKGND, (WPARAM)hdc, 0);
/*
* Client area
*/
if ( uFlags & PRF_CLIENT)
SendMessageW(hwnd, WM_PRINTCLIENT, (WPARAM)hdc, PRF_CLIENT);
}
VOID FASTCALL VOID FASTCALL
DefWndScreenshot(HWND hWnd) DefWndScreenshot(HWND hWnd)
{ {
RECT rect;
OpenClipboard(hWnd);
EmptyClipboard();
HDC hdc = GetWindowDC(hWnd);
GetWindowRect(hWnd, &rect);
INT w = rect.right - rect.left;
INT h = rect.bottom - rect.top;
HBITMAP hbitmap = CreateCompatibleBitmap(hdc, w, h);
HDC hdc2 = CreateCompatibleDC(hdc);
SelectObject(hdc2, hbitmap);
BitBlt(hdc2, 0, 0, w, h,
hdc, 0, 0,
SRCCOPY);
SetClipboardData(CF_BITMAP, hbitmap);
ReleaseDC(hWnd, hdc);
ReleaseDC(hWnd, hdc2);
CloseClipboard();
} }
LRESULT STDCALL LRESULT STDCALL
User32DefWindowProc(HWND hWnd, User32DefWindowProc(HWND hWnd,
UINT Msg, UINT Msg,
@@ -1046,20 +960,11 @@ User32DefWindowProc(HWND hWnd,
return (DefWndNCHitTest(hWnd, Point)); return (DefWndNCHitTest(hWnd, Point));
} }
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
case WM_MBUTTONDOWN:
iF10Key = iMenuSysKey = 0;
break;
case WM_NCLBUTTONDOWN: case WM_NCLBUTTONDOWN:
{ {
return (DefWndNCLButtonDown(hWnd, wParam, lParam)); return (DefWndNCLButtonDown(hWnd, wParam, lParam));
} }
case WM_LBUTTONDBLCLK:
return (DefWndNCLButtonDblClk(hWnd, HTCLIENT, lParam));
case WM_NCLBUTTONDBLCLK: case WM_NCLBUTTONDBLCLK:
{ {
return (DefWndNCLButtonDblClk(hWnd, wParam, lParam)); return (DefWndNCLButtonDblClk(hWnd, wParam, lParam));
@@ -1075,16 +980,6 @@ User32DefWindowProc(HWND hWnd,
return (DefWndHandleWindowPosChanged(hWnd, (WINDOWPOS*)lParam)); return (DefWndHandleWindowPosChanged(hWnd, (WINDOWPOS*)lParam));
} }
case WM_NCRBUTTONDOWN:
{
/* in Windows, capture is taken when right-clicking on the caption bar */
if (wParam == HTCAPTION)
{
SetCapture(hWnd);
}
break;
}
case WM_RBUTTONUP: case WM_RBUTTONUP:
{ {
POINT Pt; POINT Pt;
@@ -1107,15 +1002,6 @@ User32DefWindowProc(HWND hWnd,
break; break;
} }
case WM_NCRBUTTONUP:
/*
* FIXME : we must NOT send WM_CONTEXTMENU on a WM_NCRBUTTONUP (checked
* in Windows), but what _should_ we do? According to MSDN :
* "If it is appropriate to do so, the system sends the WM_SYSCOMMAND
* message to the window". When is it appropriate?
*/
break;
case WM_CONTEXTMENU: case WM_CONTEXTMENU:
{ {
if (GetWindowLongW(hWnd, GWL_STYLE) & WS_CHILD) if (GetWindowLongW(hWnd, GWL_STYLE) & WS_CHILD)
@@ -1171,7 +1057,7 @@ User32DefWindowProc(HWND hWnd,
case WM_PRINT: case WM_PRINT:
{ {
DefWndPrint(hWnd, (HDC)wParam, lParam); /* FIXME: Implement. */
return (0); return (0);
} }
@@ -1311,9 +1197,6 @@ User32DefWindowProc(HWND hWnd,
case WM_CTLCOLORSCROLLBAR: case WM_CTLCOLORSCROLLBAR:
return (LRESULT) DefWndControlColor((HDC)wParam, Msg - WM_CTLCOLORMSGBOX); return (LRESULT) DefWndControlColor((HDC)wParam, Msg - WM_CTLCOLORMSGBOX);
case WM_CTLCOLOR:
return (LRESULT) DefWndControlColor((HDC)wParam, HIWORD(lParam));
case WM_SETCURSOR: case WM_SETCURSOR:
{ {
ULONG Style = GetWindowLongW(hWnd, GWL_STYLE); ULONG Style = GetWindowLongW(hWnd, GWL_STYLE);
@@ -1343,26 +1226,26 @@ User32DefWindowProc(HWND hWnd,
} }
case WM_SYSCOMMAND: case WM_SYSCOMMAND:
return (DefWndHandleSysCommand(hWnd, wParam, lParam)); {
POINT Pt;
Pt.x = GET_X_LPARAM(lParam);
Pt.y = GET_Y_LPARAM(lParam);
return (DefWndHandleSysCommand(hWnd, wParam, Pt));
}
/* FIXME: Handle key messages. */
/*
case WM_KEYDOWN: case WM_KEYDOWN:
if(wParam == VK_F10) iF10Key = VK_F10; case WM_KEYUP:
break; case WM_SYSKEYUP:
case WM_SYSCHAR:
*/
/* FIXME: This is also incomplete. */ /* FIXME: This is also incomplete. */
case WM_SYSKEYDOWN: case WM_SYSKEYDOWN:
{ {
if (HIWORD(lParam) & KEYDATA_ALT) if (HIWORD(lParam) & KEYDATA_ALT)
{ {
/* if( HIWORD(lParam) & ~KEYDATA_PREVSTATE ) */
if ( (wParam == VK_MENU || wParam == VK_LMENU
|| wParam == VK_RMENU) && !iMenuSysKey )
iMenuSysKey = 1;
else
iMenuSysKey = 0;
iF10Key = 0;
if (wParam == VK_F4) /* Try to close the window */ if (wParam == VK_F4) /* Try to close the window */
{ {
HWND top = GetAncestor(hWnd, GA_ROOT); HWND top = GetAncestor(hWnd, GA_ROOT);
@@ -1376,78 +1259,35 @@ User32DefWindowProc(HWND hWnd,
} }
else if (wParam == VK_SNAPSHOT) else if (wParam == VK_SNAPSHOT)
{ {
HWND hwnd = hWnd; DefWndScreenshot(hWnd);
while (GetParent(hwnd) != NULL)
{
hwnd = GetParent(hwnd);
}
DefWndScreenshot(hwnd);
} }
} }
else if( wParam == VK_F10 )
iF10Key = 1;
else if( wParam == VK_ESCAPE && (GetKeyState(VK_SHIFT) & 0x8000))
SendMessageW( hWnd, WM_SYSCOMMAND, SC_KEYMENU, ' ' );
break;
}
case WM_KEYUP:
case WM_SYSKEYUP:
{
/* Press and release F10 or ALT */
if (((wParam == VK_MENU || wParam == VK_LMENU || wParam == VK_RMENU)
&& iMenuSysKey) || ((wParam == VK_F10) && iF10Key))
SendMessageW( GetAncestor( hWnd, GA_ROOT ), WM_SYSCOMMAND, SC_KEYMENU, 0L );
iMenuSysKey = iF10Key = 0;
break;
}
case WM_SYSCHAR:
{
iMenuSysKey = 0;
if (wParam == '\r' && IsIconic(hWnd))
{
PostMessageW( hWnd, WM_SYSCOMMAND, SC_RESTORE, 0L );
break;
}
if ((HIWORD(lParam) & KEYDATA_ALT) && wParam)
{
if (wParam == '\t' || wParam == '\x1b') break;
if (wParam == ' ' && (GetWindowLongW( hWnd, GWL_STYLE ) & WS_CHILD))
SendMessageW( GetParent(hWnd), Msg, wParam, lParam );
else
SendMessageW( hWnd, WM_SYSCOMMAND, SC_KEYMENU, wParam );
}
else /* check for Ctrl-Esc */
if (wParam != '\x1b') MessageBeep(0);
break; break;
} }
case WM_SHOWWINDOW: case WM_SHOWWINDOW:
{ {
LONG Style; LONG Style;
INT Ret = 0;
if (!lParam)
if (!lParam) return 0; return 0;
Style = GetWindowLongW(hWnd, GWL_STYLE); Style = GetWindowLongW(hWnd, GWL_STYLE);
if ((Style & WS_VISIBLE) && wParam) return 0; // if (!(Style & WS_POPUP))
if (!(Style & WS_VISIBLE) && !wParam) return 0; // return 0;
if (!GetWindow(hWnd, GW_OWNER)) return 0; if ((Style & WS_VISIBLE) && wParam)
Ret = NtUserCallTwoParam((DWORD) hWnd, (DWORD) wParam, TWOPARAM_ROUTINE_ROS_SHOWWINDOW); return 0;
if(Ret) if (!(Style & WS_VISIBLE) && !wParam)
{ return 0;
if( Ret == -1) return 0; if (!GetWindow(hWnd, GW_OWNER))
return Ret; return 0;
} NtUserCallTwoParam((DWORD) hWnd, (DWORD) wParam, TWOPARAM_ROUTINE_ROS_SHOWWINDOW);
ShowWindow(hWnd, wParam ? SW_SHOWNOACTIVATE : SW_HIDE); ShowWindow(hWnd, wParam ? SW_SHOWNA : SW_HIDE);
break; break;
} }
case WM_CANCELMODE: case WM_CANCELMODE:
{ {
iMenuSysKey = 0;
/* FIXME: Check for a desktop. */ /* FIXME: Check for a desktop. */
if (!(GetWindowLongW( hWnd, GWL_STYLE ) & WS_CHILD)) EndMenu();
if (GetCapture() == hWnd) if (GetCapture() == hWnd)
{ {
ReleaseCapture(); ReleaseCapture();
@@ -1460,7 +1300,8 @@ User32DefWindowProc(HWND hWnd,
return (-1); return (-1);
/* /*
case WM_DROPOBJECT: case WM_DROPOBJECT:
return DRAG_FILE;
break;
*/ */
case WM_QUERYDROPOBJECT: case WM_QUERYDROPOBJECT:
{ {
@@ -1495,9 +1336,14 @@ User32DefWindowProc(HWND hWnd,
case WM_NOTIFYFORMAT: case WM_NOTIFYFORMAT:
{ {
if (lParam == NF_QUERY) if (IsWindowUnicode(hWnd))
return IsWindowUnicode(hWnd) ? NFR_UNICODE : NFR_ANSI; {
break; return(NFR_UNICODE);
}
else
{
return(NFR_ANSI);
}
} }
case WM_SETICON: case WM_SETICON:
@@ -1551,38 +1397,6 @@ User32DefWindowProc(HWND hWnd,
{ {
return (1); return (1);
} }
case WM_INPUTLANGCHANGEREQUEST:
{
HKL NewHkl;
if(wParam & INPUTLANGCHANGE_BACKWARD
&& wParam & INPUTLANGCHANGE_FORWARD)
{
return FALSE;
}
//FIXME: What to do with INPUTLANGCHANGE_SYSCHARSET ?
if(wParam & INPUTLANGCHANGE_BACKWARD) NewHkl = (HKL) HKL_PREV;
else if(wParam & INPUTLANGCHANGE_FORWARD) NewHkl = (HKL) HKL_NEXT;
else NewHkl = (HKL) lParam;
NtUserActivateKeyboardLayout(NewHkl, 0);
return TRUE;
}
case WM_INPUTLANGCHANGE:
{
//FIXME: What to do?
return TRUE;
}
case WM_ENDSESSION:
if (wParam) PostQuitMessage(0);
return 0;
} }
return 0; return 0;
} }
@@ -1594,37 +1408,16 @@ DefWindowProcA(HWND hWnd,
WPARAM wParam, WPARAM wParam,
LPARAM lParam) LPARAM lParam)
{ {
LRESULT Result = 0;
SPY_EnterMessage(SPY_DEFWNDPROC, hWnd, Msg, wParam, lParam);
switch (Msg) switch (Msg)
{ {
case WM_NCCREATE: case WM_NCCREATE:
{ {
ANSI_STRING AnsiString; return TRUE;
UNICODE_STRING UnicodeString;
LPCREATESTRUCTA cs = (LPCREATESTRUCTA)lParam;
/* check for string, as static icons, bitmaps (SS_ICON, SS_BITMAP)
* may have child window IDs instead of window name */
if(cs->lpszName)
{
RtlInitAnsiString(&AnsiString, (LPSTR)cs->lpszName);
RtlAnsiStringToUnicodeString(&UnicodeString, &AnsiString, TRUE);
NtUserDefSetText(hWnd, &UnicodeString);
RtlFreeUnicodeString(&UnicodeString);
}
else
NtUserDefSetText(hWnd, NULL);
Result = 1;
break;
} }
case WM_GETTEXTLENGTH: case WM_GETTEXTLENGTH:
{ {
Result = (LRESULT)NtUserInternalGetWindowText(hWnd, NULL, 0); return (LRESULT)NtUserInternalGetWindowText(hWnd, NULL, 0);
break;
} }
case WM_GETTEXT: case WM_GETTEXT:
@@ -1635,10 +1428,7 @@ DefWindowProcA(HWND hWnd,
Buffer = HeapAlloc(GetProcessHeap(), 0, wParam * sizeof(WCHAR)); Buffer = HeapAlloc(GetProcessHeap(), 0, wParam * sizeof(WCHAR));
if (!Buffer) if (!Buffer)
{ return FALSE;
Result = 0;
break;
}
Length = NtUserInternalGetWindowText(hWnd, Buffer, wParam); Length = NtUserInternalGetWindowText(hWnd, Buffer, wParam);
if (Length > 0 && wParam > 0 && if (Length > 0 && wParam > 0 &&
!WideCharToMultiByte(CP_ACP, 0, Buffer, -1, !WideCharToMultiByte(CP_ACP, 0, Buffer, -1,
@@ -1649,8 +1439,7 @@ DefWindowProcA(HWND hWnd,
HeapFree(GetProcessHeap(), 0, Buffer); HeapFree(GetProcessHeap(), 0, Buffer);
Result = (LRESULT)Length; return (LRESULT)Length;
break;
} }
case WM_SETTEXT: case WM_SETTEXT:
@@ -1672,12 +1461,11 @@ DefWindowProcA(HWND hWnd,
{ {
DefWndNCPaint(hWnd, (HRGN)1, -1); DefWndNCPaint(hWnd, (HRGN)1, -1);
} }
return TRUE;
Result = 1;
break;
} }
/* FIXME: Implement these. */ /*
FIXME: Implement these.
case WM_IME_CHAR: case WM_IME_CHAR:
case WM_IME_KEYDOWN: case WM_IME_KEYDOWN:
case WM_IME_KEYUP: case WM_IME_KEYUP:
@@ -1686,14 +1474,10 @@ DefWindowProcA(HWND hWnd,
case WM_IME_ENDCOMPOSITION: case WM_IME_ENDCOMPOSITION:
case WM_IME_SELECT: case WM_IME_SELECT:
case WM_IME_SETCONTEXT: case WM_IME_SETCONTEXT:
FIXME("FIXME: WM_IME_* conversion isn't implemented yet!"); */
/* fall through */
default:
Result = User32DefWindowProc(hWnd, Msg, wParam, lParam, FALSE);
} }
SPY_ExitMessage(SPY_RESULT_DEFWND, hWnd, Msg, Result, wParam, lParam); return User32DefWindowProc(hWnd, Msg, wParam, lParam, FALSE);
return Result;
} }
@@ -1703,36 +1487,21 @@ DefWindowProcW(HWND hWnd,
WPARAM wParam, WPARAM wParam,
LPARAM lParam) LPARAM lParam)
{ {
LRESULT Result = 0;
SPY_EnterMessage(SPY_DEFWNDPROC, hWnd, Msg, wParam, lParam);
switch (Msg) switch (Msg)
{ {
case WM_NCCREATE: case WM_NCCREATE:
{ {
UNICODE_STRING UnicodeString; return TRUE;
LPCREATESTRUCTW cs = (LPCREATESTRUCTW)lParam;
/* check for string, as static icons, bitmaps (SS_ICON, SS_BITMAP)
* may have child window IDs instead of window name */
if(cs->lpszName)
RtlInitUnicodeString(&UnicodeString, (LPWSTR)cs->lpszName);
NtUserDefSetText( hWnd, (cs->lpszName ? &UnicodeString : NULL));
Result = 1;
break;
} }
case WM_GETTEXTLENGTH: case WM_GETTEXTLENGTH:
{ {
Result = (LRESULT)NtUserInternalGetWindowText(hWnd, NULL, 0); return (LRESULT)NtUserInternalGetWindowText(hWnd, NULL, 0);
break;
} }
case WM_GETTEXT: case WM_GETTEXT:
{ {
Result = (LRESULT)NtUserInternalGetWindowText(hWnd, (PWSTR)lParam, wParam); return (LRESULT)NtUserInternalGetWindowText(hWnd, (PWSTR)lParam, wParam);
break;
} }
case WM_SETTEXT: case WM_SETTEXT:
@@ -1748,30 +1517,22 @@ DefWindowProcW(HWND hWnd,
{ {
DefWndNCPaint(hWnd, (HRGN)1, -1); DefWndNCPaint(hWnd, (HRGN)1, -1);
} }
Result = 1; return (1);
break;
} }
case WM_IME_CHAR: case WM_IME_CHAR:
{ {
SendMessageW(hWnd, WM_CHAR, wParam, lParam); SendMessageW(hWnd, WM_CHAR, wParam, lParam);
Result = 0; return (0);
break;
} }
case WM_IME_SETCONTEXT: case WM_IME_SETCONTEXT:
{ {
/* FIXME */ /* FIXME */
FIXME("FIXME: WM_IME_SETCONTEXT is not implemented!"); return (0);
Result = 0;
break;
} }
default:
Result = User32DefWindowProc(hWnd, Msg, wParam, lParam, TRUE);
} }
SPY_ExitMessage(SPY_RESULT_DEFWND, hWnd, Msg, Result, wParam, lParam);
return Result; return User32DefWindowProc(hWnd, Msg, wParam, lParam, TRUE);
} }

File diff suppressed because it is too large Load Diff

View File

@@ -29,8 +29,8 @@
/* INCLUDES *******************************************************************/ /* INCLUDES *******************************************************************/
#include <user32.h> #include <user32.h>
#define NDEBUG
#include <wine/debug.h> #include <debug.h>
/* GLOBALS *******************************************************************/ /* GLOBALS *******************************************************************/
@@ -717,81 +717,123 @@ static BOOL UITOOLS95_DFC_ButtonCheck(HDC dc, LPRECT r, UINT uFlags)
return TRUE; return TRUE;
} }
/* Ported from WINE20020904 */
/* Draw a radio/radioimage/radiomask button coming from DrawFrameControl()
*
* Does a pretty good job in emulating MS behavior. Some quirks are
* however there because MS uses a TrueType font (Marlett) to draw
* the buttons.
*/
static BOOL UITOOLS95_DFC_ButtonRadio(HDC dc, LPRECT r, UINT uFlags) static BOOL UITOOLS95_DFC_ButtonRadio(HDC dc, LPRECT r, UINT uFlags)
{ {
RECT rc; RECT myr;
LOGFONT lf; int i;
HFONT hFont, hOldFont; int SmallDiam = UITOOLS_MakeSquareRect(r, &myr);
int SmallDiam, i; int BorderShrink = SmallDiam / 16;
HPEN hpsave;
HBRUSH hbsave;
int xc, yc;
LPCTSTR OutRight = TEXT("j"); // Outer right if(BorderShrink < 1) BorderShrink = 1;
LPCTSTR OutLeft = TEXT("k"); // Outer left
LPCTSTR InRight = TEXT("l"); // inner left
LPCTSTR InLeft = TEXT("m"); // inner right
LPCTSTR Center = TEXT("n"); // center
SmallDiam = UITOOLS_MakeSquareRect(r, &rc); if((uFlags & 0xff) == DFCS_BUTTONRADIOIMAGE)
{
FillRect(dc, r, (HBRUSH)GetStockObject(BLACK_BRUSH));
}
ZeroMemory(&lf, sizeof(LOGFONT)); xc = myr.left + SmallDiam - SmallDiam/2;
lf.lfHeight = SmallDiam; yc = myr.top + SmallDiam - SmallDiam/2;
lf.lfWidth = 0;
lf.lfWeight = FW_NORMAL; /* Define bounding box */
lf.lfCharSet = DEFAULT_CHARSET; i = 14*SmallDiam/16;
lstrcpy(lf.lfFaceName, TEXT("Marlett")); myr.left = xc - i+i/2;
hFont = CreateFontIndirect(&lf); myr.right = xc + i/2;
hOldFont = SelectObject(dc, hFont); myr.top = yc - i+i/2;
myr.bottom = yc + i/2;
if((uFlags & 0xff) == DFCS_BUTTONRADIOMASK) if((uFlags & 0xff) == DFCS_BUTTONRADIOMASK)
{ {
SetBkMode(dc, OPAQUE); hbsave = (HBRUSH)SelectObject(dc, GetStockObject(BLACK_BRUSH));
SetTextColor(dc, GetSysColor(COLOR_WINDOWFRAME)); Ellipse(dc, myr.left, myr.top, myr.right, myr.bottom);
TextOut(dc, rc.left, rc.top, Center, 1); SelectObject(dc, hbsave);
SetBkMode(dc, TRANSPARENT);
SetTextColor(dc, GetSysColor(COLOR_WINDOWFRAME));
TextOut(dc, rc.left, rc.top, OutRight, 1);
SetTextColor(dc, GetSysColor(COLOR_WINDOWFRAME));
TextOut(dc, rc.left, rc.top, OutLeft, 1);
} }
else else
{ {
SetBkMode(dc, TRANSPARENT); if(uFlags & (DFCS_FLAT|DFCS_MONO))
/* Center section, white for active, grey for inactive */
i= !(uFlags & (DFCS_INACTIVE|DFCS_PUSHED)) ? COLOR_WINDOW : COLOR_BTNFACE;
SetTextColor(dc, GetSysColor(i));
TextOut(dc, rc.left, rc.top, Center, 1);
if(uFlags & (DFCS_FLAT | DFCS_MONO))
{ {
SetTextColor(dc, GetSysColor(COLOR_WINDOWFRAME)); hpsave = (HPEN)SelectObject(dc, GetSysColorPen(COLOR_WINDOWFRAME));
TextOut(dc, rc.left, rc.top, OutRight, 1); hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(COLOR_WINDOWFRAME));
TextOut(dc, rc.left, rc.top, OutLeft, 1); Ellipse(dc, myr.left, myr.top, myr.right, myr.bottom);
TextOut(dc, rc.left, rc.top, InRight, 1); SelectObject(dc, hbsave);
TextOut(dc, rc.left, rc.top, InLeft, 1); SelectObject(dc, hpsave);
} }
else else
{ {
SetTextColor(dc, GetSysColor(COLOR_BTNSHADOW)); hpsave = (HPEN)SelectObject(dc, GetSysColorPen(COLOR_BTNHIGHLIGHT));
TextOut(dc, rc.left, rc.top, OutRight, 1); hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(COLOR_BTNHIGHLIGHT));
SetTextColor(dc, GetSysColor(COLOR_BTNHIGHLIGHT)); Pie(dc, myr.left, myr.top, myr.right+1, myr.bottom+1, myr.left-1, myr.bottom, myr.right+1, myr.top);
TextOut(dc, rc.left, rc.top, OutLeft, 1);
SetTextColor(dc, GetSysColor(COLOR_3DDKSHADOW)); SelectObject(dc, GetSysColorPen(COLOR_BTNSHADOW));
TextOut(dc, rc.left, rc.top, InRight, 1); SelectObject(dc, GetSysColorBrush(COLOR_BTNSHADOW));
SetTextColor(dc, GetSysColor(COLOR_3DLIGHT)); Pie(dc, myr.left, myr.top, myr.right+1, myr.bottom+1, myr.right+1, myr.top, myr.left-1, myr.bottom);
TextOut(dc, rc.left, rc.top, InLeft, 1);
myr.left += BorderShrink;
myr.right -= BorderShrink;
myr.top += BorderShrink;
myr.bottom -= BorderShrink;
SelectObject(dc, GetSysColorPen(COLOR_3DLIGHT));
SelectObject(dc, GetSysColorBrush(COLOR_3DLIGHT));
Pie(dc, myr.left, myr.top, myr.right+1, myr.bottom+1, myr.left-1, myr.bottom, myr.right+1, myr.top);
SelectObject(dc, GetSysColorPen(COLOR_3DDKSHADOW));
SelectObject(dc, GetSysColorBrush(COLOR_3DDKSHADOW));
Pie(dc, myr.left, myr.top, myr.right+1, myr.bottom+1, myr.right+1, myr.top, myr.left-1, myr.bottom);
SelectObject(dc, hbsave);
SelectObject(dc, hpsave);
} }
i = 10*SmallDiam/16;
myr.left = xc - i+i/2;
myr.right = xc + i/2;
myr.top = yc - i+i/2;
myr.bottom = yc + i/2;
i= !(uFlags & (DFCS_INACTIVE|DFCS_PUSHED)) ? COLOR_WINDOW : COLOR_BTNFACE;
hpsave = (HPEN)SelectObject(dc, GetSysColorPen(i));
hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(i));
Ellipse(dc, myr.left, myr.top, myr.right, myr.bottom);
SelectObject(dc, hbsave);
SelectObject(dc, hpsave);
} }
if(uFlags & DFCS_CHECKED) if(uFlags & DFCS_CHECKED)
{ {
LPCTSTR Check = TEXT("i"); i = 6*SmallDiam/16;
i = i < 1 ? 1 : i;
myr.left = xc - i+i/2;
myr.right = xc + i/2;
myr.top = yc - i+i/2;
myr.bottom = yc + i/2;
SetTextColor(dc, GetSysColor(COLOR_WINDOWTEXT)); i = uFlags & DFCS_INACTIVE ? COLOR_BTNSHADOW : COLOR_WINDOWTEXT;
TextOut(dc, rc.left, rc.top, Check, 1); hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(i));
hpsave = (HPEN)SelectObject(dc, GetSysColorPen(i));
Ellipse(dc, myr.left, myr.top, myr.right, myr.bottom);
SelectObject(dc, hpsave);
SelectObject(dc, hbsave);
} }
SetTextColor(dc, GetSysColor(COLOR_WINDOWTEXT)); /* FIXME: M$ has a Polygon in the center at relative points: */
SelectObject(dc, hOldFont); /* 0.476, 0.476 (times SmallDiam, SmallDiam) */
/* 0.476, 0.525 */
/* 0.500, 0.500 */
/* 0.500, 0.499 */
/* when the button is unchecked. The reason for it is unknown. The */
/* color is COLOR_BTNHIGHLIGHT, although the Polygon gets painted at */
/* least 3 times (it looks like a clip-region when you see it happen). */
/* I do not really see a reason why this should be implemented. If you */
/* have a good reason, let me know. Maybe this is a quirk in the Marlett */
/* font. */
return TRUE; return TRUE;
} }
@@ -1445,7 +1487,7 @@ static BOOL PAINTING_DrawStateJam(HDC hdc, UINT opcode,
return DrawTextA(hdc, (LPSTR)lp, (INT)wp, rc, dtflags); return DrawTextA(hdc, (LPSTR)lp, (INT)wp, rc, dtflags);
case DST_ICON: case DST_ICON:
return DrawIconEx(hdc, rc->left, rc->top, (HICON)lp, cx, cy, 0, NULL, DI_NORMAL); return DrawIcon(hdc, rc->left, rc->top, (HICON)lp);
case DST_BITMAP: case DST_BITMAP:
memdc = CreateCompatibleDC(hdc); memdc = CreateCompatibleDC(hdc);

View File

@@ -29,8 +29,8 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <user32.h> #include <user32.h>
#define NDEBUG
#include <wine/debug.h> #include <debug.h>
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
@@ -73,20 +73,22 @@ TabbedTextOutA(
* Note: this doesn't work too well for text-alignment modes other * Note: this doesn't work too well for text-alignment modes other
* than TA_LEFT|TA_TOP. But we want bug-for-bug compatibility :-) * than TA_LEFT|TA_TOP. But we want bug-for-bug compatibility :-)
*/ */
/* WINE synced 22-May-2006 */
static LONG TEXT_TabbedTextOut( HDC hdc, INT x, INT y, LPCWSTR lpstr, static LONG TEXT_TabbedTextOut( HDC hdc, INT x, INT y, LPCWSTR lpstr,
INT count, INT cTabStops, const INT *lpTabPos, INT nTabOrg, INT count, INT cTabStops, const INT *lpTabPos, INT nTabOrg,
BOOL fDisplayText ) BOOL fDisplayText )
{ {
INT defWidth; INT defWidth;
SIZE extent; SIZE extent;
int i, j; int i, tabPos = x;
int start = x; int start = x;
extent.cx = 0;
extent.cy = 0;
if (!lpTabPos) if (!lpTabPos)
cTabStops=0; cTabStops=0;
if (cTabStops == 1) if (cTabStops == 1 && *lpTabPos >= /* sic */ 0)
{ {
defWidth = *lpTabPos; defWidth = *lpTabPos;
cTabStops = 0; cTabStops = 0;
@@ -94,76 +96,51 @@ static LONG TEXT_TabbedTextOut( HDC hdc, INT x, INT y, LPCWSTR lpstr,
else else
{ {
TEXTMETRICA tm; TEXTMETRICA tm;
GetTextMetricsA( hdc, &tm ); if (GetTextMetricsA( hdc, &tm ))
defWidth = 8 * tm.tmAveCharWidth; defWidth = 8 * tm.tmAveCharWidth;
else
defWidth = 0;
if (cTabStops == 1)
cTabStops = 0; /* on negative *lpTabPos */
} }
while (count > 0) while (count > 0)
{ {
RECT r;
INT x0;
x0 = x;
r.left = x0;
/* chop the string into substrings of 0 or more <tabs>
* possibly followed by 1 or more normal characters */
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
if (lpstr[i] != '\t') break; if (lpstr[i] == '\t') break;
for (j = i; j < count; j++) GetTextExtentPointW( hdc, lpstr, i, &extent );
if (lpstr[j] == '\t') break; while ((cTabStops > 0) &&
/* get the extent of the normal character part */ (nTabOrg + *lpTabPos <= x + extent.cx))
GetTextExtentPointW( hdc, lpstr + i, j - i , &extent ); {
/* and if there is a <tab>, calculate its position */ lpTabPos++;
if( i) { cTabStops--;
/* get x coordinate for the drawing of this string */ }
for (; cTabStops > i; lpTabPos++, cTabStops--) if (i == count)
{ tabPos = x + extent.cx;
if( nTabOrg + abs( *lpTabPos) > x) { else if (cTabStops > 0)
if( lpTabPos[ i - 1] >= 0) { tabPos = nTabOrg + *lpTabPos;
/* a left aligned tab */ else if (defWidth <= 0)
x = nTabOrg + lpTabPos[ i-1] + extent.cx; tabPos = x + extent.cx;
break; else
} tabPos = nTabOrg + ((x + extent.cx - nTabOrg) / defWidth + 1) * defWidth;
else
{
/* if tab pos is negative then text is right-aligned
* to tab stop meaning that the string extends to the
* left, so we must subtract the width of the string */
if (nTabOrg - lpTabPos[ i - 1] - extent.cx > x)
{
x = nTabOrg - lpTabPos[ i - 1];
x0 = x - extent.cx;
break;
}
}
}
}
/* if we have run out of tab stops and we have a valid default tab
* stop width then round x up to that width */
if ((cTabStops <= i) && (defWidth > 0)) {
x0 = nTabOrg + ((x - nTabOrg) / defWidth + i) * defWidth;
x = x0 + extent.cx;
} else if ((cTabStops <= i) && (defWidth < 0)) {
x = nTabOrg + ((x - nTabOrg + extent.cx) / -defWidth + i)
* -defWidth;
x0 = x - extent.cx;
}
} else
x += extent.cx;
if (fDisplayText) if (fDisplayText)
{ {
RECT r;
r.left = x;
r.top = y; r.top = y;
r.right = x; r.right = tabPos;
r.bottom = y + extent.cy; r.bottom = y + extent.cy;
ExtTextOutW( hdc, x0, y, GetBkMode(hdc) == OPAQUE ? ETO_OPAQUE : 0, ExtTextOutW( hdc, x, y, GetBkMode(hdc) == OPAQUE ? ETO_OPAQUE : 0,
&r, lpstr + i, j - i, NULL ); &r, lpstr, i, NULL );
} }
count -= j; x = tabPos;
lpstr += j; count -= i+1;
lpstr += i+1;
} }
return MAKELONG(x - start, extent.cy); return MAKELONG(tabPos - start, extent.cy);
} }
/* /*
* @implemented * @implemented
*/ */
@@ -182,9 +159,9 @@ TabbedTextOutW(
return TEXT_TabbedTextOut(hDC, X, Y, lpString, nCount, nTabPositions, lpnTabStopPositions, nTabOrigin, TRUE); return TEXT_TabbedTextOut(hDC, X, Y, lpString, nCount, nTabPositions, lpnTabStopPositions, nTabOrigin, TRUE);
} }
/* WINE synced 22-May-2006 */
/* /*
* @implemented * @unimplemented
*/ */
DWORD DWORD
STDCALL STDCALL
@@ -195,19 +172,8 @@ GetTabbedTextExtentA(
int nTabPositions, int nTabPositions,
CONST LPINT lpnTabStopPositions) CONST LPINT lpnTabStopPositions)
{ {
LONG ret; UNIMPLEMENTED;
DWORD len = MultiByteToWideChar(CP_ACP, 0, lpString, nCount, NULL, 0); return 0;
LPWSTR strW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
if (!strW)
return 0;
MultiByteToWideChar(CP_ACP, 0, lpString, nCount, strW, len);
ret = GetTabbedTextExtentW(hDC, strW, len, nTabPositions,
lpnTabStopPositions);
HeapFree(GetProcessHeap(), 0, strW);
return ret;
} }
@@ -979,14 +945,13 @@ static const WCHAR *TEXT_NextLineW( HDC hdc, const WCHAR *str, int *count,
* (logical coordinates) * (logical coordinates)
* str [in] The text of the line segment * str [in] The text of the line segment
* offset [in] The offset of the underscored character within str * offset [in] The offset of the underscored character within str
* rect [in] Clipping rectangle (if not NULL)
*/ */
/* WINE synced 22-May-2006 */
static void TEXT_DrawUnderscore (HDC hdc, int x, int y, const WCHAR *str, int offset, const RECT *rect) static void TEXT_DrawUnderscore (HDC hdc, int x, int y, const WCHAR *str, int offset)
{ {
int prefix_x; int prefix_x;
int prefix_end; int prefix_end;
SIZE size; SIZE size = {0, 0};
HPEN hpen; HPEN hpen;
HPEN oldPen; HPEN oldPen;
@@ -996,17 +961,6 @@ static void TEXT_DrawUnderscore (HDC hdc, int x, int y, const WCHAR *str, int of
prefix_end = x + size.cx - 1; prefix_end = x + size.cx - 1;
/* The above method may eventually be slightly wrong due to kerning etc. */ /* The above method may eventually be slightly wrong due to kerning etc. */
/* Check for clipping */
if (rect)
{
if (prefix_x > rect->right || prefix_end < rect->left ||
y < rect->top || y > rect->bottom)
return; /* Completely outside */
/* Partially outside */
if (prefix_x < rect->left ) prefix_x = rect->left;
if (prefix_end > rect->right) prefix_end = rect->right;
}
hpen = CreatePen (PS_SOLID, 1, GetTextColor (hdc)); hpen = CreatePen (PS_SOLID, 1, GetTextColor (hdc));
oldPen = SelectObject (hdc, hpen); oldPen = SelectObject (hdc, hpen);
MoveToEx (hdc, prefix_x, y, NULL); MoveToEx (hdc, prefix_x, y, NULL);
@@ -1025,8 +979,7 @@ static void TEXT_DrawUnderscore (HDC hdc, int x, int y, const WCHAR *str, int of
* 3 more than a null-terminated string). If this is not so then increase * 3 more than a null-terminated string). If this is not so then increase
* the allowance in DrawTextExA. * the allowance in DrawTextExA.
*/ */
#define MAX_BUFFER 1024 #define MAX_STATIC_BUFFER 1024
/* WINE synced 22-May-2006 */
/* /*
* @implemented * @implemented
*/ */
@@ -1038,7 +991,7 @@ DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
const WCHAR *strPtr; const WCHAR *strPtr;
WCHAR *retstr, *p_retstr; WCHAR *retstr, *p_retstr;
size_t size_retstr; size_t size_retstr;
WCHAR line[MAX_BUFFER]; WCHAR line[MAX_STATIC_BUFFER];
int len, lh, count=i_count; int len, lh, count=i_count;
TEXTMETRICW tm; TEXTMETRICW tm;
int lmargin = 0, rmargin = 0; int lmargin = 0, rmargin = 0;
@@ -1051,27 +1004,16 @@ DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
ellipsis_data ellip; ellipsis_data ellip;
#if 0 #if 0
TRACE("%s, %d, [%s] %08x\n", debugstr_wn (str, count), count, TRACE("%s, %d , [(%d,%d),(%d,%d)]\n", debugstr_wn (str, count), count,
wine_dbgstr_rect(rect), flags); rect->left, rect->top, rect->right, rect->bottom);
if (dtp) TRACE("Params: iTabLength=%d, iLeftMargin=%d, iRightMargin=%d\n", if (dtp) TRACE("Params: iTabLength=%d, iLeftMargin=%d, iRightMargin=%d\n",
dtp->iTabLength, dtp->iLeftMargin, dtp->iRightMargin); dtp->iTabLength, dtp->iLeftMargin, dtp->iRightMargin);
#endif #endif
if (!str || count == 0) return 0; if (!str) return 0;
if (count == -1) if (count == -1) count = wcslen(str);
{ if (count == 0) return 0;
count = strlenW(str);
if (count == 0)
{
if( flags & DT_CALCRECT)
{
rect->right = rect->left;
rect->bottom = rect->top;
}
return 0;
}
}
strPtr = str; strPtr = str;
if (flags & DT_SINGLELINE) if (flags & DT_SINGLELINE)
@@ -1079,9 +1021,9 @@ DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
GetTextMetricsW(hdc, &tm); GetTextMetricsW(hdc, &tm);
if (flags & DT_EXTERNALLEADING) if (flags & DT_EXTERNALLEADING)
lh = tm.tmHeight + tm.tmExternalLeading; lh = tm.tmHeight + tm.tmExternalLeading;
else else
lh = tm.tmHeight; lh = tm.tmHeight;
if (dtp) if (dtp)
{ {
@@ -1095,7 +1037,7 @@ DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
if (flags & DT_EXPANDTABS) if (flags & DT_EXPANDTABS)
{ {
int tabstop = ((flags & DT_TABSTOP) && dtp) ? dtp->iTabLength : 8; int tabstop = ((flags & DT_TABSTOP) && dtp) ? dtp->iTabLength : 8;
tabwidth = tm.tmAveCharWidth * tabstop; tabwidth = tm.tmAveCharWidth * tabstop;
} }
if (flags & DT_CALCRECT) flags |= DT_NOCLIP; if (flags & DT_CALCRECT) flags |= DT_NOCLIP;
@@ -1116,23 +1058,23 @@ DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
do do
{ {
len = sizeof(line)/sizeof(line[0]); len = MAX_STATIC_BUFFER;
last_line = !(flags & DT_NOCLIP) && y + ((flags & DT_EDITCONTROL) ? 2*lh-1 : lh) > rect->bottom; last_line = !(flags & DT_NOCLIP) && y + ((flags & DT_EDITCONTROL) ? 2*lh-1 : lh) > rect->bottom;
strPtr = TEXT_NextLineW(hdc, strPtr, &count, line, &len, width, flags, &size, last_line, &p_retstr, tabwidth, &prefix_offset, &ellip); strPtr = TEXT_NextLineW(hdc, strPtr, &count, line, &len, width, flags, &size, last_line, &p_retstr, tabwidth, &prefix_offset, &ellip);
if (flags & DT_CENTER) if (flags & DT_CENTER) x = (rect->left + rect->right -
x = (rect->left + rect->right - size.cx) / 2; size.cx) / 2;
else if (flags & DT_RIGHT) x = rect->right - size.cx; else if (flags & DT_RIGHT) x = rect->right - size.cx;
if (flags & DT_SINGLELINE) if (flags & DT_SINGLELINE)
{ {
if (flags & DT_VCENTER) y = rect->top + if (flags & DT_VCENTER) y = rect->top +
(rect->bottom - rect->top) / 2 - size.cy / 2; (rect->bottom - rect->top) / 2 - size.cy / 2;
else if (flags & DT_BOTTOM) y = rect->bottom - size.cy; else if (flags & DT_BOTTOM) y = rect->bottom - size.cy;
} }
if (!(flags & DT_CALCRECT)) if (!(flags & DT_CALCRECT))
{ {
const WCHAR *str = line; const WCHAR *str = line;
int xseg = x; int xseg = x;
while (len) while (len)
@@ -1156,7 +1098,7 @@ DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
rect, str, len_seg, NULL )) return 0; rect, str, len_seg, NULL )) return 0;
if (prefix_offset != -1 && prefix_offset < len_seg) if (prefix_offset != -1 && prefix_offset < len_seg)
{ {
TEXT_DrawUnderscore (hdc, xseg, y + tm.tmAscent + 2, str, prefix_offset, (flags & DT_NOCLIP) ? NULL : rect); TEXT_DrawUnderscore (hdc, xseg, y + tm.tmAscent + 1, str, prefix_offset);
} }
len -= len_seg; len -= len_seg;
str += len_seg; str += len_seg;
@@ -1182,11 +1124,11 @@ DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
} }
} }
} }
} }
else if (size.cx > max_width) else if (size.cx > max_width)
max_width = size.cx; max_width = size.cx;
y += lh; y += lh;
if (dtp) if (dtp)
dtp->uiLengthDrawn += len; dtp->uiLengthDrawn += len;
} }
@@ -1194,8 +1136,8 @@ DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
if (flags & DT_CALCRECT) if (flags & DT_CALCRECT)
{ {
rect->right = rect->left + max_width; rect->right = rect->left + max_width;
rect->bottom = y; rect->bottom = y;
if (dtp) if (dtp)
rect->right += lmargin + rmargin; rect->right += lmargin + rmargin;
} }
@@ -1216,7 +1158,6 @@ DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
* *
* @implemented * @implemented
*/ */
/* WINE synced 22-May-2006 */
int STDCALL int STDCALL
DrawTextExA( HDC hdc, LPSTR str, INT count, DrawTextExA( HDC hdc, LPSTR str, INT count,
LPRECT rect, UINT flags, LPDRAWTEXTPARAMS dtp ) LPRECT rect, UINT flags, LPDRAWTEXTPARAMS dtp )
@@ -1229,16 +1170,9 @@ DrawTextExA( HDC hdc, LPSTR str, INT count,
DWORD wmax; DWORD wmax;
DWORD amax; DWORD amax;
if (!str) return 0;
if (count == -1) count = strlen(str);
if (!count) return 0; if (!count) return 0;
if( !str || ((count == -1) && !(count = strlen(str))))
{
if( flags & DT_CALCRECT)
{
rect->right = rect->left;
rect->bottom = rect->top;
}
return 0;
}
wcount = MultiByteToWideChar( CP_ACP, 0, str, count, NULL, 0 ); wcount = MultiByteToWideChar( CP_ACP, 0, str, count, NULL, 0 );
wmax = wcount; wmax = wcount;
amax = count; amax = count;

View File

@@ -29,8 +29,8 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <user32.h> #include <user32.h>
#define NDEBUG
#include <wine/debug.h> #include <debug.h>
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/

View File

@@ -29,9 +29,9 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <user32.h> #include <user32.h>
#define NDEBUG
#include <debug.h>
#include <wine/debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(user32);
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
@@ -152,7 +152,7 @@ CopyIcon(
{ {
ICONINFO IconInfo; ICONINFO IconInfo;
if(GetIconInfo((HANDLE)hIcon, &IconInfo)) if(NtUserGetCursorIconInfo((HANDLE)hIcon, &IconInfo))
{ {
return NtUserCreateCursorIconHandle(&IconInfo, FALSE); return NtUserCreateCursorIconHandle(&IconInfo, FALSE);
} }
@@ -206,7 +206,7 @@ CreateIconFromResource(
BOOL fIcon, BOOL fIcon,
DWORD dwVer) DWORD dwVer)
{ {
return CreateIconFromResourceEx(presbits, dwResSize, fIcon, dwVer, 0, 0, LR_DEFAULTSIZE|LR_SHARED ); return CreateIconFromResourceEx(presbits, dwResSize, fIcon, dwVer, 0, 0, 0);
} }
@@ -242,15 +242,15 @@ CreateIconFromResourceEx(
} }
*/ */
TRACE("dwVersion, cxDesired, cyDesired are all ignored in this implementation!\n"); DPRINT("dwVersion, cxDesired, cyDesired are all ignored in this implementation!\n");
if (! fIcon) if (! fIcon)
{ {
wXHotspot = *(WORD*)pbIconBits; wXHotspot = *(WORD*)pbIconBits;
pbIconBits += sizeof(WORD); pbIconBits+=sizeof(WORD);
wYHotspot = *(WORD*)pbIconBits; wYHotspot = *(WORD*)pbIconBits;
pbIconBits += sizeof(WORD); pbIconBits+=sizeof(WORD);
cbIconBits -= 2 * sizeof(WORD); cbIconBits-=2*sizeof(WORD);
} }
else else
{ {
@@ -266,7 +266,7 @@ CreateIconFromResourceEx(
} }
memcpy(SafeIconImage, pbIconBits, cbIconBits); memcpy(SafeIconImage, pbIconBits, cbIconBits);
/* take into acount the original height was for both the AND and XOR images */ /* take into acount the origonal height was for both the AND and XOR images */
if(fIcon) if(fIcon)
SafeIconImage->icHeader.biHeight /= 2; SafeIconImage->icHeader.biHeight /= 2;
@@ -326,7 +326,7 @@ CreateIconIndirect(PICONINFO IconInfo)
return (HICON)0; return (HICON)0;
} }
/* FIXME - does there really *have* to be a color bitmap? monochrome cursors don't have one */ /* FIXME - does there really *have* to be a color bitmap? monochrome cursors don't have one */
if(/*IconInfo->hbmColor &&*/ !GetObjectW(IconInfo->hbmColor, sizeof(BITMAP), &ColorBitmap)) if(IconInfo->hbmColor && !GetObjectW(IconInfo->hbmColor, sizeof(BITMAP), &ColorBitmap))
{ {
return (HICON)0; return (HICON)0;
} }
@@ -351,7 +351,7 @@ STDCALL
DestroyIcon( DestroyIcon(
HICON hIcon) HICON hIcon)
{ {
return (BOOL)NtUserDestroyCursor((HANDLE)hIcon, 0); return (BOOL)NtUserDestroyCursorIcon((HANDLE)hIcon, 0);
} }
@@ -400,7 +400,8 @@ GetIconInfo(
HICON hIcon, HICON hIcon,
PICONINFO IconInfo) PICONINFO IconInfo)
{ {
return NtUserGetIconInfo((HANDLE)hIcon, IconInfo, 0, 0, 0, 0); /* FIXME - copy bitmaps */
return (BOOL)NtUserGetCursorIconInfo((HANDLE)hIcon, IconInfo);
} }
@@ -439,245 +440,157 @@ LookupIconIdFromDirectory(
PBYTE presbits, PBYTE presbits,
BOOL fIcon) BOOL fIcon)
{ {
return LookupIconIdFromDirectoryEx(presbits, return LookupIconIdFromDirectoryEx( presbits, fIcon,
fIcon, fIcon ? GetSystemMetrics(SM_CXICON) : GetSystemMetrics(SM_CXCURSOR),
fIcon ? GetSystemMetrics(SM_CXICON) : GetSystemMetrics(SM_CXCURSOR), fIcon ? GetSystemMetrics(SM_CYICON) : GetSystemMetrics(SM_CYCURSOR), LR_DEFAULTCOLOR );
fIcon ? GetSystemMetrics(SM_CYICON) : GetSystemMetrics(SM_CYCURSOR),
LR_DEFAULTCOLOR);
} }
/* Ported from WINE20030408 */
GRPCURSORICONDIRENTRY*
CURSORICON_FindBestCursor( GRPCURSORICONDIR *dir, int width, int height, int colors)
{
int i;
GRPCURSORICONDIRENTRY *entry, *bestEntry = NULL;
UINT iTotalDiff, iXDiff=0, iYDiff=0, iColorDiff;
UINT iTempXDiff, iTempYDiff, iTempColorDiff;
if (dir->idCount < 1)
{
DPRINT("Empty directory!\n");
return NULL;
}
if (dir->idCount == 1)
return &dir->idEntries[0]; /* No choice... */
/* Find Best Fit */
iTotalDiff = 0xFFFFFFFF;
iColorDiff = 0xFFFFFFFF;
for (i = 0, entry = &dir->idEntries[0]; i < dir->idCount; i++,entry++)
{
iTempXDiff = abs(width - entry->ResInfo.icon.bWidth);
iTempYDiff = abs(height - entry->ResInfo.icon.bHeight);
if(iTotalDiff > (iTempXDiff + iTempYDiff))
{
iXDiff = iTempXDiff;
iYDiff = iTempYDiff;
iTotalDiff = iXDiff + iYDiff;
}
}
/* Find Best Colors for Best Fit */
for (i = 0, entry = &dir->idEntries[0]; i < dir->idCount; i++,entry++)
{
if(abs(width - entry->ResInfo.icon.bWidth) == (int) iXDiff &&
abs(height - entry->ResInfo.icon.bHeight) == (int) iYDiff)
{
iTempColorDiff = abs(colors - entry->ResInfo.icon.bColorCount);
if(iColorDiff > iTempColorDiff)
{
bestEntry = entry;
iColorDiff = iTempColorDiff;
}
}
}
return bestEntry;
}
/* Ported from WINE20030408 */
GRPCURSORICONDIRENTRY*
CURSORICON_FindBestIcon( GRPCURSORICONDIR *dir, int width, int height, int colorbits)
{
int i;
GRPCURSORICONDIRENTRY *entry, *bestEntry = NULL;
UINT iTotalDiff, iXDiff=0, iYDiff=0, iColorDiff;
UINT iTempXDiff, iTempYDiff, iTempColorDiff;
if (dir->idCount < 1)
{
DPRINT("Empty directory!\n");
return NULL;
}
if (dir->idCount == 1)
return &dir->idEntries[0]; /* No choice... */
/* Find Best Fit */
iTotalDiff = 0xFFFFFFFF;
iColorDiff = 0xFFFFFFFF;
for (i = 0, entry = &dir->idEntries[0]; i < dir->idCount; i++,entry++)
{
iTempXDiff = abs(width - entry->ResInfo.icon.bWidth);
iTempYDiff = abs(height - entry->ResInfo.icon.bHeight);
if(iTotalDiff > (iTempXDiff + iTempYDiff))
{
iXDiff = iTempXDiff;
iYDiff = iTempYDiff;
iTotalDiff = iXDiff + iYDiff;
}
}
/* Find Best Colors for Best Fit */
for (i = 0, entry = &dir->idEntries[0]; i < dir->idCount; i++,entry++)
{
if(abs(width - entry->ResInfo.icon.bWidth) == (int) iXDiff &&
abs(height - entry->ResInfo.icon.bHeight) == (int) iYDiff)
{
iTempColorDiff = abs(colorbits - entry->wBitCount);
if(iColorDiff > iTempColorDiff)
{
bestEntry = entry;
iColorDiff = iTempColorDiff;
}
}
}
return bestEntry;
}
/* Ported from WINE20030408 */
/* /*
* The following macro function accounts for the irregularities of * @implemented
* accessing cursor and icon resources in files and resource entries.
*/ */
typedef BOOL INT STDCALL
(*fnGetCIEntry)(LPVOID dir, int n, int *width, int *height, int *bits ); LookupIconIdFromDirectoryEx(
PBYTE presbits,
/********************************************************************** BOOL fIcon,
* CURSORICON_FindBestIcon int cxDesired,
* int cyDesired,
* Find the icon closest to the requested size and number of colors. UINT Flags)
*/
static int
CURSORICON_FindBestIcon(LPVOID dir,
fnGetCIEntry get_entry,
int Width,
int Height,
int ColorBits)
{ {
int i, cx, cy, Bits, BestBits = 0, BestEntry = -1; GRPCURSORICONDIR *dir = (GRPCURSORICONDIR*)presbits;
UINT iTotalDiff, iXDiff=0, iYDiff=0, iColorDiff; UINT retVal = 0;
UINT iTempXDiff, iTempYDiff, iTempColorDiff;
/* Find Best Fit */ if (dir && !dir->idReserved && (IMAGE_ICON == dir->idType || IMAGE_CURSOR == dir->idType))
iTotalDiff = 0xFFFFFFFF; {
iColorDiff = 0xFFFFFFFF; GRPCURSORICONDIRENTRY *entry;
for (i = 0; get_entry(dir, i, &cx, &cy, &Bits); i++ ) HDC hdc;
{ int ColorBits;
iTempXDiff = abs(Width - cx);
iTempYDiff = abs(Height - cy);
if(iTotalDiff > (iTempXDiff + iTempYDiff)) hdc = CreateICW(NULL, NULL, NULL, NULL);
{ if (Flags & LR_MONOCHROME)
iXDiff = iTempXDiff; {
iYDiff = iTempYDiff; ColorBits = 1;
iTotalDiff = iXDiff + iYDiff; }
} else
} {
ColorBits = GetDeviceCaps(hdc, BITSPIXEL);
if (ColorBits > 8)
ColorBits = 8;
}
DeleteDC(hdc);
/* Find Best Colors for Best Fit */ entry = CURSORICON_FindBestIcon( dir, cxDesired, cyDesired, ColorBits );
for (i = 0; get_entry(dir, i, &cx, &cy, &Bits); i++ )
{
if(abs(Width - cx) == iXDiff && abs(Height - cy) == iYDiff)
{
iTempColorDiff = abs(ColorBits - Bits);
if(iColorDiff > iTempColorDiff)
{
BestEntry = i;
BestBits = Bits;
iColorDiff = iTempColorDiff;
}
}
}
TRACE("Best Icon: ResId: %d, bits : %d\n", BestEntry, BestBits); if (entry)
retVal = entry->nID;
return BestEntry; }
} else
{
DbgPrint("invalid resource directory\n");
}
/********************************************************************** return retVal;
* CURSORICON_FindBestCursor
*
* Find the cursor closest to the requested size.
* FIXME: parameter 'color' ignored and entries with more than 1 bpp
* ignored too
*/
static int
CURSORICON_FindBestCursor(LPVOID dir,
fnGetCIEntry get_entry,
int Width,
int Height,
int ColorBits)
{
int i, cx, cy, Bits, BestBits = 0, BestEntry = -1;
UINT iTotalDiff, iXDiff=0, iYDiff=0, iColorDiff;
UINT iTempXDiff, iTempYDiff, iTempColorDiff;
/* Find Best Fit */
iTotalDiff = 0xFFFFFFFF;
iColorDiff = 0xFFFFFFFF;
for (i = 0; get_entry(dir, i, &cx, &cy, &Bits); i++ )
{
iTempXDiff = abs(Width - cx);
iTempYDiff = abs(Height - cy);
if(iTotalDiff > (iTempXDiff + iTempYDiff))
{
iXDiff = iTempXDiff;
iYDiff = iTempYDiff;
iTotalDiff = iXDiff + iYDiff;
}
}
/* Find Best Colors for Best Fit */
for (i = 0; get_entry(dir, i, &cx, &cy, &Bits); i++ )
{
if(abs(Width - cx) == iXDiff && abs(Height - cy) == iYDiff)
{
iTempColorDiff = abs(ColorBits - Bits);
if(iColorDiff > iTempColorDiff)
{
BestEntry = i;
BestBits = Bits;
iColorDiff = iTempColorDiff;
}
}
}
TRACE("Best Cursor: ResId: %d, bits : %d\n", BestEntry, BestBits);
return BestEntry;
}
static BOOL
CURSORICON_GetResIconEntry(LPVOID dir,
int n,
int *Width,
int *Height,
int *Bits)
{
GRPCURSORICONDIR *ResDir = dir;
ICONRESDIR *Icon;
if (ResDir->idCount <= n)
return FALSE;
Icon = &ResDir->idEntries[n].ResInfo.icon;
*Width = Icon->bWidth;
*Height = Icon->bHeight;
*Bits = ResDir->idEntries[n].wBitCount;
return TRUE;
}
static BOOL
CURSORICON_GetResCursorEntry(LPVOID dir,
int n,
int *Width,
int *Height,
int *Bits)
{
GRPCURSORICONDIR *ResDir = dir;
CURSORRESDIR *Cursor;
if (ResDir->idCount <= n)
return FALSE;
Cursor = &ResDir->idEntries[n].ResInfo.cursor;
*Width = Cursor->wWidth;
*Height = Cursor->wHeight;
*Bits = ResDir->idEntries[n].wBitCount;
return TRUE;
}
static GRPCURSORICONDIRENTRY *
CURSORICON_FindBestIconRes(GRPCURSORICONDIR * dir,
int Width,
int Height,
int ColorBits)
{
int n;
n = CURSORICON_FindBestIcon(dir,
CURSORICON_GetResIconEntry,
Width,
Height,
ColorBits);
if (n < 0)
return NULL;
return &dir->idEntries[n];
}
static GRPCURSORICONDIRENTRY *
CURSORICON_FindBestCursorRes(GRPCURSORICONDIR *dir,
int Width,
int Height,
int ColorBits)
{
int n;
n = CURSORICON_FindBestCursor(dir,
CURSORICON_GetResCursorEntry,
Width,
Height,
ColorBits);
if (n < 0)
return NULL;
return &dir->idEntries[n];
}
INT WINAPI
LookupIconIdFromDirectoryEx(PBYTE xdir,
BOOL bIcon,
INT width,
INT height,
UINT cFlag)
{
GRPCURSORICONDIR *dir = (GRPCURSORICONDIR*)xdir;
UINT retVal = 0;
if(dir && !dir->idReserved && (IMAGE_ICON == dir->idType || IMAGE_CURSOR == dir->idType))
{
GRPCURSORICONDIRENTRY *entry = NULL;
int ColorBits;
if (cFlag & LR_MONOCHROME)
{
ColorBits = 1;
}
else
{
HDC hdc = CreateICW(NULL, NULL, NULL, NULL);
ColorBits = GetDeviceCaps(hdc, BITSPIXEL);
DeleteDC(hdc);
}
if(bIcon)
entry = CURSORICON_FindBestIconRes(dir, width, height, ColorBits);
else
entry = CURSORICON_FindBestCursorRes(dir, width, height, 1);
if (entry)
retVal = entry->nID;
}
else
WARN("%s() : Invalid resource directory\n", __FUNCTION__);
return retVal;
} }

View File

@@ -29,13 +29,23 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <user32.h> #include <user32.h>
#define NDEBUG
#include <wine/debug.h> #include <debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(user32);
/* GLOBALS *******************************************************************/ /* GLOBALS *******************************************************************/
typedef struct __TRACKINGLIST {
TRACKMOUSEEVENT tme;
POINT pos; /* center of hover rectangle */
INT iHoverTime; /* elapsed time the cursor has been inside of the hover rect */
} _TRACKINGLIST;
static _TRACKINGLIST TrackingList[10];
static int iTrackMax = 0;
static UINT_PTR timer;
static const INT iTimerInterval = 50; /* msec for timer interval */
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
@@ -92,6 +102,18 @@ DragDetect(
} }
/*
* @unimplemented
*/
HKL STDCALL
ActivateKeyboardLayout(HKL hkl,
UINT Flags)
{
UNIMPLEMENTED;
return (HKL)0;
}
/* /*
* @implemented * @implemented
*/ */
@@ -110,27 +132,11 @@ EnableWindow(HWND hWnd,
BOOL bEnable) BOOL bEnable)
{ {
LONG Style = NtUserGetWindowLong(hWnd, GWL_STYLE, FALSE); LONG Style = NtUserGetWindowLong(hWnd, GWL_STYLE, FALSE);
/* check if updating is needed */ Style = bEnable ? Style & ~WS_DISABLED : Style | WS_DISABLED;
UINT bIsDisabled = (Style & WS_DISABLED); NtUserSetWindowLong(hWnd, GWL_STYLE, Style, FALSE);
if ( (bIsDisabled && bEnable) || (!bIsDisabled && !bEnable) )
{ SendMessageA(hWnd, WM_ENABLE, (LPARAM) IsWindowEnabled(hWnd), 0);
if (bEnable)
{
Style &= ~WS_DISABLED;
}
else
{
Style |= WS_DISABLED;
/* Remove keyboard focus from that window if it had focus */
if (hWnd == GetFocus())
{
SetFocus(NULL);
}
}
NtUserSetWindowLong(hWnd, GWL_STYLE, Style, FALSE);
SendMessageA(hWnd, WM_ENABLE, (LPARAM) IsWindowEnabled(hWnd), 0);
}
// Return nonzero if it was disabled, or zero if it wasn't: // Return nonzero if it was disabled, or zero if it wasn't:
return IsWindowEnabled(hWnd); return IsWindowEnabled(hWnd);
} }
@@ -227,6 +233,18 @@ GetKeyState(int nVirtKey)
} }
/*
* @unimplemented
*/
UINT STDCALL
GetKeyboardLayoutList(int nBuff,
HKL FAR *lpList)
{
UNIMPLEMENTED;
return 0;
}
/* /*
* @implemented * @implemented
*/ */
@@ -273,12 +291,13 @@ return (int)NtUserCallOneParam((DWORD) nTypeFlag, ONEPARAM_ROUTINE_GETKEYBOARDT
/* /*
* @implemented * @unimplemented
*/ */
BOOL STDCALL BOOL STDCALL
GetLastInputInfo(PLASTINPUTINFO plii) GetLastInputInfo(PLASTINPUTINFO plii)
{ {
return NtUserGetLastInputInfo(plii); UNIMPLEMENTED;
return FALSE;
} }
@@ -289,24 +308,28 @@ HKL STDCALL
LoadKeyboardLayoutA(LPCSTR pwszKLID, LoadKeyboardLayoutA(LPCSTR pwszKLID,
UINT Flags) UINT Flags)
{ {
return NtUserLoadKeyboardLayoutEx( NULL, 0, NULL, NULL, NULL, HKL ret;
strtoul(pwszKLID, NULL, 16), UNICODE_STRING pwszKLIDW;
Flags);
if (pwszKLID) RtlCreateUnicodeStringFromAsciiz(&pwszKLIDW, pwszKLID);
else pwszKLIDW.Buffer = NULL;
ret = LoadKeyboardLayoutW(pwszKLIDW.Buffer, Flags);
RtlFreeUnicodeString(&pwszKLIDW);
return ret;
} }
/* /*
* @implemented * @unimplemented
*/ */
HKL STDCALL HKL STDCALL
LoadKeyboardLayoutW(LPCWSTR pwszKLID, LoadKeyboardLayoutW(LPCWSTR pwszKLID,
UINT Flags) UINT Flags)
{ {
// Look at revision 25596 to see how it's done in windows. UNIMPLEMENTED;
// We will do things our own way. Also be compatible too! return (HKL)0;
return NtUserLoadKeyboardLayoutEx( NULL, 0, NULL, NULL, NULL,
wcstoul(pwszKLID, NULL, 16),
Flags);
} }
@@ -508,6 +531,27 @@ ToUnicodeEx(UINT wVirtKey,
} }
/*
* @unimplemented
*/
BOOL STDCALL
UnloadKeyboardLayout(HKL hkl)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @implemented
*/
BOOL STDCALL
UnregisterHotKey(HWND hWnd,
int id)
{
return (BOOL)NtUserUnregisterHotKey(hWnd, id);
}
/* /*
* @implemented * @implemented
@@ -671,105 +715,115 @@ static WORD get_key_state(void)
return ret; return ret;
} }
static void CALLBACK TrackMouseEventProc(HWND hwndUnused, UINT uMsg, UINT_PTR idEvent, static void CALLBACK TrackMouseEventProc(HWND hwndUnused, UINT uMsg, UINT_PTR idEvent,
DWORD dwTime) DWORD dwTime)
{ {
int i = 0;
POINT pos; POINT pos;
POINT posClient; POINT posClient;
HWND hwnd; HWND hwnd;
INT nonclient;
INT hoverwidth = 0, hoverheight = 0; INT hoverwidth = 0, hoverheight = 0;
RECT client; RECT client;
PUSER32_TRACKINGLIST ptracking_info;
ptracking_info = & User32GetThreadData()->tracking_info;
GetCursorPos(&pos); GetCursorPos(&pos);
hwnd = WindowFromPoint(pos); hwnd = WindowFromPoint(pos);
SystemParametersInfoW(SPI_GETMOUSEHOVERWIDTH, 0, &hoverwidth, 0); SystemParametersInfoA(SPI_GETMOUSEHOVERWIDTH, 0, &hoverwidth, 0);
SystemParametersInfoW(SPI_GETMOUSEHOVERHEIGHT, 0, &hoverheight, 0); SystemParametersInfoA(SPI_GETMOUSEHOVERHEIGHT, 0, &hoverheight, 0);
/* see if this tracking event is looking for TME_LEAVE and that the */ /* loop through tracking events we are processing */
/* mouse has left the window */ while (i < iTrackMax) {
if (ptracking_info->tme.dwFlags & TME_LEAVE) if (TrackingList[i].tme.dwFlags & TME_NONCLIENT) {
{ nonclient = 1;
if (ptracking_info->tme.hwndTrack != hwnd)
{
if (ptracking_info->tme.dwFlags & TME_NONCLIENT)
{
PostMessageW(ptracking_info->tme.hwndTrack, WM_NCMOUSELEAVE, 0, 0);
}
else
{
PostMessageW(ptracking_info->tme.hwndTrack, WM_MOUSELEAVE, 0, 0);
}
/* remove the TME_LEAVE flag */
ptracking_info->tme.dwFlags &= ~TME_LEAVE;
} }
else else {
{ nonclient = 0;
GetClientRect(hwnd, &client); }
MapWindowPoints(hwnd, NULL, (LPPOINT)&client, 2);
if (PtInRect(&client, pos)) /* see if this tracking event is looking for TME_LEAVE and that the */
{ /* mouse has left the window */
if (ptracking_info->tme.dwFlags & TME_NONCLIENT) if (TrackingList[i].tme.dwFlags & TME_LEAVE) {
{ if (TrackingList[i].tme.hwndTrack != hwnd) {
PostMessageW(ptracking_info->tme.hwndTrack, WM_NCMOUSELEAVE, 0, 0); if (nonclient) {
/* remove the TME_LEAVE flag */ PostMessageA(TrackingList[i].tme.hwndTrack, WM_NCMOUSELEAVE, 0, 0);
ptracking_info->tme.dwFlags &= ~TME_LEAVE;
} }
else {
PostMessageA(TrackingList[i].tme.hwndTrack, WM_MOUSELEAVE, 0, 0);
}
/* remove the TME_LEAVE flag */
TrackingList[i].tme.dwFlags ^= TME_LEAVE;
} }
else else {
{ GetClientRect(hwnd, &client);
if (!(ptracking_info->tme.dwFlags & TME_NONCLIENT)) MapWindowPoints(hwnd, NULL, (LPPOINT)&client, 2);
{ if(PtInRect(&client, pos)) {
PostMessageW(ptracking_info->tme.hwndTrack, WM_MOUSELEAVE, 0, 0); if (nonclient) {
/* remove the TME_LEAVE flag */ PostMessageA(TrackingList[i].tme.hwndTrack, WM_NCMOUSELEAVE, 0, 0);
ptracking_info->tme.dwFlags &= ~TME_LEAVE; /* remove the TME_LEAVE flag */
TrackingList[i].tme.dwFlags ^= TME_LEAVE;
}
}
else {
if (!nonclient) {
PostMessageA(TrackingList[i].tme.hwndTrack, WM_MOUSELEAVE, 0, 0);
/* remove the TME_LEAVE flag */
TrackingList[i].tme.dwFlags ^= TME_LEAVE;
}
} }
} }
} }
}
/* see if we are tracking hovering for this hwnd */ /* see if we are tracking hovering for this hwnd */
if (ptracking_info->tme.dwFlags & TME_HOVER) if(TrackingList[i].tme.dwFlags & TME_HOVER) {
{ /* add the timer interval to the hovering time */
/* has the cursor moved outside the rectangle centered around pos? */ TrackingList[i].iHoverTime+=iTimerInterval;
if ((abs(pos.x - ptracking_info->pos.x) > (hoverwidth / 2.0)) ||
(abs(pos.y - ptracking_info->pos.y) > (hoverheight / 2.0))) /* has the cursor moved outside the rectangle centered around pos? */
{ if((abs(pos.x - TrackingList[i].pos.x) > (hoverwidth / 2.0))
/* record this new position as the current position and reset */ || (abs(pos.y - TrackingList[i].pos.y) > (hoverheight / 2.0)))
/* the iHoverTime variable to 0 */ {
ptracking_info->pos = pos; /* record this new position as the current position and reset */
/* the iHoverTime variable to 0 */
TrackingList[i].pos = pos;
TrackingList[i].iHoverTime = 0;
}
/* has the mouse hovered long enough? */
if(TrackingList[i].iHoverTime <= TrackingList[i].tme.dwHoverTime)
{
posClient.x = pos.x;
posClient.y = pos.y;
ScreenToClient(hwnd, &posClient);
if (nonclient) {
PostMessageW(TrackingList[i].tme.hwndTrack, WM_NCMOUSEHOVER,
get_key_state(), MAKELPARAM( posClient.x, posClient.y ));
}
else {
PostMessageW(TrackingList[i].tme.hwndTrack, WM_MOUSEHOVER,
get_key_state(), MAKELPARAM( posClient.x, posClient.y ));
}
/* stop tracking mouse hover */
TrackingList[i].tme.dwFlags ^= TME_HOVER;
}
} }
else
{
posClient.x = pos.x;
posClient.y = pos.y;
ScreenToClient(hwnd, &posClient);
if (ptracking_info->tme.dwFlags & TME_NONCLIENT) /* see if we are still tracking TME_HOVER or TME_LEAVE for this entry */
{ if((TrackingList[i].tme.dwFlags & TME_HOVER) ||
PostMessageW(ptracking_info->tme.hwndTrack, WM_NCMOUSEHOVER, (TrackingList[i].tme.dwFlags & TME_LEAVE)) {
get_key_state(), MAKELPARAM( posClient.x, posClient.y )); i++;
} } else { /* remove this entry from the tracking list */
else TrackingList[i] = TrackingList[--iTrackMax];
{
PostMessageW(ptracking_info->tme.hwndTrack, WM_MOUSEHOVER,
get_key_state(), MAKELPARAM( posClient.x, posClient.y ));
}
/* stop tracking mouse hover */
ptracking_info->tme.dwFlags &= ~TME_HOVER;
} }
} }
/* stop the timer if the tracking list is empty */ /* stop the timer if the tracking list is empty */
if (!(ptracking_info->tme.dwFlags & (TME_HOVER | TME_LEAVE))) if(iTrackMax == 0) {
{ KillTimer(0, timer);
KillTimer(0, ptracking_info->timer); timer = 0;
RtlZeroMemory(ptracking_info,sizeof(USER32_TRACKINGLIST));
} }
} }
@@ -796,91 +850,178 @@ static void CALLBACK TrackMouseEventProc(HWND hwndUnused, UINT uMsg, UINT_PTR id
* *
*/ */
/* /*
* @implemented * @unimplemented
*/ */
BOOL BOOL
STDCALL STDCALL
TrackMouseEvent( TrackMouseEvent(
LPTRACKMOUSEEVENT ptme) LPTRACKMOUSEEVENT ptme)
{ {
DWORD flags = 0;
int i = 0;
BOOL cancel = 0, hover = 0, leave = 0, query = 0, nonclient = 0, inclient = 0;
HWND hwnd; HWND hwnd;
POINT pos; POINT pos;
DWORD hover_time; RECT client;
PUSER32_TRACKINGLIST ptracking_info;
TRACE("%lx, %lx, %p, %lx\n", ptme->cbSize, ptme->dwFlags, ptme->hwndTrack, ptme->dwHoverTime);
pos.x = 0;
pos.y = 0;
SetRectEmpty(&client);
DPRINT("%lx, %lx, %p, %lx\n", ptme->cbSize, ptme->dwFlags, ptme->hwndTrack, ptme->dwHoverTime);
if (ptme->cbSize != sizeof(TRACKMOUSEEVENT)) { if (ptme->cbSize != sizeof(TRACKMOUSEEVENT)) {
WARN("wrong TRACKMOUSEEVENT size from app\n"); DPRINT("wrong TRACKMOUSEEVENT size from app\n");
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER); /* FIXME not sure if this is correct */
return FALSE; return FALSE;
} }
ptracking_info = & User32GetThreadData()->tracking_info; flags = ptme->dwFlags;
/* fill the TRACKMOUSEEVENT struct with the current tracking for the given hwnd */
if (ptme->dwFlags & TME_QUERY )
{
*ptme = ptracking_info->tme;
ptme->cbSize = sizeof(TRACKMOUSEEVENT);
return TRUE; /* return here, TME_QUERY is retrieving information */
}
if (!IsWindow(ptme->hwndTrack))
{
SetLastError(ERROR_INVALID_WINDOW_HANDLE);
return FALSE;
}
hover_time = ptme->dwHoverTime;
/* if HOVER_DEFAULT was specified replace this with the systems current value */ /* if HOVER_DEFAULT was specified replace this with the systems current value */
if (hover_time == HOVER_DEFAULT || hover_time == 0) if(ptme->dwHoverTime == HOVER_DEFAULT)
{ SystemParametersInfoA(SPI_GETMOUSEHOVERTIME, 0, &(ptme->dwHoverTime), 0);
SystemParametersInfoW(SPI_GETMOUSEHOVERTIME, 0, &hover_time, 0);
}
GetCursorPos(&pos); GetCursorPos(&pos);
hwnd = WindowFromPoint(pos); hwnd = WindowFromPoint(pos);
if (ptme->dwFlags & ~(TME_CANCEL | TME_HOVER | TME_LEAVE | TME_NONCLIENT)) if ( flags & TME_CANCEL ) {
{ flags &= ~ TME_CANCEL;
FIXME("Unknown flag(s) %08lx\n", ptme->dwFlags & ~(TME_CANCEL | TME_HOVER | TME_LEAVE | TME_NONCLIENT)); cancel = 1;
} }
if (ptme->dwFlags & TME_CANCEL) if ( flags & TME_HOVER ) {
{ flags &= ~ TME_HOVER;
if (ptracking_info->tme.hwndTrack == ptme->hwndTrack) hover = 1;
{ }
ptracking_info->tme.dwFlags &= ~(ptme->dwFlags & ~TME_CANCEL);
if ( flags & TME_LEAVE ) {
flags &= ~ TME_LEAVE;
leave = 1;
}
if ( flags & TME_NONCLIENT ) {
flags &= ~ TME_NONCLIENT;
nonclient = 1;
}
/* fill the TRACKMOUSEEVENT struct with the current tracking for the given hwnd */
if ( flags & TME_QUERY ) {
flags &= ~ TME_QUERY;
query = 1;
i = 0;
/* Find the tracking list entry with the matching hwnd */
while((i < iTrackMax) && (TrackingList[i].tme.hwndTrack != ptme->hwndTrack)) {
i++;
}
/* hwnd found, fill in the ptme struct */
if(i < iTrackMax)
*ptme = TrackingList[i].tme;
else
ptme->dwFlags = 0;
return TRUE; /* return here, TME_QUERY is retrieving information */
}
if ( flags )
DPRINT("Unknown flag(s) %08lx\n", flags );
if(cancel) {
/* find a matching hwnd if one exists */
i = 0;
while((i < iTrackMax) && (TrackingList[i].tme.hwndTrack != ptme->hwndTrack)) {
i++;
}
if(i < iTrackMax) {
TrackingList[i].tme.dwFlags &= ~(ptme->dwFlags & ~TME_CANCEL);
/* if we aren't tracking on hover or leave remove this entry */ /* if we aren't tracking on hover or leave remove this entry */
if (!(ptracking_info->tme.dwFlags & (TME_HOVER | TME_LEAVE))) if(!((TrackingList[i].tme.dwFlags & TME_HOVER) ||
(TrackingList[i].tme.dwFlags & TME_LEAVE)))
{ {
KillTimer(0, ptracking_info->timer); TrackingList[i] = TrackingList[--iTrackMax];
RtlZeroMemory(ptracking_info,sizeof(USER32_TRACKINGLIST));
if(iTrackMax == 0) {
KillTimer(0, timer);
timer = 0;
}
} }
} }
} else { } else {
if (ptme->hwndTrack == hwnd) /* see if hwndTrack isn't the current window */
{ if(ptme->hwndTrack != hwnd) {
if(leave) {
if(nonclient) {
PostMessageA(ptme->hwndTrack, WM_NCMOUSELEAVE, 0, 0);
}
else {
PostMessageA(ptme->hwndTrack, WM_MOUSELEAVE, 0, 0);
}
}
} else {
GetClientRect(ptme->hwndTrack, &client);
MapWindowPoints(ptme->hwndTrack, NULL, (LPPOINT)&client, 2);
if(PtInRect(&client, pos)) {
inclient = 1;
}
if(nonclient && inclient) {
PostMessageA(ptme->hwndTrack, WM_NCMOUSELEAVE, 0, 0);
return TRUE;
}
else if(!nonclient && !inclient) {
PostMessageA(ptme->hwndTrack, WM_MOUSELEAVE, 0, 0);
return TRUE;
}
/* See if this hwnd is already being tracked and update the tracking flags */
for(i = 0; i < iTrackMax; i++) {
if(TrackingList[i].tme.hwndTrack == ptme->hwndTrack) {
TrackingList[i].tme.dwFlags = 0;
if(hover) {
TrackingList[i].tme.dwFlags |= TME_HOVER;
TrackingList[i].tme.dwHoverTime = ptme->dwHoverTime;
}
if(leave)
TrackingList[i].tme.dwFlags |= TME_LEAVE;
if(nonclient)
TrackingList[i].tme.dwFlags |= TME_NONCLIENT;
/* reset iHoverTime as per winapi specs */
TrackingList[i].iHoverTime = 0;
return TRUE;
}
}
/* if the tracking list is full return FALSE */
if (iTrackMax == sizeof (TrackingList) / sizeof(*TrackingList)) {
return FALSE;
}
/* Adding new mouse event to the tracking list */ /* Adding new mouse event to the tracking list */
ptracking_info->tme = *ptme; TrackingList[iTrackMax].tme = *ptme;
ptracking_info->tme.dwHoverTime = hover_time;
/* Initialize HoverInfo variables even if not hover tracking */ /* Initialize HoverInfo variables even if not hover tracking */
ptracking_info->pos = pos; TrackingList[iTrackMax].iHoverTime = 0;
TrackingList[iTrackMax].pos = pos;
if (!ptracking_info->timer) iTrackMax++;
{
ptracking_info->timer = SetTimer(0, 0, hover_time, TrackMouseEventProc); if (!timer) {
timer = SetTimer(0, 0, iTimerInterval, TrackMouseEventProc);
} }
} }
} }
return TRUE; return TRUE;
} }
/* EOF */ /* EOF */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -9,9 +9,8 @@
*/ */
#include <user32.h> #include <user32.h>
#define NDEBUG
#include <wine/debug.h> #include <debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(user32);
/* DDE message exchange /* DDE message exchange
* *
@@ -415,44 +414,9 @@ MsgiAnsiToUnicodeMessage(LPMSG UnicodeMsg, LPMSG AnsiMsg)
case LB_ADDFILE: case LB_ADDFILE:
case EM_REPLACESEL: case EM_REPLACESEL:
{ {
goto ConvertLParamString; UNICODE_STRING UnicodeString;
} RtlCreateUnicodeStringFromAsciiz(&UnicodeString, (LPSTR)AnsiMsg->lParam);
UnicodeMsg->lParam = (LPARAM)UnicodeString.Buffer;
case LB_ADDSTRING:
case LB_ADDSTRING_LOWER:
case LB_ADDSTRING_UPPER:
case LB_INSERTSTRING:
case LB_INSERTSTRING_UPPER:
case LB_INSERTSTRING_LOWER:
case LB_FINDSTRING:
case LB_FINDSTRINGEXACT:
case LB_SELECTSTRING:
{
DWORD dwStyle = GetWindowLongW(AnsiMsg->hwnd, GWL_STYLE);
if (!(dwStyle & (LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE)) &&
(dwStyle & LBS_HASSTRINGS))
{
goto ConvertLParamString;
}
break;
}
case CB_ADDSTRING:
case CB_INSERTSTRING:
case CB_FINDSTRING:
case CB_FINDSTRINGEXACT:
case CB_SELECTSTRING:
{
DWORD dwStyle = GetWindowLongW(AnsiMsg->hwnd, GWL_STYLE);
if (!(dwStyle & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)) &&
(dwStyle & CBS_HASSTRINGS))
{
UNICODE_STRING UnicodeString;
ConvertLParamString:
RtlCreateUnicodeStringFromAsciiz(&UnicodeString, (LPSTR)AnsiMsg->lParam);
UnicodeMsg->lParam = (LPARAM)UnicodeString.Buffer;
}
break; break;
} }
@@ -472,12 +436,12 @@ ConvertLParamString:
return FALSE; return FALSE;
} }
xs->cs = *(CREATESTRUCTW *)AnsiMsg->lParam; xs->cs = *(CREATESTRUCTW *)AnsiMsg->lParam;
if (!IS_INTRESOURCE(xs->cs.lpszName)) if (HIWORD(xs->cs.lpszName))
{ {
RtlCreateUnicodeStringFromAsciiz(&UnicodeBuffer, (LPSTR)xs->cs.lpszName); RtlCreateUnicodeStringFromAsciiz(&UnicodeBuffer, (LPSTR)xs->cs.lpszName);
xs->lpszName = xs->cs.lpszName = UnicodeBuffer.Buffer; xs->lpszName = xs->cs.lpszName = UnicodeBuffer.Buffer;
} }
if (!IS_ATOM(xs->cs.lpszClass)) if (HIWORD(xs->cs.lpszClass))
{ {
RtlCreateUnicodeStringFromAsciiz(&UnicodeBuffer, (LPSTR)xs->cs.lpszClass); RtlCreateUnicodeStringFromAsciiz(&UnicodeBuffer, (LPSTR)xs->cs.lpszClass);
xs->lpszClass = xs->cs.lpszClass = UnicodeBuffer.Buffer; xs->lpszClass = xs->cs.lpszClass = UnicodeBuffer.Buffer;
@@ -499,7 +463,7 @@ ConvertLParamString:
*cs = *(MDICREATESTRUCTW *)AnsiMsg->lParam; *cs = *(MDICREATESTRUCTW *)AnsiMsg->lParam;
if (!IS_ATOM(cs->szClass)) if (HIWORD(cs->szClass))
{ {
RtlCreateUnicodeStringFromAsciiz(&UnicodeBuffer, (LPSTR)cs->szClass); RtlCreateUnicodeStringFromAsciiz(&UnicodeBuffer, (LPSTR)cs->szClass);
cs->szClass = UnicodeBuffer.Buffer; cs->szClass = UnicodeBuffer.Buffer;
@@ -537,48 +501,12 @@ MsgiAnsiToUnicodeCleanup(LPMSG UnicodeMsg, LPMSG AnsiMsg)
case LB_ADDFILE: case LB_ADDFILE:
case EM_REPLACESEL: case EM_REPLACESEL:
{ {
goto FreeLParamString; UNICODE_STRING UnicodeString;
} RtlInitUnicodeString(&UnicodeString, (PCWSTR)UnicodeMsg->lParam);
RtlFreeUnicodeString(&UnicodeString);
case LB_ADDSTRING:
case LB_ADDSTRING_LOWER:
case LB_ADDSTRING_UPPER:
case LB_INSERTSTRING:
case LB_INSERTSTRING_UPPER:
case LB_INSERTSTRING_LOWER:
case LB_FINDSTRING:
case LB_FINDSTRINGEXACT:
case LB_SELECTSTRING:
{
DWORD dwStyle = GetWindowLongW(AnsiMsg->hwnd, GWL_STYLE);
if (!(dwStyle & (LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE)) &&
(dwStyle & LBS_HASSTRINGS))
{
goto FreeLParamString;
}
break; break;
} }
case CB_ADDSTRING:
case CB_INSERTSTRING:
case CB_FINDSTRING:
case CB_FINDSTRINGEXACT:
case CB_SELECTSTRING:
{
DWORD dwStyle = GetWindowLongW(AnsiMsg->hwnd, GWL_STYLE);
if (!(dwStyle & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)) &&
(dwStyle & CBS_HASSTRINGS))
{
UNICODE_STRING UnicodeString;
FreeLParamString:
RtlInitUnicodeString(&UnicodeString, (PCWSTR)UnicodeMsg->lParam);
RtlFreeUnicodeString(&UnicodeString);
}
break;
}
case WM_NCCREATE: case WM_NCCREATE:
case WM_CREATE: case WM_CREATE:
{ {
@@ -608,9 +536,12 @@ FreeLParamString:
{ {
UNICODE_STRING UnicodeString; UNICODE_STRING UnicodeString;
MDICREATESTRUCTW *cs = (MDICREATESTRUCTW *)UnicodeMsg->lParam; MDICREATESTRUCTW *cs = (MDICREATESTRUCTW *)UnicodeMsg->lParam;
RtlInitUnicodeString(&UnicodeString, (PCWSTR)cs->szTitle); if (HIWORD(cs->szTitle))
RtlFreeUnicodeString(&UnicodeString); {
if (!IS_ATOM(cs->szClass)) RtlInitUnicodeString(&UnicodeString, (PCWSTR)cs->szTitle);
RtlFreeUnicodeString(&UnicodeString);
}
if (HIWORD(cs->szClass))
{ {
RtlInitUnicodeString(&UnicodeString, (PCWSTR)cs->szClass); RtlInitUnicodeString(&UnicodeString, (PCWSTR)cs->szClass);
RtlFreeUnicodeString(&UnicodeString); RtlFreeUnicodeString(&UnicodeString);
@@ -709,101 +640,19 @@ MsgiUnicodeToAnsiMessage(LPMSG AnsiMsg, LPMSG UnicodeMsg)
break; break;
} }
case WM_SETTEXT: case WM_SETTEXT:
case CB_DIR:
case LB_DIR:
case LB_ADDFILE:
{ {
goto ConvertLParamString; ANSI_STRING AnsiString;
}
case LB_ADDSTRING:
case LB_ADDSTRING_LOWER:
case LB_ADDSTRING_UPPER:
case LB_INSERTSTRING:
case LB_INSERTSTRING_UPPER:
case LB_INSERTSTRING_LOWER:
case LB_FINDSTRING:
case LB_FINDSTRINGEXACT:
case LB_SELECTSTRING:
{
DWORD dwStyle = GetWindowLongW(AnsiMsg->hwnd, GWL_STYLE);
if (!(dwStyle & (LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE)) &&
(dwStyle & LBS_HASSTRINGS))
{
goto ConvertLParamString;
}
break;
}
case CB_ADDSTRING:
case CB_INSERTSTRING:
case CB_FINDSTRING:
case CB_FINDSTRINGEXACT:
case CB_SELECTSTRING:
{
DWORD dwStyle = GetWindowLongW(AnsiMsg->hwnd, GWL_STYLE);
if (!(dwStyle & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)) &&
(dwStyle & CBS_HASSTRINGS))
{
ANSI_STRING AnsiString;
UNICODE_STRING UnicodeString;
ConvertLParamString:
RtlInitUnicodeString(&UnicodeString, (PWSTR) UnicodeMsg->lParam);
if (! NT_SUCCESS(RtlUnicodeStringToAnsiString(&AnsiString,
&UnicodeString,
TRUE)))
{
return FALSE;
}
AnsiMsg->lParam = (LPARAM) AnsiString.Buffer;
}
break;
}
case WM_MDICREATE:
{
ANSI_STRING AnsiBuffer;
UNICODE_STRING UnicodeString; UNICODE_STRING UnicodeString;
MDICREATESTRUCTA *cs = RtlInitUnicodeString(&UnicodeString, (PWSTR) UnicodeMsg->lParam);
(MDICREATESTRUCTA *)HeapAlloc(GetProcessHeap(), 0, sizeof(*cs)); if (! NT_SUCCESS(RtlUnicodeStringToAnsiString(&AnsiString,
if (!cs)
{
return FALSE;
}
*cs = *(MDICREATESTRUCTA *)UnicodeMsg->lParam;
if (!IS_ATOM(cs->szClass))
{
RtlInitUnicodeString(&UnicodeString, (LPCWSTR)cs->szClass);
if (! NT_SUCCESS(RtlUnicodeStringToAnsiString(&AnsiBuffer,
&UnicodeString,
TRUE)))
{
return FALSE;
}
cs->szClass = AnsiBuffer.Buffer;
}
RtlInitUnicodeString(&UnicodeString, (LPCWSTR)cs->szTitle);
if (! NT_SUCCESS(RtlUnicodeStringToAnsiString(&AnsiBuffer,
&UnicodeString, &UnicodeString,
TRUE))) TRUE)))
{ {
if (!IS_ATOM(cs->szClass))
{
RtlInitAnsiString(&AnsiBuffer, cs->szClass);
RtlFreeAnsiString(&AnsiBuffer);
}
return FALSE; return FALSE;
} }
cs->szTitle = AnsiBuffer.Buffer; AnsiMsg->lParam = (LPARAM) AnsiString.Buffer;
AnsiMsg->lParam = (LPARAM)cs;
break; break;
} }
} }
return TRUE; return TRUE;
@@ -822,7 +671,10 @@ MsgiUnicodeToAnsiCleanup(LPMSG AnsiMsg, LPMSG UnicodeMsg)
} }
case WM_SETTEXT: case WM_SETTEXT:
{ {
goto FreeLParamString; ANSI_STRING AString;
RtlInitAnsiString(&AString, (PSTR) AnsiMsg->lParam);
RtlFreeAnsiString(&AString);
break;
} }
case WM_CREATE: case WM_CREATE:
case WM_NCCREATE: case WM_NCCREATE:
@@ -841,60 +693,6 @@ MsgiUnicodeToAnsiCleanup(LPMSG AnsiMsg, LPMSG UnicodeMsg)
RtlFreeHeap(GetProcessHeap(), 0, Cs); RtlFreeHeap(GetProcessHeap(), 0, Cs);
break; break;
} }
case LB_ADDSTRING:
case LB_ADDSTRING_LOWER:
case LB_ADDSTRING_UPPER:
case LB_INSERTSTRING:
case LB_INSERTSTRING_UPPER:
case LB_INSERTSTRING_LOWER:
case LB_FINDSTRING:
case LB_FINDSTRINGEXACT:
case LB_SELECTSTRING:
{
DWORD dwStyle = GetWindowLongW(AnsiMsg->hwnd, GWL_STYLE);
if (!(dwStyle & (LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE)) &&
(dwStyle & LBS_HASSTRINGS))
{
goto FreeLParamString;
}
break;
}
case CB_ADDSTRING:
case CB_INSERTSTRING:
case CB_FINDSTRING:
case CB_FINDSTRINGEXACT:
case CB_SELECTSTRING:
{
DWORD dwStyle = GetWindowLongW(AnsiMsg->hwnd, GWL_STYLE);
if (!(dwStyle & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)) &&
(dwStyle & CBS_HASSTRINGS))
{
ANSI_STRING AString;
FreeLParamString:
RtlInitAnsiString(&AString, (PSTR) AnsiMsg->lParam);
RtlFreeAnsiString(&AString);
}
break;
}
case WM_MDICREATE:
{
ANSI_STRING AnsiString;
MDICREATESTRUCTA *cs = (MDICREATESTRUCTA *)AnsiMsg->lParam;
RtlInitAnsiString(&AnsiString, (PCSTR)cs->szTitle);
RtlFreeAnsiString(&AnsiString);
if (!IS_ATOM(cs->szClass))
{
RtlInitAnsiString(&AnsiString, (PCSTR)cs->szClass);
RtlFreeAnsiString(&AnsiString);
}
HeapFree(GetProcessHeap(), 0, cs);
break;
}
} }
return TRUE; return TRUE;
@@ -1142,12 +940,6 @@ IntCallWindowProcW(BOOL IsAnsiProc,
MSG UnicodeMsg; MSG UnicodeMsg;
LRESULT Result; LRESULT Result;
if (WndProc == NULL)
{
WARN("IntCallWindowsProcW() called with WndProc = NULL!\n");
return FALSE;
}
if (IsAnsiProc) if (IsAnsiProc)
{ {
UnicodeMsg.hwnd = hWnd; UnicodeMsg.hwnd = hWnd;
@@ -1159,7 +951,6 @@ IntCallWindowProcW(BOOL IsAnsiProc,
return FALSE; return FALSE;
} }
Result = WndProc(AnsiMsg.hwnd, AnsiMsg.message, AnsiMsg.wParam, AnsiMsg.lParam); Result = WndProc(AnsiMsg.hwnd, AnsiMsg.message, AnsiMsg.wParam, AnsiMsg.lParam);
if (! MsgiUnicodeToAnsiReply(&AnsiMsg, &UnicodeMsg, &Result)) if (! MsgiUnicodeToAnsiReply(&AnsiMsg, &UnicodeMsg, &Result))
{ {
return FALSE; return FALSE;
@@ -1184,12 +975,6 @@ IntCallWindowProcA(BOOL IsAnsiProc,
MSG UnicodeMsg; MSG UnicodeMsg;
LRESULT Result; LRESULT Result;
if (WndProc == NULL)
{
WARN("IntCallWindowsProcA() called with WndProc = NULL!\n");
return FALSE;
}
if (IsAnsiProc) if (IsAnsiProc)
{ {
return WndProc(hWnd, Msg, wParam, lParam); return WndProc(hWnd, Msg, wParam, lParam);
@@ -1206,7 +991,6 @@ IntCallWindowProcA(BOOL IsAnsiProc,
} }
Result = WndProc(UnicodeMsg.hwnd, UnicodeMsg.message, Result = WndProc(UnicodeMsg.hwnd, UnicodeMsg.message,
UnicodeMsg.wParam, UnicodeMsg.lParam); UnicodeMsg.wParam, UnicodeMsg.lParam);
if (! MsgiAnsiToUnicodeReply(&UnicodeMsg, &AnsiMsg, &Result)) if (! MsgiAnsiToUnicodeReply(&UnicodeMsg, &AnsiMsg, &Result))
{ {
return FALSE; return FALSE;
@@ -1215,13 +999,6 @@ IntCallWindowProcA(BOOL IsAnsiProc,
} }
} }
static BOOL __inline
IsCallProcHandle(IN WNDPROC lpWndProc)
{
/* FIXME - check for 64 bit architectures... */
return ((ULONG_PTR)lpWndProc & 0xFFFF0000) == 0xFFFF0000;
}
/* /*
* @implemented * @implemented
@@ -1233,27 +1010,21 @@ CallWindowProcA(WNDPROC lpPrevWndFunc,
WPARAM wParam, WPARAM wParam,
LPARAM lParam) LPARAM lParam)
{ {
WNDPROC_INFO wpInfo; BOOL IsHandle;
WndProcHandle wphData;
if (lpPrevWndFunc == NULL) if (lpPrevWndFunc == NULL)
{ lpPrevWndFunc = (WNDPROC)NtUserGetWindowLong(hWnd, GWL_WNDPROC, FALSE);
WARN("CallWindowProcA: lpPrevWndFunc == NULL!\n");
return 0;
}
if (!IsCallProcHandle(lpPrevWndFunc)) IsHandle = NtUserDereferenceWndProcHandle(lpPrevWndFunc,&wphData);
return IntCallWindowProcA(TRUE, lpPrevWndFunc, hWnd, Msg, wParam, lParam); if (! IsHandle)
{
return IntCallWindowProcA(TRUE, lpPrevWndFunc, hWnd, Msg, wParam, lParam);
}
else else
{ {
if (NtUserDereferenceWndProcHandle((HANDLE)lpPrevWndFunc, return IntCallWindowProcA(! wphData.IsUnicode, wphData.WindowProc,
&wpInfo)) hWnd, Msg, wParam, lParam);
return IntCallWindowProcA(!wpInfo.IsUnicode, wpInfo.WindowProc,
hWnd, Msg, wParam, lParam);
else
{
WARN("CallWindowProcA: can not dereference WndProcHandle\n");
return 0;
}
} }
} }
@@ -1268,29 +1039,19 @@ CallWindowProcW(WNDPROC lpPrevWndFunc,
WPARAM wParam, WPARAM wParam,
LPARAM lParam) LPARAM lParam)
{ {
WNDPROC_INFO wpInfo; BOOL IsHandle;
WndProcHandle wphData;
/* FIXME - can the first parameter be NULL? */ IsHandle = NtUserDereferenceWndProcHandle(lpPrevWndFunc,&wphData);
if (lpPrevWndFunc == NULL) if (! IsHandle)
{ {
WARN("CallWindowProcA: lpPrevWndFunc == NULL!\n"); return IntCallWindowProcW(FALSE, lpPrevWndFunc, hWnd, Msg, wParam, lParam);
return 0;
} }
if (!IsCallProcHandle(lpPrevWndFunc))
return IntCallWindowProcW(FALSE, lpPrevWndFunc, hWnd, Msg, wParam, lParam);
else else
{ {
if (NtUserDereferenceWndProcHandle((HANDLE)lpPrevWndFunc, return IntCallWindowProcW(! wphData.IsUnicode, wphData.WindowProc,
&wpInfo))
return IntCallWindowProcW(!wpInfo.IsUnicode, wpInfo.WindowProc,
hWnd, Msg, wParam, lParam); hWnd, Msg, wParam, lParam);
else }
{
WARN("CallWindowProcW: can not dereference WndProcHandle\n");
return 0;
}
}
} }
@@ -1309,12 +1070,8 @@ DispatchMessageA(CONST MSG *lpmsg)
if (! Info.HandledByKernel) if (! Info.HandledByKernel)
{ {
/* We need to send the message ourselves */ /* We need to send the message ourselves */
SPY_EnterMessage(SPY_DISPATCHMESSAGE, Info.Msg.hwnd, Info.Msg.message,
Info.Msg.wParam, Info.Msg.lParam);
Result = IntCallWindowProcA(Info.Ansi, Info.Proc, Info.Msg.hwnd, Result = IntCallWindowProcA(Info.Ansi, Info.Proc, Info.Msg.hwnd,
Info.Msg.message, Info.Msg.wParam, Info.Msg.lParam); Info.Msg.message, Info.Msg.wParam, Info.Msg.lParam);
SPY_ExitMessage(SPY_RESULT_OK, Info.Msg.hwnd, Info.Msg.message, Result,
Info.Msg.wParam, Info.Msg.lParam);
} }
MsgConversionCleanup(lpmsg, TRUE, TRUE, &Result); MsgConversionCleanup(lpmsg, TRUE, TRUE, &Result);
@@ -1337,12 +1094,8 @@ DispatchMessageW(CONST MSG *lpmsg)
if (! Info.HandledByKernel) if (! Info.HandledByKernel)
{ {
/* We need to send the message ourselves */ /* We need to send the message ourselves */
SPY_EnterMessage(SPY_DISPATCHMESSAGE, Info.Msg.hwnd, Info.Msg.message,
Info.Msg.wParam, Info.Msg.lParam);
Result = IntCallWindowProcW(Info.Ansi, Info.Proc, Info.Msg.hwnd, Result = IntCallWindowProcW(Info.Ansi, Info.Proc, Info.Msg.hwnd,
Info.Msg.message, Info.Msg.wParam, Info.Msg.lParam); Info.Msg.message, Info.Msg.wParam, Info.Msg.lParam);
SPY_ExitMessage(SPY_RESULT_OK, Info.Msg.hwnd, Info.Msg.message, Result,
Info.Msg.wParam, Info.Msg.lParam);
} }
MsgConversionCleanup(lpmsg, FALSE, TRUE, &Result); MsgConversionCleanup(lpmsg, FALSE, TRUE, &Result);
@@ -1811,15 +1564,12 @@ SendMessageTimeoutA(
return FALSE; return FALSE;
} }
SPY_EnterMessage(SPY_SENDMESSAGE, hWnd, Msg, wParam, lParam);
Info.Ansi = TRUE; Info.Ansi = TRUE;
Result = NtUserSendMessageTimeout(UcMsg.hwnd, UcMsg.message, Result = NtUserSendMessageTimeout(UcMsg.hwnd, UcMsg.message,
UcMsg.wParam, UcMsg.lParam, UcMsg.wParam, UcMsg.lParam,
fuFlags, uTimeout, (ULONG_PTR*)lpdwResult, &Info); fuFlags, uTimeout, (ULONG_PTR*)lpdwResult, &Info);
if(!Result) if(!Result)
{ {
SPY_ExitMessage(SPY_RESULT_OK, hWnd, Msg, Result, wParam, lParam);
return FALSE; return FALSE;
} }
if (! Info.HandledByKernel) if (! Info.HandledByKernel)
@@ -1841,8 +1591,7 @@ SendMessageTimeoutA(
UcMsg.message, UcMsg.wParam, UcMsg.lParam); UcMsg.message, UcMsg.wParam, UcMsg.lParam);
if (! MsgiAnsiToUnicodeReply(&UcMsg, &AnsiMsg, &Result)) if (! MsgiAnsiToUnicodeReply(&UcMsg, &AnsiMsg, &Result))
{ {
SPY_ExitMessage(SPY_RESULT_OK, hWnd, Msg, Result, wParam, lParam); return FALSE;
return FALSE;
} }
} }
if(lpdwResult) if(lpdwResult)
@@ -1854,12 +1603,10 @@ SendMessageTimeoutA(
/* Message sent by kernel. Convert back to Ansi */ /* Message sent by kernel. Convert back to Ansi */
if (! MsgiAnsiToUnicodeReply(&UcMsg, &AnsiMsg, &Result)) if (! MsgiAnsiToUnicodeReply(&UcMsg, &AnsiMsg, &Result))
{ {
SPY_ExitMessage(SPY_RESULT_OK, hWnd, Msg, Result, wParam, lParam); return FALSE;
return FALSE;
} }
} }
SPY_ExitMessage(SPY_RESULT_OK, hWnd, Msg, Result, wParam, lParam);
return Result; return Result;
} }
@@ -1881,8 +1628,6 @@ SendMessageTimeoutW(
NTUSERSENDMESSAGEINFO Info; NTUSERSENDMESSAGEINFO Info;
LRESULT Result; LRESULT Result;
SPY_EnterMessage(SPY_SENDMESSAGE, hWnd, Msg, wParam, lParam);
Info.Ansi = FALSE; Info.Ansi = FALSE;
Result = NtUserSendMessageTimeout(hWnd, Msg, wParam, lParam, fuFlags, uTimeout, Result = NtUserSendMessageTimeout(hWnd, Msg, wParam, lParam, fuFlags, uTimeout,
lpdwResult, &Info); lpdwResult, &Info);
@@ -1892,12 +1637,9 @@ SendMessageTimeoutW(
Result = IntCallWindowProcW(Info.Ansi, Info.Proc, hWnd, Msg, wParam, lParam); Result = IntCallWindowProcW(Info.Ansi, Info.Proc, hWnd, Msg, wParam, lParam);
if(lpdwResult) if(lpdwResult)
*lpdwResult = Result; *lpdwResult = Result;
SPY_ExitMessage(SPY_RESULT_OK, hWnd, Msg, Result, wParam, lParam);
return TRUE; return TRUE;
} }
SPY_ExitMessage(SPY_RESULT_OK, hWnd, Msg, Result, wParam, lParam);
return Result; return Result;
} }
@@ -1913,30 +1655,8 @@ SendNotifyMessageA(
WPARAM wParam, WPARAM wParam,
LPARAM lParam) LPARAM lParam)
{ {
MSG AnsiMsg, UcMsg; UNIMPLEMENTED;
MSG KMMsg; return FALSE;
LRESULT Result;
AnsiMsg.hwnd = hWnd;
AnsiMsg.message = Msg;
AnsiMsg.wParam = wParam;
AnsiMsg.lParam = lParam;
if (! MsgiAnsiToUnicodeMessage(&UcMsg, &AnsiMsg))
{
return FALSE;
}
if (! MsgiUMToKMMessage(&UcMsg, &KMMsg, TRUE))
{
MsgiAnsiToUnicodeCleanup(&UcMsg, &AnsiMsg);
return FALSE;
}
Result = NtUserSendNotifyMessage(KMMsg.hwnd, KMMsg.message,
KMMsg.wParam, KMMsg.lParam);
MsgiUMToKMCleanup(&UcMsg, &KMMsg);
MsgiAnsiToUnicodeCleanup(&UcMsg, &AnsiMsg);
return Result;
} }
@@ -1951,22 +1671,8 @@ SendNotifyMessageW(
WPARAM wParam, WPARAM wParam,
LPARAM lParam) LPARAM lParam)
{ {
MSG UMMsg, KMMsg; UNIMPLEMENTED;
LRESULT Result; return FALSE;
UMMsg.hwnd = hWnd;
UMMsg.message = Msg;
UMMsg.wParam = wParam;
UMMsg.lParam = lParam;
if (! MsgiUMToKMMessage(&UMMsg, &KMMsg, TRUE))
{
return FALSE;
}
Result = NtUserSendNotifyMessage(KMMsg.hwnd, KMMsg.message,
KMMsg.wParam, KMMsg.lParam);
MsgiUMToKMCleanup(&UMMsg, &KMMsg);
return Result;
} }

View File

@@ -32,8 +32,8 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <user32.h> #include <user32.h>
#define NDEBUG
#include <wine/debug.h> #include <debug.h>
/* DEFINES *******************************************************************/ /* DEFINES *******************************************************************/

View File

@@ -23,8 +23,8 @@
/* INCLUDES *******************************************************************/ /* INCLUDES *******************************************************************/
#include <user32.h> #include <user32.h>
#define NDEBUG
#include <wine/debug.h> #include <debug.h>
#define HAS_DLGFRAME(Style, ExStyle) \ #define HAS_DLGFRAME(Style, ExStyle) \
(((ExStyle) & WS_EX_DLGMODALFRAME) || \ (((ExStyle) & WS_EX_DLGMODALFRAME) || \
@@ -410,7 +410,7 @@ DefWndNCPaint(HWND hWnd, HRGN hRgn, BOOL Active)
CurrentRect.top += GetSystemMetrics(SM_CYCAPTION); CurrentRect.top += GetSystemMetrics(SM_CYCAPTION);
} }
NtUserDrawCaption(hWnd, hDC, &TempRect, CaptionFlags); DrawCaption(hWnd, hDC, &TempRect, CaptionFlags);
/* Draw buttons */ /* Draw buttons */
if (Style & WS_SYSMENU) if (Style & WS_SYSMENU)
@@ -751,12 +751,11 @@ DefWndNCHitTest(HWND hWnd, POINT Point)
} }
else else
{ {
if(!(ExStyle & WS_EX_DLGMODALFRAME)) WindowRect.left += GetSystemMetrics(SM_CXSIZE);
WindowRect.left += GetSystemMetrics(SM_CXSIZE);
WindowRect.right -= GetSystemMetrics(SM_CXSIZE); WindowRect.right -= GetSystemMetrics(SM_CXSIZE);
} }
} }
if (Point.x < WindowRect.left) if (Point.x <= WindowRect.left)
return HTSYSMENU; return HTSYSMENU;
if (WindowRect.right <= Point.x) if (WindowRect.right <= Point.x)
return HTCLOSE; return HTCLOSE;
@@ -1098,17 +1097,243 @@ AdjustWindowRect(LPRECT lpRect,
BOOL WINAPI BOOL WINAPI
DrawCaption(HWND hWnd, HDC hDC, LPCRECT lprc, UINT uFlags) DrawCaption(HWND hWnd, HDC hDC, LPCRECT lprc, UINT uFlags)
{ {
return NtUserDrawCaption(hWnd, hDC, lprc, uFlags); NONCLIENTMETRICSW nclm;
BOOL result = FALSE;
RECT r = *lprc;
UINT VCenter = 0, Padding = 0, Height;
ULONG Style;
WCHAR buffer[256];
HFONT hFont = NULL;
HFONT hOldFont = NULL;
HBRUSH OldBrush = NULL;
HDC MemDC = NULL;
int ButtonWidth;
COLORREF OldTextColor;
#ifdef DOUBLE_BUFFER_CAPTION
HBITMAP MemBMP = NULL, OldBMP = NULL;
MemDC = CreateCompatibleDC(hDC);
if (! MemDC) goto cleanup;
MemBMP = CreateCompatibleBitmap(hDC, lprc->right - lprc->left, lprc->bottom - lprc->top);
if (! MemBMP) goto cleanup;
OldBMP = SelectObject(MemDC, MemBMP);
if (! OldBMP) goto cleanup;
#else
MemDC = hDC;
OffsetViewportOrgEx(MemDC, lprc->left, lprc->top, NULL);
#endif
Style = GetWindowLongW(hWnd, GWL_STYLE);
/* Windows behaves like this */
Height = GetSystemMetrics(SM_CYCAPTION) - 1;
VCenter = (lprc->bottom - lprc->top) / 2;
Padding = VCenter - (Height / 2);
r.left = Padding;
r.right = r.left + (lprc->right - lprc->left);
r.top = Padding;
r.bottom = r.top + (Height / 2);
// Draw the caption background
if (uFlags & DC_INBUTTON)
{
OldBrush = SelectObject(MemDC, GetSysColorBrush(uFlags & DC_ACTIVE ? COLOR_BTNFACE : COLOR_BTNSHADOW) );
if (! OldBrush) goto cleanup;
if (! PatBlt(MemDC, 0, 0, lprc->right - lprc->left, lprc->bottom - lprc->top, PATCOPY )) goto cleanup;
}
else
{
if (uFlags & DC_GRADIENT)
{
static GRADIENT_RECT gcap = {0, 1};
TRIVERTEX vert[2];
COLORREF Colors[2];
LONG xx;
r.right = (lprc->right - lprc->left);
if (uFlags & DC_SMALLCAP)
ButtonWidth = GetSystemMetrics(SM_CXSMSIZE) - 2;
else
ButtonWidth = GetSystemMetrics(SM_CXSIZE) - 2;
if (Style & WS_SYSMENU)
{
r.right -= 3 + ButtonWidth;
if (! (uFlags & DC_SMALLCAP))
{
if(Style & (WS_MAXIMIZEBOX | WS_MINIMIZEBOX))
r.right -= 2 + 2 * ButtonWidth;
else
r.right -= 2;
r.right -= 2;
}
}
Colors[0] = GetSysColor((uFlags & DC_ACTIVE) ? COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION);
Colors[1] = GetSysColor((uFlags & DC_ACTIVE) ? COLOR_GRADIENTACTIVECAPTION : COLOR_GRADIENTINACTIVECAPTION);
if ((uFlags & DC_ICON) && (Style & WS_SYSMENU) && !(uFlags & DC_SMALLCAP))
{
OldBrush = SelectObject(MemDC, GetSysColorBrush(uFlags & DC_ACTIVE ? COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION));
if (!OldBrush) goto cleanup;
xx = GetSystemMetrics(SM_CXSIZE) + Padding;
/* draw icon background */
PatBlt(MemDC, 0, 0, xx, lprc->bottom - lprc->top, PATCOPY);
/* For some reason the icon isn't centered correctly... */
r.top --;
if (UserDrawSysMenuButton(hWnd, MemDC, &r, FALSE))
r.left += xx;
r.top ++;
}
vert[0].x = r.left;
vert[0].y = 0;
vert[0].Red = GetRValue(Colors[0]) << 8;
vert[0].Green = GetGValue(Colors[0]) << 8;
vert[0].Blue = GetBValue(Colors[0]) << 8;
vert[0].Alpha = 0;
vert[1].x = r.right;
vert[1].y = lprc->bottom - lprc->top;
vert[1].Red = GetRValue(Colors[1]) << 8;
vert[1].Green = GetGValue(Colors[1]) << 8;
vert[1].Blue = GetBValue(Colors[1]) << 8;
vert[1].Alpha = 0;
GdiGradientFill(MemDC, vert, 2, &gcap, 1, GRADIENT_FILL_RECT_H);
if(OldBrush)
{
SelectObject(MemDC, OldBrush);
OldBrush = NULL;
}
xx = lprc->right - lprc->left - r.right;
if(xx > 0)
{
OldBrush = SelectObject(MemDC, GetSysColorBrush(uFlags & DC_ACTIVE ? COLOR_GRADIENTACTIVECAPTION : COLOR_GRADIENTINACTIVECAPTION));
if (!OldBrush) goto cleanup;
PatBlt(MemDC, r.right, 0, xx, lprc->bottom - lprc->top, PATCOPY);
}
}
else
{
OldBrush = SelectObject(MemDC, GetSysColorBrush(uFlags & DC_ACTIVE ? COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION) );
if (! OldBrush) goto cleanup;
if (! PatBlt(MemDC, 0, 0, lprc->right - lprc->left, lprc->bottom - lprc->top, PATCOPY )) goto cleanup;
}
}
if ((uFlags & DC_ICON) && !(uFlags & DC_GRADIENT) && (Style & WS_SYSMENU) && !(uFlags & DC_SMALLCAP))
{
/* For some reason the icon isn't centered correctly... */
r.top --;
if (UserDrawSysMenuButton(hWnd, MemDC, &r, FALSE))
r.left += GetSystemMetrics(SM_CXSIZE) + Padding;
r.top ++;
}
r.top ++;
r.left += 2;
r.bottom = r.top + Height;
if ((uFlags & DC_TEXT) && (NtUserInternalGetWindowText( hWnd, buffer, sizeof(buffer)/sizeof(buffer[0]) )))
{
if(!(uFlags & DC_GRADIENT))
{
r.right = (lprc->right - lprc->left);
if (uFlags & DC_SMALLCAP)
ButtonWidth = GetSystemMetrics(SM_CXSMSIZE) - 2;
else
ButtonWidth = GetSystemMetrics(SM_CXSIZE) - 2;
if (Style & WS_SYSMENU)
{
r.right -= 3 + ButtonWidth;
if (! (uFlags & DC_SMALLCAP))
{
if(Style & (WS_MAXIMIZEBOX | WS_MINIMIZEBOX))
r.right -= 2 + 2 * ButtonWidth;
else
r.right -= 2;
r.right -= 2;
}
}
}
nclm.cbSize = sizeof(nclm);
if (! SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSW), &nclm, 0)) goto cleanup;
SetBkMode( MemDC, TRANSPARENT );
if (uFlags & DC_SMALLCAP)
hFont = CreateFontIndirectW(&nclm.lfSmCaptionFont);
else
hFont = CreateFontIndirectW(&nclm.lfCaptionFont);
if (! hFont) goto cleanup;
hOldFont = SelectObject(MemDC, hFont);
if (! hOldFont) goto cleanup;
if (uFlags & DC_INBUTTON)
OldTextColor = SetTextColor(MemDC, GetSysColor(uFlags & DC_ACTIVE ? COLOR_BTNTEXT : COLOR_GRAYTEXT));
else
OldTextColor = SetTextColor(MemDC, GetSysColor(uFlags & DC_ACTIVE ? COLOR_CAPTIONTEXT : COLOR_INACTIVECAPTIONTEXT));
DrawTextW(MemDC, buffer, wcslen(buffer), &r, DT_VCENTER | DT_END_ELLIPSIS);
SetTextColor(MemDC, OldTextColor);
}
#if 0
if (uFlags & DC_BUTTONS)
{
// Windows XP draws the caption buttons with DC_BUTTONS
// r.left += GetSystemMetrics(SM_CXSIZE) + 1;
// UserDrawCaptionButton( hWnd, hDC, FALSE, DFCS_CAPTIONCLOSE);
// r.right -= GetSystemMetrics(SM_CXSMSIZE) + 1;
// UserDrawCaptionButton( hWnd, hDC, FALSE, DFCS_CAPTIONMIN);
// UserDrawCaptionButton( hWnd, hDC, FALSE, DFCS_CAPTIONMAX);
}
#endif
#ifdef DOUBLE_BUFFER_CAPTION
if (! BitBlt(hDC, lprc->left, lprc->top, lprc->right - lprc->left, lprc->bottom - lprc->top,
MemDC, 0, 0, SRCCOPY)) goto cleanup;
#endif
result = TRUE;
cleanup :
if (MemDC)
{
if (OldBrush) SelectObject(MemDC, OldBrush);
if (hOldFont) SelectObject(MemDC, hOldFont);
if (hFont) DeleteObject(hFont);
#ifdef DOUBLE_BUFFER_CAPTION
if (OldBMP) SelectObject(MemDC, OldBMP);
if (MemBMP) DeleteObject(MemBMP);
DeleteDC(MemDC);
#else
OffsetViewportOrgEx(MemDC, -lprc->left, -lprc->top, NULL);
#endif
}
return result;
} }
/* /*
* @implemented * @unimplemented
*/ */
BOOL BOOL
STDCALL STDCALL
DrawCaptionTempW( DrawCaptionTempW(
HWND hWnd, HWND hwnd,
HDC hDC, HDC hdc,
const RECT *rect, const RECT *rect,
HFONT hFont, HFONT hFont,
HICON hIcon, HICON hIcon,
@@ -1116,13 +1341,12 @@ DrawCaptionTempW(
UINT uFlags UINT uFlags
) )
{ {
UNICODE_STRING Text = {0}; UNIMPLEMENTED;
RtlInitUnicodeString(&Text, str); return FALSE;
return NtUserDrawCaptionTemp(hWnd, hDC, rect, hFont, hIcon, &Text, uFlags);
} }
/* /*
* @implemented * @unimplemented
*/ */
BOOL BOOL
STDCALL STDCALL
@@ -1136,21 +1360,8 @@ DrawCaptionTempA(
UINT uFlags UINT uFlags
) )
{ {
LPWSTR strW; UNIMPLEMENTED;
INT len; return FALSE;
BOOL ret = FALSE;
if (!(uFlags & DC_TEXT) || !str)
return DrawCaptionTempW(hwnd, hdc, rect, hFont, hIcon, NULL, uFlags);
len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
if ((strW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR))))
{
MultiByteToWideChar(CP_ACP, 0, str, -1, strW, len );
ret = DrawCaptionTempW(hwnd, hdc, rect, hFont, hIcon, strW, uFlags);
HeapFree(GetProcessHeap(), 0, strW);
}
return ret;
} }
/*********************************************************************** /***********************************************************************

Some files were not shown because too many files have changed in this diff Show More