Author: dchapyshev
Date: Sat Nov 20 11:24:17 2010
New Revision: 49658
URL:
http://svn.reactos.org/svn/reactos?rev=49658&view=rev
Log:
- Add wer.dll from Wine 1.3.7
- Sync gdiplus with Wine 1.3.7
Added:
trunk/reactos/dll/win32/wer/ (with props)
trunk/reactos/dll/win32/wer/main.c (with props)
trunk/reactos/dll/win32/wer/wer.rbuild (with props)
trunk/reactos/dll/win32/wer/wer.spec (with props)
trunk/reactos/include/psdk/werapi.h (with props)
Modified:
trunk/reactos/boot/bootdata/packages/reactos.dff
trunk/reactos/dll/win32/gdiplus/brush.c
trunk/reactos/dll/win32/gdiplus/font.c
trunk/reactos/dll/win32/gdiplus/gdiplus.c
trunk/reactos/dll/win32/gdiplus/gdiplus.spec
trunk/reactos/dll/win32/gdiplus/gdiplus_private.h
trunk/reactos/dll/win32/gdiplus/graphics.c
trunk/reactos/dll/win32/gdiplus/graphicspath.c
trunk/reactos/dll/win32/gdiplus/image.c
trunk/reactos/dll/win32/gdiplus/pen.c
trunk/reactos/dll/win32/gdiplus/region.c
trunk/reactos/dll/win32/win32.rbuild
trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/boot/bootdata/packages/reactos.dff
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/packages/rea…
==============================================================================
--- trunk/reactos/boot/bootdata/packages/reactos.dff [iso-8859-1] (original)
+++ trunk/reactos/boot/bootdata/packages/reactos.dff [iso-8859-1] Sat Nov 20 11:24:17
2010
@@ -456,6 +456,7 @@
dll\win32\vdmdbg\vdmdbg.dll 1
dll\win32\version\version.dll 1
dll\win32\wdmaud.drv\wdmaud.drv 1
+dll\win32\wer\wer.dll 1
dll\win32\windowscodecs\windowscodecs.dll 1
dll\win32\winemp3.acm\winemp3.acm 1
dll\win32\winfax\winfax.dll 1
Modified: trunk/reactos/dll/win32/gdiplus/brush.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/brush.c?…
==============================================================================
--- trunk/reactos/dll/win32/gdiplus/brush.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdiplus/brush.c [iso-8859-1] Sat Nov 20 11:24:17 2010
@@ -352,6 +352,9 @@
if(!line || !startpoint || !endpoint || wrap == WrapModeClamp)
return InvalidParameter;
+ if (startpoint->X == endpoint->X && startpoint->Y ==
endpoint->Y)
+ return OutOfMemory;
+
*line = GdipAlloc(sizeof(GpLineGradient));
if(!*line) return OutOfMemory;
@@ -428,7 +431,7 @@
stF.X = (REAL)startpoint->X;
stF.Y = (REAL)startpoint->Y;
endF.X = (REAL)endpoint->X;
- endF.X = (REAL)endpoint->Y;
+ endF.Y = (REAL)endpoint->Y;
return GdipCreateLineBrush(&stF, &endF, startcolor, endcolor, wrap, line);
}
@@ -1494,6 +1497,19 @@
return NotImplemented;
}
+GpStatus WINGDIPAPI GdipSetPathGradientLinearBlend(GpPathGradient *brush,
+ REAL focus, REAL scale)
+{
+ static int calls;
+
+ TRACE("(%p,%0.2f,%0.2f)\n", brush, focus, scale);
+
+ if(!(calls++))
+ FIXME("not implemented\n");
+
+ return NotImplemented;
+}
+
GpStatus WINGDIPAPI GdipSetPathGradientPresetBlend(GpPathGradient *brush,
GDIPCONST ARGB *blend, GDIPCONST REAL *pos, INT count)
{
@@ -1501,6 +1517,20 @@
return NotImplemented;
}
+GpStatus WINGDIPAPI GdipGetPathGradientPresetBlend(GpPathGradient *brush,
+ ARGB *blend, REAL *pos, INT count)
+{
+ FIXME("(%p,%p,%p,%i): stub\n", brush, blend, pos, count);
+ return NotImplemented;
+}
+
+GpStatus WINGDIPAPI GdipGetPathGradientPresetBlendCount(GpPathGradient *brush,
+ INT *count)
+{
+ FIXME("(%p,%p): stub\n", brush, count);
+ return NotImplemented;
+}
+
GpStatus WINGDIPAPI GdipSetPathGradientCenterColor(GpPathGradient *grad,
ARGB argb)
{
@@ -1619,6 +1649,84 @@
grad->wrap = wrap;
return Ok;
+}
+
+GpStatus WINGDIPAPI GdipSetPathGradientTransform(GpPathGradient *grad,
+ GpMatrix *matrix)
+{
+ static int calls;
+
+ TRACE("(%p,%p)\n", grad, matrix);
+
+ if(!(calls++))
+ FIXME("not implemented\n");
+
+ return NotImplemented;
+}
+
+GpStatus WINGDIPAPI GdipGetPathGradientTransform(GpPathGradient *grad,
+ GpMatrix *matrix)
+{
+ static int calls;
+
+ TRACE("(%p,%p)\n", grad, matrix);
+
+ if(!(calls++))
+ FIXME("not implemented\n");
+
+ return NotImplemented;
+}
+
+GpStatus WINGDIPAPI GdipMultiplyPathGradientTransform(GpPathGradient *grad,
+ GDIPCONST GpMatrix *matrix, GpMatrixOrder order)
+{
+ static int calls;
+
+ TRACE("(%p,%p,%i)\n", grad, matrix, order);
+
+ if(!(calls++))
+ FIXME("not implemented\n");
+
+ return NotImplemented;
+}
+
+GpStatus WINGDIPAPI GdipRotatePathGradientTransform(GpPathGradient *grad,
+ REAL angle, GpMatrixOrder order)
+{
+ static int calls;
+
+ TRACE("(%p,%0.2f,%i)\n", grad, angle, order);
+
+ if(!(calls++))
+ FIXME("not implemented\n");
+
+ return NotImplemented;
+}
+
+GpStatus WINGDIPAPI GdipScalePathGradientTransform(GpPathGradient *grad,
+ REAL sx, REAL sy, GpMatrixOrder order)
+{
+ static int calls;
+
+ TRACE("(%p,%0.2f,%0.2f,%i)\n", grad, sx, sy, order);
+
+ if(!(calls++))
+ FIXME("not implemented\n");
+
+ return NotImplemented;
+}
+
+GpStatus WINGDIPAPI GdipTranslatePathGradientTransform(GpPathGradient *grad,
+ REAL dx, REAL dy, GpMatrixOrder order)
+{
+ static int calls;
+
+ TRACE("(%p,%0.2f,%0.2f,%i)\n", grad, dx, dy, order);
+
+ if(!(calls++))
+ FIXME("not implemented\n");
+
+ return NotImplemented;
}
GpStatus WINGDIPAPI GdipSetSolidFillColor(GpSolidFill *sf, ARGB argb)
Modified: trunk/reactos/dll/win32/gdiplus/font.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/font.c?r…
==============================================================================
--- trunk/reactos/dll/win32/gdiplus/font.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdiplus/font.c [iso-8859-1] Sat Nov 20 11:24:17 2010
@@ -452,12 +452,16 @@
GDIPCONST GpGraphics *graphics, REAL *height)
{
REAL dpi;
+ GpStatus stat;
TRACE("%p %p %p\n", font, graphics, height);
- dpi = GetDeviceCaps(graphics->hdc, LOGPIXELSY);
-
- return GdipGetFontHeightGivenDPI(font, dpi, height);
+ stat = GdipGetDpiY((GpGraphics*)graphics, &dpi);
+
+ if (stat == Ok)
+ stat = GdipGetFontHeightGivenDPI(font, dpi, height);
+
+ return stat;
}
/*******************************************************************************
Modified: trunk/reactos/dll/win32/gdiplus/gdiplus.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/gdiplus.…
==============================================================================
--- trunk/reactos/dll/win32/gdiplus/gdiplus.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdiplus/gdiplus.c [iso-8859-1] Sat Nov 20 11:24:17 2010
@@ -121,6 +121,14 @@
/* FIXME: no object tracking */
}
+/* "bricksntiles" expects a return value of 0, which native coincidentally
gives */
+ULONG WINAPI GdiplusShutdown_wrapper(ULONG_PTR token)
+{
+ GdiplusShutdown(token);
+
+ return 0;
+}
+
/*****************************************************
* GdipAlloc [GDIPLUS.@]
*/
@@ -314,18 +322,18 @@
}
/* converts a given unit to its value in pixels */
-REAL convert_unit(HDC hdc, GpUnit unit)
+REAL convert_unit(REAL logpixels, GpUnit unit)
{
switch(unit)
{
case UnitInch:
- return (REAL) GetDeviceCaps(hdc, LOGPIXELSX);
+ return logpixels;
case UnitPoint:
- return ((REAL)GetDeviceCaps(hdc, LOGPIXELSX)) / 72.0;
+ return logpixels / 72.0;
case UnitDocument:
- return ((REAL)GetDeviceCaps(hdc, LOGPIXELSX)) / 300.0;
+ return logpixels / 300.0;
case UnitMillimeter:
- return ((REAL)GetDeviceCaps(hdc, LOGPIXELSX)) / 25.4;
+ return logpixels / 25.4;
case UnitWorld:
ERR("cannot convert UnitWorld\n");
return 0.0;
Modified: trunk/reactos/dll/win32/gdiplus/gdiplus.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/gdiplus.…
==============================================================================
--- trunk/reactos/dll/win32/gdiplus/gdiplus.spec [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdiplus/gdiplus.spec [iso-8859-1] Sat Nov 20 11:24:17 2010
@@ -67,7 +67,7 @@
@ stdcall GdipCombineRegionRegion(ptr ptr long)
@ stdcall GdipComment(ptr long ptr)
@ stdcall GdipConvertToEmfPlus(ptr ptr ptr long ptr ptr)
-@ stub GdipConvertToEmfPlusToFile
+@ stdcall GdipConvertToEmfPlusToFile(ptr ptr ptr ptr long ptr ptr)
@ stub GdipConvertToEmfPlusToStream
@ stdcall GdipCreateAdjustableArrowCap(long long long ptr)
@ stub GdipCreateBitmapFromDirectDrawSurface
@@ -215,8 +215,8 @@
@ stub GdipEnumerateMetafileSrcRectDestRectI
@ stdcall GdipFillClosedCurve2(ptr ptr ptr long long long)
@ stdcall GdipFillClosedCurve2I(ptr ptr ptr long long long)
-@ stub GdipFillClosedCurve
-@ stub GdipFillClosedCurveI
+@ stdcall GdipFillClosedCurve(ptr ptr ptr long)
+@ stdcall GdipFillClosedCurveI(ptr ptr ptr long)
@ stdcall GdipFillEllipse(ptr ptr long long long long)
@ stdcall GdipFillEllipseI(ptr ptr long long long long)
@ stdcall GdipFillPath(ptr ptr ptr)
@@ -315,10 +315,10 @@
@ stdcall GdipGetLogFontW(ptr ptr ptr)
@ stdcall GdipGetMatrixElements(ptr ptr)
@ stub GdipGetMetafileDownLevelRasterizationLimit
-@ stub GdipGetMetafileHeaderFromEmf
-@ stub GdipGetMetafileHeaderFromFile
+@ stdcall GdipGetMetafileHeaderFromEmf(ptr ptr)
+@ stdcall GdipGetMetafileHeaderFromFile(wstr ptr)
@ stdcall GdipGetMetafileHeaderFromMetafile(ptr ptr)
-@ stub GdipGetMetafileHeaderFromStream
+@ stdcall GdipGetMetafileHeaderFromStream(ptr ptr)
@ stub GdipGetMetafileHeaderFromWmf
@ stdcall GdipGetNearestColor(ptr ptr)
@ stdcall GdipGetPageScale(ptr ptr)
@@ -334,13 +334,13 @@
@ stdcall GdipGetPathGradientGammaCorrection(ptr ptr)
@ stub GdipGetPathGradientPath
@ stdcall GdipGetPathGradientPointCount(ptr ptr)
-@ stub GdipGetPathGradientPresetBlend
-@ stub GdipGetPathGradientPresetBlendCount
+@ stdcall GdipGetPathGradientPresetBlend(ptr ptr ptr long)
+@ stdcall GdipGetPathGradientPresetBlendCount(ptr ptr)
@ stdcall GdipGetPathGradientRect(ptr ptr)
@ stdcall GdipGetPathGradientRectI(ptr ptr)
@ stdcall GdipGetPathGradientSurroundColorCount(ptr ptr)
@ stdcall GdipGetPathGradientSurroundColorsWithCount(ptr ptr ptr)
-@ stub GdipGetPathGradientTransform
+@ stdcall GdipGetPathGradientTransform(ptr ptr)
@ stdcall GdipGetPathGradientWrapMode(ptr ptr)
@ stdcall GdipGetPathLastPoint(ptr ptr)
@ stdcall GdipGetPathPoints(ptr ptr long)
@@ -351,7 +351,7 @@
@ stdcall GdipGetPenBrushFill(ptr ptr)
@ stdcall GdipGetPenColor(ptr ptr)
@ stub GdipGetPenCompoundArray
-@ stub GdipGetPenCompoundCount
+@ stdcall GdipGetPenCompoundCount(ptr ptr)
@ stdcall GdipGetPenCustomEndCap(ptr ptr)
@ stdcall GdipGetPenCustomStartCap(ptr ptr)
@ stdcall GdipGetPenDashArray(ptr ptr long)
@@ -365,7 +365,7 @@
@ stdcall GdipGetPenMiterLimit(ptr ptr)
@ stdcall GdipGetPenMode(ptr ptr)
@ stdcall GdipGetPenStartCap(ptr ptr)
-@ stub GdipGetPenTransform
+@ stdcall GdipGetPenTransform(ptr ptr)
@ stdcall GdipGetPenUnit(ptr ptr)
@ stdcall GdipGetPenWidth(ptr ptr)
@ stdcall GdipGetPixelOffsetMode(ptr ptr)
@@ -380,9 +380,9 @@
@ stdcall GdipGetRegionData(ptr ptr long ptr)
@ stdcall GdipGetRegionDataSize(ptr ptr)
@ stdcall GdipGetRegionHRgn(ptr ptr ptr)
-@ stub GdipGetRegionScans
+@ stdcall GdipGetRegionScans(ptr ptr ptr ptr)
@ stdcall GdipGetRegionScansCount(ptr ptr ptr)
-@ stub GdipGetRegionScansI
+@ stdcall GdipGetRegionScansI(ptr ptr ptr ptr)
@ stdcall GdipGetRenderingOrigin(ptr ptr ptr)
@ stdcall GdipGetSmoothingMode(ptr ptr)
@ stdcall GdipGetSolidFillColor(ptr ptr)
@@ -444,8 +444,8 @@
@ stdcall GdipMeasureString(ptr wstr long ptr ptr ptr ptr ptr ptr)
@ stdcall GdipMultiplyLineTransform(ptr ptr long)
@ stdcall GdipMultiplyMatrix(ptr ptr long)
-@ stub GdipMultiplyPathGradientTransform
-@ stub GdipMultiplyPenTransform
+@ stdcall GdipMultiplyPathGradientTransform(ptr ptr long)
+@ stdcall GdipMultiplyPenTransform(ptr ptr long)
@ stdcall GdipMultiplyTextureTransform(ptr ptr long)
@ stdcall GdipMultiplyWorldTransform(ptr ptr long)
@ stdcall GdipNewInstalledFontCollection(ptr)
@@ -466,11 +466,11 @@
@ stub GdipPlayTSClientRecord
@ stdcall GdipPrivateAddFontFile(ptr wstr)
@ stdcall GdipPrivateAddMemoryFont(ptr ptr long)
-@ stub GdipRecordMetafile
+@ stdcall GdipRecordMetafile(long long ptr long wstr ptr)
@ stdcall GdipRecordMetafileFileName(wstr long long ptr long wstr ptr)
@ stdcall GdipRecordMetafileFileNameI(wstr long long ptr long wstr ptr)
@ stdcall GdipRecordMetafileI(long long ptr long wstr ptr)
-@ stub GdipRecordMetafileStream
+@ stdcall GdipRecordMetafileStream(ptr long long ptr long wstr ptr)
@ stub GdipRecordMetafileStreamI
@ stdcall GdipReleaseDC(ptr ptr)
@ stdcall GdipRemovePropertyItem(ptr long)
@@ -487,8 +487,8 @@
@ stdcall GdipReversePath(ptr)
@ stdcall GdipRotateLineTransform(ptr long long)
@ stdcall GdipRotateMatrix(ptr long long)
-@ stub GdipRotatePathGradientTransform
-@ stub GdipRotatePenTransform
+@ stdcall GdipRotatePathGradientTransform(ptr long long)
+@ stdcall GdipRotatePenTransform(ptr long long)
@ stdcall GdipRotateTextureTransform(ptr long long)
@ stdcall GdipRotateWorldTransform(ptr long long)
@ stub GdipSaveAdd
@@ -498,7 +498,7 @@
@ stdcall GdipSaveImageToStream(ptr ptr ptr ptr)
@ stdcall GdipScaleLineTransform(ptr long long long)
@ stdcall GdipScaleMatrix(ptr long long long)
-@ stub GdipScalePathGradientTransform
+@ stdcall GdipScalePathGradientTransform(ptr long long long)
@ stdcall GdipScalePenTransform(ptr long long long)
@ stdcall GdipScaleTextureTransform(ptr long long long)
@ stdcall GdipScaleWorldTransform(ptr long long long)
@@ -554,12 +554,12 @@
@ stdcall GdipSetPathGradientCenterPointI(ptr ptr)
@ stdcall GdipSetPathGradientFocusScales(ptr long long)
@ stdcall GdipSetPathGradientGammaCorrection(ptr long)
-@ stub GdipSetPathGradientLinearBlend
+@ stdcall GdipSetPathGradientLinearBlend(ptr long long)
@ stub GdipSetPathGradientPath
@ stdcall GdipSetPathGradientPresetBlend(ptr ptr ptr long)
@ stdcall GdipSetPathGradientSigmaBlend(ptr long long)
@ stdcall GdipSetPathGradientSurroundColorsWithCount(ptr ptr ptr)
-@ stub GdipSetPathGradientTransform
+@ stdcall GdipSetPathGradientTransform(ptr ptr)
@ stdcall GdipSetPathGradientWrapMode(ptr long)
@ stdcall GdipSetPathMarker(ptr)
@ stdcall GdipSetPenBrushFill(ptr ptr)
@@ -577,7 +577,7 @@
@ stdcall GdipSetPenMiterLimit(ptr long)
@ stdcall GdipSetPenMode(ptr long)
@ stdcall GdipSetPenStartCap(ptr long)
-@ stub GdipSetPenTransform
+@ stdcall GdipSetPenTransform(ptr ptr)
@ stub GdipSetPenUnit
@ stdcall GdipSetPenWidth(ptr long)
@ stdcall GdipSetPixelOffsetMode(ptr long)
@@ -613,8 +613,8 @@
@ stdcall GdipTranslateClipI(ptr long long)
@ stdcall GdipTranslateLineTransform(ptr long long long)
@ stdcall GdipTranslateMatrix(ptr long long long)
-@ stub GdipTranslatePathGradientTransform
-@ stub GdipTranslatePenTransform
+@ stdcall GdipTranslatePathGradientTransform(ptr long long long)
+@ stdcall GdipTranslatePenTransform(ptr long long long)
@ stdcall GdipTranslateRegion(ptr long long)
@ stdcall GdipTranslateRegionI(ptr long long)
@ stdcall GdipTranslateTextureTransform(ptr long long long)
@@ -623,8 +623,8 @@
@ stdcall GdipVectorTransformMatrixPointsI(ptr ptr long)
@ stdcall GdipWarpPath(ptr ptr ptr long long long long long long long)
@ stdcall GdipWidenPath(ptr ptr ptr long)
-@ stub GdipWindingModeOutline
+@ stdcall GdipWindingModeOutline(ptr ptr long)
@ stdcall GdiplusNotificationHook(ptr)
@ stdcall GdiplusNotificationUnhook(ptr)
-@ stdcall GdiplusShutdown(ptr)
+@ stdcall GdiplusShutdown(ptr) GdiplusShutdown_wrapper
@ stdcall GdiplusStartup(ptr ptr ptr)
Modified: trunk/reactos/dll/win32/gdiplus/gdiplus_private.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/gdiplus_…
==============================================================================
--- trunk/reactos/dll/win32/gdiplus/gdiplus_private.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdiplus/gdiplus_private.h [iso-8859-1] Sat Nov 20 11:24:17
2010
@@ -47,7 +47,9 @@
REAL startAngle, REAL sweepAngle);
extern REAL gdiplus_atan2(REAL dy, REAL dx);
extern GpStatus hresult_to_status(HRESULT res);
-extern REAL convert_unit(HDC hdc, GpUnit unit);
+extern REAL convert_unit(REAL logpixels, GpUnit unit);
+
+extern GpStatus graphics_from_image(GpImage *image, GpGraphics **graphics);
extern void calc_curve_bezier(CONST GpPointF *pts, REAL tension, REAL *x1,
REAL *y1, REAL *x2, REAL *y2);
@@ -150,6 +152,12 @@
UINT textcontrast; /* not used yet. get/set only */
struct list containers;
GraphicsContainer contid; /* last-issued container ID */
+ /* For giving the caller an HDC when we technically can't: */
+ HBITMAP temp_hbitmap;
+ int temp_hbitmap_width;
+ int temp_hbitmap_height;
+ BYTE *temp_bits;
+ HDC temp_hdc;
};
struct GpBrush{
@@ -269,6 +277,7 @@
HDC hdc;
BYTE *bits; /* actual image bits if this is a DIB */
INT stride; /* stride of bits if this is a DIB */
+ BYTE *own_bits; /* image bits that need to be freed with this object */
};
struct GpCachedBitmap{
Modified: trunk/reactos/dll/win32/gdiplus/graphics.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/graphics…
==============================================================================
--- trunk/reactos/dll/win32/gdiplus/graphics.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdiplus/graphics.c [iso-8859-1] Sat Nov 20 11:24:17 2010
@@ -84,13 +84,21 @@
return ret;
}
+static REAL graphics_res(GpGraphics *graphics)
+{
+ if (graphics->image) return graphics->image->xres;
+ else return (REAL)GetDeviceCaps(graphics->hdc, LOGPIXELSX);
+}
+
static INT prepare_dc(GpGraphics *graphics, GpPen *pen)
{
HPEN gdipen;
REAL width;
- INT save_state = SaveDC(graphics->hdc), i, numdashes;
+ INT save_state, i, numdashes;
GpPointF pt[2];
DWORD dash_array[MAX_DASHLEN];
+
+ save_state = SaveDC(graphics->hdc);
EndPath(graphics->hdc);
@@ -108,7 +116,7 @@
width = sqrt((pt[1].X - pt[0].X) * (pt[1].X - pt[0].X) +
(pt[1].Y - pt[0].Y) * (pt[1].Y - pt[0].Y)) / sqrt(2.0);
- width *= pen->width * convert_unit(graphics->hdc,
+ width *= pen->width * convert_unit(graphics_res(graphics),
pen->unit == UnitWorld ? graphics->unit :
pen->unit);
}
@@ -156,7 +164,7 @@
GpMatrix *matrix;
int i;
- unitscale = convert_unit(graphics->hdc, graphics->unit);
+ unitscale = convert_unit(graphics_res(graphics), graphics->unit);
/* apply page scale */
if(graphics->unit != UnitDisplay)
@@ -1131,6 +1139,8 @@
static GpStatus get_graphics_bounds(GpGraphics* graphics, GpRectF* rect)
{
RECT wnd_rect;
+ GpStatus stat=Ok;
+ GpUnit unit;
if(graphics->hwnd) {
if(!GetClientRect(graphics->hwnd, &wnd_rect))
@@ -1140,6 +1150,10 @@
rect->Y = wnd_rect.top;
rect->Width = wnd_rect.right - wnd_rect.left;
rect->Height = wnd_rect.bottom - wnd_rect.top;
+ }else if (graphics->image){
+ stat = GdipGetImageBounds(graphics->image, rect, &unit);
+ if (stat == Ok && unit != UnitPixel)
+ FIXME("need to convert from unit %i\n", unit);
}else{
rect->X = 0;
rect->Y = 0;
@@ -1147,7 +1161,7 @@
rect->Height = GetDeviceCaps(graphics->hdc, VERTRES);
}
- return Ok;
+ return stat;
}
/* on success, rgn will contain the region of the graphics object which
@@ -1218,6 +1232,45 @@
(*graphics)->hdc = hdc;
(*graphics)->hwnd = WindowFromDC(hdc);
(*graphics)->owndc = FALSE;
+ (*graphics)->smoothing = SmoothingModeDefault;
+ (*graphics)->compqual = CompositingQualityDefault;
+ (*graphics)->interpolation = InterpolationModeDefault;
+ (*graphics)->pixeloffset = PixelOffsetModeDefault;
+ (*graphics)->compmode = CompositingModeSourceOver;
+ (*graphics)->unit = UnitDisplay;
+ (*graphics)->scale = 1.0;
+ (*graphics)->busy = FALSE;
+ (*graphics)->textcontrast = 4;
+ list_init(&(*graphics)->containers);
+ (*graphics)->contid = 0;
+
+ TRACE("<-- %p\n", *graphics);
+
+ return Ok;
+}
+
+GpStatus graphics_from_image(GpImage *image, GpGraphics **graphics)
+{
+ GpStatus retval;
+
+ *graphics = GdipAlloc(sizeof(GpGraphics));
+ if(!*graphics) return OutOfMemory;
+
+ if((retval = GdipCreateMatrix(&(*graphics)->worldtrans)) != Ok){
+ GdipFree(*graphics);
+ return retval;
+ }
+
+ if((retval = GdipCreateRegion(&(*graphics)->clip)) != Ok){
+ GdipFree((*graphics)->worldtrans);
+ GdipFree(*graphics);
+ return retval;
+ }
+
+ (*graphics)->hdc = NULL;
+ (*graphics)->hwnd = NULL;
+ (*graphics)->owndc = FALSE;
+ (*graphics)->image = image;
(*graphics)->smoothing = SmoothingModeDefault;
(*graphics)->compqual = CompositingQualityDefault;
(*graphics)->interpolation = InterpolationModeDefault;
@@ -1446,6 +1499,12 @@
if(graphics->busy)
return ObjectBusy;
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
num_pts = arc2polybezier(points, x, y, width, height, startAngle, sweepAngle);
save_state = prepare_dc(graphics, pen);
@@ -1481,6 +1540,12 @@
if(graphics->busy)
return ObjectBusy;
+
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
pt[0].X = x1;
pt[0].Y = y1;
@@ -1516,6 +1581,12 @@
if(graphics->busy)
return ObjectBusy;
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
pt[0].X = x1;
pt[0].Y = y1;
pt[1].X = x2;
@@ -1722,6 +1793,12 @@
if(count < 2)
return InvalidParameter;
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
pt = GdipAlloc(len_pt * sizeof(GpPointF));
if(!pt)
return OutOfMemory;
@@ -1837,6 +1914,12 @@
if(graphics->busy)
return ObjectBusy;
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
ptf[0].X = x;
ptf[0].Y = y;
ptf[1].X = x + width;
@@ -1961,6 +2044,11 @@
if (image->picture)
{
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ }
+
/* FIXME: partially implemented (only works for rectangular parallelograms) */
if(srcUnit == UnitInch)
dx = dy = (REAL) INCH_HIMETRIC;
@@ -1983,7 +2071,7 @@
return GenericError;
}
}
- else if (image->type == ImageTypeBitmap &&
((GpBitmap*)image)->hbitmap)
+ else if (image->type == ImageTypeBitmap)
{
GpBitmap* bitmap = (GpBitmap*)image;
int use_software=0;
@@ -1997,6 +2085,7 @@
if (imageAttributes ||
(graphics->image && graphics->image->type ==
ImageTypeBitmap) ||
+ !((GpBitmap*)image)->hbitmap ||
ptf[1].Y != ptf[0].Y || ptf[2].X != ptf[0].X)
use_software = 1;
@@ -2383,6 +2472,12 @@
if(graphics->busy)
return ObjectBusy;
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
pt[0].X = x1;
pt[0].Y = y1;
pt[1].X = x2;
@@ -2412,6 +2507,12 @@
if(graphics->busy)
return ObjectBusy;
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
pt[0].X = (REAL)x1;
pt[0].Y = (REAL)y1;
pt[1].X = (REAL)x2;
@@ -2440,6 +2541,12 @@
if(graphics->busy)
return ObjectBusy;
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
save_state = prepare_dc(graphics, pen);
retval = draw_polyline(graphics, pen, points, count, TRUE);
@@ -2465,6 +2572,12 @@
if(graphics->busy)
return ObjectBusy;
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
ptf = GdipAlloc(count * sizeof(GpPointF));
if(!ptf) return OutOfMemory;
@@ -2496,6 +2609,12 @@
if(graphics->busy)
return ObjectBusy;
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
save_state = prepare_dc(graphics, pen);
retval = draw_poly(graphics, pen, path->pathdata.Points,
@@ -2519,6 +2638,12 @@
if(graphics->busy)
return ObjectBusy;
+
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
save_state = prepare_dc(graphics, pen);
SelectObject(graphics->hdc, GetStockObject(NULL_BRUSH));
@@ -2553,6 +2678,12 @@
if(graphics->busy)
return ObjectBusy;
+
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
ptf[0].X = x;
ptf[0].Y = y;
@@ -2597,6 +2728,12 @@
if(graphics->busy)
return ObjectBusy;
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
ptf = GdipAlloc(4 * count * sizeof(GpPointF));
pti = GdipAlloc(4 * count * sizeof(POINT));
@@ -2673,6 +2810,9 @@
if(graphics->busy)
return ObjectBusy;
+ if(count == 1) /* Do nothing */
+ return Ok;
+
stat = GdipCreatePath(fill, &path);
if(stat != Ok)
return stat;
@@ -2704,8 +2844,11 @@
TRACE("(%p, %p, %p, %d, %.2f, %d)\n", graphics, brush, points,
count, tension, fill);
- if(!points || count <= 0)
- return InvalidParameter;
+ if(!points || count == 0)
+ return InvalidParameter;
+
+ if(count == 1) /* Do nothing */
+ return Ok;
ptf = GdipAlloc(sizeof(GpPointF)*count);
if(!ptf)
@@ -2723,6 +2866,22 @@
return stat;
}
+GpStatus WINGDIPAPI GdipFillClosedCurve(GpGraphics *graphics, GpBrush *brush,
+ GDIPCONST GpPointF *points, INT count)
+{
+ TRACE("(%p, %p, %p, %d)\n", graphics, brush, points, count);
+ return GdipFillClosedCurve2(graphics, brush, points, count,
+ 0.5f, FillModeAlternate);
+}
+
+GpStatus WINGDIPAPI GdipFillClosedCurveI(GpGraphics *graphics, GpBrush *brush,
+ GDIPCONST GpPoint *points, INT count)
+{
+ TRACE("(%p, %p, %p, %d)\n", graphics, brush, points, count);
+ return GdipFillClosedCurve2I(graphics, brush, points, count,
+ 0.5f, FillModeAlternate);
+}
+
GpStatus WINGDIPAPI GdipFillEllipse(GpGraphics *graphics, GpBrush *brush, REAL x,
REAL y, REAL width, REAL height)
{
@@ -2737,6 +2896,12 @@
if(graphics->busy)
return ObjectBusy;
+
+ if(!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
ptf[0].X = x;
ptf[0].Y = y;
@@ -2780,6 +2945,12 @@
if(graphics->busy)
return ObjectBusy;
+ if(!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
save_state = SaveDC(graphics->hdc);
EndPath(graphics->hdc);
SetPolyFillMode(graphics->hdc, (path->fill == FillModeAlternate ? ALTERNATE
@@ -2817,6 +2988,12 @@
if(graphics->busy)
return ObjectBusy;
+ if(!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
save_state = SaveDC(graphics->hdc);
EndPath(graphics->hdc);
@@ -2855,6 +3032,12 @@
if(graphics->busy)
return ObjectBusy;
+
+ if(!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
ptf = GdipAlloc(count * sizeof(GpPointF));
pti = GdipAlloc(count * sizeof(POINT));
@@ -2903,6 +3086,12 @@
if(graphics->busy)
return ObjectBusy;
+ if(!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
ptf = GdipAlloc(count * sizeof(GpPointF));
pti = GdipAlloc(count * sizeof(POINT));
if(!ptf || !pti){
@@ -2967,6 +3156,12 @@
if(graphics->busy)
return ObjectBusy;
+
+ if(!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
ptf[0].X = x;
ptf[0].Y = y;
@@ -3008,6 +3203,12 @@
if(graphics->busy)
return ObjectBusy;
+ if(!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
ptf[0].X = x;
ptf[0].Y = y;
ptf[1].X = x + width;
@@ -3099,6 +3300,12 @@
if(graphics->busy)
return ObjectBusy;
+
+ if(!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
status = GdipGetRegionHRgn(region, graphics, &hrgn);
if(status != Ok)
@@ -3700,6 +3907,7 @@
int i;
HFONT oldfont;
struct measure_ranges_args args;
+ HDC temp_hdc=NULL;
TRACE("(%p %s %d %p %s %p %d %p)\n", graphics, debugstr_w(string),
length, font, debugstr_rectf(layoutRect), stringFormat, regionCount,
regions);
@@ -3709,6 +3917,12 @@
if (regionCount < stringFormat->range_count)
return InvalidParameter;
+
+ if(!graphics->hdc)
+ {
+ temp_hdc = graphics->hdc = CreateCompatibleDC(0);
+ if (!temp_hdc) return OutOfMemory;
+ }
if (stringFormat->attr)
TRACE("may be ignoring some format flags: attr %x\n",
stringFormat->attr);
@@ -3728,6 +3942,12 @@
measure_ranges_callback, &args);
DeleteObject(SelectObject(graphics->hdc, oldfont));
+
+ if (temp_hdc)
+ {
+ graphics->hdc = NULL;
+ DeleteDC(temp_hdc);
+ }
return stat;
}
@@ -3771,6 +3991,7 @@
{
HFONT oldfont;
struct measure_string_args args;
+ HDC temp_hdc=NULL;
TRACE("(%p, %s, %i, %p, %s, %p, %p, %p, %p)\n", graphics,
debugstr_wn(string, length), length, font, debugstr_rectf(rect), format,
@@ -3778,6 +3999,12 @@
if(!graphics || !string || !font || !rect || !bounds)
return InvalidParameter;
+
+ if(!graphics->hdc)
+ {
+ temp_hdc = graphics->hdc = CreateCompatibleDC(0);
+ if (!temp_hdc) return OutOfMemory;
+ }
if(linesfilled) *linesfilled = 0;
if(codepointsfitted) *codepointsfitted = 0;
@@ -3800,6 +4027,12 @@
measure_string_callback, &args);
DeleteObject(SelectObject(graphics->hdc, oldfont));
+
+ if (temp_hdc)
+ {
+ graphics->hdc = NULL;
+ DeleteDC(temp_hdc);
+ }
return Ok;
}
@@ -3850,6 +4083,12 @@
if((brush->bt != BrushTypeSolidColor)){
FIXME("not implemented for given parameters\n");
return NotImplemented;
+ }
+
+ if(!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
}
if(format){
@@ -4415,6 +4654,12 @@
if(graphics->busy)
return ObjectBusy;
+ if (!graphics->hdc)
+ {
+ FIXME("graphics object has no HDC\n");
+ return Ok;
+ }
+
pti = GdipAlloc(sizeof(POINT) * count);
save_state = prepare_dc(graphics, pen);
@@ -4462,7 +4707,10 @@
if(graphics->busy)
return ObjectBusy;
- *dpi = (REAL)GetDeviceCaps(graphics->hdc, LOGPIXELSX);
+ if (graphics->image)
+ *dpi = graphics->image->xres;
+ else
+ *dpi = (REAL)GetDeviceCaps(graphics->hdc, LOGPIXELSX);
return Ok;
}
@@ -4477,7 +4725,10 @@
if(graphics->busy)
return ObjectBusy;
- *dpi = (REAL)GetDeviceCaps(graphics->hdc, LOGPIXELSY);
+ if (graphics->image)
+ *dpi = graphics->image->yres;
+ else
+ *dpi = (REAL)GetDeviceCaps(graphics->hdc, LOGPIXELSY);
return Ok;
}
@@ -4505,6 +4756,9 @@
return ret;
}
+/* Color used to fill bitmaps so we can tell which parts have been drawn over by gdi32.
*/
+static const COLORREF DC_BACKGROUND_KEY = 0x0c0b0d;
+
GpStatus WINGDIPAPI GdipGetDC(GpGraphics *graphics, HDC *hdc)
{
TRACE("(%p, %p)\n", graphics, hdc);
@@ -4515,7 +4769,61 @@
if(graphics->busy)
return ObjectBusy;
- *hdc = graphics->hdc;
+ if (!graphics->hdc ||
+ (graphics->image && graphics->image->type == ImageTypeBitmap
&& ((GpBitmap*)graphics->image)->format & PixelFormatAlpha))
+ {
+ /* Create a fake HDC and fill it with a constant color. */
+ HDC temp_hdc;
+ HBITMAP hbitmap;
+ GpStatus stat;
+ GpRectF bounds;
+ BITMAPINFOHEADER bmih;
+ int i;
+
+ stat = get_graphics_bounds(graphics, &bounds);
+ if (stat != Ok)
+ return stat;
+
+ graphics->temp_hbitmap_width = bounds.Width;
+ graphics->temp_hbitmap_height = bounds.Height;
+
+ bmih.biSize = sizeof(bmih);
+ bmih.biWidth = graphics->temp_hbitmap_width;
+ bmih.biHeight = -graphics->temp_hbitmap_height;
+ bmih.biPlanes = 1;
+ bmih.biBitCount = 32;
+ bmih.biCompression = BI_RGB;
+ bmih.biSizeImage = 0;
+ bmih.biXPelsPerMeter = 0;
+ bmih.biYPelsPerMeter = 0;
+ bmih.biClrUsed = 0;
+ bmih.biClrImportant = 0;
+
+ hbitmap = CreateDIBSection(NULL, (BITMAPINFO*)&bmih, DIB_RGB_COLORS,
+ (void**)&graphics->temp_bits, NULL, 0);
+ if (!hbitmap)
+ return GenericError;
+
+ temp_hdc = CreateCompatibleDC(0);
+ if (!temp_hdc)
+ {
+ DeleteObject(hbitmap);
+ return GenericError;
+ }
+
+ for (i=0; i<(graphics->temp_hbitmap_width *
graphics->temp_hbitmap_height); i++)
+ ((DWORD*)graphics->temp_bits)[i] = DC_BACKGROUND_KEY;
+
+ SelectObject(temp_hdc, hbitmap);
+
+ graphics->temp_hbitmap = hbitmap;
+ *hdc = graphics->temp_hdc = temp_hdc;
+ }
+ else
+ {
+ *hdc = graphics->hdc;
+ }
+
graphics->busy = TRUE;
return Ok;
@@ -4525,11 +4833,39 @@
{
TRACE("(%p, %p)\n", graphics, hdc);
- if(!graphics)
- return InvalidParameter;
-
- if(graphics->hdc != hdc || !(graphics->busy))
- return InvalidParameter;
+ if(!graphics || !hdc)
+ return InvalidParameter;
+
+ if((graphics->hdc != hdc && graphics->temp_hdc != hdc) ||
!(graphics->busy))
+ return InvalidParameter;
+
+ if (graphics->temp_hdc == hdc)
+ {
+ DWORD* pos;
+ int i;
+
+ /* Find the pixels that have changed, and mark them as opaque. */
+ pos = (DWORD*)graphics->temp_bits;
+ for (i=0; i<(graphics->temp_hbitmap_width *
graphics->temp_hbitmap_height); i++)
+ {
+ if (*pos != DC_BACKGROUND_KEY)
+ {
+ *pos |= 0xff000000;
+ }
+ pos++;
+ }
+
+ /* Write the changed pixels to the real target. */
+ alpha_blend_pixels(graphics, 0, 0, graphics->temp_bits,
+ graphics->temp_hbitmap_width, graphics->temp_hbitmap_height,
+ graphics->temp_hbitmap_width * 4);
+
+ /* Clean up. */
+ DeleteDC(graphics->temp_hdc);
+ DeleteObject(graphics->temp_hbitmap);
+ graphics->temp_hdc = NULL;
+ graphics->temp_hbitmap = NULL;
+ }
graphics->busy = FALSE;
@@ -4580,7 +4916,7 @@
stat = GdipCreateMatrix(&matrix);
if (stat == Ok)
{
- unitscale = convert_unit(graphics->hdc, graphics->unit);
+ unitscale = convert_unit(graphics_res(graphics), graphics->unit);
if(graphics->unit != UnitDisplay)
unitscale *= graphics->scale;
Modified: trunk/reactos/dll/win32/gdiplus/graphicspath.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/graphics…
==============================================================================
--- trunk/reactos/dll/win32/gdiplus/graphicspath.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdiplus/graphicspath.c [iso-8859-1] Sat Nov 20 11:24:17 2010
@@ -364,7 +364,7 @@
}
/* points [len_pt-2] and [0] are calculated
- separetely to connect splines properly */
+ separately to connect splines properly */
pts[0] = points[count-1];
pts[1] = points[0]; /* equals to start and end of a resulting path */
pts[2] = points[1];
@@ -1653,3 +1653,9 @@
return Ok;
}
+
+GpStatus WINGDIPAPI GdipWindingModeOutline(GpPath *path, GpMatrix *matrix, REAL
flatness)
+{
+ FIXME("stub: %p, %p, %.2f\n", path, matrix, flatness);
+ return NotImplemented;
+}
Modified: trunk/reactos/dll/win32/gdiplus/image.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/image.c?…
==============================================================================
--- trunk/reactos/dll/win32/gdiplus/image.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdiplus/image.c [iso-8859-1] Sat Nov 20 11:24:17 2010
@@ -1626,11 +1626,10 @@
PixelFormat format, BYTE* scan0, GpBitmap** bitmap)
{
BITMAPINFO* pbmi;
- HBITMAP hbitmap;
+ HBITMAP hbitmap=NULL;
INT row_size, dib_stride;
HDC hdc;
- BYTE *bits;
- int i;
+ BYTE *bits=NULL, *own_bits=NULL;
REAL xres, yres;
GpStatus stat;
@@ -1655,46 +1654,62 @@
if(stride == 0)
stride = dib_stride;
- pbmi = GdipAlloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
- if (!pbmi)
- return OutOfMemory;
-
- pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
- pbmi->bmiHeader.biWidth = width;
- pbmi->bmiHeader.biHeight = -height;
- pbmi->bmiHeader.biPlanes = 1;
- /* FIXME: use the rest of the data from format */
- pbmi->bmiHeader.biBitCount = PIXELFORMATBPP(format);
- pbmi->bmiHeader.biCompression = BI_RGB;
- pbmi->bmiHeader.biSizeImage = 0;
- pbmi->bmiHeader.biXPelsPerMeter = 0;
- pbmi->bmiHeader.biYPelsPerMeter = 0;
- pbmi->bmiHeader.biClrUsed = 0;
- pbmi->bmiHeader.biClrImportant = 0;
-
- hdc = CreateCompatibleDC(NULL);
- if (!hdc) {
+ if (format & PixelFormatGDI && !(format &
(PixelFormatAlpha|PixelFormatIndexed)) && !scan0)
+ {
+ pbmi = GdipAlloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
+ if (!pbmi)
+ return OutOfMemory;
+
+ pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ pbmi->bmiHeader.biWidth = width;
+ pbmi->bmiHeader.biHeight = -height;
+ pbmi->bmiHeader.biPlanes = 1;
+ /* FIXME: use the rest of the data from format */
+ pbmi->bmiHeader.biBitCount = PIXELFORMATBPP(format);
+ pbmi->bmiHeader.biCompression = BI_RGB;
+ pbmi->bmiHeader.biSizeImage = 0;
+ pbmi->bmiHeader.biXPelsPerMeter = 0;
+ pbmi->bmiHeader.biYPelsPerMeter = 0;
+ pbmi->bmiHeader.biClrUsed = 0;
+ pbmi->bmiHeader.biClrImportant = 0;
+
+ hdc = CreateCompatibleDC(NULL);
+ if (!hdc) {
+ GdipFree(pbmi);
+ return GenericError;
+ }
+
+ hbitmap = CreateDIBSection(hdc, pbmi, DIB_RGB_COLORS, (void**)&bits, NULL,
0);
+
+ DeleteDC(hdc);
GdipFree(pbmi);
- return GenericError;
- }
-
- hbitmap = CreateDIBSection(hdc, pbmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
-
- DeleteDC(hdc);
- GdipFree(pbmi);
-
- if (!hbitmap) return GenericError;
-
- /* copy bits to the dib if necessary */
- /* FIXME: should reference the bits instead of copying them */
- if (scan0)
- for (i=0; i<height; i++)
- memcpy(bits+i*dib_stride, scan0+i*stride, row_size);
+
+ if (!hbitmap) return GenericError;
+
+ stride = dib_stride;
+ }
+ else
+ {
+ /* Not a GDI format; don't try to make an HBITMAP. */
+ if (scan0)
+ bits = scan0;
+ else
+ {
+ INT size = abs(stride) * height;
+
+ own_bits = bits = GdipAlloc(size);
+ if (!own_bits) return OutOfMemory;
+
+ if (stride < 0)
+ bits += stride * (1 - height);
+ }
+ }
*bitmap = GdipAlloc(sizeof(GpBitmap));
if(!*bitmap)
{
DeleteObject(hbitmap);
+ GdipFree(own_bits);
return OutOfMemory;
}
@@ -1714,7 +1729,12 @@
(*bitmap)->hbitmap = hbitmap;
(*bitmap)->hdc = NULL;
(*bitmap)->bits = bits;
- (*bitmap)->stride = dib_stride;
+ (*bitmap)->stride = stride;
+ (*bitmap)->own_bits = own_bits;
+
+ /* set format-related flags */
+ if (format & (PixelFormatAlpha|PixelFormatPAlpha|PixelFormatIndexed))
+ (*bitmap)->image.flags |= ImageFlagsHasAlpha;
if (format == PixelFormat1bppIndexed ||
format == PixelFormat4bppIndexed ||
@@ -1916,6 +1936,7 @@
dst->hdc = src->hdc;
dst->bits = src->bits;
dst->stride = src->stride;
+ dst->own_bits = src->own_bits;
GdipFree(src);
}
@@ -1927,15 +1948,22 @@
if(!image)
return InvalidParameter;
+ if (image->type == ImageTypeBitmap)
+ {
+ GdipFree(((GpBitmap*)image)->bitmapbits);
+ GdipFree(((GpBitmap*)image)->own_bits);
+ DeleteDC(((GpBitmap*)image)->hdc);
+ DeleteObject(((GpBitmap*)image)->hbitmap);
+ }
+ else if (image->type != ImageTypeMetafile)
+ {
+ WARN("invalid image: %p\n", image);
+ return ObjectBusy;
+ }
if (image->picture)
IPicture_Release(image->picture);
- if (image->type == ImageTypeBitmap)
- {
- GdipFree(((GpBitmap*)image)->bitmapbits);
- DeleteDC(((GpBitmap*)image)->hdc);
- DeleteObject(((GpBitmap*)image)->hbitmap);
- }
GdipFree(image->palette_entries);
+ image->type = ~0;
GdipFree(image);
return Ok;
@@ -2008,14 +2036,15 @@
if(image->type == ImageTypeMetafile){
HDC hdc = GetDC(0);
-
- *height = convert_unit(hdc, ((GpMetafile*)image)->unit) *
+ REAL res = (REAL)GetDeviceCaps(hdc, LOGPIXELSX);
+
+ ReleaseDC(0, hdc);
+
+ *height = convert_unit(res, ((GpMetafile*)image)->unit) *
((GpMetafile*)image)->bounds.Height;
- *width = convert_unit(hdc, ((GpMetafile*)image)->unit) *
+ *width = convert_unit(res, ((GpMetafile*)image)->unit) *
((GpMetafile*)image)->bounds.Width;
-
- ReleaseDC(0, hdc);
}
else if(image->type == ImageTypeBitmap){
@@ -2047,18 +2076,23 @@
return NotImplemented;
}
- hdc = ((GpBitmap*)image)->hdc;
-
- if(!hdc){
- hdc = CreateCompatibleDC(0);
- SelectObject(hdc, ((GpBitmap*)image)->hbitmap);
- ((GpBitmap*)image)->hdc = hdc;
- }
-
- stat = GdipCreateFromHDC(hdc, graphics);
-
- if (stat == Ok)
- (*graphics)->image = image;
+ if (((GpBitmap*)image)->hbitmap)
+ {
+ hdc = ((GpBitmap*)image)->hdc;
+
+ if(!hdc){
+ hdc = CreateCompatibleDC(0);
+ SelectObject(hdc, ((GpBitmap*)image)->hbitmap);
+ ((GpBitmap*)image)->hdc = hdc;
+ }
+
+ stat = GdipCreateFromHDC(hdc, graphics);
+
+ if (stat == Ok)
+ (*graphics)->image = image;
+ }
+ else
+ stat = graphics_from_image(image, graphics);
return stat;
}
@@ -2072,11 +2106,12 @@
if(image->type == ImageTypeMetafile){
HDC hdc = GetDC(0);
-
- *height = roundr(convert_unit(hdc, ((GpMetafile*)image)->unit) *
+ REAL res = (REAL)GetDeviceCaps(hdc, LOGPIXELSX);
+
+ ReleaseDC(0, hdc);
+
+ *height = roundr(convert_unit(res, ((GpMetafile*)image)->unit) *
((GpMetafile*)image)->bounds.Height);
-
- ReleaseDC(0, hdc);
}
else if(image->type == ImageTypeBitmap)
*height = ((GpBitmap*)image)->height;
@@ -2178,11 +2213,12 @@
if(image->type == ImageTypeMetafile){
HDC hdc = GetDC(0);
-
- *width = roundr(convert_unit(hdc, ((GpMetafile*)image)->unit) *
+ REAL res = (REAL)GetDeviceCaps(hdc, LOGPIXELSX);
+
+ ReleaseDC(0, hdc);
+
+ *width = roundr(convert_unit(res, ((GpMetafile*)image)->unit) *
((GpMetafile*)image)->bounds.Width);
-
- ReleaseDC(0, hdc);
}
else if(image->type == ImageTypeBitmap)
*width = ((GpBitmap*)image)->width;
@@ -2566,6 +2602,18 @@
*image = NULL;
GdipDisposeImage((GpImage*)bitmap);
}
+
+ if (SUCCEEDED(hr) && status == Ok)
+ {
+ double dpix, dpiy;
+ hr = IWICBitmapSource_GetResolution(source, &dpix, &dpiy);
+ if (SUCCEEDED(hr))
+ {
+ bitmap->image.xres = dpix;
+ bitmap->image.yres = dpiy;
+ }
+ hr = S_OK;
+ }
}
IWICBitmapSource_Release(source);
@@ -2580,6 +2628,12 @@
if (SUCCEEDED(initresult)) CoUninitialize();
if (FAILED(hr) && status == Ok) status = hresult_to_status(hr);
+
+ if (status == Ok)
+ {
+ /* Native GDI+ used to be smarter, but since Win7 it just sets these flags. */
+ bitmap->image.flags |=
ImageFlagsReadOnly|ImageFlagsHasRealPixelSize|ImageFlagsHasRealDPI|ImageFlagsColorSpaceRGB;
+ }
return status;
}
@@ -3756,3 +3810,16 @@
return stat;
}
+
+/*****************************************************************************
+ * GdipConvertToEmfPlusToFile [GDIPLUS.@]
+ */
+
+GpStatus WINGDIPAPI GdipConvertToEmfPlusToFile(const GpGraphics* refGraphics,
+ GpMetafile* metafile, BOOL*
conversionSuccess,
+ const WCHAR* filename, EmfType emfType,
+ const WCHAR* description, GpMetafile**
out_metafile)
+{
+ FIXME("stub: %p, %p, %p, %p, %u, %p, %p\n", refGraphics, metafile,
conversionSuccess, filename, emfType, description, out_metafile);
+ return NotImplemented;
+}
Modified: trunk/reactos/dll/win32/gdiplus/pen.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/pen.c?re…
==============================================================================
--- trunk/reactos/dll/win32/gdiplus/pen.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdiplus/pen.c [iso-8859-1] Sat Nov 20 11:24:17 2010
@@ -404,6 +404,51 @@
return NotImplemented;
}
+GpStatus WINGDIPAPI GdipSetPenTransform(GpPen *pen, GpMatrix *matrix)
+{
+ static int calls;
+
+ TRACE("(%p,%p)\n", pen, matrix);
+
+ if(!pen || !matrix)
+ return InvalidParameter;
+
+ if(!(calls++))
+ FIXME("not implemented\n");
+
+ return NotImplemented;
+}
+
+GpStatus WINGDIPAPI GdipGetPenTransform(GpPen *pen, GpMatrix *matrix)
+{
+ static int calls;
+
+ TRACE("(%p,%p)\n", pen, matrix);
+
+ if(!pen || !matrix)
+ return InvalidParameter;
+
+ if(!(calls++))
+ FIXME("not implemented\n");
+
+ return NotImplemented;
+}
+
+GpStatus WINGDIPAPI GdipTranslatePenTransform(GpPen *pen, REAL dx, REAL dy, GpMatrixOrder
order)
+{
+ static int calls;
+
+ TRACE("(%p,%0.2f,%0.2f,%u)\n", pen, dx, dy, order);
+
+ if(!pen)
+ return InvalidParameter;
+
+ if(!(calls++))
+ FIXME("not implemented\n");
+
+ return NotImplemented;
+}
+
GpStatus WINGDIPAPI GdipScalePenTransform(GpPen *pen, REAL sx, REAL sy, GpMatrixOrder
order)
{
static int calls;
@@ -415,6 +460,21 @@
if(!(calls++))
FIXME("(%p, %.2f, %.2f, %d) stub\n", pen, sx, sy, order);
+
+ return NotImplemented;
+}
+
+GpStatus WINGDIPAPI GdipRotatePenTransform(GpPen *pen, REAL angle, GpMatrixOrder order)
+{
+ static int calls;
+
+ TRACE("(%p,%0.2f,%u)\n", pen, angle, order);
+
+ if(!pen)
+ return InvalidParameter;
+
+ if(!(calls++))
+ FIXME("not implemented\n");
return NotImplemented;
}
Modified: trunk/reactos/dll/win32/gdiplus/region.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/region.c…
==============================================================================
--- trunk/reactos/dll/win32/gdiplus/region.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdiplus/region.c [iso-8859-1] Sat Nov 20 11:24:17 2010
@@ -884,6 +884,7 @@
static GpStatus get_path_hrgn(GpPath *path, GpGraphics *graphics, HRGN *hrgn)
{
HDC new_hdc=NULL;
+ GpGraphics *new_graphics=NULL;
GpStatus stat;
INT save_state;
@@ -893,13 +894,20 @@
if (!new_hdc)
return OutOfMemory;
- stat = GdipCreateFromHDC(new_hdc, &graphics);
+ stat = GdipCreateFromHDC(new_hdc, &new_graphics);
+ graphics = new_graphics;
if (stat != Ok)
{
ReleaseDC(0, new_hdc);
return stat;
}
}
+ else if (!graphics->hdc)
+ {
+ graphics->hdc = new_hdc = GetDC(0);
+ if (!new_hdc)
+ return OutOfMemory;
+ }
save_state = SaveDC(graphics->hdc);
EndPath(graphics->hdc);
@@ -918,7 +926,10 @@
if (new_hdc)
{
ReleaseDC(0, new_hdc);
- GdipDeleteGraphics(graphics);
+ if (new_graphics)
+ GdipDeleteGraphics(new_graphics);
+ else
+ graphics->hdc = NULL;
}
return stat;
@@ -1248,11 +1259,66 @@
return stat;
}
+/* Transforms GpRegion elements with given matrix */
+static GpStatus transform_region_element(region_element* element, GpMatrix *matrix)
+{
+ GpStatus stat;
+
+ switch(element->type)
+ {
+ case RegionDataEmptyRect:
+ case RegionDataInfiniteRect:
+ return Ok;
+ case RegionDataRect:
+ {
+ /* We can't transform a rectangle, so convert it to a path. */
+ GpRegion *new_region;
+ GpPath *path;
+
+ stat = GdipCreatePath(FillModeAlternate, &path);
+ if (stat == Ok)
+ {
+ stat = GdipAddPathRectangle(path,
+ element->elementdata.rect.X, element->elementdata.rect.Y,
+ element->elementdata.rect.Width,
element->elementdata.rect.Height);
+
+ if (stat == Ok)
+ stat = GdipCreateRegionPath(path, &new_region);
+
+ GdipDeletePath(path);
+ }
+
+ if (stat == Ok)
+ {
+ /* Steal the element from the created region. */
+ memcpy(element, &new_region->node, sizeof(region_element));
+ HeapFree(GetProcessHeap(), 0, new_region);
+ }
+ else
+ return stat;
+ }
+ /* Fall-through to do the actual conversion. */
+ case RegionDataPath:
+ stat = GdipTransformMatrixPoints(matrix,
+ element->elementdata.pathdata.path->pathdata.Points,
+ element->elementdata.pathdata.path->pathdata.Count);
+ return stat;
+ default:
+ stat = transform_region_element(element->elementdata.combine.left,
matrix);
+ if (stat == Ok)
+ stat = transform_region_element(element->elementdata.combine.right,
matrix);
+ return stat;
+ }
+}
+
GpStatus WINGDIPAPI GdipTransformRegion(GpRegion *region, GpMatrix *matrix)
{
- FIXME("(%p, %p): stub\n", region, matrix);
-
- return NotImplemented;
+ TRACE("(%p, %p)\n", region, matrix);
+
+ if (!region || !matrix)
+ return InvalidParameter;
+
+ return transform_region_element(®ion->node, matrix);
}
/* Translates GpRegion elements with specified offsets */
@@ -1307,14 +1373,150 @@
return GdipTranslateRegion(region, (REAL)dx, (REAL)dy);
}
+static GpStatus get_region_scans_data(GpRegion *region, GpMatrix *matrix, LPRGNDATA
*data)
+{
+ GpRegion *region_copy;
+ GpStatus stat;
+ HRGN hrgn;
+ DWORD data_size;
+
+ stat = GdipCloneRegion(region, ®ion_copy);
+
+ if (stat == Ok)
+ {
+ stat = GdipTransformRegion(region_copy, matrix);
+
+ if (stat == Ok)
+ stat = GdipGetRegionHRgn(region_copy, NULL, &hrgn);
+
+ if (stat == Ok)
+ {
+ if (hrgn)
+ {
+ data_size = GetRegionData(hrgn, 0, NULL);
+
+ *data = GdipAlloc(data_size);
+
+ if (*data)
+ GetRegionData(hrgn, data_size, *data);
+ else
+ stat = OutOfMemory;
+
+ DeleteObject(hrgn);
+ }
+ else
+ {
+ data_size = sizeof(RGNDATAHEADER) + sizeof(RECT);
+
+ *data = GdipAlloc(data_size);
+
+ if (*data)
+ {
+ (*data)->rdh.dwSize = sizeof(RGNDATAHEADER);
+ (*data)->rdh.iType = RDH_RECTANGLES;
+ (*data)->rdh.nCount = 1;
+ (*data)->rdh.nRgnSize = sizeof(RECT);
+ (*data)->rdh.rcBound.left = (*data)->rdh.rcBound.top =
-0x400000;
+ (*data)->rdh.rcBound.right = (*data)->rdh.rcBound.bottom =
0x400000;
+
+ memcpy(&(*data)->Buffer, &(*data)->rdh.rcBound,
sizeof(RECT));
+ }
+ else
+ stat = OutOfMemory;
+ }
+ }
+
+ GdipDeleteRegion(region_copy);
+ }
+
+ return stat;
+}
+
GpStatus WINGDIPAPI GdipGetRegionScansCount(GpRegion *region, UINT *count, GpMatrix
*matrix)
{
- static int calls;
+ GpStatus stat;
+ LPRGNDATA data;
TRACE("(%p, %p, %p)\n", region, count, matrix);
- if (!(calls++))
- FIXME("not implemented\n");
-
- return NotImplemented;
-}
+ if (!region || !count || !matrix)
+ return InvalidParameter;
+
+ stat = get_region_scans_data(region, matrix, &data);
+
+ if (stat == Ok)
+ {
+ *count = data->rdh.nCount;
+ GdipFree(data);
+ }
+
+ return stat;
+}
+
+GpStatus WINGDIPAPI GdipGetRegionScansI(GpRegion *region, GpRect *scans, INT *count,
GpMatrix *matrix)
+{
+ GpStatus stat;
+ INT i;
+ LPRGNDATA data;
+ RECT *rects;
+
+ if (!region || !count || !matrix)
+ return InvalidParameter;
+
+ stat = get_region_scans_data(region, matrix, &data);
+
+ if (stat == Ok)
+ {
+ *count = data->rdh.nCount;
+ rects = (RECT*)&data->Buffer;
+
+ if (scans)
+ {
+ for (i=0; i<data->rdh.nCount; i++)
+ {
+ scans[i].X = rects[i].left;
+ scans[i].Y = rects[i].top;
+ scans[i].Width = rects[i].right - rects[i].left;
+ scans[i].Height = rects[i].bottom - rects[i].top;
+ }
+ }
+
+ GdipFree(data);
+ }
+
+ return Ok;
+}
+
+GpStatus WINGDIPAPI GdipGetRegionScans(GpRegion *region, GpRectF *scans, INT *count,
GpMatrix *matrix)
+{
+ GpStatus stat;
+ INT i;
+ LPRGNDATA data;
+ RECT *rects;
+
+ if (!region || !count || !matrix)
+ return InvalidParameter;
+
+ stat = get_region_scans_data(region, matrix, &data);
+
+ if (stat == Ok)
+ {
+ *count = data->rdh.nCount;
+ rects = (RECT*)&data->Buffer;
+
+ if (scans)
+ {
+ for (i=0; i<data->rdh.nCount; i++)
+ {
+ scans[i].X = rects[i].left;
+ scans[i].Y = rects[i].top;
+ scans[i].Width = rects[i].right - rects[i].left;
+ scans[i].Height = rects[i].bottom - rects[i].top;
+ }
+ }
+
+ GdipFree(data);
+ }
+
+ return Ok;
+}
Propchange: trunk/reactos/dll/win32/wer/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Sat Nov 20 11:24:17 2010
@@ -1,0 +1,2 @@
+([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))?
+(\d+)
Propchange: trunk/reactos/dll/win32/wer/
------------------------------------------------------------------------------
bugtraq:message = See issue #%BUGID% for more details.
Propchange: trunk/reactos/dll/win32/wer/
------------------------------------------------------------------------------
bugtraq:url =
http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: trunk/reactos/dll/win32/wer/
------------------------------------------------------------------------------
tsvn:logminsize = 10
Added: trunk/reactos/dll/win32/wer/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wer/main.c?rev=4…
==============================================================================
--- trunk/reactos/dll/win32/wer/main.c (added)
+++ trunk/reactos/dll/win32/wer/main.c [iso-8859-1] Sat Nov 20 11:24:17 2010
@@ -1,0 +1,321 @@
+/*
+ * Copyright 2010 Louis Lenders
+ * Copyright 2010 Detlef Riekenberg
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "config.h"
+
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "winreg.h"
+#include "werapi.h"
+#include "wine/list.h"
+#include "wine/unicode.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(wer);
+
+typedef struct {
+ struct list entry;
+ WER_REPORT_INFORMATION info;
+ WER_REPORT_TYPE reporttype;
+ WCHAR eventtype[1];
+} report_t;
+
+
+static CRITICAL_SECTION report_table_cs;
+static CRITICAL_SECTION_DEBUG report_table_cs_debug =
+{
+ 0, 0, &report_table_cs,
+ { &report_table_cs_debug.ProcessLocksList,
&report_table_cs_debug.ProcessLocksList },
+ 0, 0, { (DWORD_PTR)(__FILE__ ": report_table_cs") }
+};
+static CRITICAL_SECTION report_table_cs = { &report_table_cs_debug, -1, 0, 0, 0, 0
};
+
+static struct list report_table = LIST_INIT(report_table);
+
+static WCHAR regpath_exclude[] =
{'S','o','f','t','w','a','r','e','\\',
+
'M','i','c','r','o','s','o','f','t','\\',
+
'W','i','n','d','o','w','s','
','E','r','r','o','r','
','R','e','p','o','r','t','i','n','g','\\',
+
'E','x','c','l','u','d','e','d','A','p','p','l','i','c','a','t','i','o','n','s',0};
+
+/***********************************************************************
+ * Memory alloccation helper
+ */
+
+static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
+{
+ return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
+}
+
+static inline BOOL heap_free(void *mem)
+{
+ return HeapFree(GetProcessHeap(), 0, mem);
+}
+
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+{
+ TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
+
+ switch (fdwReason)
+ {
+ case DLL_WINE_PREATTACH:
+ return FALSE; /* prefer native version */
+ case DLL_PROCESS_ATTACH:
+ DisableThreadLibraryCalls(hinstDLL);
+ break;
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+
+ return TRUE;
+}
+
+/***********************************************************************
+ * WerAddExcludedApplication (wer.@)
+ *
+ * Add an application to the user specific or the system wide exclusion list
+ *
+ * PARAMS
+ * exeName [i] The application name
+ * allUsers [i] for all users (TRUE) or for the current user (FALSE)
+ *
+ * RETURNS
+ * Success: S_OK
+ * Faulure: A HRESULT error code
+ *
+ */
+HRESULT WINAPI WerAddExcludedApplication(PCWSTR exeName, BOOL allUsers)
+{
+ HKEY hkey;
+ DWORD value = 1;
+ LPWSTR bs;
+
+ TRACE("(%s, %d)\n",debugstr_w(exeName), allUsers);
+ if (!exeName || !exeName[0])
+ return E_INVALIDARG;
+
+ bs = strrchrW(exeName, '\\');
+ if (bs) {
+ bs++; /* skip the backslash */
+ if (!bs[0]) {
+ return E_INVALIDARG;
+ }
+ } else
+ bs = (LPWSTR) exeName;
+
+ if (!RegCreateKeyW(allUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER,
regpath_exclude, &hkey)) {
+ RegSetValueExW(hkey, bs, 0, REG_DWORD, (LPBYTE)&value, sizeof(DWORD));
+ RegCloseKey(hkey);
+ return S_OK;
+ }
+ return E_ACCESSDENIED;
+}
+
+/***********************************************************************
+ * WerRemoveExcludedApplication (wer.@)
+ *
+ * remove an application from the exclusion list
+ *
+ * PARAMS
+ * exeName [i] The application name
+ * allUsers [i] for all users (TRUE) or for the current user (FALSE)
+ *
+ * RETURNS
+ * Success: S_OK
+ * Faulure: A HRESULT error code
+ *
+ */
+HRESULT WINAPI WerRemoveExcludedApplication(PCWSTR exeName, BOOL allUsers)
+{
+ HKEY hkey;
+ LPWSTR bs;
+ LONG lres;
+
+ TRACE("(%s, %d)\n",debugstr_w(exeName), allUsers);
+ if (!exeName || !exeName[0])
+ return E_INVALIDARG;
+
+ bs = strrchrW(exeName, '\\');
+ if (bs) {
+ bs++; /* skip the backslash */
+ if (!bs[0]) {
+ return E_INVALIDARG;
+ }
+ } else
+ bs = (LPWSTR) exeName;
+
+ if (!RegCreateKeyW(allUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER,
regpath_exclude, &hkey)) {
+ lres = RegDeleteValueW(hkey, bs);
+ RegCloseKey(hkey);
+ return lres ? __HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND) : S_OK;
+ }
+ return E_ACCESSDENIED;
+}
+
+/***********************************************************************
+ * WerReportCloseHandle (wer.@)
+ *
+ * Close an error reporting handle and free associated resources
+ *
+ * PARAMS
+ * hreport [i] error reporting handle to close
+ *
+ * RETURNS
+ * Success: S_OK
+ * Failure: A HRESULT error code
+ *
+ */
+HRESULT WINAPI WerReportCloseHandle(HREPORT hreport)
+{
+ report_t * report = (report_t *) hreport;
+ report_t * cursor;
+ BOOL found = FALSE;
+
+ TRACE("(%p)\n", hreport);
+ EnterCriticalSection(&report_table_cs);
+ if (report) {
+ LIST_FOR_EACH_ENTRY(cursor, &report_table, report_t, entry)
+ {
+ if (cursor == report) {
+ found = TRUE;
+ list_remove(&report->entry);
+ break;
+ }
+ }
+ }
+ LeaveCriticalSection(&report_table_cs);
+ if (!found)
+ return E_INVALIDARG;
+
+ heap_free(report);
+
+ return S_OK;
+}
+
+/***********************************************************************
+ * WerReportCreate (wer.@)
+ *
+ * Create an error report in memory and return a related HANDLE
+ *
+ * PARAMS
+ * eventtype [i] a name for the event type
+ * reporttype [i] what type of report should be created
+ * reportinfo [i] NULL or a ptr to a struct with some detailed information
+ * phandle [o] ptr, where the resulting handle should be saved
+ *
+ * RETURNS
+ * Success: S_OK
+ * Failure: A HRESULT error code
+ *
+ * NOTES
+ * The event type must be registered at microsoft. Predefined types are
+ * "APPCRASH" as the default on Windows, "Crash32" and
"Crash64"
+ *
+ */
+HRESULT WINAPI WerReportCreate(PCWSTR eventtype, WER_REPORT_TYPE reporttype,
PWER_REPORT_INFORMATION reportinfo, HREPORT *phandle)
+{
+ report_t *report;
+ DWORD len;
+
+ TRACE("(%s, %d, %p, %p)\n", debugstr_w(eventtype), reporttype, reportinfo,
phandle);
+ if (reportinfo) {
+ TRACE(".wzFriendlyEventName: %s\n",
debugstr_w(reportinfo->wzFriendlyEventName));
+ TRACE(".wzApplicationName: %s\n",
debugstr_w(reportinfo->wzApplicationName));
+ }
+
+ if (phandle) *phandle = NULL;
+ if (!eventtype || !eventtype[0] || !phandle) {
+ return E_INVALIDARG;
+ }
+
+ len = lstrlenW(eventtype) + 1;
+
+ report = heap_alloc_zero(len * sizeof(WCHAR) + sizeof(report_t));
+ if (!report)
+ return __HRESULT_FROM_WIN32(ERROR_OUTOFMEMORY);
+
+ lstrcpyW(report->eventtype, eventtype);
+ report->reporttype = reporttype;
+
+ if (reportinfo) {
+ report->info = *reportinfo;
+ } else {
+ FIXME("build report information from scratch for %p\n", report);
+ }
+
+ EnterCriticalSection(&report_table_cs);
+ list_add_head(&report_table, &report->entry);
+ LeaveCriticalSection(&report_table_cs);
+
+ *phandle = report;
+ TRACE("=> %p\n", report);
+ return S_OK;
+}
+
+/***********************************************************************
+ * WerReportSetParameter (wer.@)
+ *
+ * Set one of 10 parameter / value pairs for a report handle
+ *
+ * PARAMS
+ * hreport [i] error reporting handle to add the parameter
+ * id [i] parameter to set (WER_P0 upto WER_P9)
+ * name [i] optional name of the parameter
+ * value [i] value of the parameter
+ *
+ * RETURNS
+ * Success: S_OK
+ * Failure: A HRESULT error code
+ *
+ */
+HRESULT WINAPI WerReportSetParameter(HREPORT hreport, DWORD id, PCWSTR name, PCWSTR
value)
+{
+ FIXME("(%p, %d, %s, %s) :stub\n", hreport, id, debugstr_w(name),
debugstr_w(value));
+
+ return E_NOTIMPL;
+}
+
+/***********************************************************************
+ * WerReportSubmit (wer.@)
+ *
+ * Ask the user for permission and send the error report
+ * then kill or restart the application, when requested
+ *
+ * PARAMS
+ * hreport [i] error reporting handle to send
+ * consent [i] current transmit permission
+ * flags [i] flag to select dialog, transmission snd restart options
+ * presult [o] ptr, where the transmission result should be saved
+ *
+ * RETURNS
+ * Success: S_OK
+ * Failure: A HRESULT error code
+ *
+ */
+HRESULT WINAPI WerReportSubmit(HREPORT hreport, WER_CONSENT consent, DWORD flags,
PWER_SUBMIT_RESULT presult)
+{
+ FIXME("(%p, %d, 0x%x, %p) :stub\n", hreport, consent, flags, presult);
+
+ if(!presult)
+ return E_INVALIDARG;
+
+ *presult = WerDisabled;
+ return E_NOTIMPL;
+}
Propchange: trunk/reactos/dll/win32/wer/main.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/win32/wer/wer.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wer/wer.rbuild?r…
==============================================================================
--- trunk/reactos/dll/win32/wer/wer.rbuild (added)
+++ trunk/reactos/dll/win32/wer/wer.rbuild [iso-8859-1] Sat Nov 20 11:24:17 2010
@@ -1,0 +1,11 @@
+<?xml version="1.0"?>
+<!DOCTYPE group SYSTEM "../../../tools/rbuild/project.dtd">
+<module name="wer" type="win32dll"
installbase="system32" installname="wer.dll"
unicode="yes">
+ <importlibrary definition="wer.spec" />
+ <include base="wer">.</include>
+ <include base="ReactOS">include/reactos/wine</include>
+ <define name="__WINESRC__" />
+ <library>advapi32</library>
+ <library>wine</library>
+ <file>main.c</file>
+</module>
Propchange: trunk/reactos/dll/win32/wer/wer.rbuild
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/win32/wer/wer.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wer/wer.spec?rev…
==============================================================================
--- trunk/reactos/dll/win32/wer/wer.spec (added)
+++ trunk/reactos/dll/win32/wer/wer.spec [iso-8859-1] Sat Nov 20 11:24:17 2010
@@ -1,0 +1,77 @@
+@ stub WerSysprepCleanup
+@ stub WerSysprepGeneralize
+@ stub WerSysprepSpecialize
+@ stub WerUnattendedSetup
+@ stub WerpAddAppCompatData
+@ stub WerpAddFile
+@ stub WerpAddMemoryBlock
+@ stub WerpAddRegisteredDataToReport
+@ stub WerpAddSecondaryParameter
+@ stub WerpAddTextToReport
+@ stub WerpArchiveReport
+@ stub WerpCancelResponseDownload
+@ stub WerpCancelUpload
+@ stub WerpCloseStore
+@ stub WerpCreateMachineStore
+@ stub WerpDeleteReport
+@ stub WerpDestroyWerString
+@ stub WerpDownloadResponse
+@ stub WerpDownloadResponseTemplate
+@ stub WerpEnumerateStoreNext
+@ stub WerpEnumerateStoreStart
+@ stub WerpExtractReportFiles
+@ stub WerpGetBucketId
+@ stub WerpGetDynamicParameter
+@ stub WerpGetEventType
+@ stub WerpGetFileByIndex
+@ stub WerpGetFilePathByIndex
+@ stub WerpGetNumFiles
+@ stub WerpGetNumSecParams
+@ stub WerpGetNumSigParams
+@ stub WerpGetReportFinalConsent
+@ stub WerpGetReportFlags
+@ stub WerpGetReportInformation
+@ stub WerpGetReportTime
+@ stub WerpGetReportType
+@ stub WerpGetResponseId
+@ stub WerpGetResponseUrl
+@ stub WerpGetSecParamByIndex
+@ stub WerpGetSigParamByIndex
+@ stub WerpGetStoreLocation
+@ stub WerpGetStoreType
+@ stub WerpGetTextFromReport
+@ stub WerpGetUIParamByIndex
+@ stub WerpGetUploadTime
+@ stub WerpGetWerStringData
+@ stub WerpIsTransportAvailable
+@ stub WerpLoadReport
+@ stub WerpOpenMachineArchive
+@ stub WerpOpenMachineQueue
+@ stub WerpOpenUserArchive
+@ stub WerpReportCancel
+@ stub WerpRestartApplication
+@ stub WerpSetDynamicParameter
+@ stub WerpSetEventName
+@ stub WerpSetReportFlags
+@ stub WerpSetReportInformation
+@ stub WerpSetReportTime
+@ stub WerpSetReportUploadContextToken
+@ stub WerpShowNXNotification
+@ stub WerpShowSecondLevelConsent
+@ stub WerpShowUpsellUI
+@ stub WerpSubmitReportFromStore
+@ stub WerpSvcReportFromMachineQueue
+@ stdcall WerAddExcludedApplication(wstr long)
+@ stdcall WerRemoveExcludedApplication(wstr long)
+@ stub WerReportAddDump
+@ stub WerReportAddFile
+@ stdcall WerReportCloseHandle(ptr)
+@ stdcall WerReportCreate(wstr long ptr ptr)
+@ stdcall WerReportSetParameter(ptr long wstr wstr)
+@ stub WerReportSetUIOption
+@ stdcall WerReportSubmit(ptr long long ptr)
+@ stub WerpGetReportConsent
+@ stub WerpIsDisabled
+@ stub WerpOpenUserQueue
+@ stub WerpPromtUser
+@ stub WerpSetCallBack
Propchange: trunk/reactos/dll/win32/wer/wer.spec
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/dll/win32/win32.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/win32.rbuild?rev…
==============================================================================
--- trunk/reactos/dll/win32/win32.rbuild [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/win32.rbuild [iso-8859-1] Sat Nov 20 11:24:17 2010
@@ -595,6 +595,9 @@
<directory name="wdmaud.drv">
<xi:include href="wdmaud.drv/wdmaud.rbuild" />
</directory>
+<directory name="wer">
+ <xi:include href="wer/wer.rbuild" />
+</directory>
<directory name="windowscodecs">
<xi:include href="windowscodecs/windowscodecs.rbuild" />
</directory>
Added: trunk/reactos/include/psdk/werapi.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/werapi.h?rev=…
==============================================================================
--- trunk/reactos/include/psdk/werapi.h (added)
+++ trunk/reactos/include/psdk/werapi.h [iso-8859-1] Sat Nov 20 11:24:17 2010
@@ -1,0 +1,127 @@
+/*
+ * Windows Error Reporing definitions
+ *
+ * Copyright (C) 2010 Louis Lenders
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef __WINE_WERAPI_H
+#define __WINE_WERAPI_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Only 10 parameter are allowed in WerReportSetParameter */
+#define WER_MAX_PARAM_COUNT 10
+#define WER_P0 0
+#define WER_P1 1
+#define WER_P2 2
+#define WER_P3 3
+#define WER_P4 4
+#define WER_P5 5
+#define WER_P6 6
+#define WER_P7 7
+#define WER_P8 8
+#define WER_P9 9
+
+/* Flags for WerReportSubmit */
+#define WER_SUBMIT_HONOR_RECOVERY 0x0001
+#define WER_SUBMIT_HONOR_RESTART 0x0002
+#define WER_SUBMIT_QUEUE 0x0004
+#define WER_SUBMIT_SHOW_DEBUG 0x0008
+#define WER_SUBMIT_ADD_REGISTERED_DATA 0x0010
+#define WER_SUBMIT_OUTOFPROCESS 0x0020
+#define WER_SUBMIT_NO_CLOSE_UI 0x0040
+#define WER_SUBMIT_NO_QUEUE 0x0080
+#define WER_SUBMIT_NO_ARCHIVE 0x0100
+#define WER_SUBMIT_START_MINIMIZED 0x0200
+#define WER_SUBMIT_OUTOFPROCESS_ASYNC 0x0400
+#define WER_SUBMIT_BYPASS_DATA_THROTTLING 0x0800
+#define WER_SUBMIT_ARCHIVE_PARAMETERS_ONLY 0x1000
+#define WER_SUBMIT_REPORT_MACHINE_ID 0x2000
+
+/* #### */
+
+typedef HANDLE HREPORT;
+
+typedef enum _WER_CONSENT
+{
+ WerConsentNotAsked = 1,
+ WerConsentApproved,
+ WerConsentDenied,
+ WerConsentAlwaysPrompt,
+ WerConsentMax
+} WER_CONSENT;
+
+typedef enum _WER_REGISTER_FILE_TYPE
+{
+ WerRegFileTypeUserDocument = 1,
+ WerRegFileTypeOther = 2,
+ WerRegFileTypeMax
+} WER_REGISTER_FILE_TYPE;
+
+typedef struct _WER_REPORT_INFORMATION
+{
+ DWORD dwSize;
+ HANDLE hProcess;
+ WCHAR wzConsentKey[64];
+ WCHAR wzFriendlyEventName[128];
+ WCHAR wzApplicationName[128];
+ WCHAR wzApplicationPath[MAX_PATH];
+ WCHAR wzDescription[512];
+ HWND hwndParent;
+} WER_REPORT_INFORMATION, *PWER_REPORT_INFORMATION;
+
+
+typedef enum _WER_REPORT_TYPE
+{
+ WerReportNonCritical = 0,
+ WerReportCritical,
+ WerReportApplicationCrash,
+ WerReportApplicationHang,
+ WerReportKernel,
+ WerReportInvalid
+} WER_REPORT_TYPE;
+
+typedef enum _WER_SUBMIT_RESULT
+{
+ WerReportQueued = 1,
+ WerReportUploaded,
+ WerReportDebug,
+ WerReportFailed,
+ WerDisabled,
+ WerReportCancelled,
+ WerDisabledQueue,
+ WerReportAsync,
+ WerCustomAction
+} WER_SUBMIT_RESULT, *PWER_SUBMIT_RESULT;
+
+/* #### */
+
+HRESULT WINAPI WerAddExcludedApplication(PCWSTR, BOOL);
+HRESULT WINAPI WerRegisterFile(PCWSTR file, WER_REGISTER_FILE_TYPE regfiletype, DWORD
flags);
+HRESULT WINAPI WerRemoveExcludedApplication(PCWSTR, BOOL);
+HRESULT WINAPI WerReportCloseHandle(HREPORT);
+HRESULT WINAPI WerReportCreate(PCWSTR, WER_REPORT_TYPE, PWER_REPORT_INFORMATION,
HREPORT*);
+HRESULT WINAPI WerReportSetParameter(HREPORT, DWORD, PCWSTR, PCWSTR);
+HRESULT WINAPI WerReportSubmit(HREPORT, WER_CONSENT, DWORD, PWER_SUBMIT_RESULT);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __WINE_WERAPI_H */
Propchange: trunk/reactos/include/psdk/werapi.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/media/doc/README.WINE
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sat Nov 20 11:24:17 2010
@@ -167,6 +167,7 @@
reactos/dll/win32/usp10 # Autosync
reactos/dll/win32/uxtheme # Autosync
reactos/dll/win32/version # Autosync
+reactos/dll/win32/wer # Autosync
reactos/dll/win32/windowscodecs # Autosync
reactos/dll/win32/winemp3.acm # Autosync
reactos/dll/win32/wininet # Autosync