winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
July 2008
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
3 participants
1114 discussions
Start a n
N
ew thread
Piotr Caban : msxml3/tests: Added more tests to ISAXXMLReader_putContentHandler and ISAXXMLReader_getContentHandler , added todo test for ISAXXMLReader_parse.
by Alexandre Julliard
10 Jul '08
10 Jul '08
Module: wine Branch: master Commit: 088f3eef9c34e481131d2881ff307ece61aeceec URL:
http://source.winehq.org/git/wine.git/?a=commit;h=088f3eef9c34e481131d2881f…
Author: Piotr Caban <piotr.caban(a)gmail.com> Date: Thu Jul 10 15:22:14 2008 +0200 msxml3/tests: Added more tests to ISAXXMLReader_putContentHandler and ISAXXMLReader_getContentHandler, added todo test for ISAXXMLReader_parse. --- dlls/msxml3/tests/saxreader.c | 55 +++++++++++++++++++++++++++++++--------- 1 files changed, 42 insertions(+), 13 deletions(-) diff --git a/dlls/msxml3/tests/saxreader.c b/dlls/msxml3/tests/saxreader.c index 64ad625..22d071a 100644 --- a/dlls/msxml3/tests/saxreader.c +++ b/dlls/msxml3/tests/saxreader.c @@ -29,6 +29,14 @@ #include "wine/test.h" +static const WCHAR szSimpleXML[] = { +'<','?','x','m','l',' ','v','e','r','s','i','o','n','=','\"','1','.','0','\"',' ','?','>','\n', +'<','B','a','n','k','A','c','c','o','u','n','t','>','\n', +' ',' ',' ','<','N','u','m','b','e','r','>','1','2','3','4','<','/','N','u','m','b','e','r','>','\n', +' ',' ',' ','<','N','a','m','e','>','C','a','p','t','a','i','n',' ','A','h','a','b','<','/','N','a','m','e','>','\n', +'<','/','B','a','n','k','A','c','c','o','u','n','t','>','\n','\0' +}; + typedef struct _contenthandler { const struct ISAXContentHandlerVtbl *lpContentHandlerVtbl; @@ -61,32 +69,32 @@ static HRESULT WINAPI contentHandler_QueryInterface( static ULONG WINAPI contentHandler_AddRef( ISAXContentHandler* iface) { - return 2; + return 2; } static ULONG WINAPI contentHandler_Release( ISAXContentHandler* iface) { - return 1; + return 1; } static HRESULT WINAPI contentHandler_putDocumentLocator( ISAXContentHandler* iface, ISAXLocator *pLocator) { - return S_OK; + return S_OK; } static HRESULT WINAPI contentHandler_startDocument( ISAXContentHandler* iface) { - return S_OK; + return S_OK; } static HRESULT WINAPI contentHandler_endDocument( ISAXContentHandler* iface) { - return S_OK; + return S_OK; } static HRESULT WINAPI contentHandler_startPrefixMapping( @@ -96,7 +104,7 @@ static HRESULT WINAPI contentHandler_startPrefixMapping( const WCHAR *pUri, int nUri) { - return S_OK; + return S_OK; } static HRESULT WINAPI contentHandler_endPrefixMapping( @@ -104,7 +112,7 @@ static HRESULT WINAPI contentHandler_endPrefixMapping( const WCHAR *pPrefix, int nPrefix) { - return S_OK; + return S_OK; } static HRESULT WINAPI contentHandler_startElement( @@ -117,7 +125,7 @@ static HRESULT WINAPI contentHandler_startElement( int nQName, ISAXAttributes *pAttr) { - return S_OK; + return S_OK; } static HRESULT WINAPI contentHandler_endElement( @@ -129,7 +137,7 @@ static HRESULT WINAPI contentHandler_endElement( const WCHAR *pQName, int nQName) { - return S_OK; + return S_OK; } static HRESULT WINAPI contentHandler_characters( @@ -137,7 +145,7 @@ static HRESULT WINAPI contentHandler_characters( const WCHAR *pChars, int nChars) { - return S_OK; + return S_OK; } static HRESULT WINAPI contentHandler_ignorableWhitespace( @@ -145,7 +153,7 @@ static HRESULT WINAPI contentHandler_ignorableWhitespace( const WCHAR *pChars, int nChars) { - return S_OK; + return S_OK; } static HRESULT WINAPI contentHandler_processingInstruction( @@ -155,7 +163,7 @@ static HRESULT WINAPI contentHandler_processingInstruction( const WCHAR *pData, int nData) { - return S_OK; + return S_OK; } static HRESULT WINAPI contentHandler_skippedEntity( @@ -163,7 +171,7 @@ static HRESULT WINAPI contentHandler_skippedEntity( const WCHAR *pName, int nName) { - return S_OK; + return S_OK; } @@ -192,6 +200,8 @@ static void test_saxreader(void) { HRESULT hr; ISAXXMLReader *reader = NULL; + VARIANT var; + ISAXContentHandler *lpContentHandler; hr = CoCreateInstance(&CLSID_SAXXMLReader, NULL, CLSCTX_INPROC_SERVER, &IID_ISAXXMLReader, (LPVOID*)&reader); @@ -202,9 +212,28 @@ static void test_saxreader(void) return; } + hr = ISAXXMLReader_getContentHandler(reader, &lpContentHandler); + ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); + ok(lpContentHandler == NULL, "Expected %p, got %p\n", NULL, lpContentHandler); + + hr = ISAXXMLReader_putContentHandler(reader, NULL); + ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); + hr = ISAXXMLReader_putContentHandler(reader, &contentHandler); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); + hr = ISAXXMLReader_getContentHandler(reader, &lpContentHandler); + ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); + ok(lpContentHandler == &contentHandler, "Expected %p, got %p\n", &contentHandler, lpContentHandler); + + V_VT(&var) = VT_BSTR; + V_BSTR(&var) = SysAllocString(szSimpleXML); + + hr = ISAXXMLReader_parse(reader, var); + todo_wine { + ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); + } + ISAXXMLReader_Release(reader); }
1
0
0
0
Huw Davies : gdiplus: Partial implementation of GdipCreateBitmapFromGdiDib.
by Alexandre Julliard
10 Jul '08
10 Jul '08
Module: wine Branch: master Commit: b2ebf709ffa859bc4515bf0c12ba4c347ce3a293 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b2ebf709ffa859bc4515bf0c1…
Author: Huw Davies <huw(a)codeweavers.com> Date: Thu Jul 10 15:39:29 2008 +0100 gdiplus: Partial implementation of GdipCreateBitmapFromGdiDib. --- dlls/gdiplus/gdiplus.spec | 2 +- dlls/gdiplus/image.c | 41 +++++++++++++++++++++++++++++++++++++++++ include/gdiplusflat.h | 1 + 3 files changed, 43 insertions(+), 1 deletions(-) diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index 318ec53..b1c784d 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -73,7 +73,7 @@ @ stub GdipCreateBitmapFromDirectDrawSurface @ stdcall GdipCreateBitmapFromFile(wstr ptr) @ stdcall GdipCreateBitmapFromFileICM(wstr ptr) -@ stub GdipCreateBitmapFromGdiDib +@ stdcall GdipCreateBitmapFromGdiDib(ptr ptr ptr) @ stdcall GdipCreateBitmapFromGraphics(long long ptr ptr) @ stdcall GdipCreateBitmapFromHBITMAP(long long ptr) @ stub GdipCreateBitmapFromHICON diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index 8fd452a..d2ce074 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -270,6 +270,47 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromFile(GDIPCONST WCHAR* filename, return stat; } +GpStatus WINGDIPAPI GdipCreateBitmapFromGdiDib(GDIPCONST BITMAPINFO* info, + VOID *bits, GpBitmap **bitmap) +{ + DWORD height, stride; + PixelFormat format; + + FIXME("(%p, %p, %p) - partially implemented\n", info, bits, bitmap); + + height = abs(info->bmiHeader.biHeight); + stride = ((info->bmiHeader.biWidth * info->bmiHeader.biBitCount + 31) >> 3) & ~3; + + if(info->bmiHeader.biHeight > 0) /* bottom-up */ + { + bits = (BYTE*)bits + (height - 1) * stride; + stride = -stride; + } + + switch(info->bmiHeader.biBitCount) { + case 1: + format = PixelFormat1bppIndexed; + break; + case 4: + format = PixelFormat4bppIndexed; + break; + case 8: + format = PixelFormat8bppIndexed; + break; + case 24: + format = PixelFormat24bppRGB; + break; + default: + FIXME("don't know how to handle %d bpp\n", info->bmiHeader.biBitCount); + *bitmap = NULL; + return InvalidParameter; + } + + return GdipCreateBitmapFromScan0(info->bmiHeader.biWidth, height, stride, format, + bits, bitmap); + +} + /* FIXME: no icm */ GpStatus WINGDIPAPI GdipCreateBitmapFromFileICM(GDIPCONST WCHAR* filename, GpBitmap **bitmap) diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index ad40a67..25b6f5f 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -332,6 +332,7 @@ GpStatus WINGDIPAPI GdipConvertToEmfPlusToFile(const GpGraphics*,GpMetafile*,INT GpStatus WINGDIPAPI GdipConvertToEmfPlusToStream(const GpGraphics*,GpMetafile*,INT*,IStream*,EmfType,const WCHAR*,GpMetafile**); GpStatus WINGDIPAPI GdipCreateBitmapFromFile(GDIPCONST WCHAR*,GpBitmap**); GpStatus WINGDIPAPI GdipCreateBitmapFromFileICM(GDIPCONST WCHAR*,GpBitmap**); +GpStatus WINGDIPAPI GdipCreateBitmapFromGdiDib(GDIPCONST BITMAPINFO*,VOID*,GpBitmap**); GpStatus WINGDIPAPI GdipCreateBitmapFromGraphics(INT,INT,GpGraphics*,GpBitmap**); GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT,INT,INT,PixelFormat,BYTE*, GpBitmap**);
1
0
0
0
Huw Davies : gdiplus: Stubs for GdipIsVisiblePathPoint[I].
by Alexandre Julliard
10 Jul '08
10 Jul '08
Module: wine Branch: master Commit: fc1a1f66ee92334c9eeb465512b7f6f6e5b38683 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=fc1a1f66ee92334c9eeb46551…
Author: Huw Davies <huw(a)codeweavers.com> Date: Thu Jul 10 15:34:09 2008 +0100 gdiplus: Stubs for GdipIsVisiblePathPoint[I]. --- dlls/gdiplus/gdiplus.spec | 6 +++--- dlls/gdiplus/graphicspath.c | 23 +++++++++++++++++++++++ include/gdiplusflat.h | 4 +++- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index f60d389..318ec53 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -421,12 +421,12 @@ @ stdcall GdipIsMatrixEqual(ptr ptr ptr) @ stdcall GdipIsMatrixIdentity(ptr ptr) @ stdcall GdipIsMatrixInvertible(ptr ptr) -@ stub GdipIsOutlineVisiblePathPoint +@ stdcall GdipIsOutlineVisiblePathPoint(ptr long long ptr ptr ptr) @ stdcall GdipIsOutlineVisiblePathPointI(ptr long long ptr ptr ptr) @ stub GdipIsStyleAvailable @ stub GdipIsVisibleClipEmpty -@ stub GdipIsVisiblePathPoint -@ stub GdipIsVisiblePathPointI +@ stdcall GdipIsVisiblePathPoint(ptr long long ptr ptr) +@ stdcall GdipIsVisiblePathPointI(ptr long long ptr ptr) @ stub GdipIsVisiblePoint @ stub GdipIsVisiblePointI @ stub GdipIsVisibleRect diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 1022fb4..75f89d4 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -730,6 +730,12 @@ GpStatus WINGDIPAPI GdipGetPointCount(GpPath *path, INT *count) GpStatus WINGDIPAPI GdipIsOutlineVisiblePathPointI(GpPath* path, INT x, INT y, GpPen *pen, GpGraphics *graphics, BOOL *result) { + return GdipIsOutlineVisiblePathPoint(path, x, y, pen, graphics, result); +} + +GpStatus WINGDIPAPI GdipIsOutlineVisiblePathPoint(GpPath* path, REAL x, REAL y, + GpPen *pen, GpGraphics *graphics, BOOL *result) +{ static int calls; if(!path || !pen) @@ -741,6 +747,23 @@ GpStatus WINGDIPAPI GdipIsOutlineVisiblePathPointI(GpPath* path, INT x, INT y, return NotImplemented; } +GpStatus WINGDIPAPI GdipIsVisiblePathPointI(GpPath* path, INT x, INT y, GpGraphics *graphics, BOOL *result) +{ + return GdipIsVisiblePathPoint(path, x, y, graphics, result); +} + +GpStatus WINGDIPAPI GdipIsVisiblePathPoint(GpPath* path, REAL x, REAL y, GpGraphics *graphics, BOOL *result) +{ + static int calls; + + if(!path) return InvalidParameter; + + if(!(calls++)) + FIXME("not implemented\n"); + + return NotImplemented; +} + GpStatus WINGDIPAPI GdipStartPathFigure(GpPath *path) { if(!path) diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index b93308b..ad40a67 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -266,10 +266,12 @@ GpStatus WINGDIPAPI GdipGetPathTypes(GpPath*,BYTE*,INT); GpStatus WINGDIPAPI GdipGetPathWorldBounds(GpPath*,GpRectF*,GDIPCONST GpMatrix*,GDIPCONST GpPen*); GpStatus WINGDIPAPI GdipGetPathWorldBoundsI(GpPath*,GpRect*,GDIPCONST GpMatrix*,GDIPCONST GpPen*); GpStatus WINGDIPAPI GdipGetPointCount(GpPath*,INT*); - GpStatus WINGDIPAPI GdipIsOutlineVisiblePathPoint(GpPath*,REAL,REAL,GpPen*, +GpStatus WINGDIPAPI GdipIsOutlineVisiblePathPoint(GpPath*,REAL,REAL,GpPen*, GpGraphics*,BOOL*); GpStatus WINGDIPAPI GdipIsOutlineVisiblePathPointI(GpPath*,INT,INT,GpPen*, GpGraphics*,BOOL*); +GpStatus WINGDIPAPI GdipIsVisiblePathPoint(GpPath*,REAL,REAL,GpGraphics*,BOOL*); +GpStatus WINGDIPAPI GdipIsVisiblePathPointI(GpPath*,INT,INT,GpGraphics*,BOOL*); GpStatus WINGDIPAPI GdipResetPath(GpPath*); GpStatus WINGDIPAPI GdipSetPathFillMode(GpPath*,GpFillMode); GpStatus WINGDIPAPI GdipStartPathFigure(GpPath*);
1
0
0
0
Huw Davies : gdiplus: Implement GdipCreateMetafileFromWmfFile.
by Alexandre Julliard
10 Jul '08
10 Jul '08
Module: wine Branch: master Commit: eb9d7f598033daff554ac79b4fce013eea5964f9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=eb9d7f598033daff554ac79b4…
Author: Huw Davies <huw(a)codeweavers.com> Date: Thu Jul 10 15:30:30 2008 +0100 gdiplus: Implement GdipCreateMetafileFromWmfFile. --- dlls/gdiplus/gdiplus.spec | 2 +- dlls/gdiplus/graphics.c | 12 ++++++++++++ include/gdiplusflat.h | 1 + 3 files changed, 14 insertions(+), 1 deletions(-) diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index 2553779..f60d389 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -112,7 +112,7 @@ @ stub GdipCreateMetafileFromFile @ stub GdipCreateMetafileFromStream @ stdcall GdipCreateMetafileFromWmf(ptr long ptr ptr) -@ stub GdipCreateMetafileFromWmfFile +@ stdcall GdipCreateMetafileFromWmfFile(wstr ptr ptr) @ stdcall GdipCreatePath2(ptr ptr long long ptr) @ stdcall GdipCreatePath2I(ptr ptr long long ptr) @ stdcall GdipCreatePath(long ptr) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 48917b3..c127dbb 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -881,6 +881,18 @@ err: return retval; } +GpStatus WINGDIPAPI GdipCreateMetafileFromWmfFile(GDIPCONST WCHAR *file, + GDIPCONST WmfPlaceableFileHeader * placeable, GpMetafile **metafile) +{ + HMETAFILE hmf = GetMetaFileW(file); + + TRACE("(%s, %p, %p)\n", debugstr_w(file), placeable, metafile); + + if(!hmf) return InvalidParameter; + + return GdipCreateMetafileFromWmf(hmf, TRUE, placeable, metafile); +} + GpStatus WINGDIPAPI GdipCreateStreamOnFile(GDIPCONST WCHAR * filename, UINT access, IStream **stream) { diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index 378057a..b93308b 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -77,6 +77,7 @@ GpStatus WINGDIPAPI GdipCreateLineBrushFromRectWithAngleI(GDIPCONST GpRect*, GpStatus WINGDIPAPI GdipCreateMetafileFromEmf(HENHMETAFILE,BOOL,GpMetafile**); GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE,BOOL, GDIPCONST WmfPlaceableFileHeader*,GpMetafile**); +GpStatus WINGDIPAPI GdipCreateMetafileFromWmfFile(GDIPCONST WCHAR*, 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);
1
0
0
0
Huw Davies : gdiplus: Add stubs for GdipTransformPoints[I].
by Alexandre Julliard
10 Jul '08
10 Jul '08
Module: wine Branch: master Commit: 3ab7666248f830eb0a26a181265c7dab54adba6e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3ab7666248f830eb0a26a1812…
Author: Huw Davies <huw(a)codeweavers.com> Date: Thu Jul 10 15:26:58 2008 +0100 gdiplus: Add stubs for GdipTransformPoints[I]. --- dlls/gdiplus/gdiplus.spec | 4 ++-- dlls/gdiplus/graphics.c | 16 ++++++++++++++++ include/gdiplusenums.h | 8 ++++++++ include/gdiplusflat.h | 4 ++++ include/gdiplusgpstubs.h | 1 + 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index df323aa..2553779 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -606,8 +606,8 @@ @ stdcall GdipTransformMatrixPoints(ptr ptr long) @ stdcall GdipTransformMatrixPointsI(ptr ptr long) @ stdcall GdipTransformPath(ptr ptr) -@ stub GdipTransformPoints -@ stub GdipTransformPointsI +@ stdcall GdipTransformPoints(ptr long long ptr long) +@ stdcall GdipTransformPointsI(ptr long long ptr long) @ stdcall GdipTransformRegion(ptr ptr) @ stub GdipTranslateClip @ stub GdipTranslateClipI diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 23919e2..48917b3 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -2621,3 +2621,19 @@ GpStatus WINGDIPAPI GdipGetClip(GpGraphics *graphics, GpRegion *region) return NotImplemented; } + +GpStatus WINGDIPAPI GdipTransformPoints(GpGraphics *graphics, GpCoordinateSpace dst_space, + GpCoordinateSpace src_space, GpPointF *points, INT count) +{ + FIXME("(%p, %d, %d, %p, %d): stub\n", graphics, dst_space, src_space, points, count); + + return NotImplemented; +} + +GpStatus WINGDIPAPI GdipTransformPointsI(GpGraphics *graphics, GpCoordinateSpace dst_space, + GpCoordinateSpace src_space, GpPoint *points, INT count) +{ + FIXME("(%p, %d, %d, %p, %d): stub\n", graphics, dst_space, src_space, points, count); + + return NotImplemented; +} diff --git a/include/gdiplusenums.h b/include/gdiplusenums.h index 8e1148d..53401bd 100644 --- a/include/gdiplusenums.h +++ b/include/gdiplusenums.h @@ -314,6 +314,13 @@ enum FlushIntention FlushIntentionSync = 1 }; +enum CoordinateSpace +{ + CoordinateSpaceWorld, + CoordinateSpacePage, + CoordinateSpaceDevice +}; + #ifndef __cplusplus typedef enum Unit Unit; @@ -347,6 +354,7 @@ typedef enum PenAlignment GpPenAlignment; typedef enum ImageCodecFlags ImageCodecFlags; typedef enum CombineMode CombineMode; typedef enum FlushIntention FlushIntention; +typedef enum CoordinateSpace CoordinateSpace; #endif /* end of c typedefs */ diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index 190e6f1..378057a 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -224,6 +224,10 @@ GpStatus WINGDIPAPI GdipSetPathGradientSurroundColorsWithCount(GpPathGradient*, GpStatus WINGDIPAPI GdipSetPathGradientWrapMode(GpPathGradient*,GpWrapMode); GpStatus WINGDIPAPI GdipSetSolidFillColor(GpSolidFill*,ARGB); GpStatus WINGDIPAPI GdipSetTextureTransform(GpTexture *,GDIPCONST GpMatrix*); +GpStatus WINGDIPAPI GdipTransformPoints(GpGraphics*, GpCoordinateSpace, GpCoordinateSpace, + GpPointF *, INT); +GpStatus WINGDIPAPI GdipTransformPointsI(GpGraphics*, GpCoordinateSpace, GpCoordinateSpace, + GpPoint *, INT); GpStatus WINGDIPAPI GdipAddPathArc(GpPath*,REAL,REAL,REAL,REAL,REAL,REAL); GpStatus WINGDIPAPI GdipAddPathArcI(GpPath*,INT,INT,INT,INT,REAL,REAL); diff --git a/include/gdiplusgpstubs.h b/include/gdiplusgpstubs.h index a1878f6..bb7c47f 100644 --- a/include/gdiplusgpstubs.h +++ b/include/gdiplusgpstubs.h @@ -85,5 +85,6 @@ typedef Point GpPoint; typedef WrapMode GpWrapMode; typedef Color GpColor; typedef FlushIntention GpFlushIntention; +typedef CoordinateSpace GpCoordinateSpace; #endif
1
0
0
0
Alexander Nicolaysen Sørnes : regedit: Add support for importing Unicode files.
by Alexandre Julliard
10 Jul '08
10 Jul '08
Module: wine Branch: master Commit: 6f2e3e1b1ecce90f98d6e84170a3185a28661d1d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6f2e3e1b1ecce90f98d6e8417…
Author: Alexander Nicolaysen Sørnes <alex(a)thehandofagony.com> Date: Wed Jul 9 23:39:08 2008 +0200 regedit: Add support for importing Unicode files. --- programs/regedit/framewnd.c | 12 +++- programs/regedit/regedit.c | 2 +- programs/regedit/regproc.c | 164 ++++++++++++++++++++++++++++++++++-------- programs/regedit/regproc.h | 3 +- 4 files changed, 145 insertions(+), 36 deletions(-) diff --git a/programs/regedit/framewnd.c b/programs/regedit/framewnd.c index fd20a62..4bf78af 100644 --- a/programs/regedit/framewnd.c +++ b/programs/regedit/framewnd.c @@ -311,6 +311,16 @@ static BOOL InitOpenFileName(HWND hWnd, OPENFILENAME *pofn) return TRUE; } +static BOOL import_registry_filename(LPTSTR filename) +{ + FILE* reg_file = fopen(filename, "r"); + + if(!reg_file) + return FALSE; + + return import_registry_file(reg_file); +} + static BOOL ImportRegistryFile(HWND hWnd) { OPENFILENAME ofn; @@ -320,7 +330,7 @@ static BOOL ImportRegistryFile(HWND hWnd) LoadString(hInst, IDS_FILEDIALOG_IMPORT_TITLE, title, COUNT_OF(title)); ofn.lpstrTitle = title; if (GetOpenFileName(&ofn)) { - if (!import_registry_file(ofn.lpstrFile)) { + if (!import_registry_filename(ofn.lpstrFile)) { /*printf("Can't open file \"%s\"\n", ofn.lpstrFile);*/ return FALSE; } diff --git a/programs/regedit/regedit.c b/programs/regedit/regedit.c index 8c473e6..8e7136b 100644 --- a/programs/regedit/regedit.c +++ b/programs/regedit/regedit.c @@ -167,7 +167,7 @@ static BOOL PerformRegAction(REGEDIT_ACTION action, LPSTR s) exit(1); } } - processRegLines(reg_file); + import_registry_file(reg_file); if (realname) { HeapFree(GetProcessHeap(),0,realname); diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c index a42ee5c..2f8b826 100644 --- a/programs/regedit/regproc.c +++ b/programs/regedit/regproc.c @@ -594,11 +594,10 @@ static void processRegEntry(WCHAR* stdInput) * Parameters: * in - input stream to read from */ -void processRegLines(FILE *in) +void processRegLinesA(FILE *in) { LPSTR line = NULL; /* line read from input stream */ ULONG lineSize = REG_VAL_BUF_SIZE; - BOOL unicode_check = TRUE; line = HeapAlloc(GetProcessHeap(), 0, lineSize); CHECK_ENOUGH_MEMORY(line); @@ -636,31 +635,7 @@ void processRegLines(FILE *in) */ size_to_get = (size_remaining > INT_MAX ? INT_MAX : size_remaining); - if (unicode_check) - { - if (fread( s, 2, 1, in) == 1) - { - if ((BYTE)s[0] == 0xff && (BYTE)s[1] == 0xfe) - { - printf("Trying to import from a unicode file: this isn't supported yet.\n" - "Please use export as Win 9x/NT4 files from native regedit\n"); - HeapFree(GetProcessHeap(), 0, line); - return; - } - else - { - unicode_check = FALSE; - check = fgets (&s[2], size_to_get-2, in); - } - } - else - { - unicode_check = FALSE; - check = NULL; - } - } - else - check = fgets (s, size_to_get, in); + check = fgets (s, size_to_get, in); if (check == NULL) { if (ferror(in)) { @@ -725,6 +700,119 @@ void processRegLines(FILE *in) HeapFree(GetProcessHeap(), 0, line); } +void processRegLinesW(FILE *in) +{ + WCHAR* buf = NULL; /* line read from input stream */ + ULONG lineSize = REG_VAL_BUF_SIZE; + size_t check = -1; + + WCHAR* s; /* The pointer into line for where the current fgets should read */ + int i; + + buf = HeapAlloc(GetProcessHeap(), 0, lineSize * sizeof(WCHAR)); + CHECK_ENOUGH_MEMORY(buf); + + s = buf; + + while(!feof(in)) { + size_t size_remaining; + int size_to_get; + WCHAR *s_eol = NULL; /* various local uses */ + + /* Do we need to expand the buffer ? */ + assert (s >= buf && s <= buf + lineSize); + size_remaining = lineSize - (s-buf); + if (size_remaining < 2) /* room for 1 character and the \0 */ + { + WCHAR *new_buffer; + size_t new_size = lineSize + (REG_VAL_BUF_SIZE / sizeof(WCHAR)); + if (new_size > lineSize) /* no arithmetic overflow */ + new_buffer = HeapReAlloc (GetProcessHeap(), 0, buf, new_size * sizeof(WCHAR)); + else + new_buffer = NULL; + CHECK_ENOUGH_MEMORY(new_buffer); + buf = new_buffer; + s = buf + lineSize - size_remaining; + lineSize = new_size; + size_remaining = lineSize - (s-buf); + } + + /* Get as much as possible into the buffer, terminated either by + * eof, error, eol or getting the maximum amount. Abort on error. + */ + size_to_get = (size_remaining > INT_MAX ? INT_MAX : size_remaining); + + check = fread(s, sizeof(WCHAR), size_to_get, in); + + if (check == 0) { + if (ferror(in)) { + perror ("While reading input"); + exit (IO_ERROR); + } else { + assert (feof(in)); + *s = '\0'; + /* It is not clear to me from the definition that the + * contents of the buffer are well defined on detecting + * an eof without managing to read anything. + */ + } + } + + /* If we didn't read the eol nor the eof go around for the rest */ + while(1) + { + for(i = 0; s[i] != 0; i++) + { + if(s[i] == '\n') + { + s_eol = &s[i]; + break; + } + } + + /* If it is a comment line then discard it and go around again */ + if (buf[0] == '#') { + s = buf; + continue; + } + + /* Remove any line feed. Leave s_eol on the \0 */ + if (s_eol) { + *s_eol = '\0'; + if (s_eol > buf && *(s_eol-1) == '\r') + *(s_eol-1) = '\0'; + } + + /* If there is a concatenating \\ then go around again */ + if (s_eol > buf && *(s_eol-1) == '\\') { + WCHAR c[2]; + s = s_eol+1; + /* The following error protection could be made more self- + * correcting but I thought it not worth trying. + */ + if(!fread(&c, sizeof(WCHAR), 2, in)) + break; + if (feof(in) || c[0] != ' ' || c[1] != ' ') + fprintf(stderr,"%s: ERROR - invalid continuation.\n", + getAppName()); + continue; + } + + if(!s_eol) + break; + + processRegEntry(s); + s = s_eol + 1; + s_eol = 0; + continue; /* That is the full virtual line */ + } + } + + processRegEntry(NULL); + + HeapFree(GetProcessHeap(), 0, buf); +} + /**************************************************************************** * REGPROC_print_error * @@ -1080,12 +1168,24 @@ BOOL export_registry_key(CHAR *file_name, CHAR *reg_key_name) /****************************************************************************** * Reads contents of the specified file into the registry. */ -BOOL import_registry_file(LPTSTR filename) +BOOL import_registry_file(FILE* reg_file) { - FILE* reg_file = fopen(filename, "r"); - - if (reg_file) { - processRegLines(reg_file); + if (reg_file) + { + BYTE s[2]; + if (fread( s, 2, 1, reg_file) == 1) + { + if (s[0] == 0xff && s[1] == 0xfe) + { + printf("Trying to open unicode file\n"); + processRegLinesW(reg_file); + } else + { + printf("ansi file\n"); + rewind(reg_file); + processRegLinesA(reg_file); + } + } return TRUE; } return FALSE; diff --git a/programs/regedit/regproc.h b/programs/regedit/regproc.h index d1725b1..0621d8b 100644 --- a/programs/regedit/regproc.h +++ b/programs/regedit/regproc.h @@ -22,7 +22,6 @@ const CHAR *getAppName(void); BOOL export_registry_key(CHAR *file_name, CHAR *reg_key_name); -BOOL import_registry_file(LPTSTR filename); +BOOL import_registry_file(FILE *in); void delete_registry_key(WCHAR *reg_key_name); WCHAR* GetWideString(const char* strA); -void processRegLines(FILE *in);
1
0
0
0
Alexander Nicolaysen Sørnes : regedit: Convert remaining registry import code to Unicode.
by Alexandre Julliard
10 Jul '08
10 Jul '08
Module: wine Branch: master Commit: 9d60849037ee3b466c7a174d3d1ddacdbc8d4dc5 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9d60849037ee3b466c7a174d3…
Author: Alexander Nicolaysen Sørnes <alex(a)thehandofagony.com> Date: Wed Jul 9 22:41:26 2008 +0200 regedit: Convert remaining registry import code to Unicode. --- programs/regedit/regproc.c | 56 +++++++++++++++++++++++-------------------- 1 files changed, 30 insertions(+), 26 deletions(-) diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c index bbced33..a42ee5c 100644 --- a/programs/regedit/regproc.c +++ b/programs/regedit/regproc.c @@ -475,13 +475,10 @@ static void closeKey(void) * line - registry file unwrapped line. Should have the registry value name and * complete registry value data. */ -static void processSetValue(LPSTR line) +static void processSetValue(WCHAR* line) { - LPSTR val_name; /* registry value name */ - LPSTR val_data; /* registry value data */ - WCHAR* val_nameW; - WCHAR* val_dataW; - + WCHAR* val_name; /* registry value name */ + WCHAR* val_data; /* registry value data */ int line_idx = 0; /* current character under analysis */ LONG res; @@ -508,37 +505,44 @@ static void processSetValue(LPSTR line) } } if (line[line_idx] != '=') { + char* lineA; line[line_idx] = '\"'; - fprintf(stderr,"Warning! unrecognized line:\n%s\n", line); + lineA = GetMultiByteString(line); + fprintf(stderr,"Warning! unrecognized line:\n%s\n", lineA); + HeapFree(GetProcessHeap(), 0, lineA); return; } } else { - fprintf(stderr,"Warning! unrecognized line:\n%s\n", line); + char* lineA = GetMultiByteString(line); + fprintf(stderr,"Warning! unrecognized line:\n%s\n", lineA); + HeapFree(GetProcessHeap(), 0, lineA); return; } line_idx++; /* skip the '=' character */ val_data = line + line_idx; - val_nameW = GetWideString(val_name); - val_dataW = GetWideString(val_data); - REGPROC_unescape_string(val_nameW); - res = setValue(val_nameW, val_dataW); - HeapFree(GetProcessHeap(), 0, val_nameW); - HeapFree(GetProcessHeap(), 0, val_dataW); + REGPROC_unescape_string(val_name); + res = setValue(val_name, val_data); if ( res != ERROR_SUCCESS ) + { + char* val_nameA = GetMultiByteString(val_name); + char* val_dataA = GetMultiByteString(val_data); fprintf(stderr,"%s: ERROR Key %s not created. Value: %s, Data: %s\n", getAppName(), currentKeyName, - val_name, - val_data); + val_nameA, + val_dataA); + HeapFree(GetProcessHeap(), 0, val_nameA); + HeapFree(GetProcessHeap(), 0, val_dataA); + } } /****************************************************************************** * This function receives the currently read entry and performs the * corresponding action. */ -static void processRegEntry(LPSTR stdInput) +static void processRegEntry(WCHAR* stdInput) { /* * We encountered the end of the file, make sure we @@ -551,28 +555,24 @@ static void processRegEntry(LPSTR stdInput) if ( stdInput[0] == '[') /* We are reading a new key */ { - LPSTR keyEnd; - WCHAR* stdInputW; + WCHAR* keyEnd; closeKey(); /* Close the previous key */ /* Get rid of the square brackets */ stdInput++; - keyEnd = strrchr(stdInput, ']'); + keyEnd = strrchrW(stdInput, ']'); if (keyEnd) *keyEnd='\0'; - stdInputW = GetWideString(stdInput); - /* delete the key if we encounter '-' at the start of reg key */ if ( stdInput[0] == '-') { - delete_registry_key(stdInputW + 1); - } else if ( openKeyW(stdInputW) != ERROR_SUCCESS ) + delete_registry_key(stdInput + 1); + } else if ( openKeyW(stdInput) != ERROR_SUCCESS ) { fprintf(stderr,"%s: setValue failed to open key %s\n", getAppName(), stdInput); } - HeapFree(GetProcessHeap(), 0, stdInputW); } else if( currentKeyHandle && (( stdInput[0] == '@') || /* reading a default @=data pair */ ( stdInput[0] == '\"'))) /* reading a new value=data pair */ @@ -606,6 +606,7 @@ void processRegLines(FILE *in) while (!feof(in)) { LPSTR s; /* The pointer into line for where the current fgets should read */ LPSTR check; + WCHAR* lineW; s = line; for (;;) { size_t size_remaining; @@ -711,10 +712,13 @@ void processRegLines(FILE *in) continue; } + lineW = GetWideString(line); + break; /* That is the full virtual line */ } - processRegEntry(line); + processRegEntry(lineW); + HeapFree(GetProcessHeap(), 0, lineW); } processRegEntry(NULL);
1
0
0
0
Alexander Nicolaysen Sørnes : regedit: Convert openKey to Unicode.
by Alexandre Julliard
10 Jul '08
10 Jul '08
Module: wine Branch: master Commit: db074ee9a336fe3c6576d05c96992b746e75e7e8 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=db074ee9a336fe3c6576d05c9…
Author: Alexander Nicolaysen Sørnes <alex(a)thehandofagony.com> Date: Wed Jul 9 21:42:20 2008 +0200 regedit: Convert openKey to Unicode. --- programs/regedit/regproc.c | 28 ++++++++++++---------------- 1 files changed, 12 insertions(+), 16 deletions(-) diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c index bed68af..bbced33 100644 --- a/programs/regedit/regproc.c +++ b/programs/regedit/regproc.c @@ -418,10 +418,10 @@ static LONG setValue(WCHAR* val_name, WCHAR* val_data) * A helper function for processRegEntry() that opens the current key. * That key must be closed by calling closeKey(). */ -static LONG openKey(LPSTR stdInput) +static LONG openKeyW(WCHAR* stdInput) { HKEY keyClass; - LPSTR keyPath; + WCHAR* keyPath; DWORD dwDisp; LONG res; @@ -430,10 +430,10 @@ static LONG openKey(LPSTR stdInput) return ERROR_INVALID_PARAMETER; /* Get the registry class */ - if (!parseKeyName(stdInput, &keyClass, &keyPath)) + if (!parseKeyNameW(stdInput, &keyClass, &keyPath)) return ERROR_INVALID_PARAMETER; - res = RegCreateKeyEx( + res = RegCreateKeyExW( keyClass, /* Class */ keyPath, /* Sub Key */ 0, /* MUST BE 0 */ @@ -446,15 +446,9 @@ static LONG openKey(LPSTR stdInput) REG_OPENED_EXISTING_KEY */ if (res == ERROR_SUCCESS) - { - currentKeyName = HeapAlloc(GetProcessHeap(), 0, strlen(stdInput)+1); - CHECK_ENOUGH_MEMORY(currentKeyName); - strcpy(currentKeyName, stdInput); - } + currentKeyName = GetMultiByteString(stdInput); else - { currentKeyHandle = NULL; - } return res; @@ -558,6 +552,7 @@ static void processRegEntry(LPSTR stdInput) if ( stdInput[0] == '[') /* We are reading a new key */ { LPSTR keyEnd; + WCHAR* stdInputW; closeKey(); /* Close the previous key */ /* Get rid of the square brackets */ @@ -566,17 +561,18 @@ static void processRegEntry(LPSTR stdInput) if (keyEnd) *keyEnd='\0'; + stdInputW = GetWideString(stdInput); + /* delete the key if we encounter '-' at the start of reg key */ if ( stdInput[0] == '-') { - WCHAR* stdInputW = GetWideString(stdInput + 1); - delete_registry_key(stdInputW); - HeapFree(GetProcessHeap(), 0, stdInputW); - } else if ( openKey(stdInput) != ERROR_SUCCESS ) + delete_registry_key(stdInputW + 1); + } else if ( openKeyW(stdInputW) != ERROR_SUCCESS ) { fprintf(stderr,"%s: setValue failed to open key %s\n", getAppName(), stdInput); } + HeapFree(GetProcessHeap(), 0, stdInputW); } else if( currentKeyHandle && (( stdInput[0] == '@') || /* reading a default @=data pair */ ( stdInput[0] == '\"'))) /* reading a new value=data pair */ @@ -1017,7 +1013,7 @@ BOOL export_registry_key(CHAR *file_name, CHAR *reg_key_name) if (reg_key_name && reg_key_name[0]) { HKEY reg_key_class; - CHAR *branch_name; + CHAR *branch_name = NULL; HKEY key; REGPROC_resize_char_buffer(®_key_name_buf, ®_key_name_len,
1
0
0
0
Alexander Nicolaysen Sørnes : regedit: Convert the rest of setValue to Unicode.
by Alexandre Julliard
10 Jul '08
10 Jul '08
Module: wine Branch: master Commit: 2e7b8cbc423f96888360460dacbd60587b9d974a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2e7b8cbc423f96888360460da…
Author: Alexander Nicolaysen Sørnes <alex(a)thehandofagony.com> Date: Wed Jul 9 20:59:01 2008 +0200 regedit: Convert the rest of setValue to Unicode. --- programs/regedit/regproc.c | 73 +++++++++++++++++++++++++++---------------- 1 files changed, 46 insertions(+), 27 deletions(-) diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c index 23d94d1..bed68af 100644 --- a/programs/regedit/regproc.c +++ b/programs/regedit/regproc.c @@ -26,6 +26,7 @@ #include <winnt.h> #include <winreg.h> #include <assert.h> +#include <wine/unicode.h> #include "regproc.h" #define REG_VAL_BUF_SIZE 4096 @@ -107,10 +108,13 @@ char* GetMultiByteString(const WCHAR* strW) /****************************************************************************** * Converts a hex representation of a DWORD into a DWORD. */ -static BOOL convertHexToDWord(char* str, DWORD *dw) +static BOOL convertHexToDWord(WCHAR* str, DWORD *dw) { + char buf[9]; char dummy; - if (strlen(str) > 8 || sscanf(str, "%x%c", dw, &dummy) != 1) { + + WideCharToMultiByte(CP_ACP, 0, str, -1, buf, 9, NULL, NULL); + if (lstrlenW(str) > 8 || sscanf(buf, "%x%c", dw, &dummy) != 1) { fprintf(stderr,"%s: ERROR, invalid hex value\n", getAppName()); return FALSE; } @@ -120,17 +124,18 @@ static BOOL convertHexToDWord(char* str, DWORD *dw) /****************************************************************************** * Converts a hex comma separated values list into a binary string. */ -static BYTE* convertHexCSVToHex(char *str, DWORD *size) +static BYTE* convertHexCSVToHex(WCHAR *strW, DWORD *size) { char *s; BYTE *d, *data; + char* strA = GetMultiByteString(strW); /* The worst case is 1 digit + 1 comma per byte */ - *size=(strlen(str)+1)/2; + *size=(strlen(strA)+1)/2; data=HeapAlloc(GetProcessHeap(), 0, *size); CHECK_ENOUGH_MEMORY(data); - s = str; + s = strA; d = data; *size=0; while (*s != '\0') { @@ -142,6 +147,7 @@ static BYTE* convertHexCSVToHex(char *str, DWORD *size) fprintf(stderr,"%s: ERROR converting CSV hex stream. Invalid value at '%s'\n", getAppName(), s); HeapFree(GetProcessHeap(), 0, data); + HeapFree(GetProcessHeap(), 0, strA); return NULL; } *d++ =(BYTE)wc; @@ -150,6 +156,8 @@ static BYTE* convertHexCSVToHex(char *str, DWORD *size) s = end; } + HeapFree(GetProcessHeap(), 0, strA); + return data; } @@ -160,17 +168,24 @@ static BYTE* convertHexCSVToHex(char *str, DWORD *size) * * Note: Updated based on the algorithm used in 'server/registry.c' */ -static DWORD getDataType(LPSTR *lpValue, DWORD* parse_type) +static DWORD getDataType(LPWSTR *lpValue, DWORD* parse_type) { - struct data_type { const char *tag; int len; int type; int parse_type; }; + struct data_type { const WCHAR *tag; int len; int type; int parse_type; }; + + static const WCHAR quote[] = {'"'}; + static const WCHAR str[] = {'s','t','r',':','"'}; + static const WCHAR str2[] = {'s','t','r','(','2',')',':','"'}; + static const WCHAR hex[] = {'h','e','x',':'}; + static const WCHAR dword[] = {'d','w','o','r','d',':'}; + static const WCHAR hexp[] = {'h','e','x','('}; static const struct data_type data_types[] = { /* actual type */ /* type to assume for parsing */ - { "\"", 1, REG_SZ, REG_SZ }, - { "str:\"", 5, REG_SZ, REG_SZ }, - { "str(2):\"", 8, REG_EXPAND_SZ, REG_SZ }, - { "hex:", 4, REG_BINARY, REG_BINARY }, - { "dword:", 6, REG_DWORD, REG_DWORD }, - { "hex(", 4, -1, REG_BINARY }, + { quote, 1, REG_SZ, REG_SZ }, + { str, 5, REG_SZ, REG_SZ }, + { str2, 8, REG_EXPAND_SZ, REG_SZ }, + { hex, 4, REG_BINARY, REG_BINARY }, + { dword, 6, REG_DWORD, REG_DWORD }, + { hexp, 4, -1, REG_BINARY }, { NULL, 0, 0, 0 } }; @@ -178,7 +193,7 @@ static DWORD getDataType(LPSTR *lpValue, DWORD* parse_type) int type; for (ptr = data_types; ptr->tag; ptr++) { - if (memcmp( ptr->tag, *lpValue, ptr->len )) + if (strncmpW( ptr->tag, *lpValue, ptr->len )) continue; /* Found! */ @@ -186,13 +201,14 @@ static DWORD getDataType(LPSTR *lpValue, DWORD* parse_type) type=ptr->type; *lpValue+=ptr->len; if (type == -1) { - char* end; + WCHAR* end; + /* "hex(xx):" is special */ - type = (int)strtoul( *lpValue , &end, 16 ); + type = (int)strtoulW( *lpValue , &end, 16 ); if (**lpValue=='\0' || *end!=')' || *(end+1)!=':') { type=REG_NONE; } else { - *lpValue=end+2; + *lpValue = end + 2; } } return type; @@ -330,17 +346,18 @@ static HKEY currentKeyHandle = NULL; * val_name - name of the registry value * val_data - registry value data */ -static LONG setValue(WCHAR* val_name, LPSTR val_data) +static LONG setValue(WCHAR* val_name, WCHAR* val_data) { LONG res; DWORD dwDataType, dwParseType; LPBYTE lpbData; DWORD dwData, dwLen; + WCHAR del[] = {'-',0}; if ( (val_name == NULL) || (val_data == NULL) ) return ERROR_INVALID_PARAMETER; - if (strcmp(val_data, "-") == 0) + if (lstrcmpW(val_data, del) == 0) { res=RegDeleteValueW(currentKeyHandle,val_name); return (res == ERROR_FILE_NOT_FOUND ? ERROR_SUCCESS : res); @@ -351,19 +368,18 @@ static LONG setValue(WCHAR* val_name, LPSTR val_data) if (dwParseType == REG_SZ) /* no conversion for string */ { - WCHAR* val_dataW = GetWideString(val_data); - REGPROC_unescape_string(val_dataW); + REGPROC_unescape_string(val_data); /* Compute dwLen after REGPROC_unescape_string because it may * have changed the string length and we don't want to store * the extra garbage in the registry. */ - dwLen = lstrlenW(val_dataW); - if (dwLen>0 && val_dataW[dwLen-1]=='"') + dwLen = lstrlenW(val_data); + if (dwLen>0 && val_data[dwLen-1]=='"') { dwLen--; - val_dataW[dwLen]='\0'; + val_data[dwLen]='\0'; } - lpbData = (BYTE*) val_dataW; + lpbData = (BYTE*) val_data; dwLen++; /* include terminating null */ dwLen = dwLen * sizeof(WCHAR); /* size is in bytes */ } @@ -393,7 +409,7 @@ static LONG setValue(WCHAR* val_name, LPSTR val_data) dwDataType, lpbData, dwLen); - if (dwParseType == REG_BINARY || dwParseType == REG_SZ) + if (dwParseType == REG_BINARY) HeapFree(GetProcessHeap(), 0, lpbData); return res; } @@ -470,6 +486,7 @@ static void processSetValue(LPSTR line) LPSTR val_name; /* registry value name */ LPSTR val_data; /* registry value data */ WCHAR* val_nameW; + WCHAR* val_dataW; int line_idx = 0; /* current character under analysis */ LONG res; @@ -510,9 +527,11 @@ static void processSetValue(LPSTR line) val_data = line + line_idx; val_nameW = GetWideString(val_name); + val_dataW = GetWideString(val_data); REGPROC_unescape_string(val_nameW); - res = setValue(val_nameW, val_data); + res = setValue(val_nameW, val_dataW); HeapFree(GetProcessHeap(), 0, val_nameW); + HeapFree(GetProcessHeap(), 0, val_dataW); if ( res != ERROR_SUCCESS ) fprintf(stderr,"%s: ERROR Key %s not created. Value: %s, Data: %s\n", getAppName(),
1
0
0
0
Alexandre Julliard : regedit: Fixed the GetWideString and GetMultiByteString functions to work with null-terminated strings .
by Alexandre Julliard
10 Jul '08
10 Jul '08
Module: wine Branch: master Commit: f7f249e59bdb3c4d150b5250701f48738938a0f9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f7f249e59bdb3c4d150b52507…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Jul 10 17:49:36 2008 +0200 regedit: Fixed the GetWideString and GetMultiByteString functions to work with null-terminated strings. --- programs/regedit/regedit.c | 2 +- programs/regedit/regproc.c | 20 +++++++++++--------- programs/regedit/regproc.h | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/programs/regedit/regedit.c b/programs/regedit/regedit.c index fca0cac..8c473e6 100644 --- a/programs/regedit/regedit.c +++ b/programs/regedit/regedit.c @@ -188,7 +188,7 @@ static BOOL PerformRegAction(REGEDIT_ACTION action, LPSTR s) exit(1); } else { - WCHAR* reg_key_nameW = GetWideString(reg_key_name, lstrlenA(reg_key_name)+1); + WCHAR* reg_key_nameW = GetWideString(reg_key_name); delete_registry_key(reg_key_nameW); HeapFree(GetProcessHeap(), 0, reg_key_nameW); } diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c index f8f4eca..23d94d1 100644 --- a/programs/regedit/regproc.c +++ b/programs/regedit/regproc.c @@ -78,13 +78,14 @@ if (!(p)) \ * Allocates memory and convers input from multibyte to wide chars * Returned string must be freed by the caller */ -WCHAR* GetWideString(char* strA, int len) +WCHAR* GetWideString(const char* strA) { WCHAR* strW = NULL; + int len = MultiByteToWideChar(CP_ACP, 0, strA, -1, NULL, 0); strW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); CHECK_ENOUGH_MEMORY(strW); - MultiByteToWideChar(CP_ACP, 0, strA, len, strW, len); + MultiByteToWideChar(CP_ACP, 0, strA, -1, strW, len); return strW; } @@ -92,13 +93,14 @@ WCHAR* GetWideString(char* strA, int len) * Allocates memory and convers input from wide chars to multibyte * Returned string must be freed by the caller */ -char* GetMultiByteString(WCHAR* strW, int len) +char* GetMultiByteString(const WCHAR* strW) { char* strA = NULL; + int len = WideCharToMultiByte(CP_ACP, 0, strW, -1, NULL, 0, NULL, NULL); strA = HeapAlloc(GetProcessHeap(), 0, len); CHECK_ENOUGH_MEMORY(strA); - WideCharToMultiByte(CP_ACP, 0, strW, len, strA, len, NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, strW, -1, strA, len, NULL, NULL); return strA; } @@ -349,7 +351,7 @@ static LONG setValue(WCHAR* val_name, LPSTR val_data) if (dwParseType == REG_SZ) /* no conversion for string */ { - WCHAR* val_dataW = GetWideString(val_data, lstrlenA(val_data)+1); + WCHAR* val_dataW = GetWideString(val_data); REGPROC_unescape_string(val_dataW); /* Compute dwLen after REGPROC_unescape_string because it may * have changed the string length and we don't want to store @@ -507,7 +509,7 @@ static void processSetValue(LPSTR line) line_idx++; /* skip the '=' character */ val_data = line + line_idx; - val_nameW = GetWideString(val_name, lstrlenA(val_name)+1); + val_nameW = GetWideString(val_name); REGPROC_unescape_string(val_nameW); res = setValue(val_nameW, val_data); HeapFree(GetProcessHeap(), 0, val_nameW); @@ -548,7 +550,7 @@ static void processRegEntry(LPSTR stdInput) /* delete the key if we encounter '-' at the start of reg key */ if ( stdInput[0] == '-') { - WCHAR* stdInputW = GetWideString(stdInput + 1, keyEnd - stdInput); + WCHAR* stdInputW = GetWideString(stdInput + 1); delete_registry_key(stdInputW); HeapFree(GetProcessHeap(), 0, stdInputW); } else if ( openKey(stdInput) != ERROR_SUCCESS ) @@ -1086,14 +1088,14 @@ void delete_registry_key(WCHAR *reg_key_name) return; if (!parseKeyNameW(reg_key_name, &key_class, &key_name)) { - char* reg_key_nameA = GetMultiByteString(reg_key_name, lstrlenW(reg_key_name)); + char* reg_key_nameA = GetMultiByteString(reg_key_name); fprintf(stderr,"%s: Incorrect registry class specification in '%s'\n", getAppName(), reg_key_nameA); HeapFree(GetProcessHeap(), 0, reg_key_nameA); exit(1); } if (!*key_name) { - char* reg_key_nameA = GetMultiByteString(reg_key_name, lstrlenW(reg_key_name)); + char* reg_key_nameA = GetMultiByteString(reg_key_name); fprintf(stderr,"%s: Can't delete registry class '%s'\n", getAppName(), reg_key_nameA); HeapFree(GetProcessHeap(), 0, reg_key_nameA); diff --git a/programs/regedit/regproc.h b/programs/regedit/regproc.h index 9faf8b1..d1725b1 100644 --- a/programs/regedit/regproc.h +++ b/programs/regedit/regproc.h @@ -24,5 +24,5 @@ const CHAR *getAppName(void); BOOL export_registry_key(CHAR *file_name, CHAR *reg_key_name); BOOL import_registry_file(LPTSTR filename); void delete_registry_key(WCHAR *reg_key_name); -WCHAR* GetWideString(char* strA, int len); +WCHAR* GetWideString(const char* strA); void processRegLines(FILE *in);
1
0
0
0
← Newer
1
...
63
64
65
66
67
68
69
...
112
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
Results per page:
10
25
50
100
200