diff --git a/dlls/gdiplus/Makefile.in b/dlls/gdiplus/Makefile.in index d651c4cd683..ddf3d9938ef 100644 --- a/dlls/gdiplus/Makefile.in +++ b/dlls/gdiplus/Makefile.in @@ -4,7 +4,7 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = gdiplus.dll IMPORTLIB = libgdiplus.$(IMPLIBEXT) -IMPORTS = oleaut32 ole32 user32 gdi32 advapi32 kernel32 ntdll +IMPORTS = shlwapi oleaut32 ole32 user32 gdi32 advapi32 kernel32 ntdll EXTRALIBS = -luuid C_SRCS = \ diff --git a/dlls/gdiplus/gdiplus.c b/dlls/gdiplus/gdiplus.c index 378783688bd..998cec85ea3 100644 --- a/dlls/gdiplus/gdiplus.c +++ b/dlls/gdiplus/gdiplus.c @@ -27,6 +27,9 @@ #include "objbase.h" +#include "winreg.h" +#include "shlwapi.h" + #include "gdiplus.h" #include "gdiplus_private.h" @@ -246,3 +249,17 @@ REAL gdiplus_atan2(REAL dy, REAL dx) return atan2(dy, dx); } + +GpStatus hresult_to_status(HRESULT res) +{ + switch(res){ + case S_OK: + return Ok; + case E_OUTOFMEMORY: + return OutOfMemory; + case E_INVALIDARG: + return InvalidParameter; + default: + return GenericError; + } +} diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index 7e533227a02..218990d8cb2 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -129,7 +129,7 @@ @ stub GdipCreateRegionRectI @ stub GdipCreateRegionRgnData @ stdcall GdipCreateSolidFill(long ptr) -@ stub GdipCreateStreamOnFile +@ stdcall GdipCreateStreamOnFile(ptr long ptr) @ stub GdipCreateStringFormat @ stub GdipCreateTexture2 @ stub GdipCreateTexture2I diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index 79440a2e2a9..130703ddce3 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -41,6 +41,7 @@ COLORREF ARGB2COLORREF(ARGB color); extern INT arc2polybezier(GpPointF * points, REAL x1, REAL y1, REAL x2, REAL y2, REAL startAngle, REAL sweepAngle); extern REAL gdiplus_atan2(REAL dy, REAL dx); +extern GpStatus hresult_to_status(HRESULT res); static inline INT roundr(REAL x) { diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index c21e8916db5..978723472ec 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -30,6 +30,9 @@ #include "olectl.h" #include "ole2.h" +#include "winreg.h" +#include "shlwapi.h" + #include "gdiplus.h" #include "gdiplus_private.h" #include "wine/debug.h" @@ -873,6 +876,27 @@ end: return retval; } +GpStatus WINGDIPAPI GdipCreateStreamOnFile(GDIPCONST WCHAR * filename, + UINT access, IStream **stream) +{ + DWORD dwMode; + HRESULT ret; + + if(!stream || !filename) + return InvalidParameter; + + if(access & GENERIC_WRITE) + dwMode = STGM_SHARE_DENY_WRITE | STGM_WRITE | STGM_CREATE; + else if(access & GENERIC_READ) + dwMode = STGM_SHARE_DENY_WRITE | STGM_READ | STGM_FAILIFTHERE; + else + return InvalidParameter; + + ret = SHCreateStreamOnFileW(filename, dwMode, stream); + + return hresult_to_status(ret); +} + GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics) { if(!graphics) return InvalidParameter; diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index 3035f0d4ab5..17684191da8 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -52,6 +52,7 @@ GpStatus WINGDIPAPI GdipCreateFromHWND(HWND,GpGraphics**); GpStatus WINGDIPAPI GdipCreateMetafileFromEmf(HENHMETAFILE,BOOL,GpMetafile**); GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE,BOOL, GDIPCONST WmfPlaceableFileHeader*,GpMetafile**); +GpStatus WINGDIPAPI GdipCreateStreamOnFile(GDIPCONST WCHAR*,UINT,IStream**); GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *); GpStatus WINGDIPAPI GdipDrawArc(GpGraphics*,GpPen*,REAL,REAL,REAL,REAL,REAL,REAL); GpStatus WINGDIPAPI GdipDrawBezier(GpGraphics*,GpPen*,REAL,REAL,REAL,REAL,REAL,