ReactOS.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
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
List overview
Download
Ros-diffs
May 2009
----- 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
ros-diffs@reactos.org
27 participants
504 discussions
Start a n
N
ew thread
[dchapyshev] 41067: - Sync comdlg32 with Wine 1.1.22
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Sat May 23 14:33:06 2009 New Revision: 41067 URL:
http://svn.reactos.org/svn/reactos?rev=41067&view=rev
Log: - Sync comdlg32 with Wine 1.1.22 Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Nl.rc trunk/reactos/dll/win32/comdlg32/cdlg_Ro.rc Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Nl.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Nl…
============================================================================== --- trunk/reactos/dll/win32/comdlg32/cdlg_Nl.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comdlg32/cdlg_Nl.rc [iso-8859-1] Sat May 23 14:33:06 2009 @@ -182,7 +182,7 @@ } -FINDDLGORD DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 236, 62 +FINDDLGORD DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 246, 72 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Tekst zoeken" FONT 8, "MS Shell Dlg" @@ -190,18 +190,18 @@ LTEXT "&Zoek naar:", -1, 4, 8, 42, 8 EDITTEXT 1152, 47, 7, 128, 12, ES_AUTOHSCROLL | WS_BORDER | WS_GROUP | WS_TABSTOP CHECKBOX "Heel &woord", 1040, 4, 26, 100, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - CHECKBOX "Gelijke &hoofd-/kleine letters", 1041, 4, 42, 64, 12, BS_AUTOCHECKBOX | WS_TABSTOP - GROUPBOX "Zoekrichting", 1072, 107, 26, 68, 28 - CONTROL "&Omhoog", 1056, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 111, 38, 20, 12 - CONTROL "Om&laag", 1057, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 138, 38, 30, 12 - - DEFPUSHBUTTON "&Volgende zoeken", IDOK, 182, 5, 50, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON - PUSHBUTTON "Annuleren", IDCANCEL, 182, 23, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON "&Help", pshHelp , 182, 45, 50, 14, WS_GROUP | WS_TABSTOP -} - - -REPLACEDLGORD DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 230, 94 + CHECKBOX "Gelijke &hoofd-/kleine letters", 1041, 4, 52, 100, 12, BS_AUTOCHECKBOX | WS_TABSTOP + GROUPBOX "Zoekrichting", 1072, 117, 26, 58, 38 + CONTROL "&Omhoog", 1056, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 121, 38, 40, 12 + CONTROL "Om&laag", 1057, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 121, 50, 40, 12 + + DEFPUSHBUTTON "&Volgende zoeken", IDOK, 182, 5, 60, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Annuleren", IDCANCEL, 182, 23, 60, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Help", pshHelp , 182, 45, 60, 14, WS_GROUP | WS_TABSTOP +} + + +REPLACEDLGORD DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 240, 94 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Tekst vervangen" FONT 8, "MS Shell Dlg" @@ -211,13 +211,13 @@ LTEXT "Vervang &door:", -1, 4, 26, 48, 8 EDITTEXT 1153, 54, 24, 114, 12, ES_AUTOHSCROLL | WS_BORDER | WS_GROUP | WS_TABSTOP CHECKBOX "Heel &woord", 1040, 5, 46, 104, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - CHECKBOX "Gelijke &hoofd-/kleine letters", 1041, 5, 62, 59, 12, BS_AUTOCHECKBOX | WS_TABSTOP - - DEFPUSHBUTTON "Volgende zoeken", IDOK, 174, 4, 50, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON - PUSHBUTTON "Ve&rvangen", psh1 , 174, 21, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON "&Alles vervangen", psh2 , 174, 38, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON "Annuleren", IDCANCEL, 174, 55, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON "&Help", pshHelp , 174, 75, 50, 14, WS_GROUP | WS_TABSTOP + CHECKBOX "Gelijke &hoofd-/kleine letters", 1041, 5, 62, 100, 12, BS_AUTOCHECKBOX | WS_TABSTOP + + DEFPUSHBUTTON "Volgende zoeken", IDOK, 174, 4, 60, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Ve&rvangen", psh1 , 174, 21, 60, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Alles vervangen", psh2 , 174, 38, 60, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "Annuleren", IDCANCEL, 174, 55, 60, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Help", pshHelp , 174, 75, 60, 14, WS_GROUP | WS_TABSTOP } NEWFILEOPENORD DIALOG LOADONCALL MOVEABLE DISCARDABLE 0, 0, 280, 164 Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Ro.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Ro…
============================================================================== --- trunk/reactos/dll/win32/comdlg32/cdlg_Ro.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comdlg32/cdlg_Ro.rc [iso-8859-1] Sat May 23 14:33:06 2009 @@ -155,7 +155,7 @@ CAPTION "Culoare" FONT 8, "MS Shell Dlg" { - LTEXT "Culori de &basÄ:", 1088, 4, 4, 140, 10 + LTEXT "Culori de &bazÄ:", 1088, 4, 4, 140, 10 LTEXT "&Culori personalizate:", 1089, 4, 106, 140, 10 LTEXT "Culoare | Sol&id", 1090, 150, 151, 48, 10 LTEXT "&RoÈu:", 726 /*1094*/,249,126,24,10
15 years, 7 months
1
0
0
0
[dchapyshev] 41066: - Sync gdiplus, fusion, cryptui with Wine 1.1.22
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Sat May 23 14:32:19 2009 New Revision: 41066 URL:
http://svn.reactos.org/svn/reactos?rev=41066&view=rev
Log: - Sync gdiplus, fusion, cryptui with Wine 1.1.22 Modified: trunk/reactos/dll/win32/cryptui/main.c trunk/reactos/dll/win32/fusion/assembly.c trunk/reactos/dll/win32/fusion/fusion.c trunk/reactos/dll/win32/fusion/fusionpriv.h 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/stringformat.c Modified: trunk/reactos/dll/win32/cryptui/main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/cryptui/main.c?r…
============================================================================== --- trunk/reactos/dll/win32/cryptui/main.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/cryptui/main.c [iso-8859-1] Sat May 23 14:32:19 2009 @@ -5170,7 +5170,7 @@ selectInfo.dwSize = sizeof(selectInfo); selectInfo.parent = hwnd; selectInfo.dwFlags = CRYPTUI_ENABLE_SHOW_PHYSICAL_STORE; - selectInfo.pwszTitle = selectInfo.pwszTitle = NULL; + selectInfo.pwszTitle = NULL; selectInfo.pEnumData = &enumData; selectInfo.pfnSelectedStoreCallback = NULL; if ((store = CryptUIDlgSelectStoreW(&selectInfo))) Modified: trunk/reactos/dll/win32/fusion/assembly.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/fusion/assembly.…
============================================================================== --- trunk/reactos/dll/win32/fusion/assembly.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/fusion/assembly.c [iso-8859-1] Sat May 23 14:32:19 2009 @@ -811,12 +811,6 @@ return S_OK; } -HRESULT assembly_get_architecture(ASSEMBLY *assembly, DWORD fixme) -{ - /* FIXME */ - return S_OK; -} - static BYTE *assembly_get_blob(ASSEMBLY *assembly, WORD index, ULONG *size) { return GetData(&assembly->blobs[index], size); Modified: trunk/reactos/dll/win32/fusion/fusion.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/fusion/fusion.c?…
============================================================================== --- trunk/reactos/dll/win32/fusion/fusion.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/fusion/fusion.c [iso-8859-1] Sat May 23 14:32:19 2009 @@ -42,19 +42,6 @@ } /****************************************************************** - * CompareAssemblyIdentity (FUSION.@) - */ -HRESULT WINAPI CompareAssemblyIdentity(LPCWSTR pwzAssemblyIdentity1, BOOL fUnified1, - LPCWSTR pwzAssemblyIdentity2, BOOL fUnified2, - BOOL *pfEquivalent, AssemblyComparisonResult *pResult) -{ - FIXME("(%s, %d, %s, %d, %p, %p) stub!\n", debugstr_w(pwzAssemblyIdentity1), - fUnified1, debugstr_w(pwzAssemblyIdentity2), fUnified2, pfEquivalent, pResult); - - return E_NOTIMPL; -} - -/****************************************************************** * CreateInstallReferenceEnum (FUSION.@) */ HRESULT WINAPI CreateInstallReferenceEnum(IInstallReferenceEnum **ppRefEnum, @@ -62,18 +49,6 @@ LPVOID pvReserved) { FIXME("(%p, %p, %08x, %p) stub!\n", ppRefEnum, pName, dwFlags, pvReserved); - return E_NOTIMPL; -} - -/****************************************************************** - * GetAssemblyIdentityFromFile (FUSION.@) - */ -HRESULT WINAPI GetAssemblyIdentityFromFile(LPCWSTR pwzFilePath, REFIID riid, - IUnknown **ppIdentity) -{ - FIXME("(%s, %s, %p) stub!\n", debugstr_w(pwzFilePath), debugstr_guid(riid), - ppIdentity); - return E_NOTIMPL; } Modified: trunk/reactos/dll/win32/fusion/fusionpriv.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/fusion/fusionpri…
============================================================================== --- trunk/reactos/dll/win32/fusion/fusionpriv.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/fusion/fusionpriv.h [iso-8859-1] Sat May 23 14:32:19 2009 @@ -433,7 +433,6 @@ HRESULT assembly_get_name(ASSEMBLY *assembly, LPWSTR *name); HRESULT assembly_get_path(ASSEMBLY *assembly, LPWSTR *path); HRESULT assembly_get_version(ASSEMBLY *assembly, LPWSTR *version); -HRESULT assembly_get_architecture(ASSEMBLY *assembly, DWORD fixme); HRESULT assembly_get_pubkey_token(ASSEMBLY *assembly, LPWSTR *token); static inline LPWSTR strdupW(LPCWSTR src) 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 May 23 14:32:19 2009 @@ -73,13 +73,19 @@ switch(brush->bt){ case BrushTypeSolidColor: + { + GpSolidFill *fill; *clone = GdipAlloc(sizeof(GpSolidFill)); if (!*clone) return OutOfMemory; + fill = (GpSolidFill*)*clone; + memcpy(*clone, brush, sizeof(GpSolidFill)); (*clone)->gdibrush = CreateBrushIndirect(&(*clone)->lb); + fill->bmp = ARGB2BMP(fill->color); break; + } case BrushTypeHatchFill: *clone = GdipAlloc(sizeof(GpHatch)); if (!*clone) return OutOfMemory; @@ -587,6 +593,7 @@ (*sf)->brush.gdibrush = CreateSolidBrush(col); (*sf)->brush.bt = BrushTypeSolidColor; (*sf)->color = color; + (*sf)->bmp = ARGB2BMP(color); return Ok; } @@ -869,6 +876,8 @@ GdipFree(((GpPathGradient*) brush)->blendpos); break; case BrushTypeSolidColor: + if (((GpSolidFill*)brush)->bmp) + DeleteObject(((GpSolidFill*)brush)->bmp); break; case BrushTypeLinearGradient: GdipFree(((GpLineGradient*)brush)->blendfac); 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 May 23 14:32:19 2009 @@ -844,6 +844,7 @@ (*fontCollection)->FontFamilies = NULL; (*fontCollection)->count = 0; + (*fontCollection)->allocated = 0; return Ok; } @@ -930,14 +931,77 @@ return Ok; } +void free_installed_fonts(void) +{ + while (installedFontCollection.count) + GdipDeleteFontFamily(installedFontCollection.FontFamilies[--installedFontCollection.count]); + HeapFree(GetProcessHeap(), 0, installedFontCollection.FontFamilies); + installedFontCollection.FontFamilies = NULL; + installedFontCollection.allocated = 0; +} + +static INT CALLBACK add_font_proc(const LOGFONTW *lfw, const TEXTMETRICW *ntm, + DWORD type, LPARAM lParam) +{ + GpFontCollection* fonts = (GpFontCollection*)lParam; + int i; + + /* skip duplicates */ + for (i=0; i<fonts->count; i++) + if (strcmpiW(lfw->lfFaceName, fonts->FontFamilies[i]->FamilyName) == 0) + return 1; + + if (fonts->allocated == fonts->count) + { + INT new_alloc_count = fonts->allocated+50; + GpFontFamily** new_family_list = HeapAlloc(GetProcessHeap(), 0, new_alloc_count*sizeof(void*)); + + if (!new_family_list) + return 0; + + memcpy(new_family_list, fonts->FontFamilies, fonts->count*sizeof(void*)); + HeapFree(GetProcessHeap(), 0, fonts->FontFamilies); + fonts->FontFamilies = new_family_list; + fonts->allocated = new_alloc_count; + } + + if (GdipCreateFontFamilyFromName(lfw->lfFaceName, NULL, &fonts->FontFamilies[fonts->count]) == Ok) + fonts->count++; + else + return 0; + + return 1; +} + GpStatus WINGDIPAPI GdipNewInstalledFontCollection( GpFontCollection** fontCollection) { - FIXME("stub: %p\n",fontCollection); + TRACE("(%p)\n",fontCollection); if (!fontCollection) return InvalidParameter; + if (installedFontCollection.count == 0) + { + HDC hdc; + LOGFONTW lfw; + + hdc = GetDC(0); + + lfw.lfCharSet = DEFAULT_CHARSET; + lfw.lfFaceName[0] = 0; + lfw.lfPitchAndFamily = 0; + + if (!EnumFontFamiliesExW(hdc, &lfw, add_font_proc, (LPARAM)&installedFontCollection, 0)) + { + free_installed_fonts(); + ReleaseDC(0, hdc); + return OutOfMemory; + } + + ReleaseDC(0, hdc); + } + *fontCollection = &installedFontCollection; return Ok; 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 May 23 14:32:19 2009 @@ -64,6 +64,10 @@ case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls( hinst ); break; + + case DLL_PROCESS_DETACH: + free_installed_fonts(); + break; } return TRUE; } @@ -252,6 +256,42 @@ return ((color & 0x0000ff) << 16) + (color & 0x00ff00) + ((color & 0xff0000) >> 16); +} + +HBITMAP ARGB2BMP(ARGB color) +{ + HDC hdc; + BITMAPINFO bi; + HBITMAP result; + RGBQUAD *bits; + int alpha; + + if ((color & 0xff000000) == 0xff000000) return 0; + + hdc = CreateCompatibleDC(NULL); + + bi.bmiHeader.biSize = sizeof(bi.bmiHeader); + bi.bmiHeader.biWidth = 1; + bi.bmiHeader.biHeight = 1; + bi.bmiHeader.biPlanes = 1; + bi.bmiHeader.biBitCount = 32; + bi.bmiHeader.biCompression = BI_RGB; + bi.bmiHeader.biSizeImage = 0; + bi.bmiHeader.biXPelsPerMeter = 0; + bi.bmiHeader.biYPelsPerMeter = 0; + bi.bmiHeader.biClrUsed = 0; + bi.bmiHeader.biClrImportant = 0; + + result = CreateDIBSection(hdc, &bi, DIB_RGB_COLORS, (void*)&bits, NULL, 0); + + bits[0].rgbReserved = alpha = (color>>24)&0xff; + bits[0].rgbRed = ((color>>16)&0xff)*alpha/255; + bits[0].rgbGreen = ((color>>8)&0xff)*alpha/255; + bits[0].rgbBlue = (color&0xff)*alpha/255; + + DeleteDC(hdc); + + return result; } /* Like atan2, but puts angle in correct quadrant if dx is 0. */ @@ -380,3 +420,9 @@ break; } } + +const char *debugstr_rectf(CONST RectF* rc) +{ + if (!rc) return "(null)"; + return wine_dbg_sprintf("(%0.2f,%0.2f,%0.2f,%0.2f)", rc->X, rc->Y, rc->Width, rc->Height); +} 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 May 23 14:32:19 2009 @@ -621,8 +621,8 @@ @ stdcall GdipTranslateWorldTransform(ptr long long long) @ stdcall GdipVectorTransformMatrixPoints(ptr ptr long) @ stdcall GdipVectorTransformMatrixPointsI(ptr ptr long) -@ stub GdipWarpPath -@ stub GdipWidenPath +@ stdcall GdipWarpPath(ptr ptr ptr long long long long long long long) +@ stdcall GdipWidenPath(ptr ptr ptr long) @ stub GdipWindingModeOutline @ stdcall GdiplusNotificationHook(ptr) @ stdcall GdiplusNotificationUnhook(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 May 23 14:32:19 2009 @@ -41,6 +41,7 @@ #define TENSION_CONST (0.3) COLORREF ARGB2COLORREF(ARGB color); +HBITMAP ARGB2BMP(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); @@ -52,6 +53,8 @@ extern void calc_curve_bezier_endp(REAL xend, REAL yend, REAL xadj, REAL yadj, REAL tension, REAL *x, REAL *y); +extern void free_installed_fonts(void); + extern BOOL lengthen_path(GpPath *path, INT len); extern GpStatus trace_path(GpGraphics *graphics, GpPath *path); @@ -68,6 +71,8 @@ { return M_PI * degrees / 180.0; } + +extern const char *debugstr_rectf(CONST RectF* rc); struct GpPen{ UINT style; @@ -122,6 +127,7 @@ struct GpSolidFill{ GpBrush brush; ARGB color; + HBITMAP bmp; }; struct GpPathGradient{ @@ -243,6 +249,7 @@ struct GpFontCollection{ GpFontFamily **FontFamilies; INT count; + INT allocated; }; struct GpFontFamily{ 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 May 23 14:32:19 2009 @@ -346,6 +346,40 @@ } break; } + case BrushTypeSolidColor: + { + GpSolidFill *fill = (GpSolidFill*)brush; + if (fill->bmp) + { + RECT rc; + /* partially transparent fill */ + + SelectClipPath(graphics->hdc, RGN_AND); + if (GetClipBox(graphics->hdc, &rc) != NULLREGION) + { + HDC hdc = CreateCompatibleDC(NULL); + HBITMAP oldbmp; + BLENDFUNCTION bf; + + if (!hdc) break; + + oldbmp = SelectObject(hdc, fill->bmp); + + bf.BlendOp = AC_SRC_OVER; + bf.BlendFlags = 0; + bf.SourceConstantAlpha = 255; + bf.AlphaFormat = AC_SRC_ALPHA; + + GdiAlphaBlend(graphics->hdc, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, hdc, 0, 0, 1, 1, bf); + + SelectObject(hdc, oldbmp); + DeleteDC(hdc); + } + + break; + } + /* else fall through */ + } default: SelectObject(graphics->hdc, brush->gdibrush); FillPath(graphics->hdc); @@ -2016,6 +2050,9 @@ SIZE size; RECT drawcoord; + TRACE("(%p, %s, %i, %p, %s, %p, %p)\n", graphics, debugstr_wn(string, length), + length, font, debugstr_rectf(rect), format, brush); + if(!graphics || !string || !font || !brush || !rect) return InvalidParameter; @@ -2932,6 +2969,10 @@ nheight; SIZE size; + TRACE("(%p, %s, %i, %p, %s, %p, %p, %p, %p)\n", graphics, + debugstr_wn(string, length), length, font, debugstr_rectf(rect), format, + bounds, codepointsfitted, linesfilled); + if(!graphics || !string || !font || !rect) return InvalidParameter; @@ -3585,23 +3626,104 @@ GpStatus WINGDIPAPI GdipTransformPoints(GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpPointF *points, INT count) { + GpMatrix *matrix; + GpStatus stat; + REAL unitscale; + if(!graphics || !points || count <= 0) return InvalidParameter; if(graphics->busy) return ObjectBusy; - FIXME("(%p, %d, %d, %p, %d): stub\n", graphics, dst_space, src_space, points, count); - - return NotImplemented; + TRACE("(%p, %d, %d, %p, %d)\n", graphics, dst_space, src_space, points, count); + + if (src_space == dst_space) return Ok; + + stat = GdipCreateMatrix(&matrix); + if (stat == Ok) + { + unitscale = convert_unit(graphics->hdc, graphics->unit); + + if(graphics->unit != UnitDisplay) + unitscale *= graphics->scale; + + /* transform from src_space to CoordinateSpacePage */ + switch (src_space) + { + case CoordinateSpaceWorld: + GdipMultiplyMatrix(matrix, graphics->worldtrans, MatrixOrderAppend); + break; + case CoordinateSpacePage: + break; + case CoordinateSpaceDevice: + GdipScaleMatrix(matrix, 1.0/unitscale, 1.0/unitscale, MatrixOrderAppend); + break; + } + + /* transform from CoordinateSpacePage to dst_space */ + switch (dst_space) + { + case CoordinateSpaceWorld: + { + GpMatrix *inverted_transform; + stat = GdipCloneMatrix(graphics->worldtrans, &inverted_transform); + if (stat == Ok) + { + stat = GdipInvertMatrix(inverted_transform); + if (stat == Ok) + GdipMultiplyMatrix(matrix, inverted_transform, MatrixOrderAppend); + GdipDeleteMatrix(inverted_transform); + } + break; + } + case CoordinateSpacePage: + break; + case CoordinateSpaceDevice: + GdipScaleMatrix(matrix, unitscale, unitscale, MatrixOrderAppend); + break; + } + + if (stat == Ok) + stat = GdipTransformMatrixPoints(matrix, points, count); + + GdipDeleteMatrix(matrix); + } + + return stat; } 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; + GpPointF *pointsF; + GpStatus ret; + INT i; + + TRACE("(%p, %d, %d, %p, %d)\n", graphics, dst_space, src_space, points, count); + + if(count <= 0) + return InvalidParameter; + + pointsF = GdipAlloc(sizeof(GpPointF) * count); + if(!pointsF) + return OutOfMemory; + + for(i = 0; i < count; i++){ + pointsF[i].X = (REAL)points[i].X; + pointsF[i].Y = (REAL)points[i].Y; + } + + ret = GdipTransformPoints(graphics, dst_space, src_space, pointsF, count); + + if(ret == Ok) + for(i = 0; i < count; i++){ + points[i].X = roundr(pointsF[i].X); + points[i].Y = roundr(pointsF[i].Y); + } + GdipFree(pointsF); + + return ret; } HPALETTE WINGDIPAPI GdipCreateHalftonePalette(void) 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 May 23 14:32:19 2009 @@ -1465,6 +1465,24 @@ path->pathdata.Count); } +GpStatus WINGDIPAPI GdipWarpPath(GpPath *path, GpMatrix* matrix, + GDIPCONST GpPointF *points, INT count, REAL x, REAL y, REAL width, + REAL height, WarpMode warpmode, REAL flatness) +{ + FIXME("(%p,%p,%p,%i,%0.2f,%0.2f,%0.2f,%0.2f,%i,%0.2f)\n", path, matrix, + points, count, x, y, width, height, warpmode, flatness); + + return NotImplemented; +} + +GpStatus WINGDIPAPI GdipWidenPath(GpPath *path, GpPen *pen, GpMatrix *matrix, + REAL flatness) +{ + FIXME("(%p,%p,%p,%0.2f)\n", path, pen, matrix, flatness); + + return NotImplemented; +} + GpStatus WINGDIPAPI GdipAddPathRectangle(GpPath *path, REAL x, REAL y, REAL width, REAL height) { Modified: trunk/reactos/dll/win32/gdiplus/stringformat.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/stringfo…
============================================================================== --- trunk/reactos/dll/win32/gdiplus/stringformat.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdiplus/stringformat.c [iso-8859-1] Sat May 23 14:32:19 2009 @@ -35,6 +35,8 @@ GpStatus WINGDIPAPI GdipCreateStringFormat(INT attr, LANGID lang, GpStringFormat **format) { + TRACE("(%i, %x, %p)\n", attr, lang, format); + if(!format) return InvalidParameter; @@ -189,6 +191,8 @@ GpStatus WINGDIPAPI GdipSetStringFormatAlign(GpStringFormat *format, StringAlignment align) { + TRACE("(%p, %i)\n", format, align); + if(!format) return InvalidParameter; @@ -201,6 +205,8 @@ GpStatus WINGDIPAPI GdipSetStringFormatDigitSubstitution(GpStringFormat *format, LANGID language, StringDigitSubstitute substitute) { + TRACE("(%p, %x, %i)\n", format, language, substitute); + if(!format) return InvalidParameter; @@ -213,6 +219,8 @@ GpStatus WINGDIPAPI GdipSetStringFormatHotkeyPrefix(GpStringFormat *format, INT hkpx) { + TRACE("(%p, %i)\n", format, hkpx); + if(!format || hkpx < 0 || hkpx > 2) return InvalidParameter; @@ -224,6 +232,8 @@ GpStatus WINGDIPAPI GdipSetStringFormatLineAlign(GpStringFormat *format, StringAlignment align) { + TRACE("(%p, %i)\n", format, align); + if(!format) return InvalidParameter; @@ -246,6 +256,8 @@ GpStatus WINGDIPAPI GdipSetStringFormatTabStops(GpStringFormat *format, REAL firsttab, INT count, GDIPCONST REAL *tabs) { + TRACE("(%p, %0.2f, %i, %p)\n", format, firsttab, count, tabs); + if(!format || !tabs) return InvalidParameter; @@ -276,6 +288,8 @@ GpStatus WINGDIPAPI GdipSetStringFormatTrimming(GpStringFormat *format, StringTrimming trimming) { + TRACE("(%p, %i)\n", format, trimming); + if(!format) return InvalidParameter; @@ -286,6 +300,8 @@ GpStatus WINGDIPAPI GdipSetStringFormatFlags(GpStringFormat *format, INT flags) { + TRACE("(%p, %x)\n", format, flags); + if(!format) return InvalidParameter;
15 years, 7 months
1
0
0
0
[dchapyshev] 41065: - Sync msctf, mlang, inetmib1, inetcomm with Wine 1.1.22
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Sat May 23 14:31:01 2009 New Revision: 41065 URL:
http://svn.reactos.org/svn/reactos?rev=41065&view=rev
Log: - Sync msctf, mlang, inetmib1, inetcomm with Wine 1.1.22 Added: trunk/reactos/dll/win32/msctf/range.c (with props) Modified: trunk/reactos/dll/win32/inetcomm/smtptransport.c trunk/reactos/dll/win32/inetmib1/main.c trunk/reactos/dll/win32/mlang/mlang.c trunk/reactos/dll/win32/msctf/context.c trunk/reactos/dll/win32/msctf/documentmgr.c trunk/reactos/dll/win32/msctf/inputprocessor.c trunk/reactos/dll/win32/msctf/msctf.c trunk/reactos/dll/win32/msctf/msctf.rbuild trunk/reactos/dll/win32/msctf/msctf_internal.h trunk/reactos/dll/win32/msctf/threadmgr.c Modified: trunk/reactos/dll/win32/inetcomm/smtptransport.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/inetcomm/smtptra…
============================================================================== --- trunk/reactos/dll/win32/inetcomm/smtptransport.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/inetcomm/smtptransport.c [iso-8859-1] Sat May 23 14:31:01 2009 @@ -732,7 +732,7 @@ SMTPTransport *This = (SMTPTransport *)iface; const char szCommandFormat[] = "MAIL FROM: <%s>\n"; char *szCommand; - int len = sizeof(szCommandFormat) - 2 /* "%s" */ + strlen(pszEmailFrom); + int len; HRESULT hr; TRACE("(%s)\n", debugstr_a(pszEmailFrom)); @@ -740,6 +740,7 @@ if (!pszEmailFrom) return E_INVALIDARG; + len = sizeof(szCommandFormat) - 2 /* "%s" */ + strlen(pszEmailFrom); szCommand = HeapAlloc(GetProcessHeap(), 0, len); if (!szCommand) return E_OUTOFMEMORY; @@ -758,7 +759,7 @@ SMTPTransport *This = (SMTPTransport *)iface; const char szCommandFormat[] = "RCPT TO: <%s>\n"; char *szCommand; - int len = sizeof(szCommandFormat) - 2 /* "%s" */ + strlen(pszEmailTo); + int len; HRESULT hr; TRACE("(%s)\n", debugstr_a(pszEmailTo)); @@ -766,6 +767,7 @@ if (!pszEmailTo) return E_INVALIDARG; + len = sizeof(szCommandFormat) - 2 /* "%s" */ + strlen(pszEmailTo); szCommand = HeapAlloc(GetProcessHeap(), 0, len); if (!szCommand) return E_OUTOFMEMORY; @@ -833,7 +835,7 @@ SMTPTransport *This = (SMTPTransport *)iface; const char szCommandFormat[] = "AUTH %s\n"; char *szCommand; - int len = sizeof(szCommandFormat) - 2 /* "%s" */ + strlen(pszAuthType); + int len; HRESULT hr; TRACE("(%s)\n", debugstr_a(pszAuthType)); @@ -841,6 +843,7 @@ if (!pszAuthType) return E_INVALIDARG; + len = sizeof(szCommandFormat) - 2 /* "%s" */ + strlen(pszAuthType); szCommand = HeapAlloc(GetProcessHeap(), 0, len); if (!szCommand) return E_OUTOFMEMORY; Modified: trunk/reactos/dll/win32/inetmib1/main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/inetmib1/main.c?…
============================================================================== --- trunk/reactos/dll/win32/inetmib1/main.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/inetmib1/main.c [iso-8859-1] Sat May 23 14:31:01 2009 @@ -143,7 +143,10 @@ copyInt(&pVarBind->value, &numIfs); if (bPduType == SNMP_PDU_GETNEXT) + { + SnmpUtilOidFree(&pVarBind->name); SnmpUtilOidCpy(&pVarBind->name, &numberOid); + } *pErrorStatus = SNMP_ERRORSTATUS_NOERROR; } else @@ -320,7 +323,27 @@ typedef void (*oidToKeyFunc)(AsnObjectIdentifier *oid, void *dst); typedef int (*compareFunc)(const void *key, const void *value); -static UINT findValueInTable(AsnObjectIdentifier *oid, +/* Finds the first value in the table that matches key. Returns its 1-based + * index if found, or 0 if not found. + */ +static UINT findValueInTable(const void *key, + struct GenericTable *table, size_t tableEntrySize, compareFunc compare) +{ + UINT index = 0; + void *value; + + value = bsearch(key, table->entries, table->numEntries, tableEntrySize, + compare); + if (value) + index = ((BYTE *)value - (BYTE *)table->entries) / tableEntrySize + 1; + return index; +} + +/* Finds the first value in the table that matches oid, using makeKey to + * convert the oid to a key for comparison. Returns the value's 1-based + * index if found, or 0 if not found. + */ +static UINT findOidInTable(AsnObjectIdentifier *oid, struct GenericTable *table, size_t tableEntrySize, oidToKeyFunc makeKey, compareFunc compare) { @@ -329,14 +352,50 @@ if (key) { - void *value; - makeKey(oid, key); - value = bsearch(key, table->entries, table->numEntries, tableEntrySize, - compare); - if (value) - index = ((BYTE *)value - (BYTE *)table->entries) / tableEntrySize - + 1; + index = findValueInTable(key, table, tableEntrySize, compare); + HeapFree(GetProcessHeap(), 0, key); + } + return index; +} + +/* Finds the first successor to the value in the table that does matches oid, + * using makeKey to convert the oid to a key for comparison. A successor is + * a value that does not match oid, so if multiple entries match an oid, only + * the first will ever be returned using this method. + * Returns the successor's 1-based index if found, or 0 if not found. + */ +static UINT findNextOidInTable(AsnObjectIdentifier *oid, + struct GenericTable *table, size_t tableEntrySize, oidToKeyFunc makeKey, + compareFunc compare) +{ + UINT index = 0; + void *key = HeapAlloc(GetProcessHeap(), 0, tableEntrySize); + + if (key) + { + makeKey(oid, key); + index = findValueInTable(key, table, tableEntrySize, compare); + if (index == 0) + { + /* Not found in table. If it's less than the first entry, return + * the first index. Otherwise just return 0 and let the caller + * handle finding the successor. + */ + if (compare(key, table->entries) < 0) + index = 1; + } + else + { + /* Skip any entries that match the same key. This enumeration will + * be incomplete, but it's what Windows appears to do if there are + * multiple entries with the same index in a table, and it avoids + * an infinite loop. + */ + for (++index; index <= table->numEntries && compare(key, + &table->entries[tableEntrySize * index]) == 0; ++index) + ; + } HeapFree(GetProcessHeap(), 0, key); } return index; @@ -397,12 +456,12 @@ } else { - AsnObjectIdentifier ipOid = { instanceLen, + AsnObjectIdentifier instanceOid = { instanceLen, oid->ids + base->idLength + 1 }; - *instance = findValueInTable(&ipOid, table, tableEntrySize, - makeKey, compare) + 1; - if (*instance > table->numEntries) + *instance = findNextOidInTable(&instanceOid, table, + tableEntrySize, makeKey, compare); + if (!*instance || *instance > table->numEntries) ret = SNMP_ERRORSTATUS_NOSUCHNAME; } } @@ -418,10 +477,10 @@ ret = SNMP_ERRORSTATUS_NOSUCHNAME; else { - AsnObjectIdentifier ipOid = { instanceLen, + AsnObjectIdentifier instanceOid = { instanceLen, oid->ids + base->idLength + 1 }; - *instance = findValueInTable(&ipOid, table, tableEntrySize, + *instance = findOidInTable(&instanceOid, table, tableEntrySize, makeKey, compare); if (!*instance) ret = SNMP_ERRORSTATUS_NOSUCHNAME; @@ -440,6 +499,7 @@ AsnObjectIdentifier oid; INT ret; + SnmpUtilOidFree(dst); ret = SnmpUtilOidCpy(dst, base); if (ret) { @@ -1311,7 +1371,7 @@ * so we have to continue until an implementation handles the * query or we exhaust the table of supported OIDs. */ - for (; error == SNMP_ERRORSTATUS_NOSUCHNAME && + for (matchingIndex++; error == SNMP_ERRORSTATUS_NOSUCHNAME && matchingIndex < DEFINE_SIZEOF(supportedIDs); matchingIndex++) { Modified: trunk/reactos/dll/win32/mlang/mlang.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mlang/mlang.c?re…
============================================================================== --- trunk/reactos/dll/win32/mlang/mlang.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mlang/mlang.c [iso-8859-1] Sat May 23 14:31:01 2009 @@ -1939,7 +1939,7 @@ } if (pdwCodePages) *pdwCodePages = cps; - if (pcchCodePages) *pcchCodePages = i; + if (pcchCodePages) *pcchCodePages = min( i + 1, cchSrc ); return S_OK; } Modified: trunk/reactos/dll/win32/msctf/context.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/context.c?…
============================================================================== --- trunk/reactos/dll/win32/msctf/context.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/context.c [iso-8859-1] Sat May 23 14:31:01 2009 @@ -58,14 +58,24 @@ typedef struct tagContext { const ITfContextVtbl *ContextVtbl; const ITfSourceVtbl *SourceVtbl; + /* const ITfContextCompositionVtbl *ContextCompositionVtbl; */ + /* const ITfContextOwnerCompositionServicesVtbl *ContextOwnerCompositionServicesVtbl; */ + /* const ITfContextOwnerServicesVtbl *ContextOwnerServicesVtbl; */ + /* const ITfInsertAtSelectionVtbl *InsertAtSelectionVtbl; */ + /* const ITfMouseTrackerVtbl *MouseTrackerVtbl; */ + /* const ITfQueryEmbeddedVtbl *QueryEmbeddedVtbl; */ + /* const ITfSourceSingleVtbl *SourceSingleVtbl; */ LONG refCount; + BOOL connected; TfClientId tidOwner; + TfEditCookie defaultCookie; ITextStoreACP *pITextStoreACP; ITfContextOwnerCompositionSink *pITfContextOwnerCompositionSink; ITextStoreACPSink *pITextStoreACPSink; + ITfEditSession* currentEditSession; /* kept as separate lists to reduce unnecessary iterations */ struct list pContextKeyEventSink; @@ -76,9 +86,14 @@ } Context; +typedef struct tagEditCookie { + DWORD lockType; + Context *pOwningContext; +} EditCookie; typedef struct tagTextStoreACPSink { const ITextStoreACPSinkVtbl *TextStoreACPSinkVtbl; + /* const ITextStoreACPServicesVtbl *TextStoreACPServicesVtbl; */ LONG refCount; Context *pContext; @@ -101,6 +116,7 @@ static void Context_Destructor(Context *This) { struct list *cursor, *cursor2; + EditCookie *cookie; TRACE("destroying %p\n", This); if (This->pITextStoreACPSink) @@ -114,6 +130,13 @@ if (This->pITfContextOwnerCompositionSink) ITextStoreACPSink_Release(This->pITfContextOwnerCompositionSink); + + if (This->defaultCookie) + { + cookie = remove_Cookie(This->defaultCookie); + HeapFree(GetProcessHeap(),0,cookie); + This->defaultCookie = 0; + } LIST_FOR_EACH_SAFE(cursor, cursor2, &This->pContextKeyEventSink) { @@ -197,9 +220,53 @@ TfClientId tid, ITfEditSession *pes, DWORD dwFlags, HRESULT *phrSession) { - Context *This = (Context *)iface; - FIXME("STUB:(%p)\n",This); - return E_NOTIMPL; + HRESULT hr; + Context *This = (Context *)iface; + DWORD dwLockFlags = 0x0; + TS_STATUS status; + + TRACE("(%p) %i %p %x %p\n",This, tid, pes, dwFlags, phrSession); + + if (!(dwFlags & TF_ES_READ) && !(dwFlags & TF_ES_READWRITE)) + { + *phrSession = E_FAIL; + return E_INVALIDARG; + } + + if (!This->pITextStoreACP) + { + FIXME("No ITextStoreACP avaliable\n"); + *phrSession = E_FAIL; + return E_FAIL; + } + + if (!(dwFlags & TF_ES_ASYNC)) + dwLockFlags |= TS_LF_SYNC; + + if ((dwFlags & TF_ES_READWRITE) == TF_ES_READWRITE) + dwLockFlags |= TS_LF_READWRITE; + else if (dwFlags & TF_ES_READ) + dwLockFlags |= TS_LF_READ; + + /* TODO: cache this */ + ITextStoreACP_GetStatus(This->pITextStoreACP, &status); + + if (((dwFlags & TF_ES_READWRITE) == TF_ES_READWRITE) && (status.dwDynamicFlags & TS_SD_READONLY)) + { + *phrSession = TS_E_READONLY; + return S_OK; + } + + if (FAILED (ITfEditSession_QueryInterface(pes, &IID_ITfEditSession, (LPVOID*)&This->currentEditSession))) + { + *phrSession = E_FAIL; + return E_INVALIDARG; + } + + + hr = ITextStoreACP_RequestLock(This->pITextStoreACP, dwLockFlags, phrSession); + + return hr; } static HRESULT WINAPI Context_InWriteSession (ITfContext *iface, @@ -216,8 +283,59 @@ TF_SELECTION *pSelection, ULONG *pcFetched) { Context *This = (Context *)iface; - FIXME("STUB:(%p)\n",This); - return E_NOTIMPL; + EditCookie *cookie; + ULONG count, i; + ULONG totalFetched = 0; + HRESULT hr = S_OK; + + if (!pSelection || !pcFetched) + return E_INVALIDARG; + + *pcFetched = 0; + + if (!This->connected) + return TF_E_DISCONNECTED; + + if (get_Cookie_magic(ec)!=COOKIE_MAGIC_EDITCOOKIE) + return TF_E_NOLOCK; + + if (!This->pITextStoreACP) + { + FIXME("Context does not have a ITextStoreACP\n"); + return E_NOTIMPL; + } + + cookie = get_Cookie_data(ec); + + if (ulIndex == TF_DEFAULT_SELECTION) + count = 1; + else + count = ulCount; + + for (i = 0; i < count; i++) + { + DWORD fetched; + TS_SELECTION_ACP acps; + + hr = ITextStoreACP_GetSelection(This->pITextStoreACP, ulIndex + i, + 1, &acps, &fetched); + + if (hr == TS_E_NOLOCK) + return TF_E_NOLOCK; + else if (SUCCEEDED(hr)) + { + pSelection[totalFetched].style.ase = acps.style.ase; + pSelection[totalFetched].style.fInterimChar = acps.style.fInterimChar; + Range_Constructor(iface, This->pITextStoreACP, cookie->lockType, acps.acpStart, acps.acpEnd, &pSelection[totalFetched].range); + totalFetched ++; + } + else + break; + } + + *pcFetched = totalFetched; + + return hr; } static HRESULT WINAPI Context_SetSelection (ITfContext *iface, @@ -232,16 +350,53 @@ TfEditCookie ec, ITfRange **ppStart) { Context *This = (Context *)iface; - FIXME("STUB:(%p)\n",This); - return E_NOTIMPL; + EditCookie *cookie; + TRACE("(%p) %i %p\n",This,ec,ppStart); + + if (!ppStart) + return E_INVALIDARG; + + *ppStart = NULL; + + if (!This->connected) + return TF_E_DISCONNECTED; + + if (get_Cookie_magic(ec)!=COOKIE_MAGIC_EDITCOOKIE) + return TF_E_NOLOCK; + + cookie = get_Cookie_data(ec); + return Range_Constructor(iface, This->pITextStoreACP, cookie->lockType, 0, 0, ppStart); } static HRESULT WINAPI Context_GetEnd (ITfContext *iface, TfEditCookie ec, ITfRange **ppEnd) { Context *This = (Context *)iface; - FIXME("STUB:(%p)\n",This); - return E_NOTIMPL; + EditCookie *cookie; + LONG end; + TRACE("(%p) %i %p\n",This,ec,ppEnd); + + if (!ppEnd) + return E_INVALIDARG; + + *ppEnd = NULL; + + if (!This->connected) + return TF_E_DISCONNECTED; + + if (get_Cookie_magic(ec)!=COOKIE_MAGIC_EDITCOOKIE) + return TF_E_NOLOCK; + + if (!This->pITextStoreACP) + { + FIXME("Context does not have a ITextStoreACP\n"); + return E_NOTIMPL; + } + + cookie = get_Cookie_data(ec); + ITextStoreACP_GetEndACP(This->pITextStoreACP,&end); + + return Range_Constructor(iface, This->pITextStoreACP, cookie->lockType, end, end, ppEnd); } static HRESULT WINAPI Context_GetActiveView (ITfContext *iface, @@ -376,7 +531,7 @@ es = HeapAlloc(GetProcessHeap(),0,sizeof(ContextSink)); if (!es) return E_OUTOFMEMORY; - if (!SUCCEEDED(IUnknown_QueryInterface(punk, riid, (LPVOID*)&es->interfaces.pITfTextEditSink))) + if (FAILED(IUnknown_QueryInterface(punk, riid, (LPVOID *)&es->interfaces.pITfTextEditSink))) { HeapFree(GetProcessHeap(),0,es); return CONNECT_E_CANNOTCONNECT; @@ -427,10 +582,18 @@ HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfContext **ppOut, TfEditCookie *pecTextStore) { Context *This; + EditCookie *cookie; This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(Context)); if (This == NULL) return E_OUTOFMEMORY; + + cookie = HeapAlloc(GetProcessHeap(),0,sizeof(EditCookie)); + if (cookie == NULL) + { + HeapFree(GetProcessHeap(),0,This); + return E_OUTOFMEMORY; + } TRACE("(%p) %x %p %p %p\n",This, tidOwner, punk, ppOut, pecTextStore); @@ -438,16 +601,15 @@ This->SourceVtbl = &Context_SourceVtbl; This->refCount = 1; This->tidOwner = tidOwner; + This->connected = FALSE; + + cookie->lockType = TF_ES_READ; + cookie->pOwningContext = This; if (punk) { - if (SUCCEEDED(IUnknown_QueryInterface(punk, &IID_ITextStoreACP, - (LPVOID*)&This->pITextStoreACP))) - { - if (SUCCEEDED(TextStoreACPSink_Constructor(&This->pITextStoreACPSink, This))) - ITextStoreACP_AdviseSink(This->pITextStoreACP, &IID_ITextStoreACPSink, - (IUnknown*)This->pITextStoreACPSink, TS_AS_ALL_SINKS); - } + IUnknown_QueryInterface(punk, &IID_ITextStoreACP, + (LPVOID*)&This->pITextStoreACP); IUnknown_QueryInterface(punk, &IID_ITfContextOwnerCompositionSink, (LPVOID*)&This->pITfContextOwnerCompositionSink); @@ -456,10 +618,8 @@ FIXME("Unhandled pUnk\n"); } - TRACE("returning %p\n", This); - *ppOut = (ITfContext*)This; - /* FIXME */ - *pecTextStore = 0xdeaddead; + This->defaultCookie = generate_Cookie(COOKIE_MAGIC_EDITCOOKIE,cookie); + *pecTextStore = This->defaultCookie; list_init(&This->pContextKeyEventSink); list_init(&This->pEditTransactionSink); @@ -467,6 +627,37 @@ list_init(&This->pTextEditSink); list_init(&This->pTextLayoutSink); + *ppOut = (ITfContext*)This; + TRACE("returning %p\n", This); + + return S_OK; +} + +HRESULT Context_Initialize(ITfContext *iface) +{ + Context *This = (Context *)iface; + + if (This->pITextStoreACP) + { + if (SUCCEEDED(TextStoreACPSink_Constructor(&This->pITextStoreACPSink, This))) + ITextStoreACP_AdviseSink(This->pITextStoreACP, &IID_ITextStoreACPSink, + (IUnknown*)This->pITextStoreACPSink, TS_AS_ALL_SINKS); + } + This->connected = TRUE; + return S_OK; +} + +HRESULT Context_Uninitialize(ITfContext *iface) +{ + Context *This = (Context *)iface; + + if (This->pITextStoreACPSink) + { + ITextStoreACP_UnadviseSink(This->pITextStoreACP, (IUnknown*)This->pITextStoreACPSink); + if (ITextStoreACPSink_Release(This->pITextStoreACPSink) == 0) + This->pITextStoreACPSink = NULL; + } + This->connected = FALSE; return S_OK; } @@ -564,8 +755,36 @@ DWORD dwLockFlags) { TextStoreACPSink *This = (TextStoreACPSink *)iface; - FIXME("STUB:(%p)\n",This); - return E_NOTIMPL; + HRESULT hr; + EditCookie *cookie; + TfEditCookie ec; + + TRACE("(%p) %x\n",This, dwLockFlags); + + if (!This->pContext || !This->pContext->currentEditSession) + { + ERR("OnLockGranted called on a context without a current edit session\n"); + return E_FAIL; + } + + cookie = HeapAlloc(GetProcessHeap(),0,sizeof(EditCookie)); + if (!cookie) + return E_OUTOFMEMORY; + + cookie->lockType = dwLockFlags; + cookie->pOwningContext = This->pContext; + ec = generate_Cookie(COOKIE_MAGIC_EDITCOOKIE, cookie); + + hr = ITfEditSession_DoEditSession(This->pContext->currentEditSession, ec); + + ITfEditSession_Release(This->pContext->currentEditSession); + This->pContext->currentEditSession = NULL; + + /* Edit Cookie is only valid during the edit session */ + cookie = remove_Cookie(ec); + HeapFree(GetProcessHeap(),0,cookie); + + return hr; } static HRESULT WINAPI TextStoreACPSink_OnStartEditTransaction(ITextStoreACPSink *iface) Modified: trunk/reactos/dll/win32/msctf/documentmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/documentmg…
============================================================================== --- trunk/reactos/dll/win32/msctf/documentmgr.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/documentmgr.c [iso-8859-1] Sat May 23 14:31:01 2009 @@ -138,6 +138,7 @@ This->contextStack[0] = check; ITfThreadMgrEventSink_OnPushContext(This->ThreadMgrSink,check); + Context_Initialize(check); return S_OK; } @@ -153,11 +154,13 @@ { ITfThreadMgrEventSink_OnPopContext(This->ThreadMgrSink,This->contextStack[0]); ITfContext_Release(This->contextStack[0]); + Context_Uninitialize(This->contextStack[0]); } if (This->contextStack[1]) { ITfThreadMgrEventSink_OnPopContext(This->ThreadMgrSink,This->contextStack[1]); ITfContext_Release(This->contextStack[1]); + Context_Uninitialize(This->contextStack[1]); } This->contextStack[0] = This->contextStack[1] = NULL; ITfThreadMgrEventSink_OnUninitDocumentMgr(This->ThreadMgrSink, iface); @@ -172,6 +175,7 @@ ITfThreadMgrEventSink_OnPopContext(This->ThreadMgrSink,This->contextStack[0]); ITfContext_Release(This->contextStack[0]); + Context_Uninitialize(This->contextStack[0]); This->contextStack[0] = This->contextStack[1]; This->contextStack[1] = NULL; Modified: trunk/reactos/dll/win32/msctf/inputprocessor.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/inputproce…
============================================================================== --- trunk/reactos/dll/win32/msctf/inputprocessor.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/inputprocessor.c [iso-8859-1] Sat May 23 14:31:01 2009 @@ -32,8 +32,10 @@ #include "shlwapi.h" #include "winerror.h" #include "objbase.h" +#include "olectl.h" #include "wine/unicode.h" +#include "wine/list.h" #include "msctf.h" #include "msctf_internal.h" @@ -45,11 +47,26 @@ static const WCHAR szwTipfmt[] = {'%','s','\\','%','s',0}; static const WCHAR szwFullLangfmt[] = {'%','s','\\','%','s','\\','%','s','\\','0','x','%','0','8','x','\\','%','s',0}; +typedef struct tagInputProcessorProfilesSink { + struct list entry; + union { + /* InputProcessorProfile Sinks */ + IUnknown *pIUnknown; + ITfLanguageProfileNotifySink *pITfLanguageProfileNotifySink; + } interfaces; +} InputProcessorProfilesSink; + typedef struct tagInputProcessorProfiles { const ITfInputProcessorProfilesVtbl *InputProcessorProfilesVtbl; + const ITfSourceVtbl *SourceVtbl; + /* const ITfInputProcessorProfileMgrVtbl *InputProcessorProfileMgrVtbl; */ + /* const ITfInputProcessorProfilesExVtbl *InputProcessorProfilesExVtbl; */ + /* const ITfInputProcessorProfileSubstituteLayoutVtbl *InputProcessorProfileSubstituteLayoutVtbl; */ LONG refCount; LANGID currentLanguage; + + struct list LanguageProfileNotifySink; } InputProcessorProfiles; typedef struct tagProfilesEnumGuid { @@ -78,9 +95,30 @@ static HRESULT ProfilesEnumGuid_Constructor(IEnumGUID **ppOut); static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, IEnumTfLanguageProfiles **ppOut); +static inline InputProcessorProfiles *impl_from_ITfSourceVtbl(ITfSource *iface) +{ + return (InputProcessorProfiles *)((char *)iface - FIELD_OFFSET(InputProcessorProfiles,SourceVtbl)); +} + +static void free_sink(InputProcessorProfilesSink *sink) +{ + IUnknown_Release(sink->interfaces.pIUnknown); + HeapFree(GetProcessHeap(),0,sink); +} + static void InputProcessorProfiles_Destructor(InputProcessorProfiles *This) { + struct list *cursor, *cursor2; TRACE("destroying %p\n", This); + + /* free sinks */ + LIST_FOR_EACH_SAFE(cursor, cursor2, &This->LanguageProfileNotifySink) + { + InputProcessorProfilesSink* sink = LIST_ENTRY(cursor,InputProcessorProfilesSink,entry); + list_remove(cursor); + free_sink(sink); + } + HeapFree(GetProcessHeap(),0,This); } @@ -121,6 +159,10 @@ if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfInputProcessorProfiles)) { *ppvOut = This; + } + else if (IsEqualIID(iid, &IID_ITfSource)) + { + *ppvOut = &This->SourceVtbl; } if (*ppvOut) @@ -536,6 +578,92 @@ InputProcessorProfiles_SubstituteKeyboardLayout }; +/***************************************************** + * ITfSource functions + *****************************************************/ +static HRESULT WINAPI IPPSource_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut) +{ + InputProcessorProfiles *This = impl_from_ITfSourceVtbl(iface); + return InputProcessorProfiles_QueryInterface((ITfInputProcessorProfiles *)This, iid, *ppvOut); +} + +static ULONG WINAPI IPPSource_AddRef(ITfSource *iface) +{ + InputProcessorProfiles *This = impl_from_ITfSourceVtbl(iface); + return InputProcessorProfiles_AddRef((ITfInputProcessorProfiles*)This); +} + +static ULONG WINAPI IPPSource_Release(ITfSource *iface) +{ + InputProcessorProfiles *This = impl_from_ITfSourceVtbl(iface); + return InputProcessorProfiles_Release((ITfInputProcessorProfiles *)This); +} + +static WINAPI HRESULT IPPSource_AdviseSink(ITfSource *iface, + REFIID riid, IUnknown *punk, DWORD *pdwCookie) +{ + InputProcessorProfilesSink *ipps; + InputProcessorProfiles *This = impl_from_ITfSourceVtbl(iface); + + TRACE("(%p) %s %p %p\n",This,debugstr_guid(riid),punk,pdwCookie); + + if (!riid || !punk || !pdwCookie) + return E_INVALIDARG; + + if (IsEqualIID(riid, &IID_ITfLanguageProfileNotifySink)) + { + ipps = HeapAlloc(GetProcessHeap(),0,sizeof(InputProcessorProfilesSink)); + if (!ipps) + return E_OUTOFMEMORY; + if (FAILED(IUnknown_QueryInterface(punk, riid, (LPVOID *)&ipps->interfaces.pITfLanguageProfileNotifySink))) + { + HeapFree(GetProcessHeap(),0,ipps); + return CONNECT_E_CANNOTCONNECT; + } + list_add_head(&This->LanguageProfileNotifySink,&ipps->entry); + *pdwCookie = generate_Cookie(COOKIE_MAGIC_IPPSINK, ipps); + } + else + { + FIXME("(%p) Unhandled Sink: %s\n",This,debugstr_guid(riid)); + return E_NOTIMPL; + } + + TRACE("cookie %x\n",*pdwCookie); + + return S_OK; +} + +static WINAPI HRESULT IPPSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie) +{ + InputProcessorProfilesSink *sink; + InputProcessorProfiles *This = impl_from_ITfSourceVtbl(iface); + + TRACE("(%p) %x\n",This,pdwCookie); + + if (get_Cookie_magic(pdwCookie)!=COOKIE_MAGIC_IPPSINK) + return E_INVALIDARG; + + sink = (InputProcessorProfilesSink*)remove_Cookie(pdwCookie); + if (!sink) + return CONNECT_E_NOCONNECTION; + + list_remove(&sink->entry); + free_sink(sink); + + return S_OK; +} + +static const ITfSourceVtbl InputProcessorProfiles_SourceVtbl = +{ + IPPSource_QueryInterface, + IPPSource_AddRef, + IPPSource_Release, + + IPPSource_AdviseSink, + IPPSource_UnadviseSink, +}; + HRESULT InputProcessorProfiles_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) { InputProcessorProfiles *This; @@ -547,8 +675,11 @@ return E_OUTOFMEMORY; This->InputProcessorProfilesVtbl= &InputProcessorProfiles_InputProcessorProfilesVtbl; + This->SourceVtbl = &InputProcessorProfiles_SourceVtbl; This->refCount = 1; This->currentLanguage = GetUserDefaultLCID(); + + list_init(&This->LanguageProfileNotifySink); TRACE("returning %p\n", This); *ppOut = (IUnknown *)This; Modified: trunk/reactos/dll/win32/msctf/msctf.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/msctf.c?re…
============================================================================== --- trunk/reactos/dll/win32/msctf/msctf.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/msctf.c [iso-8859-1] Sat May 23 14:31:01 2009 @@ -55,6 +55,7 @@ TF_LANGUAGEPROFILE LanguageProfile; ITfTextInputProcessor *pITfTextInputProcessor; ITfThreadMgr *pITfThreadMgr; + ITfKeyEventSink *pITfKeyEventSink; TfClientId tid; } ActivatedTextService; @@ -357,14 +358,6 @@ actsvr = HeapAlloc(GetProcessHeap(),0,sizeof(ActivatedTextService)); if (!actsvr) return E_OUTOFMEMORY; - entry = HeapAlloc(GetProcessHeap(),0,sizeof(AtsEntry)); - - if (!entry) - { - HeapFree(GetProcessHeap(),0,actsvr); - return E_OUTOFMEMORY; - } - ITfThreadMgr_QueryInterface(tm,&IID_ITfClientId,(LPVOID)&clientid); ITfClientId_GetClientId(clientid, &lp->clsid, &actsvr->tid); ITfClientId_Release(clientid); @@ -378,6 +371,7 @@ actsvr->pITfTextInputProcessor = NULL; actsvr->LanguageProfile = *lp; actsvr->LanguageProfile.fActive = TRUE; + actsvr->pITfKeyEventSink = NULL; /* get TIP category */ if (SUCCEEDED(CategoryMgr_Constructor(NULL,(IUnknown**)&catmgr))) @@ -401,6 +395,14 @@ if (activated > 0) activate_given_ts(actsvr, tm); + + entry = HeapAlloc(GetProcessHeap(),0,sizeof(AtsEntry)); + + if (!entry) + { + HeapFree(GetProcessHeap(),0,actsvr); + return E_OUTOFMEMORY; + } entry->ats = actsvr; list_add_head(&AtsList, &entry->entry); @@ -454,6 +456,50 @@ deactivate_given_ts(ats->ats); return S_OK; +} + +CLSID get_textservice_clsid(TfClientId tid) +{ + AtsEntry *ats; + + LIST_FOR_EACH_ENTRY(ats, &AtsList, AtsEntry, entry) + if (ats->ats->tid == tid) + return ats->ats->LanguageProfile.clsid; + return GUID_NULL; +} + +HRESULT get_textservice_sink(TfClientId tid, REFCLSID iid, IUnknown **sink) +{ + AtsEntry *ats; + + if (!IsEqualCLSID(iid,&IID_ITfKeyEventSink)) + return E_NOINTERFACE; + + LIST_FOR_EACH_ENTRY(ats, &AtsList, AtsEntry, entry) + if (ats->ats->tid == tid) + { + *sink = (IUnknown*)ats->ats->pITfKeyEventSink; + return S_OK; + } + + return E_FAIL; +} + +HRESULT set_textservice_sink(TfClientId tid, REFCLSID iid, IUnknown* sink) +{ + AtsEntry *ats; + + if (!IsEqualCLSID(iid,&IID_ITfKeyEventSink)) + return E_NOINTERFACE; + + LIST_FOR_EACH_ENTRY(ats, &AtsList, AtsEntry, entry) + if (ats->ats->tid == tid) + { + ats->ats->pITfKeyEventSink = (ITfKeyEventSink*)sink; + return S_OK; + } + + return E_FAIL; } /************************************************************************* Modified: trunk/reactos/dll/win32/msctf/msctf.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/msctf.rbui…
============================================================================== --- trunk/reactos/dll/win32/msctf/msctf.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/msctf.rbuild [iso-8859-1] Sat May 23 14:31:01 2009 @@ -13,6 +13,7 @@ <file>documentmgr.c</file> <file>inputprocessor.c</file> <file>msctf.c</file> + <file>range.c</file> <file>regsvr.c</file> <file>threadmgr.c</file> <file>version.rc</file> Modified: trunk/reactos/dll/win32/msctf/msctf_internal.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/msctf_inte…
============================================================================== --- trunk/reactos/dll/win32/msctf/msctf_internal.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/msctf_internal.h [iso-8859-1] Sat May 23 14:31:01 2009 @@ -24,6 +24,8 @@ #define COOKIE_MAGIC_TMSINK 0x0010 #define COOKIE_MAGIC_CONTEXTSINK 0x0020 #define COOKIE_MAGIC_GUIDATOM 0x0030 +#define COOKIE_MAGIC_IPPSINK 0x0040 +#define COOKIE_MAGIC_EDITCOOKIE 0x0050 extern DWORD tlsIndex; extern TfClientId processId; @@ -33,6 +35,10 @@ extern HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfContext **ppOut, TfEditCookie *pecTextStore); extern HRESULT InputProcessorProfiles_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut); extern HRESULT CategoryMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut); +extern HRESULT Range_Constructor(ITfContext *context, ITextStoreACP *textstore, DWORD lockType, DWORD anchorStart, DWORD anchorEnd, ITfRange **ppOut); + +extern HRESULT Context_Initialize(ITfContext *cxt); +extern HRESULT Context_Uninitialize(ITfContext *cxt); /* cookie function */ extern DWORD generate_Cookie(DWORD magic, LPVOID data); @@ -47,5 +53,9 @@ extern HRESULT activate_textservices(ITfThreadMgr *tm); extern HRESULT deactivate_textservices(void); +extern CLSID get_textservice_clsid(TfClientId tid); +extern HRESULT get_textservice_sink(TfClientId tid, REFCLSID iid, IUnknown** sink); +extern HRESULT set_textservice_sink(TfClientId tid, REFCLSID iid, IUnknown* sink); + extern const WCHAR szwSystemTIPKey[]; #endif /* __WINE_MSCTF_I_H */ Added: trunk/reactos/dll/win32/msctf/range.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/range.c?re…
============================================================================== --- trunk/reactos/dll/win32/msctf/range.c (added) +++ trunk/reactos/dll/win32/msctf/range.c [iso-8859-1] Sat May 23 14:31:01 2009 @@ -1,0 +1,333 @@ +/* + * ITfRange implementation + * + * Copyright 2009 Aric Stewart, CodeWeavers + * + * 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> + +#define COBJMACROS + +#include "wine/debug.h" +#include "windef.h" +#include "winbase.h" +#include "winreg.h" +#include "winuser.h" +#include "shlwapi.h" +#include "winerror.h" +#include "objbase.h" + +#include "wine/unicode.h" + +#include "msctf.h" +#include "msctf_internal.h" + +WINE_DEFAULT_DEBUG_CHANNEL(msctf); + +typedef struct tagRange { + const ITfRangeVtbl *RangeVtbl; + /* const ITfRangeACPVtb *RangeACPVtbl; */ + LONG refCount; + + ITextStoreACP *pITextStoreACP; + ITfContext *pITfContext; + + DWORD lockType; + TfGravity gravityStart, gravityEnd; + DWORD anchorStart, anchorEnd; + +} Range; + +static void Range_Destructor(Range *This) +{ + TRACE("destroying %p\n", This); + HeapFree(GetProcessHeap(),0,This); +} + +static HRESULT WINAPI Range_QueryInterface(ITfRange *iface, REFIID iid, LPVOID *ppvOut) +{ + Range *This = (Range*)iface; + *ppvOut = NULL; + + if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfRange)) + { + *ppvOut = This; + } + + if (*ppvOut) + { + IUnknown_AddRef(iface); + return S_OK; + } + + WARN("unsupported interface: %s\n", debugstr_guid(iid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI Range_AddRef(ITfRange *iface) +{ + Range *This = (Range *)iface; + return InterlockedIncrement(&This->refCount); +} + +static ULONG WINAPI Range_Release(ITfRange *iface) +{ + Range *This = (Range *)iface; + ULONG ret; + + ret = InterlockedDecrement(&This->refCount); + if (ret == 0) + Range_Destructor(This); + return ret; +} + +/***************************************************** + * ITfRange functions + *****************************************************/ + +static HRESULT WINAPI Range_GetText(ITfRange *iface, TfEditCookie ec, + DWORD dwFlags, WCHAR *pchText, ULONG cchMax, ULONG *pcch) +{ + Range *This = (Range *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI Range_SetText(ITfRange *iface, TfEditCookie ec, + DWORD dwFlags, const WCHAR *pchText, LONG cch) +{ + Range *This = (Range *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI Range_GetFormattedText(ITfRange *iface, TfEditCookie ec, + IDataObject **ppDataObject) +{ + Range *This = (Range *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI Range_GetEmbedded(ITfRange *iface, TfEditCookie ec, + REFGUID rguidService, REFIID riid, IUnknown **ppunk) +{ + Range *This = (Range *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI Range_InsertEmbedded(ITfRange *iface, TfEditCookie ec, + DWORD dwFlags, IDataObject *pDataObject) +{ + Range *This = (Range *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI Range_ShiftStart(ITfRange *iface, TfEditCookie ec, + LONG cchReq, LONG *pcch, const TF_HALTCOND *pHalt) +{ + Range *This = (Range *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI Range_ShiftEnd(ITfRange *iface, TfEditCookie ec, + LONG cchReq, LONG *pcch, const TF_HALTCOND *pHalt) +{ + Range *This = (Range *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI Range_ShiftStartToRange(ITfRange *iface, TfEditCookie ec, + ITfRange *pRange, TfAnchor aPos) +{ + Range *This = (Range *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI Range_ShiftEndToRange(ITfRange *iface, TfEditCookie ec, + ITfRange *pRange, TfAnchor aPos) +{ + Range *This = (Range *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI Range_ShiftStartRegion(ITfRange *iface, TfEditCookie ec, + TfShiftDir dir, BOOL *pfNoRegion) +{ + Range *This = (Range *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI Range_ShiftEndRegion(ITfRange *iface, TfEditCookie ec, + TfShiftDir dir, BOOL *pfNoRegion) +{ + Range *This = (Range *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI Range_IsEmpty(ITfRange *iface, TfEditCookie ec, + BOOL *pfEmpty) +{ + Range *This = (Range *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI Range_Collapse(ITfRange *iface, TfEditCookie ec, + TfAnchor aPos) +{ + Range *This = (Range *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI Range_IsEqualStart(ITfRange *iface, TfEditCookie ec, + ITfRange *pWith, TfAnchor aPos, BOOL *pfEqual) +{ + Range *This = (Range *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI Range_IsEqualEnd(ITfRange *iface, TfEditCookie ec, + ITfRange *pWith, TfAnchor aPos, BOOL *pfEqual) +{ + Range *This = (Range *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI Range_CompareStart(ITfRange *iface, TfEditCookie ec, + ITfRange *pWith, TfAnchor aPos, LONG *plResult) +{ + Range *This = (Range *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI Range_CompareEnd(ITfRange *iface, TfEditCookie ec, + ITfRange *pWith, TfAnchor aPos, LONG *plResult) +{ + Range *This = (Range *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI Range_AdjustForInsert(ITfRange *iface, TfEditCookie ec, + ULONG cchInsert, BOOL *pfInsertOk) +{ + Range *This = (Range *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI Range_GetGravity(ITfRange *iface, + TfGravity *pgStart, TfGravity *pgEnd) +{ + Range *This = (Range *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI Range_SetGravity(ITfRange *iface, TfEditCookie ec, + TfGravity gStart, TfGravity gEnd) +{ + Range *This = (Range *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI Range_Clone(ITfRange *iface, ITfRange **ppClone) +{ + Range *This = (Range *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI Range_GetContext(ITfRange *iface, ITfContext **ppContext) +{ + Range *This = (Range *)iface; + TRACE("(%p)\n",This); + if (!ppContext) + return E_INVALIDARG; + *ppContext = This->pITfContext; + return S_OK; +} + +static const ITfRangeVtbl Range_RangeVtbl = +{ + Range_QueryInterface, + Range_AddRef, + Range_Release, + + Range_GetText, + Range_SetText, + Range_GetFormattedText, + Range_GetEmbedded, + Range_InsertEmbedded, + Range_ShiftStart, + Range_ShiftEnd, + Range_ShiftStartToRange, + Range_ShiftEndToRange, + Range_ShiftStartRegion, + Range_ShiftEndRegion, + Range_IsEmpty, + Range_Collapse, + Range_IsEqualStart, + Range_IsEqualEnd, + Range_CompareStart, + Range_CompareEnd, + Range_AdjustForInsert, + Range_GetGravity, + Range_SetGravity, + Range_Clone, + Range_GetContext +}; + +HRESULT Range_Constructor(ITfContext *context, ITextStoreACP *textstore, DWORD lockType, DWORD anchorStart, DWORD anchorEnd, ITfRange **ppOut) +{ + Range *This; + + This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(Range)); + if (This == NULL) + return E_OUTOFMEMORY; + + TRACE("(%p) %p %p\n",This, context, textstore); + + This->RangeVtbl= &Range_RangeVtbl; + This->refCount = 1; + This->pITfContext = context; + This->pITextStoreACP = textstore; + This->lockType = lockType; + This->anchorStart = anchorStart; + This->anchorEnd = anchorEnd; + + *ppOut = (ITfRange*)This; + TRACE("returning %p\n", This); + + return S_OK; +} Propchange: trunk/reactos/dll/win32/msctf/range.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/dll/win32/msctf/threadmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/threadmgr.…
============================================================================== --- trunk/reactos/dll/win32/msctf/threadmgr.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/threadmgr.c [iso-8859-1] Sat May 23 14:31:01 2009 @@ -71,12 +71,20 @@ const ITfKeystrokeMgrVtbl *KeystrokeMgrVtbl; const ITfMessagePumpVtbl *MessagePumpVtbl; const ITfClientIdVtbl *ClientIdVtbl; + /* const ITfThreadMgrExVtbl *ThreadMgrExVtbl; */ + /* const ITfConfigureSystemKeystrokeFeedVtbl *ConfigureSystemKeystrokeFeedVtbl; */ + /* const ITfLangBarItemMgrVtbl *LangBarItemMgrVtbl; */ + /* const ITfUIElementMgrVtbl *UIElementMgrVtbl; */ + /* const ITfSourceSingleVtbl *SourceSingleVtbl; */ LONG refCount; const ITfThreadMgrEventSinkVtbl *ThreadMgrEventSinkVtbl; /* internal */ ITfDocumentMgr *focus; LONG activationCount; + + ITfKeyEventSink *forgroundKeyEventSink; + CLSID forgroundTextService; struct list CurrentPreservedKeys; @@ -434,7 +442,7 @@ tms = HeapAlloc(GetProcessHeap(),0,sizeof(ThreadMgrSink)); if (!tms) return E_OUTOFMEMORY; - if (!SUCCEEDED(IUnknown_QueryInterface(punk, riid, (LPVOID*)&tms->interfaces.pITfThreadMgrEventSink))) + if (FAILED(IUnknown_QueryInterface(punk, riid, (LPVOID *)&tms->interfaces.pITfThreadMgrEventSink))) { HeapFree(GetProcessHeap(),0,tms); return CONNECT_E_CANNOTCONNECT; @@ -509,24 +517,87 @@ TfClientId tid, ITfKeyEventSink *pSink, BOOL fForeground) { ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); - FIXME("STUB:(%p)\n",This); - return E_NOTIMPL; + CLSID textservice; + ITfKeyEventSink *check = NULL; + + TRACE("(%p) %x %p %i\n",This,tid,pSink,fForeground); + + if (!tid || !pSink) + return E_INVALIDARG; + + textservice = get_textservice_clsid(tid); + if (IsEqualCLSID(&GUID_NULL,&textservice)) + return E_INVALIDARG; + + get_textservice_sink(tid, &IID_ITfKeyEventSink, (IUnknown**)&check); + if (check != NULL) + return CONNECT_E_ADVISELIMIT; + + if (FAILED(IUnknown_QueryInterface(pSink,&IID_ITfKeyEventSink,(LPVOID*) &check))) + return E_INVALIDARG; + + set_textservice_sink(tid, &IID_ITfKeyEventSink, (IUnknown*)check); + + if (fForeground) + { + if (This->forgroundKeyEventSink) + { + ITfKeyEventSink_OnSetFocus(This->forgroundKeyEventSink, FALSE); + ITfKeyEventSink_Release(This->forgroundKeyEventSink); + } + ITfKeyEventSink_AddRef(check); + ITfKeyEventSink_OnSetFocus(check, TRUE); + This->forgroundKeyEventSink = check; + This->forgroundTextService = textservice; + } + return S_OK; } static HRESULT WINAPI KeystrokeMgr_UnadviseKeyEventSink(ITfKeystrokeMgr *iface, TfClientId tid) { ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); - FIXME("STUB:(%p)\n",This); - return E_NOTIMPL; + CLSID textservice; + ITfKeyEventSink *check = NULL; + TRACE("(%p) %x\n",This,tid); + + if (!tid) + return E_INVALIDARG; + + textservice = get_textservice_clsid(tid); + if (IsEqualCLSID(&GUID_NULL,&textservice)) + return E_INVALIDARG; + + get_textservice_sink(tid, &IID_ITfKeyEventSink, (IUnknown**)&check); + + if (!check) + return CONNECT_E_NOCONNECTION; + + set_textservice_sink(tid, &IID_ITfKeyEventSink, NULL); + ITfKeyEventSink_Release(check); + + if (This->forgroundKeyEventSink == check) + { + ITfKeyEventSink_Release(This->forgroundKeyEventSink); + This->forgroundKeyEventSink = NULL; + This->forgroundTextService = GUID_NULL; + } + return S_OK; } static HRESULT WINAPI KeystrokeMgr_GetForeground(ITfKeystrokeMgr *iface, CLSID *pclsid) { ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); - FIXME("STUB:(%p)\n",This); - return E_NOTIMPL; + TRACE("(%p) %p\n",This,pclsid); + if (!pclsid) + return E_INVALIDARG; + + if (IsEqualCLSID(&This->forgroundTextService,&GUID_NULL)) + return S_FALSE; + + *pclsid = This->forgroundTextService; + return S_OK; } static HRESULT WINAPI KeystrokeMgr_TestKeyDown(ITfKeystrokeMgr *iface,
15 years, 7 months
1
0
0
0
[cwittich] 41064: sync msi with wine 1.1.22
by cwittich@svn.reactos.org
Author: cwittich Date: Sat May 23 14:29:15 2009 New Revision: 41064 URL:
http://svn.reactos.org/svn/reactos?rev=41064&view=rev
Log: sync msi with wine 1.1.22 Modified: trunk/reactos/dll/win32/msi/dialog.c trunk/reactos/dll/win32/msi/msi.c Modified: trunk/reactos/dll/win32/msi/dialog.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/dialog.c?rev…
============================================================================== --- trunk/reactos/dll/win32/msi/dialog.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/dialog.c [iso-8859-1] Sat May 23 14:29:15 2009 @@ -135,6 +135,8 @@ static const WCHAR szPathEdit[] = { 'P','a','t','h','E','d','i','t',0 }; static const WCHAR szProgressBar[] = { 'P','r','o','g','r','e','s','s','B','a','r',0 }; +static const WCHAR szSetProgress[] = { + 'S','e','t','P','r','o','g','r','e','s','s',0 }; static const WCHAR szRadioButtonGroup[] = { 'R','a','d','i','o','B','u','t','t','o','n','G','r','o','u','p',0 }; static const WCHAR szIcon[] = { 'I','c','o','n',0 }; @@ -1571,7 +1573,14 @@ static UINT msi_dialog_progress_bar( msi_dialog *dialog, MSIRECORD *rec ) { - msi_dialog_add_control( dialog, rec, PROGRESS_CLASSW, WS_VISIBLE ); + msi_control *control; + + control = msi_dialog_add_control( dialog, rec, PROGRESS_CLASSW, WS_VISIBLE ); + if( !control ) + return ERROR_FUNCTION_FAILED; + + ControlEvent_SubscribeToEvent( dialog->package, dialog, + szSetProgress, control->name, szProgress ); return ERROR_SUCCESS; } Modified: trunk/reactos/dll/win32/msi/msi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msi.c?rev=41…
============================================================================== --- trunk/reactos/dll/win32/msi/msi.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/msi.c [iso-8859-1] Sat May 23 14:29:15 2009 @@ -304,7 +304,7 @@ static UINT MSI_ApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szProductCode, LPCWSTR szCommandLine) { MSIHANDLE patch = 0, info = 0; - UINT r, type; + UINT r = ERROR_SUCCESS, type; DWORD size = 0; LPCWSTR cmd_ptr = szCommandLine; LPCWSTR product_code = szProductCode;
15 years, 7 months
1
0
0
0
[dchapyshev] 41063: - Sync ole32, oleaut32 with Wine 1.1.22
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Sat May 23 14:25:54 2009 New Revision: 41063 URL:
http://svn.reactos.org/svn/reactos?rev=41063&view=rev
Log: - Sync ole32, oleaut32 with Wine 1.1.22 Modified: trunk/reactos/dll/win32/ole32/compobj.c trunk/reactos/dll/win32/ole32/ole2impl.c trunk/reactos/dll/win32/ole32/usrmarshal.c trunk/reactos/dll/win32/oleaut32/tmarshal.c trunk/reactos/dll/win32/oleaut32/typelib.c trunk/reactos/dll/win32/oleaut32/varformat.c Modified: trunk/reactos/dll/win32/ole32/compobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/compobj.c?…
============================================================================== --- trunk/reactos/dll/win32/ole32/compobj.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/compobj.c [iso-8859-1] Sat May 23 14:25:54 2009 @@ -56,6 +56,7 @@ #include "ole2.h" #include "ole2ver.h" #include "ctxtcall.h" +#include "dde.h" #include "compobj_private.h" @@ -3525,7 +3526,8 @@ /* first try to retrieve messages for incoming COM calls to the apartment window */ return PeekMessageW(msg, apt->win, WM_USER, WM_APP - 1, PM_REMOVE|PM_NOYIELD) || /* next retrieve other messages necessary for the app to remain responsive */ - PeekMessageW(msg, NULL, 0, 0, PM_QS_PAINT|PM_QS_POSTMESSAGE|PM_REMOVE|PM_NOYIELD); + PeekMessageW(msg, NULL, WM_DDE_FIRST, WM_DDE_LAST, PM_REMOVE|PM_NOYIELD) || + PeekMessageW(msg, NULL, 0, 0, PM_QS_PAINT|PM_QS_SENDMESSAGE|PM_REMOVE|PM_NOYIELD); } /*********************************************************************** Modified: trunk/reactos/dll/win32/ole32/ole2impl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole2impl.c…
============================================================================== --- trunk/reactos/dll/win32/ole32/ole2impl.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/ole2impl.c [iso-8859-1] Sat May 23 14:25:54 2009 @@ -84,6 +84,75 @@ return found_static ? OLE_S_STATIC : S_FALSE; } +static inline void init_fmtetc(FORMATETC *fmt, CLIPFORMAT cf, TYMED tymed) +{ + fmt->cfFormat = cf; + fmt->ptd = NULL; + fmt->dwAspect = DVASPECT_CONTENT; + fmt->lindex = -1; + fmt->tymed = tymed; +} + +/*************************************************************************** + * get_storage + * + * Retrieve an object's storage from a variety of sources. + * + * FIXME: CF_FILENAME. + */ +static HRESULT get_storage(IDataObject *data, IStorage *stg, UINT *src_cf) +{ + HRESULT hr; + FORMATETC fmt; + STGMEDIUM med; + IPersistStorage *persist; + CLSID clsid; + + *src_cf = 0; + + /* CF_EMBEDEDOBJECT */ + init_fmtetc(&fmt, embedded_object_clipboard_format, TYMED_ISTORAGE); + med.tymed = TYMED_ISTORAGE; + med.u.pstg = stg; + hr = IDataObject_GetDataHere(data, &fmt, &med); + if(SUCCEEDED(hr)) + { + *src_cf = embedded_object_clipboard_format; + return hr; + } + + /* CF_EMBEDSOURCE */ + init_fmtetc(&fmt, embed_source_clipboard_format, TYMED_ISTORAGE); + med.tymed = TYMED_ISTORAGE; + med.u.pstg = stg; + hr = IDataObject_GetDataHere(data, &fmt, &med); + if(SUCCEEDED(hr)) + { + *src_cf = embed_source_clipboard_format; + return hr; + } + + /* IPersistStorage */ + hr = IDataObject_QueryInterface(data, &IID_IPersistStorage, (void**)&persist); + if(FAILED(hr)) return hr; + + hr = IPersistStorage_GetClassID(persist, &clsid); + if(FAILED(hr)) goto end; + + hr = IStorage_SetClass(stg, &clsid); + if(FAILED(hr)) goto end; + + hr = IPersistStorage_Save(persist, stg, FALSE); + if(FAILED(hr)) goto end; + + hr = IPersistStorage_SaveCompleted(persist, NULL); + +end: + IPersistStorage_Release(persist); + + return hr; +} + /****************************************************************************** * OleCreateFromDataEx [OLE32.@] * @@ -91,125 +160,40 @@ * the clipboard or OLE drag and drop. */ HRESULT WINAPI OleCreateFromDataEx(IDataObject *data, REFIID iid, DWORD flags, - DWORD renderopt, ULONG num_fmts, DWORD *adv_flags, FORMATETC *fmts, + DWORD renderopt, ULONG num_cache_fmts, DWORD *adv_flags, FORMATETC *cache_fmts, IAdviseSink *sink, DWORD *conns, IOleClientSite *client_site, IStorage *stg, void **obj) { + HRESULT hr; + UINT src_cf; + FIXME("(%p, %s, %08x, %08x, %d, %p, %p, %p, %p, %p, %p, %p): stub\n", - data, debugstr_guid(iid), flags, renderopt, num_fmts, adv_flags, fmts, + data, debugstr_guid(iid), flags, renderopt, num_cache_fmts, adv_flags, cache_fmts, sink, conns, client_site, stg, obj); - return E_NOTIMPL; + hr = get_storage(data, stg, &src_cf); + if(FAILED(hr)) return hr; + + hr = OleLoad(stg, iid, client_site, obj); + if(FAILED(hr)) return hr; + + /* FIXME: Init cache */ + + return hr; } /****************************************************************************** * OleCreateFromData [OLE32.@] - * - * Author : Abey George - * Creates an embedded object from data transfer object retrieved from - * the clipboard or OLE drag and drop. - * Returns : S_OK - Embedded object was created successfully. - * OLE_E_STATIC - OLE can create only a static object - * DV_E_FORMATETC - No acceptable format is available (only error return code) - * TODO : CF_FILENAME, CF_EMBEDEDOBJECT formats. Parameter renderopt is currently ignored. - */ - -HRESULT WINAPI OleCreateFromData(LPDATAOBJECT pSrcDataObject, REFIID riid, - DWORD renderopt, LPFORMATETC pFormatEtc, - LPOLECLIENTSITE pClientSite, LPSTORAGE pStg, - LPVOID* ppvObj) -{ - IEnumFORMATETC *pfmt; - FORMATETC fmt; - CHAR szFmtName[MAX_CLIPFORMAT_NAME]; - STGMEDIUM std; - HRESULT hr; - HRESULT hr1; - - hr = IDataObject_EnumFormatEtc(pSrcDataObject, DATADIR_GET, &pfmt); - - if (hr == S_OK) - { - memset(&std, 0, sizeof(STGMEDIUM)); - - hr = IEnumFORMATETC_Next(pfmt, 1, &fmt, NULL); - while (hr == S_OK) - { - GetClipboardFormatNameA(fmt.cfFormat, szFmtName, MAX_CLIPFORMAT_NAME-1); - - /* first, Check for Embedded Object, Embed Source or Filename */ - /* TODO: Currently checks only for Embed Source. */ - - if (!strcmp(szFmtName, CF_EMBEDSOURCE)) - { - std.tymed = TYMED_HGLOBAL; - - if ((hr1 = IDataObject_GetData(pSrcDataObject, &fmt, &std)) == S_OK) - { - ILockBytes *ptrILockBytes = 0; - IStorage *pStorage = 0; - IOleObject *pOleObject = 0; - IPersistStorage *pPersistStorage = 0; - CLSID clsID; - - /* Create ILock bytes */ - - hr1 = CreateILockBytesOnHGlobal(std.u.hGlobal, FALSE, &ptrILockBytes); - - /* Open storage on the ILock bytes */ - - if (hr1 == S_OK) - hr1 = StgOpenStorageOnILockBytes(ptrILockBytes, NULL, STGM_SHARE_EXCLUSIVE, NULL, 0, &pStorage); - - /* Get Class ID from the opened storage */ - - if (hr1 == S_OK) - hr1 = ReadClassStg(pStorage, &clsID); - - /* Create default handler for Persist storage */ - - if (hr1 == S_OK) - hr1 = OleCreateDefaultHandler(&clsID, NULL, &IID_IPersistStorage, (LPVOID*)&pPersistStorage); - - /* Load the storage to Persist storage */ - - if (hr1 == S_OK) - hr1 = IPersistStorage_Load(pPersistStorage, pStorage); - - /* Query for IOleObject */ - - if (hr1 == S_OK) - hr1 = IPersistStorage_QueryInterface(pPersistStorage, &IID_IOleObject, (LPVOID*)&pOleObject); - - /* Set client site with the IOleObject */ - - if (hr1 == S_OK) - hr1 = IOleObject_SetClientSite(pOleObject, pClientSite); - - IPersistStorage_Release(pPersistStorage); - /* Query for the requested interface */ - - if (hr1 == S_OK) - hr1 = IPersistStorage_QueryInterface(pPersistStorage, riid, ppvObj); - - IPersistStorage_Release(pPersistStorage); - - IStorage_Release(pStorage); - - if (hr1 == S_OK) - return S_OK; - } - - /* Return error */ - - return DV_E_FORMATETC; - } - - hr = IEnumFORMATETC_Next(pfmt, 1, &fmt, NULL); - } - } - - return DV_E_FORMATETC; + */ +HRESULT WINAPI OleCreateFromData(LPDATAOBJECT data, REFIID iid, + DWORD renderopt, LPFORMATETC fmt, + LPOLECLIENTSITE client_site, LPSTORAGE stg, + LPVOID* obj) +{ + DWORD advf = ADVF_PRIMEFIRST; + + return OleCreateFromDataEx(data, iid, 0, renderopt, fmt ? 1 : 0, fmt ? &advf : NULL, + fmt, NULL, NULL, client_site, stg, obj); } Modified: trunk/reactos/dll/win32/ole32/usrmarshal.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/usrmarshal…
============================================================================== --- trunk/reactos/dll/win32/ole32/usrmarshal.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/usrmarshal.c [iso-8859-1] Sat May 23 14:25:54 2009 @@ -1378,19 +1378,25 @@ TRACE("(%s, %d, &%p)\n", debugstr_user_flags(pFlags), StartingSize, *phMfp); size += sizeof(ULONG); - size += sizeof(HMETAFILEPICT); - - if ((LOWORD(*pFlags) != MSHCTX_INPROC) && *phMfp) - { - METAFILEPICT *mfpict = GlobalLock(*phMfp); - - /* FIXME: raise an exception if mfpict is NULL? */ - size += FIELD_OFFSET(remoteMETAFILEPICT, hMF); + + if(LOWORD(*pFlags) == MSHCTX_INPROC) + size += sizeof(HMETAFILEPICT); + else + { size += sizeof(ULONG); - size = HMETAFILE_UserSize(pFlags, size, &mfpict->hMF); - - GlobalUnlock(*phMfp); + if (*phMfp) + { + METAFILEPICT *mfpict = GlobalLock(*phMfp); + + /* FIXME: raise an exception if mfpict is NULL? */ + size += 3 * sizeof(ULONG); + size += sizeof(ULONG); + + size = HMETAFILE_UserSize(pFlags, size, &mfpict->hMF); + + GlobalUnlock(*phMfp); + } } return size; @@ -1420,32 +1426,40 @@ TRACE("(%s, %p, &%p)\n", debugstr_user_flags(pFlags), pBuffer, *phMfp); if (LOWORD(*pFlags) == MSHCTX_INPROC) - *(ULONG *)pBuffer = WDT_INPROC_CALL; + { + if (sizeof(HMETAFILEPICT) == 8) + *(ULONG *)pBuffer = WDT_INPROC64_CALL; + else + *(ULONG *)pBuffer = WDT_INPROC_CALL; + pBuffer += sizeof(ULONG); + *(HMETAFILEPICT *)pBuffer = *phMfp; + pBuffer += sizeof(HMETAFILEPICT); + } else + { *(ULONG *)pBuffer = WDT_REMOTE_CALL; - pBuffer += sizeof(ULONG); - - *(HMETAFILEPICT *)pBuffer = *phMfp; - pBuffer += sizeof(HMETAFILEPICT); - - if ((LOWORD(*pFlags) != MSHCTX_INPROC) && *phMfp) - { - METAFILEPICT *mfpict = GlobalLock(*phMfp); - remoteMETAFILEPICT * remmfpict = (remoteMETAFILEPICT *)pBuffer; - - /* FIXME: raise an exception if mfpict is NULL? */ - remmfpict->mm = mfpict->mm; - remmfpict->xExt = mfpict->xExt; - remmfpict->yExt = mfpict->yExt; - pBuffer += FIELD_OFFSET(remoteMETAFILEPICT, hMF); - *(ULONG *)pBuffer = USER_MARSHAL_PTR_PREFIX; pBuffer += sizeof(ULONG); - - pBuffer = HMETAFILE_UserMarshal(pFlags, pBuffer, &mfpict->hMF); - - GlobalUnlock(*phMfp); - } - + *(ULONG *)pBuffer = (ULONG)(ULONG_PTR)*phMfp; + pBuffer += sizeof(ULONG); + + if (*phMfp) + { + METAFILEPICT *mfpict = GlobalLock(*phMfp); + remoteMETAFILEPICT * remmfpict = (remoteMETAFILEPICT *)pBuffer; + + /* FIXME: raise an exception if mfpict is NULL? */ + remmfpict->mm = mfpict->mm; + remmfpict->xExt = mfpict->xExt; + remmfpict->yExt = mfpict->yExt; + pBuffer += 3 * sizeof(ULONG); + *(ULONG *)pBuffer = USER_MARSHAL_PTR_PREFIX; + pBuffer += sizeof(ULONG); + + pBuffer = HMETAFILE_UserMarshal(pFlags, pBuffer, &mfpict->hMF); + + GlobalUnlock(*phMfp); + } + } return pBuffer; } @@ -1477,40 +1491,45 @@ fContext = *(ULONG *)pBuffer; pBuffer += sizeof(ULONG); - if ((fContext == WDT_INPROC_CALL) || !*(HMETAFILEPICT *)pBuffer) + if ((fContext == WDT_INPROC_CALL) || fContext == WDT_INPROC64_CALL) { *phMfp = *(HMETAFILEPICT *)pBuffer; pBuffer += sizeof(HMETAFILEPICT); } else { - METAFILEPICT *mfpict; - const remoteMETAFILEPICT *remmfpict; - ULONG user_marshal_prefix; - - pBuffer += sizeof(HMETAFILEPICT); - remmfpict = (const remoteMETAFILEPICT *)pBuffer; - - *phMfp = GlobalAlloc(GMEM_MOVEABLE, sizeof(METAFILEPICT)); - if (!*phMfp) - RpcRaiseException(E_OUTOFMEMORY); - - mfpict = GlobalLock(*phMfp); - mfpict->mm = remmfpict->mm; - mfpict->xExt = remmfpict->xExt; - mfpict->yExt = remmfpict->yExt; - pBuffer += FIELD_OFFSET(remoteMETAFILEPICT, hMF); - user_marshal_prefix = *(ULONG *)pBuffer; + ULONG handle = *(ULONG *)pBuffer; pBuffer += sizeof(ULONG); - - if (user_marshal_prefix != USER_MARSHAL_PTR_PREFIX) - RpcRaiseException(RPC_X_INVALID_TAG); - - pBuffer = HMETAFILE_UserUnmarshal(pFlags, pBuffer, &mfpict->hMF); - - GlobalUnlock(*phMfp); - } - + *phMfp = NULL; + + if(handle) + { + METAFILEPICT *mfpict; + const remoteMETAFILEPICT *remmfpict; + ULONG user_marshal_prefix; + + remmfpict = (const remoteMETAFILEPICT *)pBuffer; + + *phMfp = GlobalAlloc(GMEM_MOVEABLE, sizeof(METAFILEPICT)); + if (!*phMfp) + RpcRaiseException(E_OUTOFMEMORY); + + mfpict = GlobalLock(*phMfp); + mfpict->mm = remmfpict->mm; + mfpict->xExt = remmfpict->xExt; + mfpict->yExt = remmfpict->yExt; + pBuffer += 3 * sizeof(ULONG); + user_marshal_prefix = *(ULONG *)pBuffer; + pBuffer += sizeof(ULONG); + + if (user_marshal_prefix != USER_MARSHAL_PTR_PREFIX) + RpcRaiseException(RPC_X_INVALID_TAG); + + pBuffer = HMETAFILE_UserUnmarshal(pFlags, pBuffer, &mfpict->hMF); + + GlobalUnlock(*phMfp); + } + } return pBuffer; } @@ -1570,10 +1589,19 @@ * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which * the first parameter is a ULONG. */ -ULONG __RPC_USER WdtpInterfacePointer_UserSize(ULONG *pFlags, ULONG RealFlags, IUnknown *punk, ULONG StartingSize, REFIID riid) -{ - FIXME("(%s, 0%x, %p, %d, %s): stub\n", debugstr_user_flags(pFlags), RealFlags, punk, StartingSize, debugstr_guid(riid)); - return 0; +ULONG __RPC_USER WdtpInterfacePointer_UserSize(ULONG *pFlags, ULONG RealFlags, ULONG StartingSize, IUnknown *punk, REFIID riid) +{ + DWORD marshal_size = 0; + HRESULT hr; + + TRACE("(%s, 0%x, %d, %p, %s)\n", debugstr_user_flags(pFlags), RealFlags, StartingSize, punk, debugstr_guid(riid)); + + hr = CoGetMarshalSizeMax(&marshal_size, riid, punk, LOWORD(RealFlags), NULL, MSHLFLAGS_NORMAL); + if(FAILED(hr)) return StartingSize; + + ALIGN_LENGTH(StartingSize, 3); + StartingSize += 2 * sizeof(DWORD); + return StartingSize + marshal_size; } /****************************************************************************** @@ -1598,8 +1626,40 @@ */ unsigned char * WINAPI WdtpInterfacePointer_UserMarshal(ULONG *pFlags, ULONG RealFlags, unsigned char *pBuffer, IUnknown *punk, REFIID riid) { - FIXME("(%s, 0x%x, %p, &%p, %s): stub\n", debugstr_user_flags(pFlags), RealFlags, pBuffer, punk, debugstr_guid(riid)); - return NULL; + HGLOBAL h = GlobalAlloc(GMEM_MOVEABLE, 0); + IStream *stm; + DWORD size; + void *ptr; + + TRACE("(%s, 0x%x, %p, &%p, %s)\n", debugstr_user_flags(pFlags), RealFlags, pBuffer, punk, debugstr_guid(riid)); + + if(!h) return NULL; + if(CreateStreamOnHGlobal(h, TRUE, &stm) != S_OK) + { + GlobalFree(h); + return NULL; + } + + if(CoMarshalInterface(stm, riid, punk, LOWORD(RealFlags), NULL, MSHLFLAGS_NORMAL) != S_OK) + { + IStream_Release(stm); + return NULL; + } + + ALIGN_POINTER(pBuffer, 3); + size = GlobalSize(h); + + *(DWORD *)pBuffer = size; + pBuffer += sizeof(DWORD); + *(DWORD *)pBuffer = size; + pBuffer += sizeof(DWORD); + + ptr = GlobalLock(h); + memcpy(pBuffer, ptr, size); + GlobalUnlock(h); + + IStream_Release(stm); + return pBuffer + size; } /****************************************************************************** @@ -1623,24 +1683,61 @@ */ unsigned char * WINAPI WdtpInterfacePointer_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, IUnknown **ppunk, REFIID riid) { - FIXME("(%s, %p, %p, %s): stub\n", debugstr_user_flags(pFlags), pBuffer, ppunk, debugstr_guid(riid)); - return NULL; + HRESULT hr; + HGLOBAL h; + IStream *stm; + DWORD size; + void *ptr; + + TRACE("(%s, %p, %p, %s)\n", debugstr_user_flags(pFlags), pBuffer, ppunk, debugstr_guid(riid)); + + ALIGN_POINTER(pBuffer, 3); + + size = *(DWORD *)pBuffer; + pBuffer += sizeof(DWORD); + if(size != *(DWORD *)pBuffer) + RaiseException(RPC_X_BAD_STUB_DATA, 0, 0, NULL); + + pBuffer += sizeof(DWORD); + + /* FIXME: sanity check on size */ + + h = GlobalAlloc(GMEM_MOVEABLE, size); + if(!h) RaiseException(RPC_X_NO_MEMORY, 0, 0, NULL); + + if(CreateStreamOnHGlobal(h, TRUE, &stm) != S_OK) + { + GlobalFree(h); + RaiseException(RPC_X_NO_MEMORY, 0, 0, NULL); + } + + ptr = GlobalLock(h); + memcpy(ptr, pBuffer, size); + GlobalUnlock(h); + + hr = CoUnmarshalInterface(stm, riid, (void**)ppunk); + IStream_Release(stm); + + if(hr != S_OK) RaiseException(hr, 0, 0, NULL); + + return pBuffer + size; } /****************************************************************************** * WdtpInterfacePointer_UserFree [OLE32.@] * - * Frees an unmarshaled interface pointer. - * - * PARAMS - * punk [I] Interface pointer to free. + * Releases an unmarshaled interface pointer. + * + * PARAMS + * punk [I] Interface pointer to release. * * RETURNS * Nothing. */ void WINAPI WdtpInterfacePointer_UserFree(IUnknown *punk) { - FIXME("(%p): stub\n", punk); + TRACE("(%p)\n", punk); + if(punk) IUnknown_Release(punk); } /****************************************************************************** @@ -1698,14 +1795,20 @@ TRACE("TYMED_ISTREAM\n"); if (pStgMedium->u.pstm) { - FIXME("not implemented for IStream %p\n", pStgMedium->u.pstm); + IUnknown *unk; + IStream_QueryInterface(pStgMedium->u.pstm, &IID_IUnknown, (void**)&unk); + size = WdtpInterfacePointer_UserSize(pFlags, LOWORD(*pFlags), size, unk, &IID_IStream); + IUnknown_Release(unk); } break; case TYMED_ISTORAGE: TRACE("TYMED_ISTORAGE\n"); if (pStgMedium->u.pstg) { - FIXME("not implemented for IStorage %p\n", pStgMedium->u.pstg); + IUnknown *unk; + IStorage_QueryInterface(pStgMedium->u.pstg, &IID_IUnknown, (void**)&unk); + size = WdtpInterfacePointer_UserSize(pFlags, LOWORD(*pFlags), size, unk, &IID_IStorage); + IUnknown_Release(unk); } break; case TYMED_GDI: @@ -1730,7 +1833,7 @@ } if (pStgMedium->pUnkForRelease) - FIXME("buffer size pUnkForRelease\n"); + size = WdtpInterfacePointer_UserSize(pFlags, LOWORD(*pFlags), size, pStgMedium->pUnkForRelease, &IID_IUnknown); return size; } @@ -1804,14 +1907,20 @@ TRACE("TYMED_ISTREAM\n"); if (pStgMedium->u.pstm) { - FIXME("not implemented for IStream %p\n", pStgMedium->u.pstm); + IUnknown *unk; + IStream_QueryInterface(pStgMedium->u.pstm, &IID_IUnknown, (void**)&unk); + pBuffer = WdtpInterfacePointer_UserMarshal(pFlags, LOWORD(*pFlags), pBuffer, unk, &IID_IStream); + IUnknown_Release(unk); } break; case TYMED_ISTORAGE: TRACE("TYMED_ISTORAGE\n"); if (pStgMedium->u.pstg) { - FIXME("not implemented for IStorage %p\n", pStgMedium->u.pstg); + IUnknown *unk; + IStorage_QueryInterface(pStgMedium->u.pstg, &IID_IUnknown, (void**)&unk); + pBuffer = WdtpInterfacePointer_UserMarshal(pFlags, LOWORD(*pFlags), pBuffer, unk, &IID_IStorage); + IUnknown_Release(unk); } break; case TYMED_GDI: @@ -1836,7 +1945,7 @@ } if (pStgMedium->pUnkForRelease) - FIXME("marshal pUnkForRelease\n"); + pBuffer = WdtpInterfacePointer_UserMarshal(pFlags, LOWORD(*pFlags), pBuffer, pStgMedium->pUnkForRelease, &IID_IUnknown); return pBuffer; } @@ -1932,7 +2041,7 @@ TRACE("TYMED_ISTREAM\n"); if (content) { - FIXME("not implemented for IStream\n"); + pBuffer = WdtpInterfacePointer_UserUnmarshal(pFlags, pBuffer, (IUnknown**)&pStgMedium->u.pstm, &IID_IStream); } else pStgMedium->u.pstm = NULL; @@ -1941,7 +2050,7 @@ TRACE("TYMED_ISTORAGE\n"); if (content) { - FIXME("not implemented for IStorage\n"); + pBuffer = WdtpInterfacePointer_UserUnmarshal(pFlags, pBuffer, (IUnknown**)&pStgMedium->u.pstg, &IID_IStorage); } else pStgMedium->u.pstg = NULL; @@ -1975,7 +2084,7 @@ pStgMedium->pUnkForRelease = NULL; if (releaseunk) - FIXME("unmarshal pUnkForRelease\n"); + pBuffer = WdtpInterfacePointer_UserUnmarshal(pFlags, pBuffer, &pStgMedium->pUnkForRelease, &IID_IUnknown); return pBuffer; } @@ -2297,8 +2406,15 @@ ULONG cb, ULONG *pcbRead) { - FIXME(":stub\n"); - return E_NOTIMPL; + ULONG read; + HRESULT hr; + + TRACE("(%p)->(%p, %d, %p)\n", This, pv, cb, pcbRead); + + hr = ISequentialStream_RemoteRead_Proxy(This, pv, cb, &read); + if(pcbRead) *pcbRead = read; + + return hr; } HRESULT __RPC_STUB ISequentialStream_Read_Stub( @@ -2307,8 +2423,8 @@ ULONG cb, ULONG *pcbRead) { - FIXME(":stub\n"); - return E_NOTIMPL; + TRACE("(%p)->(%p, %d, %p)\n", This, pv, cb, pcbRead); + return ISequentialStream_Read(This, pv, cb, pcbRead); } HRESULT CALLBACK ISequentialStream_Write_Proxy( @@ -2317,8 +2433,15 @@ ULONG cb, ULONG *pcbWritten) { - FIXME(":stub\n"); - return E_NOTIMPL; + ULONG written; + HRESULT hr; + + TRACE("(%p)->(%p, %d, %p)\n", This, pv, cb, pcbWritten); + + hr = ISequentialStream_RemoteWrite_Proxy(This, pv, cb, &written); + if(pcbWritten) *pcbWritten = written; + + return hr; } HRESULT __RPC_STUB ISequentialStream_Write_Stub( @@ -2327,8 +2450,8 @@ ULONG cb, ULONG *pcbWritten) { - FIXME(":stub\n"); - return E_NOTIMPL; + TRACE("(%p)->(%p, %d, %p)\n", This, pv, cb, pcbWritten); + return ISequentialStream_Write(This, pv, cb, pcbWritten); } HRESULT CALLBACK IStream_Seek_Proxy( @@ -2337,8 +2460,15 @@ DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) { - FIXME(":stub\n"); - return E_NOTIMPL; + ULARGE_INTEGER newpos; + HRESULT hr; + + TRACE("(%p)->(%s, %d, %p)\n", This, wine_dbgstr_longlong(dlibMove.QuadPart), dwOrigin, plibNewPosition); + + hr = IStream_RemoteSeek_Proxy(This, dlibMove, dwOrigin, &newpos); + if(plibNewPosition) *plibNewPosition = newpos; + + return hr; } HRESULT __RPC_STUB IStream_Seek_Stub( @@ -2347,8 +2477,8 @@ DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) { - FIXME(":stub\n"); - return E_NOTIMPL; + TRACE("(%p)->(%s, %d, %p)\n", This, wine_dbgstr_longlong(dlibMove.QuadPart), dwOrigin, plibNewPosition); + return IStream_Seek(This, dlibMove, dwOrigin, plibNewPosition); } HRESULT CALLBACK IStream_CopyTo_Proxy( @@ -2358,8 +2488,16 @@ ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten) { - FIXME(":stub\n"); - return E_NOTIMPL; + ULARGE_INTEGER read, written; + HRESULT hr; + + TRACE("(%p)->(%p, %s, %p, %p)\n", This, pstm, wine_dbgstr_longlong(cb.QuadPart), pcbRead, pcbWritten); + + hr = IStream_RemoteCopyTo_Proxy(This, pstm, cb, &read, &written); + if(pcbRead) *pcbRead = read; + if(pcbWritten) *pcbWritten = written; + + return hr; } HRESULT __RPC_STUB IStream_CopyTo_Stub( @@ -2369,8 +2507,9 @@ ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten) { - FIXME(":stub\n"); - return E_NOTIMPL; + TRACE("(%p)->(%p, %s, %p, %p)\n", This, pstm, wine_dbgstr_longlong(cb.QuadPart), pcbRead, pcbWritten); + + return IStream_CopyTo(This, pstm, cb, pcbRead, pcbWritten); } HRESULT CALLBACK IEnumSTATSTG_Next_Proxy( @@ -2407,8 +2546,10 @@ DWORD reserved2, IStream **ppstm) { - FIXME(":stub\n"); - return E_NOTIMPL; + TRACE("(%p)->(%s, %p, %08x, %d %p)\n", This, debugstr_w(pwcsName), reserved1, grfMode, reserved2, ppstm); + if(reserved1) WARN("reserved1 %p\n", reserved1); + + return IStorage_RemoteOpenStream_Proxy(This, pwcsName, 0, NULL, grfMode, reserved2, ppstm); } HRESULT __RPC_STUB IStorage_OpenStream_Stub( @@ -2420,8 +2561,10 @@ DWORD reserved2, IStream **ppstm) { - FIXME(":stub\n"); - return E_NOTIMPL; + TRACE("(%p)->(%s, %d, %p, %08x, %d %p)\n", This, debugstr_w(pwcsName), cbReserved1, reserved1, grfMode, reserved2, ppstm); + if(cbReserved1 || reserved1) WARN("cbReserved1 %d reserved1 %p\n", cbReserved1, reserved1); + + return IStorage_OpenStream(This, pwcsName, NULL, grfMode, reserved2, ppstm); } HRESULT CALLBACK IStorage_EnumElements_Proxy( @@ -2431,8 +2574,10 @@ DWORD reserved3, IEnumSTATSTG **ppenum) { - FIXME(":stub\n"); - return E_NOTIMPL; + TRACE("(%p)->(%d, %p, %d, %p)\n", This, reserved1, reserved2, reserved3, ppenum); + if(reserved2) WARN("reserved2 %p\n", reserved2); + + return IStorage_RemoteEnumElements_Proxy(This, reserved1, 0, NULL, reserved3, ppenum); } HRESULT __RPC_STUB IStorage_EnumElements_Stub( @@ -2443,8 +2588,10 @@ DWORD reserved3, IEnumSTATSTG **ppenum) { - FIXME(":stub\n"); - return E_NOTIMPL; + TRACE("(%p)->(%d, %d, %p, %d, %p)\n", This, reserved1, cbReserved2, reserved2, reserved3, ppenum); + if(cbReserved2 || reserved2) WARN("cbReserved2 %d reserved2 %p\n", cbReserved2, reserved2); + + return IStorage_EnumElements(This, reserved1, NULL, reserved3, ppenum); } HRESULT CALLBACK ILockBytes_ReadAt_Proxy( @@ -2454,8 +2601,15 @@ ULONG cb, ULONG *pcbRead) { - FIXME(":stub\n"); - return E_NOTIMPL; + ULONG read; + HRESULT hr; + + TRACE("(%p)->(%s, %p, %d, %p)\n", This, wine_dbgstr_longlong(ulOffset.QuadPart), pv, cb, pcbRead); + + hr = ILockBytes_RemoteReadAt_Proxy(This, ulOffset, pv, cb, &read); + if(pcbRead) *pcbRead = read; + + return hr; } HRESULT __RPC_STUB ILockBytes_ReadAt_Stub( @@ -2465,8 +2619,8 @@ ULONG cb, ULONG *pcbRead) { - FIXME(":stub\n"); - return E_NOTIMPL; + TRACE("(%p)->(%s, %p, %d, %p)\n", This, wine_dbgstr_longlong(ulOffset.QuadPart), pv, cb, pcbRead); + return ILockBytes_ReadAt(This, ulOffset, pv, cb, pcbRead); } HRESULT CALLBACK ILockBytes_WriteAt_Proxy( @@ -2476,8 +2630,15 @@ ULONG cb, ULONG *pcbWritten) { - FIXME(":stub\n"); - return E_NOTIMPL; + ULONG written; + HRESULT hr; + + TRACE("(%p)->(%s, %p, %d, %p)\n", This, wine_dbgstr_longlong(ulOffset.QuadPart), pv, cb, pcbWritten); + + hr = ILockBytes_RemoteWriteAt_Proxy(This, ulOffset, pv, cb, &written); + if(pcbWritten) *pcbWritten = written; + + return hr; } HRESULT __RPC_STUB ILockBytes_WriteAt_Stub( @@ -2487,8 +2648,8 @@ ULONG cb, ULONG *pcbWritten) { - FIXME(":stub\n"); - return E_NOTIMPL; + TRACE("(%p)->(%s, %p, %d, %p)\n", This, wine_dbgstr_longlong(ulOffset.QuadPart), pv, cb, pcbWritten); + return ILockBytes_WriteAt(This, ulOffset, pv, cb, pcbWritten); } HRESULT CALLBACK IFillLockBytes_FillAppend_Proxy( @@ -2497,8 +2658,15 @@ ULONG cb, ULONG *pcbWritten) { - FIXME(":stub\n"); - return E_NOTIMPL; + ULONG written; + HRESULT hr; + + TRACE("(%p)->(%p, %d, %p)\n", This, pv, cb, pcbWritten); + + hr = IFillLockBytes_RemoteFillAppend_Proxy(This, pv, cb, &written); + if(pcbWritten) *pcbWritten = written; + + return hr; } HRESULT __RPC_STUB IFillLockBytes_FillAppend_Stub( @@ -2507,8 +2675,8 @@ ULONG cb, ULONG *pcbWritten) { - FIXME(":stub\n"); - return E_NOTIMPL; + TRACE("(%p)->(%p, %d, %p)\n", This, pv, cb, pcbWritten); + return IFillLockBytes_FillAppend(This, pv, cb, pcbWritten); } HRESULT CALLBACK IFillLockBytes_FillAt_Proxy( @@ -2518,8 +2686,15 @@ ULONG cb, ULONG *pcbWritten) { - FIXME(":stub\n"); - return E_NOTIMPL; + ULONG written; + HRESULT hr; + + TRACE("(%p)->(%s, %p, %d, %p)\n", This, wine_dbgstr_longlong(ulOffset.QuadPart), pv, cb, pcbWritten); + + hr = IFillLockBytes_RemoteFillAt_Proxy(This, ulOffset, pv, cb, &written); + if(pcbWritten) *pcbWritten = written; + + return hr; } HRESULT __RPC_STUB IFillLockBytes_FillAt_Stub( @@ -2529,8 +2704,8 @@ ULONG cb, ULONG *pcbWritten) { - FIXME(":stub\n"); - return E_NOTIMPL; + TRACE("(%p)->(%s, %p, %d, %p)\n", This, wine_dbgstr_longlong(ulOffset.QuadPart), pv, cb, pcbWritten); + return IFillLockBytes_FillAt(This, ulOffset, pv, cb, pcbWritten); } HRESULT CALLBACK IEnumFORMATETC_Next_Proxy( @@ -2678,8 +2853,8 @@ FORMATETC *pformatetcIn, STGMEDIUM *pmedium) { - FIXME(":stub\n"); - return E_NOTIMPL; + TRACE("(%p)->(%p, %p)\n", This, pformatetcIn, pmedium); + return IDataObject_RemoteGetData_Proxy(This, pformatetcIn, pmedium); } HRESULT __RPC_STUB IDataObject_GetData_Stub( @@ -2687,8 +2862,8 @@ FORMATETC *pformatetcIn, STGMEDIUM *pRemoteMedium) { - FIXME(":stub\n"); - return E_NOTIMPL; + TRACE("(%p)->(%p, %p)\n", This, pformatetcIn, pRemoteMedium); + return IDataObject_GetData(This, pformatetcIn, pRemoteMedium); } HRESULT CALLBACK IDataObject_GetDataHere_Proxy( @@ -2696,8 +2871,8 @@ FORMATETC *pformatetc, STGMEDIUM *pmedium) { - FIXME(":stub\n"); - return E_NOTIMPL; + TRACE("(%p)->(%p, %p)\n", This, pformatetc, pmedium); + return IDataObject_RemoteGetDataHere_Proxy(This, pformatetc, pmedium); } HRESULT __RPC_STUB IDataObject_GetDataHere_Stub( @@ -2705,8 +2880,8 @@ FORMATETC *pformatetc, STGMEDIUM *pRemoteMedium) { - FIXME(":stub\n"); - return E_NOTIMPL; + TRACE("(%p)->(%p, %p)\n", This, pformatetc, pRemoteMedium); + return IDataObject_GetDataHere(This, pformatetc, pRemoteMedium); } HRESULT CALLBACK IDataObject_SetData_Proxy( Modified: trunk/reactos/dll/win32/oleaut32/tmarshal.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/tmarsha…
============================================================================== --- trunk/reactos/dll/win32/oleaut32/tmarshal.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/oleaut32/tmarshal.c [iso-8859-1] Sat May 23 14:25:54 2009 @@ -299,7 +299,7 @@ return E_FAIL; } RegCloseKey(ikey); - sprintf(typelibkey,"Typelib\\%s\\%s\\0\\win32",tlguid,ver); + sprintf(typelibkey,"Typelib\\%s\\%s\\0\\win%u",tlguid,ver,(sizeof(void*) == 8) ? 64 : 32); tlfnlen = sizeof(tlfn); if (RegQueryValueA(HKEY_CLASSES_ROOT,typelibkey,tlfn,&tlfnlen)) { ERR("Could not get typelib fn?\n"); Modified: trunk/reactos/dll/win32/oleaut32/typelib.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/typelib…
============================================================================== --- trunk/reactos/dll/win32/oleaut32/typelib.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/oleaut32/typelib.c [iso-8859-1] Sat May 23 14:25:54 2009 @@ -265,12 +265,14 @@ static const WCHAR LcidFormatW[] = {'%','l','x','\\',0}; static const WCHAR win16W[] = {'w','i','n','1','6',0}; static const WCHAR win32W[] = {'w','i','n','3','2',0}; + static const WCHAR win64W[] = {'w','i','n','6','4',0}; sprintfW( buffer, LcidFormatW, lcid ); switch(syskind) { case SYS_WIN16: strcatW( buffer, win16W ); break; case SYS_WIN32: strcatW( buffer, win32W ); break; + case SYS_WIN64: strcatW( buffer, win64W ); break; default: TRACE("Typelib is for unsupported syskind %i\n", syskind); return NULL; @@ -534,6 +536,12 @@ if (FAILED(ITypeLib_GetLibAttr(ptlib, &attr))) return E_FAIL; + +#ifdef _WIN64 + if (attr->syskind != SYS_WIN64) return TYPE_E_BADMODULEKIND; +#else + if (attr->syskind != SYS_WIN32 && attr->syskind != SYS_WIN16) return TYPE_E_BADMODULEKIND; +#endif get_typelib_key( &attr->guid, attr->wMajorVerNum, attr->wMinorVerNum, keyName ); @@ -780,7 +788,7 @@ /* Create the path to the key */ get_typelib_key( libid, wVerMajor, wVerMinor, keyName ); - if (syskind != SYS_WIN16 && syskind != SYS_WIN32) + if (syskind != SYS_WIN16 && syskind != SYS_WIN32 && syskind != SYS_WIN64) { TRACE("Unsupported syskind %i\n", syskind); result = E_INVALIDARG; @@ -1926,7 +1934,7 @@ (*pptfd)->funcdesc.callconv = (pFuncRec->FKCCIC) >> 8 & 0xF; (*pptfd)->funcdesc.cParams = pFuncRec->nrargs ; (*pptfd)->funcdesc.cParamsOpt = pFuncRec->nroargs ; - (*pptfd)->funcdesc.oVft = (pFuncRec->VtableOffset * sizeof(void *))/4; + (*pptfd)->funcdesc.oVft = pFuncRec->VtableOffset; (*pptfd)->funcdesc.wFuncFlags = LOWORD(pFuncRec->Flags) ; MSFT_GetTdesc(pcx, @@ -2185,7 +2193,7 @@ ptiRet->TypeAttr.wMajorVerNum=LOWORD(tiBase.version); ptiRet->TypeAttr.wMinorVerNum=HIWORD(tiBase.version); ptiRet->TypeAttr.cImplTypes=tiBase.cImplTypes; - ptiRet->TypeAttr.cbSizeVft=(tiBase.cbSizeVft * sizeof(void *))/4; /* FIXME: this is only the non inherited part */ + ptiRet->TypeAttr.cbSizeVft=tiBase.cbSizeVft; /* FIXME: this is only the non inherited part */ if(ptiRet->TypeAttr.typekind == TKIND_ALIAS) MSFT_GetTdesc(pcx, tiBase.datatype1, &ptiRet->TypeAttr.tdescAlias, ptiRet); @@ -3947,7 +3955,7 @@ (*ppTypeInfoImpl)->TypeAttr.cbAlignment = pTITail->cbAlignment; (*ppTypeInfoImpl)->TypeAttr.cbSizeInstance = pTITail->cbSizeInstance; - (*ppTypeInfoImpl)->TypeAttr.cbSizeVft = (pTITail->cbSizeVft * sizeof(void *))/4; + (*ppTypeInfoImpl)->TypeAttr.cbSizeVft = pTITail->cbSizeVft; switch(pTIHeader->typekind) { case TKIND_ENUM: @@ -7528,7 +7536,7 @@ (*ppFuncDesc)->funcdesc.callconv = md->cc; (*ppFuncDesc)->funcdesc.cParams = md->cArgs; (*ppFuncDesc)->funcdesc.cParamsOpt = 0; - (*ppFuncDesc)->funcdesc.oVft = md->iMeth << 2; + (*ppFuncDesc)->funcdesc.oVft = md->iMeth * sizeof(void *); (*ppFuncDesc)->funcdesc.cScodes = 0; (*ppFuncDesc)->funcdesc.wFuncFlags = 0; (*ppFuncDesc)->funcdesc.elemdescFunc.tdesc.vt = md->vtReturn; Modified: trunk/reactos/dll/win32/oleaut32/varformat.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/varform…
============================================================================== --- trunk/reactos/dll/win32/oleaut32/varformat.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/oleaut32/varformat.c [iso-8859-1] Sat May 23 14:25:54 2009 @@ -1305,11 +1305,17 @@ else { rgbDig[have_int + need_frac] = 0; - have_int++; + if (exponent < 0) + exponent++; + else + have_int++; } } else (*prgbDig)++; + /* We converted trailing digits to zeroes => have_frac has changed */ + while (have_frac > 0 && rgbDig[have_int + have_frac - 1] == 0) + have_frac--; } } TRACE("have_int=%d,need_int=%d,have_frac=%d,need_frac=%d,pad=%d,exp=%d\n",
15 years, 7 months
1
0
0
0
[dchapyshev] 41062: - Sync riched20, qmgr, pdh with Wine 1.1.22
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Sat May 23 14:25:02 2009 New Revision: 41062 URL:
http://svn.reactos.org/svn/reactos?rev=41062&view=rev
Log: - Sync riched20, qmgr, pdh with Wine 1.1.22 Modified: trunk/reactos/dll/win32/pdh/pdh_main.c trunk/reactos/dll/win32/qmgr/job.c trunk/reactos/dll/win32/riched20/editor.h trunk/reactos/dll/win32/riched20/string.c Modified: trunk/reactos/dll/win32/pdh/pdh_main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/pdh/pdh_main.c?r…
============================================================================== --- trunk/reactos/dll/win32/pdh/pdh_main.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/pdh/pdh_main.c [iso-8859-1] Sat May 23 14:25:02 2009 @@ -1098,6 +1098,8 @@ } heap_free( bufferW ); } + else + ret = PDH_MEMORY_ALLOCATION_FAILURE; } done: Modified: trunk/reactos/dll/win32/qmgr/job.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/qmgr/job.c?rev=4…
============================================================================== --- trunk/reactos/dll/win32/qmgr/job.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/qmgr/job.c [iso-8859-1] Sat May 23 14:25:02 2009 @@ -334,8 +334,8 @@ IBackgroundCopyJob2 *iface, BG_JOB_PRIORITY Val) { - FIXME("Not implemented\n"); - return E_NOTIMPL; + FIXME("(%p,0x%08x) stub\n", iface, Val); + return S_OK; } static HRESULT WINAPI BITS_IBackgroundCopyJob_GetPriority( Modified: trunk/reactos/dll/win32/riched20/editor.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/editor.…
============================================================================== --- trunk/reactos/dll/win32/riched20/editor.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/riched20/editor.h [iso-8859-1] Sat May 23 14:25:02 2009 @@ -86,7 +86,6 @@ const char *ME_GetDITypeName(ME_DIType type); /* string.c */ -ME_String *ME_MakeString(LPCWSTR szText); ME_String *ME_MakeStringN(LPCWSTR szText, int nMaxChars); ME_String *ME_MakeStringR(WCHAR cRepeat, int nMaxChars); ME_String *ME_StrDup(const ME_String *s); Modified: trunk/reactos/dll/win32/riched20/string.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/string.…
============================================================================== --- trunk/reactos/dll/win32/riched20/string.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/riched20/string.c [iso-8859-1] Sat May 23 14:25:02 2009 @@ -47,11 +47,6 @@ /* Native allows NULL chars */ memcpy(s->szData, szText, s->nLen * sizeof(WCHAR)); return s; -} - -ME_String *ME_MakeString(LPCWSTR szText) -{ - return ME_MakeStringN(szText, lstrlenW(szText)); } /* Make a string by repeating a char nMaxChars times */
15 years, 7 months
1
0
0
0
[dchapyshev] 41061: shell32: - Add IShellItem implementation from Wine - Implement SHCreateShellItem setupapi: - Stubimplement SetupUninstallOEMInfA/W - Stubimplement Get_Device_Interface_List_Size_ExA/W
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Sat May 23 14:23:33 2009 New Revision: 41061 URL:
http://svn.reactos.org/svn/reactos?rev=41061&view=rev
Log: shell32: - Add IShellItem implementation from Wine - Implement SHCreateShellItem setupapi: - Stubimplement SetupUninstallOEMInfA/W - Stubimplement Get_Device_Interface_List_Size_ExA/W Added: trunk/reactos/dll/win32/shell32/shellitem.c (with props) trunk/reactos/dll/win32/shell32/shobjidl_local.idl (with props) Modified: trunk/reactos/dll/win32/setupapi/misc.c trunk/reactos/dll/win32/setupapi/setupapi.spec trunk/reactos/dll/win32/setupapi/stubs.c trunk/reactos/dll/win32/shell32/pidl.c trunk/reactos/dll/win32/shell32/shell32.rbuild trunk/reactos/dll/win32/shell32/shell32_main.h trunk/reactos/dll/win32/shell32/shellole.c Modified: trunk/reactos/dll/win32/setupapi/misc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/misc.c?…
============================================================================== --- trunk/reactos/dll/win32/setupapi/misc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/setupapi/misc.c [iso-8859-1] Sat May 23 14:23:33 2009 @@ -1160,6 +1160,51 @@ MyFree(lpInfo); return TRUE; +} + +/*********************************************************************** + * SetupUninstallOEMInfW (SETUPAPI.@) + */ +BOOL WINAPI SetupUninstallOEMInfW( PCWSTR inf_file, DWORD flags, PVOID reserved ) +{ + static const WCHAR infW[] = {'\\','i','n','f','\\',0}; + WCHAR target[MAX_PATH]; + + TRACE("%s, 0x%08x, %p\n", debugstr_w(inf_file), flags, reserved); + + if (!inf_file) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + if (!GetWindowsDirectoryW( target, sizeof(target)/sizeof(WCHAR) )) return FALSE; + + strcatW( target, infW ); + strcatW( target, inf_file ); + + if (flags & SUOI_FORCEDELETE) + return DeleteFileW(target); + + FIXME("not deleting %s\n", debugstr_w(target)); + + return TRUE; +} + +/*********************************************************************** + * SetupUninstallOEMInfA (SETUPAPI.@) + */ +BOOL WINAPI SetupUninstallOEMInfA( PCSTR inf_file, DWORD flags, PVOID reserved ) +{ + BOOL ret; + WCHAR *inf_fileW = NULL; + + TRACE("%s, 0x%08x, %p\n", debugstr_a(inf_file), flags, reserved); + + if (inf_file && !(inf_fileW = strdupAtoW( inf_file ))) return FALSE; + ret = SetupUninstallOEMInfW( inf_fileW, flags, reserved ); + HeapFree( GetProcessHeap(), 0, inf_fileW ); + return ret; } /*********************************************************************** Modified: trunk/reactos/dll/win32/setupapi/setupapi.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/setupap…
============================================================================== --- trunk/reactos/dll/win32/setupapi/setupapi.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/setupapi/setupapi.spec [iso-8859-1] Sat May 23 14:23:33 2009 @@ -100,8 +100,8 @@ @ stub CM_Get_Device_Interface_List_ExW @ stub CM_Get_Device_Interface_List_SizeA @ stub CM_Get_Device_Interface_List_SizeW -@ stub CM_Get_Device_Interface_List_Size_ExA -@ stub CM_Get_Device_Interface_List_Size_ExW +@ stdcall CM_Get_Device_Interface_List_Size_ExA(ptr ptr str long ptr) +@ stdcall CM_Get_Device_Interface_List_Size_ExW(ptr ptr wstr long ptr) @ stdcall CM_Get_First_Log_Conf(ptr long long) @ stdcall CM_Get_First_Log_Conf_Ex(ptr long long long) @ stdcall CM_Get_Global_State(ptr long) @@ -528,8 +528,8 @@ @ stdcall SetupTermDefaultQueueCallback(ptr) @ stdcall SetupTerminateFileLog(long) @ stub SetupUninstallNewlyCopiedInfs -@ stub SetupUninstallOEMInfA -@ stub SetupUninstallOEMInfW +@ stdcall SetupUninstallOEMInfA(str long ptr) +@ stdcall SetupUninstallOEMInfW(wstr long ptr) @ stub SetupVerifyInfFileA @ stub SetupVerifyInfFileW @ stdcall UnicodeToMultiByte(wstr long) Modified: trunk/reactos/dll/win32/setupapi/stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/stubs.c…
============================================================================== --- trunk/reactos/dll/win32/setupapi/stubs.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/setupapi/stubs.c [iso-8859-1] Sat May 23 14:23:33 2009 @@ -213,3 +213,23 @@ FIXME ("Stub %p\n", handle); return CR_SUCCESS; } + +/*********************************************************************** + * CM_Get_Device_Interface_List_Size_ExA (SETUPAPI.@) + */ +CONFIGRET WINAPI CM_Get_Device_Interface_List_Size_ExA(PULONG len, LPGUID class, DEVINSTID_A id, + ULONG flags, HMACHINE machine) +{ + FIXME("%p %p %s 0x%08x %p: stub\n", len, class, debugstr_a(id), flags, machine); + return CR_FAILURE; +} + +/*********************************************************************** + * CM_Get_Device_Interface_List_Size_ExW (SETUPAPI.@) + */ +CONFIGRET WINAPI CM_Get_Device_Interface_List_Size_ExW(PULONG len, LPGUID class, DEVINSTID_W id, + ULONG flags, HMACHINE machine) +{ + FIXME("%p %p %s 0x%08x %p: stub\n", len, class, debugstr_w(id), flags, machine); + return CR_FAILURE; +} Modified: trunk/reactos/dll/win32/shell32/pidl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/pidl.c?r…
============================================================================== --- trunk/reactos/dll/win32/shell32/pidl.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/pidl.c [iso-8859-1] Sat May 23 14:23:33 2009 @@ -2392,10 +2392,3 @@ return dst; } - -HRESULT WINAPI SHCreateShellItem(LPCITEMIDLIST pidlParent, - IShellFolder *psfParent, LPCITEMIDLIST pidl, void **ppsi) -{ - FIXME("STUB: %p %p %p %p\n",pidlParent, psfParent, pidl, ppsi); - return E_NOINTERFACE; -} Modified: trunk/reactos/dll/win32/shell32/shell32.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shell32.…
============================================================================== --- trunk/reactos/dll/win32/shell32/shell32.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shell32.rbuild [iso-8859-1] Sat May 23 14:23:33 2009 @@ -1,3 +1,4 @@ +<group> <module name="shell32" type="win32dll" baseaddress="${BASEADDRESS_SHELL32}" installbase="system32" installname="shell32.dll" crt="msvcrt"> <autoregister infsection="OleControlDlls" type="Both" /> <importlibrary definition="shell32.spec" /> @@ -44,6 +45,7 @@ <file>pidl.c</file> <file>regsvr.c</file> <file>shell32_main.c</file> + <file>shellitem.c</file> <file>shelllink.c</file> <file>shellole.c</file> <file>shellord.c</file> @@ -78,3 +80,7 @@ <file>folder_options.c</file> <file>shell32.rc</file> </module> +<module name="shobjidl_local_interface" type="idlinterface"> + <file>shobjidl_local.idl</file> +</module> +</group> Modified: trunk/reactos/dll/win32/shell32/shell32_main.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shell32_…
============================================================================== --- trunk/reactos/dll/win32/shell32/shell32_main.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shell32_main.h [iso-8859-1] Sat May 23 14:23:33 2009 @@ -91,6 +91,7 @@ LPSHELLVIEW IShellView_Constructor(LPSHELLFOLDER); HRESULT WINAPI IFSFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv); +HRESULT WINAPI IShellItem_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv); HRESULT WINAPI IShellLink_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv); HRESULT WINAPI IShellLink_ConstructFromFile(IUnknown * pUnkOuter, REFIID riid, LPCITEMIDLIST pidl, LPVOID * ppv); HRESULT WINAPI ISF_Desktop_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv); Added: trunk/reactos/dll/win32/shell32/shellitem.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellite…
============================================================================== --- trunk/reactos/dll/win32/shell32/shellitem.c (added) +++ trunk/reactos/dll/win32/shell32/shellitem.c [iso-8859-1] Sat May 23 14:23:33 2009 @@ -1,0 +1,382 @@ +/* + * IShellItem implementation + * + * Copyright 2008 Vincent Povirk for CodeWeavers + * + * 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 "precomp.h" + +WINE_DEFAULT_DEBUG_CHANNEL(shell); + +typedef struct _ShellItem { + const IShellItemVtbl *lpIShellItemVtbl; + LONG ref; + LPITEMIDLIST pidl; + const IPersistIDListVtbl *lpIPersistIDListVtbl; +} ShellItem; + +HRESULT WINAPI SHCreateShellItem(LPCITEMIDLIST pidlParent, + IShellFolder *psfParent, LPCITEMIDLIST pidl, IShellItem **ppsi); + + +static inline ShellItem *impl_from_IPersistIDList( IPersistIDList *iface ) +{ + return (ShellItem*)((char*)iface - FIELD_OFFSET(ShellItem, lpIPersistIDListVtbl)); +} + + +static HRESULT WINAPI ShellItem_QueryInterface(IShellItem *iface, REFIID riid, + void **ppv) +{ + ShellItem *This = (ShellItem*)iface; + + TRACE("(%p,%p,%p)\n", iface, riid, ppv); + + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(&IID_IUnknown, riid) || IsEqualIID(&IID_IShellItem, riid)) + { + *ppv = This; + } + else if (IsEqualIID(&IID_IPersist, riid) || IsEqualIID(&IID_IPersistIDList, riid)) + { + *ppv = &(This->lpIPersistIDListVtbl); + } + else { + FIXME("not implemented for %s\n", shdebugstr_guid(riid)); + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; +} + +static ULONG WINAPI ShellItem_AddRef(IShellItem *iface) +{ + ShellItem *This = (ShellItem*)iface; + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p), new refcount=%i\n", iface, ref); + + return ref; +} + +static ULONG WINAPI ShellItem_Release(IShellItem *iface) +{ + ShellItem *This = (ShellItem*)iface; + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p), new refcount=%i\n", iface, ref); + + if (ref == 0) + { + ILFree(This->pidl); + HeapFree(GetProcessHeap(), 0, This); + } + + return ref; +} + +static HRESULT ShellItem_get_parent_pidl(ShellItem *This, LPITEMIDLIST *parent_pidl) +{ + *parent_pidl = ILClone(This->pidl); + if (*parent_pidl) + { + if (ILRemoveLastID(*parent_pidl)) + return S_OK; + else + { + ILFree(*parent_pidl); + *parent_pidl = NULL; + return E_INVALIDARG; + } + } + else + { + *parent_pidl = NULL; + return E_OUTOFMEMORY; + } +} + +static HRESULT ShellItem_get_parent_shellfolder(ShellItem *This, IShellFolder **ppsf) +{ + LPITEMIDLIST parent_pidl; + IShellFolder *desktop; + HRESULT ret; + + ret = ShellItem_get_parent_pidl(This, &parent_pidl); + if (SUCCEEDED(ret)) + { + ret = SHGetDesktopFolder(&desktop); + if (SUCCEEDED(ret)) + { + ret = IShellFolder_BindToObject(desktop, parent_pidl, NULL, &IID_IShellFolder, (void**)ppsf); + IShellFolder_Release(desktop); + } + ILFree(parent_pidl); + } + + return ret; +} + +static HRESULT WINAPI ShellItem_BindToHandler(IShellItem *iface, IBindCtx *pbc, + REFGUID rbhid, REFIID riid, void **ppvOut) +{ + FIXME("(%p,%p,%s,%p,%p)\n", iface, pbc, shdebugstr_guid(rbhid), riid, ppvOut); + + *ppvOut = NULL; + + return E_NOTIMPL; +} + +static HRESULT WINAPI ShellItem_GetParent(IShellItem *iface, IShellItem **ppsi) +{ + ShellItem *This = (ShellItem*)iface; + LPITEMIDLIST parent_pidl; + HRESULT ret; + + TRACE("(%p,%p)\n", iface, ppsi); + + ret = ShellItem_get_parent_pidl(This, &parent_pidl); + if (SUCCEEDED(ret)) + { + ret = SHCreateShellItem(NULL, NULL, parent_pidl, ppsi); + ILFree(parent_pidl); + } + + return ret; +} + +static HRESULT WINAPI ShellItem_GetDisplayName(IShellItem *iface, SIGDN sigdnName, + LPWSTR *ppszName) +{ + FIXME("(%p,%x,%p)\n", iface, sigdnName, ppszName); + + *ppszName = NULL; + + return E_NOTIMPL; +} + +static HRESULT WINAPI ShellItem_GetAttributes(IShellItem *iface, SFGAOF sfgaoMask, + SFGAOF *psfgaoAttribs) +{ + ShellItem *This = (ShellItem*)iface; + IShellFolder *parent_folder; + LPITEMIDLIST child_pidl; + HRESULT ret; + + TRACE("(%p,%x,%p)\n", iface, sfgaoMask, psfgaoAttribs); + + ret = ShellItem_get_parent_shellfolder(This, &parent_folder); + if (SUCCEEDED(ret)) + { + child_pidl = ILFindLastID(This->pidl); + *psfgaoAttribs = sfgaoMask; + ret = IShellFolder_GetAttributesOf(parent_folder, 1, (LPCITEMIDLIST*)&child_pidl, psfgaoAttribs); + IShellFolder_Release(parent_folder); + } + + return ret; +} + +static HRESULT WINAPI ShellItem_Compare(IShellItem *iface, IShellItem *oth, + SICHINTF hint, int *piOrder) +{ + FIXME("(%p,%p,%x,%p)\n", iface, oth, hint, piOrder); + + return E_NOTIMPL; +} + +static const IShellItemVtbl ShellItem_Vtbl = { + ShellItem_QueryInterface, + ShellItem_AddRef, + ShellItem_Release, + ShellItem_BindToHandler, + ShellItem_GetParent, + ShellItem_GetDisplayName, + ShellItem_GetAttributes, + ShellItem_Compare +}; + + +static HRESULT ShellItem_GetClassID(ShellItem* This, CLSID *pClassID) +{ + TRACE("(%p,%p)\n", This, pClassID); + + *pClassID = CLSID_ShellItem; + return S_OK; +} + + +static HRESULT WINAPI ShellItem_IPersistIDList_QueryInterface(IPersistIDList *iface, + REFIID riid, void **ppv) +{ + ShellItem *This = impl_from_IPersistIDList(iface); + return ShellItem_QueryInterface((IShellItem*)This, riid, ppv); +} + +static ULONG WINAPI ShellItem_IPersistIDList_AddRef(IPersistIDList *iface) +{ + ShellItem *This = impl_from_IPersistIDList(iface); + return ShellItem_AddRef((IShellItem*)This); +} + +static ULONG WINAPI ShellItem_IPersistIDList_Release(IPersistIDList *iface) +{ + ShellItem *This = impl_from_IPersistIDList(iface); + return ShellItem_Release((IShellItem*)This); +} + +static HRESULT WINAPI ShellItem_IPersistIDList_GetClassID(IPersistIDList* iface, + CLSID *pClassID) +{ + ShellItem *This = impl_from_IPersistIDList(iface); + + return ShellItem_GetClassID(This, pClassID); +} + +static HRESULT WINAPI ShellItem_IPersistIDList_SetIDList(IPersistIDList* iface, + LPCITEMIDLIST pidl) +{ + ShellItem *This = impl_from_IPersistIDList(iface); + LPITEMIDLIST new_pidl; + + TRACE("(%p,%p)\n", This, pidl); + + new_pidl = ILClone(pidl); + + if (new_pidl) + { + ILFree(This->pidl); + This->pidl = new_pidl; + return S_OK; + } + else + return E_OUTOFMEMORY; +} + +static HRESULT WINAPI ShellItem_IPersistIDList_GetIDList(IPersistIDList* iface, + LPITEMIDLIST *ppidl) +{ + ShellItem *This = impl_from_IPersistIDList(iface); + + TRACE("(%p,%p)\n", This, ppidl); + + *ppidl = ILClone(This->pidl); + if (*ppidl) + return S_OK; + else + return E_OUTOFMEMORY; +} + +static const IPersistIDListVtbl ShellItem_IPersistIDList_Vtbl = { + ShellItem_IPersistIDList_QueryInterface, + ShellItem_IPersistIDList_AddRef, + ShellItem_IPersistIDList_Release, + ShellItem_IPersistIDList_GetClassID, + ShellItem_IPersistIDList_SetIDList, + ShellItem_IPersistIDList_GetIDList +}; + + +HRESULT WINAPI IShellItem_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv) +{ + ShellItem *This; + HRESULT ret; + + TRACE("(%p,%s)\n",pUnkOuter, debugstr_guid(riid)); + + *ppv = NULL; + + if (pUnkOuter) return CLASS_E_NOAGGREGATION; + + This = HeapAlloc(GetProcessHeap(), 0, sizeof(ShellItem)); + This->lpIShellItemVtbl = &ShellItem_Vtbl; + This->ref = 1; + This->pidl = NULL; + This->lpIPersistIDListVtbl = &ShellItem_IPersistIDList_Vtbl; + + ret = ShellItem_QueryInterface((IShellItem*)This, riid, ppv); + ShellItem_Release((IShellItem*)This); + + return ret; +} + +HRESULT WINAPI SHCreateShellItem(LPCITEMIDLIST pidlParent, + IShellFolder *psfParent, LPCITEMIDLIST pidl, IShellItem **ppsi) +{ + ShellItem *This; + LPITEMIDLIST new_pidl; + HRESULT ret; + + TRACE("(%p,%p,%p,%p)\n", pidlParent, psfParent, pidl, ppsi); + + if (!pidl) + { + return E_INVALIDARG; + } + else if (pidlParent || psfParent) + { + LPITEMIDLIST temp_parent=NULL; + if (!pidlParent) + { + IPersistFolder2* ppf2Parent; + + if (!SUCCEEDED(IPersistFolder2_QueryInterface(psfParent, &IID_IPersistFolder2, (void**)&ppf2Parent))) + { + FIXME("couldn't get IPersistFolder2 interface of parent\n"); + return E_NOINTERFACE; + } + + if (!SUCCEEDED(IPersistFolder2_GetCurFolder(ppf2Parent, &temp_parent))) + { + FIXME("couldn't get parent PIDL\n"); + IPersistFolder2_Release(ppf2Parent); + return E_NOINTERFACE; + } + + pidlParent = temp_parent; + IPersistFolder2_Release(ppf2Parent); + } + + new_pidl = ILCombine(pidlParent, pidl); + ILFree(temp_parent); + + if (!new_pidl) + return E_OUTOFMEMORY; + } + else + { + new_pidl = ILClone(pidl); + if (!new_pidl) + return E_OUTOFMEMORY; + } + + ret = IShellItem_Constructor(NULL, &IID_IShellItem, (void**)&This); + if (This) + { + *ppsi = (IShellItem*)This; + This->pidl = new_pidl; + } + else + { + *ppsi = NULL; + ILFree(new_pidl); + } + return ret; +} Propchange: trunk/reactos/dll/win32/shell32/shellitem.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/dll/win32/shell32/shellole.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellole…
============================================================================== --- trunk/reactos/dll/win32/shell32/shellole.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shellole.c [iso-8859-1] Sat May 23 14:23:33 2009 @@ -42,6 +42,7 @@ {&CLSID_ShellFSFolder, &IFSFolder_Constructor}, {&CLSID_MyComputer, &ISF_MyComputer_Constructor}, {&CLSID_ShellDesktop, &ISF_Desktop_Constructor}, + {&CLSID_ShellItem, &IShellItem_Constructor}, {&CLSID_ShellLink, &IShellLink_Constructor}, {&CLSID_DragDropHelper, &IDropTargetHelper_Constructor}, {&CLSID_ControlPanel, &IControlPanel_Constructor}, Added: trunk/reactos/dll/win32/shell32/shobjidl_local.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shobjidl…
============================================================================== --- trunk/reactos/dll/win32/shell32/shobjidl_local.idl (added) +++ trunk/reactos/dll/win32/shell32/shobjidl_local.idl [iso-8859-1] Sat May 23 14:23:33 2009 @@ -1,0 +1,2 @@ + +#include "shobjidl.idl" Propchange: trunk/reactos/dll/win32/shell32/shobjidl_local.idl ------------------------------------------------------------------------------ svn:eol-style = native
15 years, 7 months
1
0
0
0
[dchapyshev] 41060: - Sync shlwapi, traffic, urlmon with Wine 1.1.22
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Sat May 23 14:20:22 2009 New Revision: 41060 URL:
http://svn.reactos.org/svn/reactos?rev=41060&view=rev
Log: - Sync shlwapi, traffic, urlmon with Wine 1.1.22 Added: trunk/reactos/dll/win32/urlmon/protproxy.c (with props) Modified: trunk/reactos/dll/win32/shlwapi/ordinal.c trunk/reactos/dll/win32/shlwapi/shlwapi.spec trunk/reactos/dll/win32/traffic/traffic.spec trunk/reactos/dll/win32/traffic/traffic_main.c trunk/reactos/dll/win32/urlmon/binding.c trunk/reactos/dll/win32/urlmon/bindprot.c trunk/reactos/dll/win32/urlmon/file.c trunk/reactos/dll/win32/urlmon/ftp.c trunk/reactos/dll/win32/urlmon/gopher.c trunk/reactos/dll/win32/urlmon/http.c trunk/reactos/dll/win32/urlmon/mk.c trunk/reactos/dll/win32/urlmon/session.c trunk/reactos/dll/win32/urlmon/urlmon.rbuild trunk/reactos/dll/win32/urlmon/urlmon_main.c trunk/reactos/dll/win32/urlmon/urlmon_main.h Modified: trunk/reactos/dll/win32/shlwapi/ordinal.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/ordinal.…
============================================================================== --- trunk/reactos/dll/win32/shlwapi/ordinal.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shlwapi/ordinal.c [iso-8859-1] Sat May 23 14:20:22 2009 @@ -1081,11 +1081,11 @@ */ LONG WINAPI SHSetWindowBits(HWND hwnd, INT offset, UINT wMask, UINT wFlags) { - LONG ret = GetWindowLongPtrA(hwnd, offset); + LONG ret = GetWindowLongA(hwnd, offset); LONG newFlags = (wFlags & wMask) | (ret & ~wFlags); if (newFlags != ret) - ret = SetWindowLongPtrA(hwnd, offset, newFlags); + ret = SetWindowLongA(hwnd, offset, newFlags); return ret; } @@ -2912,6 +2912,26 @@ return S_OK; } + +/************************************************************************* + * IConnectionPoint_InvokeWithCancel [SHLWAPI.283] + */ +HRESULT WINAPI IConnectionPoint_InvokeWithCancel( IConnectionPoint* iCP, + DISPID dispId, DISPPARAMS* dispParams, + DWORD unknown1, DWORD unknown2 ) +{ + IID iid; + HRESULT result; + + FIXME("(%p)->(0x%x %p %x %x) partial stub\n", iCP, dispId, dispParams, unknown1, unknown2); + + result = IConnectionPoint_GetConnectionInterface(iCP, &iid); + if (SUCCEEDED(result)) + result = SHLWAPI_InvokeByIID(iCP, &iid, dispId, dispParams); + + return result; +} + /************************************************************************* * @ [SHLWAPI.284] Modified: trunk/reactos/dll/win32/shlwapi/shlwapi.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/shlwapi.…
============================================================================== --- trunk/reactos/dll/win32/shlwapi/shlwapi.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shlwapi/shlwapi.spec [iso-8859-1] Sat May 23 14:20:22 2009 @@ -280,7 +280,7 @@ 280 stdcall -noname SHRegGetIntW(ptr wstr long) 281 stdcall -noname SHPackDispParamsV(ptr ptr long ptr) 282 varargs -noname SHPackDispParams(ptr ptr long) -283 stub -noname IConnectionPoint_InvokeWithCancel +283 stdcall -noname IConnectionPoint_InvokeWithCancel(ptr long long long long) 284 stdcall -noname IConnectionPoint_SimpleInvoke(ptr long ptr) 285 stdcall -noname IConnectionPoint_OnChanged(ptr long) 286 varargs -noname IUnknown_CPContainerInvokeParam(ptr ptr long ptr long) Modified: trunk/reactos/dll/win32/traffic/traffic.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/traffic/traffic.…
============================================================================== --- trunk/reactos/dll/win32/traffic/traffic.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/traffic/traffic.spec [iso-8859-1] Sat May 23 14:20:22 2009 @@ -15,7 +15,7 @@ @ stub TcQueryFlowA @ stub TcQueryFlowW @ stub TcQueryInterface -@ stub TcRegisterClient +@ stdcall TcRegisterClient(long ptr ptr ptr) @ stub TcSetFlowA @ stub TcSetFlowW @ stub TcSetInterface Modified: trunk/reactos/dll/win32/traffic/traffic_main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/traffic/traffic_…
============================================================================== --- trunk/reactos/dll/win32/traffic/traffic_main.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/traffic/traffic_main.c [iso-8859-1] Sat May 23 14:20:22 2009 @@ -21,6 +21,7 @@ #include "windef.h" #include "winbase.h" +#include "traffic.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(traffic); @@ -42,3 +43,14 @@ return TRUE; } + +/***************************************************************************** + * TcRegisterClient [TRAFFIC.@] + */ +ULONG WINAPI TcRegisterClient(ULONG version, HANDLE context, + PTCI_CLIENT_FUNC_LIST list, PHANDLE buffer) +{ + FIXME("(%u %p %p %p) stub\n", version, context, list, buffer); + if(buffer) *buffer = INVALID_HANDLE_VALUE; + return ERROR_CALL_NOT_IMPLEMENTED; +} Modified: trunk/reactos/dll/win32/urlmon/binding.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/binding.c…
============================================================================== --- trunk/reactos/dll/win32/urlmon/binding.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/urlmon/binding.c [iso-8859-1] Sat May 23 14:20:22 2009 @@ -78,7 +78,7 @@ struct Binding { const IBindingVtbl *lpBindingVtbl; - const IInternetProtocolSinkVtbl *lpInternetProtocolSinkVtbl; + const IInternetProtocolSinkVtbl *lpIInternetProtocolSinkVtbl; const IInternetBindInfoVtbl *lpInternetBindInfoVtbl; const IWinInetHttpInfoVtbl *lpWinInetHttpInfoVtbl; const IServiceProviderVtbl *lpServiceProviderVtbl; @@ -100,66 +100,24 @@ LPWSTR url; IID iid; BOOL report_mime; - DWORD continue_call; DWORD state; HRESULT hres; download_state_t download_state; IUnknown *obj; IMoniker *mon; IBindCtx *bctx; - - DWORD apartment_thread; HWND notif_hwnd; - task_header_t *task_queue_head, *task_queue_tail; CRITICAL_SECTION section; }; #define BINDING(x) ((IBinding*) &(x)->lpBindingVtbl) -#define PROTSINK(x) ((IInternetProtocolSink*) &(x)->lpInternetProtocolSinkVtbl) #define BINDINF(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl) #define INETINFO(x) ((IWinInetHttpInfo*) &(x)->lpWinInetHttpInfoVtbl) #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl) #define STREAM(x) ((IStream*) &(x)->lpStreamVtbl) #define HTTPNEG2(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl) - -#define WM_MK_CONTINUE (WM_USER+101) - -static void push_task(Binding *binding, task_header_t *task, task_proc_t proc) -{ - task->proc = proc; - task->next = NULL; - - EnterCriticalSection(&binding->section); - - if(binding->task_queue_tail) { - binding->task_queue_tail->next = task; - binding->task_queue_tail = task; - }else { - binding->task_queue_tail = binding->task_queue_head = task; - } - - LeaveCriticalSection(&binding->section); -} - -static task_header_t *pop_task(Binding *binding) -{ - task_header_t *ret; - - EnterCriticalSection(&binding->section); - - ret = binding->task_queue_head; - if(ret) { - binding->task_queue_head = ret->next; - if(!binding->task_queue_head) - binding->task_queue_tail = NULL; - } - - LeaveCriticalSection(&binding->section); - - return ret; -} static void fill_stgmed_buffer(stgmed_buf_t *buf) { @@ -173,59 +131,6 @@ buf->size += read; if(read > 0) buf->init = TRUE; -} - -static LRESULT WINAPI notif_wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - if(msg == WM_MK_CONTINUE) { - Binding *binding = (Binding*)lParam; - task_header_t *task; - - while((task = pop_task(binding))) { - binding->continue_call++; - task->proc(binding, task); - binding->continue_call--; - } - - IBinding_Release(BINDING(binding)); - return 0; - } - - return DefWindowProcW(hwnd, msg, wParam, lParam); -} - -static HWND get_notif_hwnd(void) -{ - static ATOM wnd_class = 0; - HWND hwnd; - - static const WCHAR wszURLMonikerNotificationWindow[] = - {'U','R','L',' ','M','o','n','i','k','e','r',' ', - 'N','o','t','i','f','i','c','a','t','i','o','n',' ','W','i','n','d','o','w',0}; - - if(!wnd_class) { - static WNDCLASSEXW wndclass = { - sizeof(wndclass), 0, - notif_wnd_proc, 0, 0, - NULL, NULL, NULL, NULL, NULL, - wszURLMonikerNotificationWindow, - NULL - }; - - wndclass.hInstance = URLMON_hInstance; - - wnd_class = RegisterClassExW(&wndclass); - if (!wnd_class && GetLastError() == ERROR_CLASS_ALREADY_EXISTS) - wnd_class = 1; - } - - hwnd = CreateWindowExW(0, wszURLMonikerNotificationWindow, - wszURLMonikerNotificationWindow, 0, 0, 0, 0, 0, HWND_MESSAGE, - NULL, URLMON_hInstance, NULL); - - TRACE("hwnd = %p\n", hwnd); - - return hwnd; } static void dump_BINDINFO(BINDINFO *bi) @@ -272,73 +177,17 @@ ); } -static void set_binding_mime(Binding *binding, LPCWSTR mime) -{ - EnterCriticalSection(&binding->section); - - if(binding->report_mime) { - heap_free(binding->mime); - binding->mime = heap_strdupW(mime); - } - - LeaveCriticalSection(&binding->section); -} - -static void handle_mime_available(Binding *binding, BOOL verify) -{ - BOOL report_mime; - - EnterCriticalSection(&binding->section); - report_mime = binding->report_mime; - binding->report_mime = FALSE; - LeaveCriticalSection(&binding->section); - - if(!report_mime) +static void mime_available(Binding *This, LPCWSTR mime) +{ + heap_free(This->mime); + This->mime = heap_strdupW(mime); + + if(!This->mime || !This->report_mime) return; - if(verify) { - LPWSTR mime = NULL; - - fill_stgmed_buffer(binding->stgmed_buf); - FindMimeFromData(NULL, binding->url, binding->stgmed_buf->buf, - min(binding->stgmed_buf->size, 255), binding->mime, 0, &mime, 0); - - heap_free(binding->mime); - binding->mime = heap_strdupW(mime); - CoTaskMemFree(mime); - } - - IBindStatusCallback_OnProgress(binding->callback, 0, 0, BINDSTATUS_MIMETYPEAVAILABLE, binding->mime); - - binding->clipboard_format = RegisterClipboardFormatW(binding->mime); -} - -typedef struct { - task_header_t header; - BOOL verify; -} mime_available_task_t; - -static void mime_available_proc(Binding *binding, task_header_t *t) -{ - mime_available_task_t *task = (mime_available_task_t*)t; - - handle_mime_available(binding, task->verify); - - heap_free(task); -} - -static void mime_available(Binding *This, LPCWSTR mime, BOOL verify) -{ - if(mime) - set_binding_mime(This, mime); - - if(GetCurrentThreadId() == This->apartment_thread) { - handle_mime_available(This, verify); - }else { - mime_available_task_t *task = heap_alloc(sizeof(task_header_t)); - task->verify = verify; - push_task(This, &task->header, mime_available_proc); - } + IBindStatusCallback_OnProgress(This->callback, 0, 0, BINDSTATUS_MIMETYPEAVAILABLE, This->mime); + + This->clipboard_format = RegisterClipboardFormatW(This->mime); } static void stop_binding(Binding *binding, HRESULT hres, LPCWSTR str) @@ -957,8 +806,8 @@ TRACE("(%p) ref=%d\n", This, ref); if(!ref) { - if (This->notif_hwnd) - DestroyWindow( This->notif_hwnd ); + if(This->notif_hwnd) + release_notif_hwnd(This->notif_hwnd); if(This->mon) IMoniker_Release(This->mon); if(This->callback) @@ -1066,7 +915,7 @@ Binding_GetBindResult }; -#define PROTSINK_THIS(iface) DEFINE_THIS(Binding, InternetProtocolSink, iface) +#define PROTSINK_THIS(iface) DEFINE_THIS(Binding, IInternetProtocolSink, iface) static HRESULT WINAPI InternetProtocolSink_QueryInterface(IInternetProtocolSink *iface, REFIID riid, void **ppv) @@ -1087,92 +936,21 @@ return IBinding_Release(BINDING(This)); } -typedef struct { - task_header_t header; - PROTOCOLDATA data; -} switch_task_t; - -static void switch_proc(Binding *binding, task_header_t *t) -{ - switch_task_t *task = (switch_task_t*)t; - - IInternetProtocol_Continue(binding->protocol, &task->data); - - heap_free(task); -} - static HRESULT WINAPI InternetProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData) { Binding *This = PROTSINK_THIS(iface); - switch_task_t *task; - - TRACE("(%p)->(%p)\n", This, pProtocolData); - - task = heap_alloc(sizeof(switch_task_t)); - task->data = *pProtocolData; - - push_task(This, &task->header, switch_proc); - - IBinding_AddRef(BINDING(This)); - PostMessageW(This->notif_hwnd, WM_MK_CONTINUE, 0, (LPARAM)This); - - return S_OK; -} - -typedef struct { - task_header_t header; - - Binding *binding; - ULONG progress; - ULONG progress_max; - ULONG status_code; - LPWSTR status_text; -} on_progress_task_t; - -static void on_progress_proc(Binding *binding, task_header_t *t) -{ - on_progress_task_t *task = (on_progress_task_t*)t; - - IBindStatusCallback_OnProgress(binding->callback, task->progress, - task->progress_max, task->status_code, task->status_text); - - heap_free(task->status_text); - heap_free(task); + + WARN("(%p)->(%p)\n", This, pProtocolData); + + return E_FAIL; } static void on_progress(Binding *This, ULONG progress, ULONG progress_max, ULONG status_code, LPCWSTR status_text) { - on_progress_task_t *task; - - if(GetCurrentThreadId() == This->apartment_thread && !This->continue_call) { - IBindStatusCallback_OnProgress(This->callback, progress, progress_max, - status_code, status_text); - return; - } - - task = heap_alloc(sizeof(on_progress_task_t)); - - task->progress = progress; - task->progress_max = progress_max; - task->status_code = status_code; - - if(status_text) { - DWORD size = (strlenW(status_text)+1)*sizeof(WCHAR); - - task->status_text = heap_alloc(size); - memcpy(task->status_text, status_text, size); - }else { - task->status_text = NULL; - } - - push_task(This, &task->header, on_progress_proc); - - if(GetCurrentThreadId() != This->apartment_thread) { - IBinding_AddRef(BINDING(This)); - PostMessageW(This->notif_hwnd, WM_MK_CONTINUE, 0, (LPARAM)This); - } + IBindStatusCallback_OnProgress(This->callback, progress, progress_max, + status_code, status_text); } static HRESULT WINAPI InternetProtocolSink_ReportProgress(IInternetProtocolSink *iface, @@ -1192,22 +970,26 @@ case BINDSTATUS_BEGINDOWNLOADDATA: fill_stgmed_buffer(This->stgmed_buf); break; - case BINDSTATUS_MIMETYPEAVAILABLE: - set_binding_mime(This, szStatusText); - break; case BINDSTATUS_SENDINGREQUEST: on_progress(This, 0, 0, BINDSTATUS_SENDINGREQUEST, szStatusText); break; case BINDSTATUS_PROTOCOLCLASSID: break; + case BINDSTATUS_MIMETYPEAVAILABLE: case BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE: - mime_available(This, szStatusText, FALSE); + mime_available(This, szStatusText); break; case BINDSTATUS_CACHEFILENAMEAVAILABLE: heap_free(This->stgmed_buf->cache_file); This->stgmed_buf->cache_file = heap_strdupW(szStatusText); break; - case BINDSTATUS_DIRECTBIND: + case BINDSTATUS_DECODING: + IBindStatusCallback_OnProgress(This->callback, 0, 0, BINDSTATUS_DECODING, szStatusText); + break; + case BINDSTATUS_LOADINGMIMEHANDLER: + on_progress(This, 0, 0, BINDSTATUS_LOADINGMIMEHANDLER, szStatusText); + break; + case BINDSTATUS_DIRECTBIND: /* FIXME: Handle BINDSTATUS_DIRECTBIND in BindProtocol */ This->report_mime = FALSE; break; case BINDSTATUS_ACCEPTRANGES: @@ -1230,12 +1012,6 @@ if(This->download_state == END_DOWNLOAD || (This->state & BINDING_STOPPED)) return; - if(GetCurrentThreadId() != This->apartment_thread) - FIXME("called from worker thread\n"); - - if(This->report_mime) - mime_available(This, NULL, TRUE); - if(This->download_state == BEFORE_DOWNLOAD) { fill_stgmed_buffer(This->stgmed_buf); @@ -1288,22 +1064,6 @@ } } -typedef struct { - task_header_t header; - DWORD bscf; - ULONG progress; - ULONG progress_max; -} report_data_task_t; - -static void report_data_proc(Binding *binding, task_header_t *t) -{ - report_data_task_t *task = (report_data_task_t*)t; - - report_data(binding, task->bscf, task->progress, task->progress_max); - - heap_free(task); -} - static HRESULT WINAPI InternetProtocolSink_ReportData(IInternetProtocolSink *iface, DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax) { @@ -1311,40 +1071,8 @@ TRACE("(%p)->(%d %u %u)\n", This, grfBSCF, ulProgress, ulProgressMax); - if(GetCurrentThreadId() != This->apartment_thread) - FIXME("called from worked hread\n"); - - if(This->continue_call) { - report_data_task_t *task = heap_alloc(sizeof(report_data_task_t)); - task->bscf = grfBSCF; - task->progress = ulProgress; - task->progress_max = ulProgressMax; - - push_task(This, &task->header, report_data_proc); - }else { - report_data(This, grfBSCF, ulProgress, ulProgressMax); - } - + report_data(This, grfBSCF, ulProgress, ulProgressMax); return S_OK; -} - -typedef struct { - task_header_t header; - - HRESULT hres; - LPWSTR str; -} report_result_task_t; - -static void report_result_proc(Binding *binding, task_header_t *t) -{ - report_result_task_t *task = (report_result_task_t*)t; - - IInternetProtocol_Terminate(binding->protocol, 0); - - stop_binding(binding, task->hres, task->str); - - heap_free(task->str); - heap_free(task); } static HRESULT WINAPI InternetProtocolSink_ReportResult(IInternetProtocolSink *iface, @@ -1354,18 +1082,8 @@ TRACE("(%p)->(%08x %d %s)\n", This, hrResult, dwError, debugstr_w(szResult)); - if(GetCurrentThreadId() == This->apartment_thread && !This->continue_call) { - IInternetProtocol_Terminate(This->protocol, 0); - stop_binding(This, hrResult, szResult); - }else { - report_result_task_t *task = heap_alloc(sizeof(report_result_task_t)); - - task->hres = hrResult; - task->str = heap_strdupW(szResult); - - push_task(This, &task->header, report_result_proc); - } - + IInternetProtocol_Terminate(This->protocol, 0); + stop_binding(This, hrResult, szResult); return S_OK; } @@ -1458,6 +1176,17 @@ IInternetBindInfo_Release(bindinfo); return hres; + } + case BINDSTRING_URL: { + DWORD size = (strlenW(This->url)+1) * sizeof(WCHAR); + + if(!ppwzStr || !pcElFetched) + return E_INVALIDARG; + + *ppwzStr = CoTaskMemAlloc(size); + memcpy(*ppwzStr, This->url, size); + *pcElFetched = 1; + return S_OK; } } @@ -1630,7 +1359,7 @@ ret = heap_alloc_zero(sizeof(Binding)); ret->lpBindingVtbl = &BindingVtbl; - ret->lpInternetProtocolSinkVtbl = &InternetProtocolSinkVtbl; + ret->lpIInternetProtocolSinkVtbl = &InternetProtocolSinkVtbl; ret->lpInternetBindInfoVtbl = &InternetBindInfoVtbl; ret->lpWinInetHttpInfoVtbl = &WinInetHttpInfoVtbl; ret->lpServiceProviderVtbl = &ServiceProviderVtbl; @@ -1639,7 +1368,6 @@ ret->to_object = to_obj; ret->iid = *riid; - ret->apartment_thread = GetCurrentThreadId(); ret->notif_hwnd = get_notif_hwnd(); ret->report_mime = !binding_ctx; ret->download_state = BEFORE_DOWNLOAD; @@ -1749,7 +1477,7 @@ report_data(binding, 0, 0, 0); }else { hres = IInternetProtocol_Start(binding->protocol, url, PROTSINK(binding), - BINDINF(binding), 0, 0); + BINDINF(binding), PI_APARTMENTTHREADED|PI_MIMEVERIFICATION, 0); TRACE("start ret %08x\n", hres); Modified: trunk/reactos/dll/win32/urlmon/bindprot.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/bindprot.…
============================================================================== --- trunk/reactos/dll/win32/urlmon/bindprot.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/urlmon/bindprot.c [iso-8859-1] Sat May 23 14:20:22 2009 @@ -1,5 +1,5 @@ /* - * Copyright 2007 Jacek Caban for CodeWeavers + * Copyright 2007-2009 Jacek Caban for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -21,16 +21,30 @@ WINE_DEFAULT_DEBUG_CHANNEL(urlmon); -typedef struct { - const IInternetProtocolVtbl *lpInternetProtocolVtbl; - const IInternetBindInfoVtbl *lpInternetBindInfoVtbl; - const IInternetPriorityVtbl *lpInternetPriorityVtbl; - const IServiceProviderVtbl *lpServiceProviderVtbl; - const IInternetProtocolSinkVtbl *lpInternetProtocolSinkVtbl; +typedef struct BindProtocol BindProtocol; + +struct _task_header_t; + +typedef void (*task_proc_t)(BindProtocol*,struct _task_header_t*); + +typedef struct _task_header_t { + task_proc_t proc; + struct _task_header_t *next; +} task_header_t; + +struct BindProtocol { + const IInternetProtocolVtbl *lpIInternetProtocolVtbl; + const IInternetBindInfoVtbl *lpInternetBindInfoVtbl; + const IInternetPriorityVtbl *lpInternetPriorityVtbl; + const IServiceProviderVtbl *lpServiceProviderVtbl; + const IInternetProtocolSinkVtbl *lpIInternetProtocolSinkVtbl; + + const IInternetProtocolVtbl *lpIInternetProtocolHandlerVtbl; LONG ref; IInternetProtocol *protocol; + IInternetProtocol *protocol_handler; IInternetBindInfo *bind_info; IInternetProtocolSink *protocol_sink; IServiceProvider *service_provider; @@ -39,16 +53,240 @@ LONG priority; BOOL reported_result; + BOOL reported_mime; BOOL from_urlmon; -} BindProtocol; - -#define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl) + DWORD pi; + + DWORD apartment_thread; + HWND notif_hwnd; + DWORD continue_call; + + CRITICAL_SECTION section; + task_header_t *task_queue_head, *task_queue_tail; + + BYTE *buf; + DWORD buf_size; + LPWSTR mime; + LPWSTR url; + ProtocolProxy *filter_proxy; +}; + #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl) #define PRIORITY(x) ((IInternetPriority*) &(x)->lpInternetPriorityVtbl) #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl) -#define PROTSINK(x) ((IInternetProtocolSink*) &(x)->lpInternetProtocolSinkVtbl) - -#define PROTOCOL_THIS(iface) DEFINE_THIS(BindProtocol, InternetProtocol, iface) + +#define PROTOCOLHANDLER(x) ((IInternetProtocol*) &(x)->lpIInternetProtocolHandlerVtbl) + +#define BUFFER_SIZE 2048 +#define MIME_TEST_SIZE 255 + +#define WM_MK_CONTINUE (WM_USER+101) +#define WM_MK_RELEASE (WM_USER+102) + +static LRESULT WINAPI notif_wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) { + case WM_MK_CONTINUE: { + BindProtocol *This = (BindProtocol*)lParam; + task_header_t *task; + + while(1) { + EnterCriticalSection(&This->section); + + task = This->task_queue_head; + if(task) { + This->task_queue_head = task->next; + if(!This->task_queue_head) + This->task_queue_tail = NULL; + } + + LeaveCriticalSection(&This->section); + + if(!task) + break; + + This->continue_call++; + task->proc(This, task); + This->continue_call--; + } + + IInternetProtocol_Release(PROTOCOL(This)); + return 0; + } + case WM_MK_RELEASE: { + tls_data_t *data = get_tls_data(); + + if(!--data->notif_hwnd_cnt) { + DestroyWindow(hwnd); + data->notif_hwnd = NULL; + } + } + } + + return DefWindowProcW(hwnd, msg, wParam, lParam); +} + +HWND get_notif_hwnd(void) +{ + static ATOM wnd_class = 0; + tls_data_t *tls_data; + + static const WCHAR wszURLMonikerNotificationWindow[] = + {'U','R','L',' ','M','o','n','i','k','e','r',' ', + 'N','o','t','i','f','i','c','a','t','i','o','n',' ','W','i','n','d','o','w',0}; + + tls_data = get_tls_data(); + if(!tls_data) + return NULL; + + if(tls_data->notif_hwnd_cnt) { + tls_data->notif_hwnd_cnt++; + return tls_data->notif_hwnd; + } + + if(!wnd_class) { + static WNDCLASSEXW wndclass = { + sizeof(wndclass), 0, + notif_wnd_proc, 0, 0, + NULL, NULL, NULL, NULL, NULL, + wszURLMonikerNotificationWindow, + NULL + }; + + wndclass.hInstance = URLMON_hInstance; + + wnd_class = RegisterClassExW(&wndclass); + if (!wnd_class && GetLastError() == ERROR_CLASS_ALREADY_EXISTS) + wnd_class = 1; + } + + tls_data->notif_hwnd = CreateWindowExW(0, wszURLMonikerNotificationWindow, + wszURLMonikerNotificationWindow, 0, 0, 0, 0, 0, HWND_MESSAGE, + NULL, URLMON_hInstance, NULL); + if(tls_data->notif_hwnd) + tls_data->notif_hwnd_cnt++; + + TRACE("hwnd = %p\n", tls_data->notif_hwnd); + + return tls_data->notif_hwnd; +} + +void release_notif_hwnd(HWND hwnd) +{ + tls_data_t *data = get_tls_data(); + + if(!data) + return; + + if(data->notif_hwnd != hwnd) { + PostMessageW(data->notif_hwnd, WM_MK_RELEASE, 0, 0); + return; + } + + if(!--data->notif_hwnd_cnt) { + DestroyWindow(data->notif_hwnd); + data->notif_hwnd = NULL; + } +} + +static void push_task(BindProtocol *This, task_header_t *task, task_proc_t proc) +{ + BOOL do_post = FALSE; + + task->proc = proc; + task->next = NULL; + + EnterCriticalSection(&This->section); + + if(This->task_queue_tail) { + This->task_queue_tail->next = task; + This->task_queue_tail = task; + }else { + This->task_queue_tail = This->task_queue_head = task; + do_post = TRUE; + } + + LeaveCriticalSection(&This->section); + + if(do_post) { + IInternetProtocol_AddRef(PROTOCOL(This)); + PostMessageW(This->notif_hwnd, WM_MK_CONTINUE, 0, (LPARAM)This); + } +} + +static inline BOOL do_direct_notif(BindProtocol *This) +{ + return !(This->pi & PI_APARTMENTTHREADED) || (This->apartment_thread == GetCurrentThreadId() && !This->continue_call); +} + +static HRESULT handle_mime_filter(BindProtocol *This, IInternetProtocol *mime_filter, LPCWSTR mime) +{ + PROTOCOLFILTERDATA filter_data = { sizeof(PROTOCOLFILTERDATA), NULL, NULL, NULL, 0 }; + IInternetProtocolSink *protocol_sink, *old_sink; + ProtocolProxy *filter_proxy; + HRESULT hres; + + hres = IInternetProtocol_QueryInterface(mime_filter, &IID_IInternetProtocolSink, (void**)&protocol_sink); + if(FAILED(hres)) + return hres; + + hres = create_protocol_proxy(PROTOCOLHANDLER(This), This->protocol_sink, &filter_proxy); + if(FAILED(hres)) { + IInternetProtocolSink_Release(protocol_sink); + return hres; + } + + old_sink = This->protocol_sink; + This->protocol_sink = protocol_sink; + This->filter_proxy = filter_proxy; + + IInternetProtocol_AddRef(mime_filter); + This->protocol_handler = mime_filter; + + filter_data.pProtocol = PROTOCOL(filter_proxy); + hres = IInternetProtocol_Start(mime_filter, mime, PROTSINK(filter_proxy), BINDINFO(This), + PI_FILTER_MODE|PI_FORCE_ASYNC, (HANDLE_PTR)&filter_data); + if(FAILED(hres)) { + IInternetProtocolSink_Release(old_sink); + return hres; + } + + IInternetProtocolSink_ReportProgress(old_sink, BINDSTATUS_LOADINGMIMEHANDLER, NULL); + IInternetProtocolSink_Release(old_sink); + + This->pi &= ~PI_MIMEVERIFICATION; /* FIXME: more tests */ + return S_OK; +} + +static void mime_available(BindProtocol *This, LPCWSTR mime, BOOL verified) +{ + IInternetProtocol *mime_filter; + HRESULT hres; + + heap_free(This->mime); + This->mime = NULL; + + mime_filter = get_mime_filter(mime); + if(mime_filter) { + TRACE("Got mime filter for %s\n", debugstr_w(mime)); + + hres = handle_mime_filter(This, mime_filter, mime); + IInternetProtocol_Release(mime_filter); + if(FAILED(hres)) + FIXME("MIME filter failed: %08x\n", hres); + }else { + This->mime = heap_strdupW(mime); + + if(verified || !(This->pi & PI_MIMEVERIFICATION)) { + This->reported_mime = TRUE; + + if(This->protocol_sink) + IInternetProtocolSink_ReportProgress(This->protocol_sink, BINDSTATUS_MIMETYPEAVAILABLE, mime); + } + } +} + +#define PROTOCOL_THIS(iface) DEFINE_THIS(BindProtocol, IInternetProtocol, iface) static HRESULT WINAPI BindProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv) { @@ -111,8 +349,19 @@ IInternetProtocol_Release(This->protocol); if(This->bind_info) IInternetBindInfo_Release(This->bind_info); + if(This->protocol_handler && This->protocol_handler != PROTOCOLHANDLER(This)) + IInternetProtocol_Release(This->protocol_handler); + if(This->filter_proxy) + IInternetProtocol_Release(PROTOCOL(This->filter_proxy)); set_binding_sink(PROTOCOL(This), NULL); + + if(This->notif_hwnd) + release_notif_hwnd(This->notif_hwnd); + DeleteCriticalSection(&This->section); + + heap_free(This->mime); + heap_free(This->url); heap_free(This); URLMON_UnlockModule(); @@ -126,77 +375,11 @@ DWORD grfPI, HANDLE_PTR dwReserved) { BindProtocol *This = PROTOCOL_THIS(iface); - IInternetProtocol *protocol = NULL; - IInternetPriority *priority; - IServiceProvider *service_provider; - BOOL urlmon_protocol = FALSE; - CLSID clsid = IID_NULL; - LPOLESTR clsid_str; - HRESULT hres; TRACE("(%p)->(%s %p %p %08x %lx)\n", This, debugstr_w(szUrl), pOIProtSink, pOIBindInfo, grfPI, dwReserved); - if(!szUrl || !pOIProtSink || !pOIBindInfo) - return E_INVALIDARG; - - hres = IInternetProtocolSink_QueryInterface(pOIProtSink, &IID_IServiceProvider, - (void**)&service_provider); - if(SUCCEEDED(hres)) { - /* FIXME: What's protocol CLSID here? */ - IServiceProvider_QueryService(service_provider, &IID_IInternetProtocol, - &IID_IInternetProtocol, (void**)&protocol); - IServiceProvider_Release(service_provider); - } - - if(!protocol) { - IClassFactory *cf; - IUnknown *unk; - - hres = get_protocol_handler(szUrl, &clsid, &urlmon_protocol, &cf); - if(FAILED(hres)) - return hres; - - if(This->from_urlmon) { - hres = IClassFactory_CreateInstance(cf, NULL, &IID_IInternetProtocol, (void**)&protocol); - IClassFactory_Release(cf); - if(FAILED(hres)) - return hres; - }else { - hres = IClassFactory_CreateInstance(cf, (IUnknown*)BINDINFO(This), - &IID_IUnknown, (void**)&unk); - IClassFactory_Release(cf); - if(FAILED(hres)) - return hres; - - hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocol, (void**)&protocol); - IUnknown_Release(unk); - if(FAILED(hres)) - return hres; - } - } - - StringFromCLSID(&clsid, &clsid_str); - IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_PROTOCOLCLASSID, clsid_str); - CoTaskMemFree(clsid_str); - - This->protocol = protocol; - - if(urlmon_protocol) - IInternetProtocol_QueryInterface(protocol, &IID_IWinInetInfo, (void**)&This->wininet_info); - - IInternetBindInfo_AddRef(pOIBindInfo); - This->bind_info = pOIBindInfo; - - set_binding_sink(PROTOCOL(This), pOIProtSink); - - hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetPriority, (void**)&priority); - if(SUCCEEDED(hres)) { - IInternetPriority_SetPriority(priority, This->priority); - IInternetPriority_Release(priority); - } - - return IInternetProtocol_Start(protocol, szUrl, PROTSINK(This), BINDINFO(This), 0, 0); + return IInternetProtocol_Start(This->protocol_handler, szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved); } static HRESULT WINAPI BindProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData) @@ -205,7 +388,7 @@ TRACE("(%p)->(%p)\n", This, pProtocolData); - return IInternetProtocol_Continue(This->protocol, pProtocolData); + return IInternetProtocol_Continue(This->protocol_handler, pProtocolData); } static HRESULT WINAPI BindProtocol_Abort(IInternetProtocol *iface, HRESULT hrReason, @@ -222,19 +405,7 @@ TRACE("(%p)->(%08x)\n", This, dwOptions); - if(!This->reported_result) - return E_FAIL; - - IInternetProtocol_Terminate(This->protocol, 0); - - set_binding_sink(PROTOCOL(This), NULL); - - if(This->bind_info) { - IInternetBindInfo_Release(This->bind_info); - This->bind_info = NULL; - } - - return S_OK; + return IInternetProtocol_Terminate(This->protocol_handler, dwOptions); } static HRESULT WINAPI BindProtocol_Suspend(IInternetProtocol *iface) @@ -255,15 +426,12 @@ ULONG cb, ULONG *pcbRead) { BindProtocol *This = PROTOCOL_THIS(iface); - ULONG read = 0; - HRESULT hres; TRACE("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead); - hres = IInternetProtocol_Read(This->protocol, pv, cb, &read); - - *pcbRead = read; - return hres; + if(pcbRead) + *pcbRead = 0; + return IInternetProtocol_Read(This->protocol_handler, pv, cb, pcbRead); } static HRESULT WINAPI BindProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove, @@ -280,7 +448,7 @@ TRACE("(%p)->(%08x)\n", This, dwOptions); - return IInternetProtocol_LockRequest(This->protocol, dwOptions); + return IInternetProtocol_LockRequest(This->protocol_handler, dwOptions); } static HRESULT WINAPI BindProtocol_UnlockRequest(IInternetProtocol *iface) @@ -289,7 +457,7 @@ TRACE("(%p)\n", This); - return IInternetProtocol_UnlockRequest(This->protocol); + return IInternetProtocol_UnlockRequest(This->protocol_handler); } void set_binding_sink(IInternetProtocol *bind_protocol, IInternetProtocolSink *sink) @@ -336,6 +504,242 @@ BindProtocol_UnlockRequest }; +#define PROTOCOLHANDLER_THIS(iface) DEFINE_THIS(BindProtocol, IInternetProtocolHandler, iface) + +static HRESULT WINAPI ProtocolHandler_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv) +{ + ERR("should not be called\n"); + return E_NOINTERFACE; +} + +static ULONG WINAPI ProtocolHandler_AddRef(IInternetProtocol *iface) +{ + BindProtocol *This = PROTOCOLHANDLER_THIS(iface); + return IInternetProtocol_AddRef(PROTOCOL(This)); +} + +static ULONG WINAPI ProtocolHandler_Release(IInternetProtocol *iface) +{ + BindProtocol *This = PROTOCOLHANDLER_THIS(iface); + return IInternetProtocol_Release(PROTOCOL(This)); +} + +static HRESULT WINAPI ProtocolHandler_Start(IInternetProtocol *iface, LPCWSTR szUrl, + IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, + DWORD grfPI, HANDLE_PTR dwReserved) +{ + BindProtocol *This = PROTOCOLHANDLER_THIS(iface); + IInternetProtocol *protocol = NULL; + IInternetPriority *priority; + IServiceProvider *service_provider; + BOOL urlmon_protocol = FALSE; + CLSID clsid = IID_NULL; + LPOLESTR clsid_str; + HRESULT hres; + + TRACE("(%p)->(%s %p %p %08x %lx)\n", This, debugstr_w(szUrl), pOIProtSink, + pOIBindInfo, grfPI, dwReserved); + + if(!szUrl || !pOIProtSink || !pOIBindInfo) + return E_INVALIDARG; + + This->pi = grfPI; + This->url = heap_strdupW(szUrl); + + hres = IInternetProtocolSink_QueryInterface(pOIProtSink, &IID_IServiceProvider, + (void**)&service_provider); + if(SUCCEEDED(hres)) { + /* FIXME: What's protocol CLSID here? */ + IServiceProvider_QueryService(service_provider, &IID_IInternetProtocol, + &IID_IInternetProtocol, (void**)&protocol); + IServiceProvider_Release(service_provider); + } + + if(!protocol) { + IClassFactory *cf; + IUnknown *unk; + + hres = get_protocol_handler(szUrl, &clsid, &urlmon_protocol, &cf); + if(FAILED(hres)) + return hres; + + if(This->from_urlmon) { + hres = IClassFactory_CreateInstance(cf, NULL, &IID_IInternetProtocol, (void**)&protocol); + IClassFactory_Release(cf); + if(FAILED(hres)) + return hres; + }else { + hres = IClassFactory_CreateInstance(cf, (IUnknown*)BINDINFO(This), + &IID_IUnknown, (void**)&unk); + IClassFactory_Release(cf); + if(FAILED(hres)) + return hres; + + hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocol, (void**)&protocol); + IUnknown_Release(unk); + if(FAILED(hres)) + return hres; + } + } + + StringFromCLSID(&clsid, &clsid_str); + IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_PROTOCOLCLASSID, clsid_str); + CoTaskMemFree(clsid_str); + + This->protocol = protocol; + + if(urlmon_protocol) + IInternetProtocol_QueryInterface(protocol, &IID_IWinInetInfo, (void**)&This->wininet_info); + + IInternetBindInfo_AddRef(pOIBindInfo); + This->bind_info = pOIBindInfo; + + set_binding_sink(PROTOCOL(This), pOIProtSink); + + hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetPriority, (void**)&priority); + if(SUCCEEDED(hres)) { + IInternetPriority_SetPriority(priority, This->priority); + IInternetPriority_Release(priority); + } + + return IInternetProtocol_Start(protocol, szUrl, PROTSINK(This), BINDINFO(This), 0, 0); +} + +static HRESULT WINAPI ProtocolHandler_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData) +{ + BindProtocol *This = PROTOCOLHANDLER_THIS(iface); + + TRACE("(%p)->(%p)\n", This, pProtocolData); + + return IInternetProtocol_Continue(This->protocol, pProtocolData); +} + +static HRESULT WINAPI ProtocolHandler_Abort(IInternetProtocol *iface, HRESULT hrReason, + DWORD dwOptions) +{ + BindProtocol *This = PROTOCOLHANDLER_THIS(iface); + FIXME("(%p)->(%08x %08x)\n", This, hrReason, dwOptions); + return E_NOTIMPL; +} + +static HRESULT WINAPI ProtocolHandler_Terminate(IInternetProtocol *iface, DWORD dwOptions) +{ + BindProtocol *This = PROTOCOLHANDLER_THIS(iface); + + TRACE("(%p)->(%08x)\n", This, dwOptions); + + if(!This->reported_result) + return E_FAIL; + + IInternetProtocol_Terminate(This->protocol, 0); + + if(This->filter_proxy) { + IInternetProtocol_Release(PROTOCOL(This->filter_proxy)); + This->filter_proxy = NULL; + } + + set_binding_sink(PROTOCOL(This), NULL); + + if(This->bind_info) { + IInternetBindInfo_Release(This->bind_info); + This->bind_info = NULL; + } + + return S_OK; +} + +static HRESULT WINAPI ProtocolHandler_Suspend(IInternetProtocol *iface) +{ + BindProtocol *This = PROTOCOLHANDLER_THIS(iface); + FIXME("(%p)\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI ProtocolHandler_Resume(IInternetProtocol *iface) +{ + BindProtocol *This = PROTOCOLHANDLER_THIS(iface); + FIXME("(%p)\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI ProtocolHandler_Read(IInternetProtocol *iface, void *pv, + ULONG cb, ULONG *pcbRead) +{ + BindProtocol *This = PROTOCOLHANDLER_THIS(iface); + ULONG read = 0; + HRESULT hres = S_OK; + + TRACE("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead); + + if(This->buf) { + read = min(cb, This->buf_size); + memcpy(pv, This->buf, read); + + if(read == This->buf_size) { + heap_free(This->buf); + This->buf = NULL; + }else { + memmove(This->buf, This->buf+cb, This->buf_size-cb); + } + + This->buf_size -= read; + } + + if(read < cb) { + ULONG cread = 0; + + hres = IInternetProtocol_Read(This->protocol, (BYTE*)pv+read, cb-read, &cread); + read += cread; + } + + *pcbRead = read; + return hres; +} + +static HRESULT WINAPI ProtocolHandler_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove, + DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) +{ + BindProtocol *This = PROTOCOLHANDLER_THIS(iface); + FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition); + return E_NOTIMPL; +} + +static HRESULT WINAPI ProtocolHandler_LockRequest(IInternetProtocol *iface, DWORD dwOptions) +{ + BindProtocol *This = PROTOCOLHANDLER_THIS(iface); + + TRACE("(%p)->(%08x)\n", This, dwOptions); + + return IInternetProtocol_LockRequest(This->protocol, dwOptions); +} + +static HRESULT WINAPI ProtocolHandler_UnlockRequest(IInternetProtocol *iface) +{ + BindProtocol *This = PROTOCOLHANDLER_THIS(iface); + + TRACE("(%p)\n", This); + + return IInternetProtocol_UnlockRequest(This->protocol); +} + +#undef PROTOCOL_THIS + +static const IInternetProtocolVtbl InternetProtocolHandlerVtbl = { + ProtocolHandler_QueryInterface, + ProtocolHandler_AddRef, + ProtocolHandler_Release, + ProtocolHandler_Start, + ProtocolHandler_Continue, + ProtocolHandler_Abort, + ProtocolHandler_Terminate, + ProtocolHandler_Suspend, + ProtocolHandler_Resume, + ProtocolHandler_Read, + ProtocolHandler_Seek, + ProtocolHandler_LockRequest, + ProtocolHandler_UnlockRequest +}; + #define BINDINFO_THIS(iface) DEFINE_THIS(BindProtocol, InternetBindInfo, iface) static HRESULT WINAPI BindInfo_QueryInterface(IInternetBindInfo *iface, @@ -447,7 +851,7 @@ }; -#define PROTSINK_THIS(iface) DEFINE_THIS(BindProtocol, InternetProtocolSink, iface) +#define PROTSINK_THIS(iface) DEFINE_THIS(BindProtocol, IInternetProtocolSink, iface) static HRESULT WINAPI BPInternetProtocolSink_QueryInterface(IInternetProtocolSink *iface, REFIID riid, void **ppv) @@ -468,6 +872,20 @@ return IInternetProtocol_Release(PROTOCOL(This)); } +typedef struct { + task_header_t header; + PROTOCOLDATA data; +} switch_task_t; + +static void switch_proc(BindProtocol *bind, task_header_t *t) +{ + switch_task_t *task = (switch_task_t*)t; + + IInternetProtocol_Continue(bind->protocol_handler, &task->data); + + heap_free(task); +} + static HRESULT WINAPI BPInternetProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData) { @@ -478,22 +896,30 @@ TRACE("flags %x state %x data %p cb %u\n", pProtocolData->grfFlags, pProtocolData->dwState, pProtocolData->pData, pProtocolData->cbData); + if(!do_direct_notif(This)) { + switch_task_t *task; + + task = heap_alloc(sizeof(switch_task_t)); + if(!task) + return E_OUTOFMEMORY; + + task->data = *pProtocolData; + + push_task(This, &task->header, switch_proc); + return S_OK; + } + if(!This->protocol_sink) { - IInternetProtocol_Continue(This->protocol, pProtocolData); + IInternetProtocol_Continue(This->protocol_handler, pProtocolData); return S_OK; } return IInternetProtocolSink_Switch(This->protocol_sink, pProtocolData); } -static HRESULT WINAPI BPInternetProtocolSink_ReportProgress(IInternetProtocolSink *iface, - ULONG ulStatusCode, LPCWSTR szStatusText) -{ - BindProtocol *This = PROTSINK_THIS(iface); - - TRACE("(%p)->(%u %s)\n", This, ulStatusCode, debugstr_w(szStatusText)); - - switch(ulStatusCode) { +static void report_progress(BindProtocol *This, ULONG status_code, LPCWSTR status_text) +{ + switch(status_code) { case BINDSTATUS_FINDINGRESOURCE: case BINDSTATUS_CONNECTING: case BINDSTATUS_BEGINDOWNLOADDATA: @@ -501,23 +927,116 @@ case BINDSTATUS_CACHEFILENAMEAVAILABLE: case BINDSTATUS_DIRECTBIND: case BINDSTATUS_ACCEPTRANGES: + if(This->protocol_sink) + IInternetProtocolSink_ReportProgress(This->protocol_sink, status_code, status_text); + break; + case BINDSTATUS_MIMETYPEAVAILABLE: - if(!This->protocol_sink) + mime_available(This, status_text, FALSE); + break; + + case BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE: + mime_available(This, status_text, TRUE); + break; + + default: + FIXME("unsupported ulStatusCode %u\n", status_code); + } +} + +typedef struct { + task_header_t header; + + ULONG status_code; + LPWSTR status_text; +} on_progress_task_t; + +static void on_progress_proc(BindProtocol *This, task_header_t *t) +{ + on_progress_task_t *task = (on_progress_task_t*)t; + + report_progress(This, task->status_code, task->status_text); + + heap_free(task->status_text); + heap_free(task); +} + +static HRESULT WINAPI BPInternetProtocolSink_ReportProgress(IInternetProtocolSink *iface, + ULONG ulStatusCode, LPCWSTR szStatusText) +{ + BindProtocol *This = PROTSINK_THIS(iface); + + TRACE("(%p)->(%u %s)\n", This, ulStatusCode, debugstr_w(szStatusText)); + + if(do_direct_notif(This)) { + report_progress(This, ulStatusCode, szStatusText); + }else { + on_progress_task_t *task; + + task = heap_alloc(sizeof(on_progress_task_t)); + + task->status_code = ulStatusCode; + task->status_text = heap_strdupW(szStatusText); + + push_task(This, &task->header, on_progress_proc); + } + + return S_OK; +} + +static HRESULT report_data(BindProtocol *This, DWORD bscf, ULONG progress, ULONG progress_max) +{ + if(!This->protocol_sink) + return S_OK; + + if((This->pi & PI_MIMEVERIFICATION) && !This->reported_mime) { + DWORD read = 0; + LPWSTR mime; + HRESULT hres; + + if(!This->buf) { + This->buf = heap_alloc(BUFFER_SIZE); + if(!This->buf) + return E_OUTOFMEMORY; + } + + do { + read = 0; + hres = IInternetProtocol_Read(This->protocol, This->buf+This->buf_size, + BUFFER_SIZE-This->buf_size, &read); + if(FAILED(hres) && hres != E_PENDING) + return hres; + This->buf_size += read; + }while(This->buf_size < MIME_TEST_SIZE && hres == S_OK); + + if(This->buf_size < MIME_TEST_SIZE && hres != S_FALSE) return S_OK; - return IInternetProtocolSink_ReportProgress(This->protocol_sink, - ulStatusCode, szStatusText); - - case BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE: - if(!This->protocol_sink) - return S_OK; - return IInternetProtocolSink_ReportProgress(This->protocol_sink, - This->from_urlmon ? BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE : BINDSTATUS_MIMETYPEAVAILABLE, - szStatusText); - default: - FIXME("unsupported ulStatusCode %u\n", ulStatusCode); - } - - return E_NOTIMPL; + + hres = FindMimeFromData(NULL, This->url, This->buf, min(This->buf_size, MIME_TEST_SIZE), + This->mime, 0, &mime, 0); + if(FAILED(hres)) + return hres; + + mime_available(This, mime, TRUE); + CoTaskMemFree(mime); + } + + return IInternetProtocolSink_ReportData(This->protocol_sink, bscf, progress, progress_max); +} + +typedef struct { + task_header_t header; + DWORD bscf; + ULONG progress; + ULONG progress_max; +} report_data_task_t; + +static void report_data_proc(BindProtocol *This, task_header_t *t) +{ + report_data_task_t *task = (report_data_task_t*)t; + + report_data(This, task->bscf, task->progress, task->progress_max); + heap_free(task); } static HRESULT WINAPI BPInternetProtocolSink_ReportData(IInternetProtocolSink *iface, @@ -530,7 +1049,41 @@ if(!This->protocol_sink) return S_OK; - return IInternetProtocolSink_ReportData(This->protocol_sink, grfBSCF, ulProgress, ulProgressMax); + if(!do_direct_notif(This)) { + report_data_task_t *task; + + task = heap_alloc(sizeof(report_data_task_t)); + if(!task) + return E_OUTOFMEMORY; + + task->bscf = grfBSCF; + task->progress = ulProgress; + task->progress_max = ulProgressMax; + + push_task(This, &task->header, report_data_proc); + return S_OK; + } + + return report_data(This, grfBSCF, ulProgress, ulProgressMax); +} + +typedef struct { + task_header_t header; + + HRESULT hres; + DWORD err; + LPWSTR str; +} report_result_task_t; + +static void report_result_proc(BindProtocol *This, task_header_t *t) +{ + report_result_task_t *task = (report_result_task_t*)t; + + if(This->protocol_sink) + IInternetProtocolSink_ReportResult(This->protocol_sink, task->hres, task->err, task->str); + + heap_free(task->str); + heap_free(task); } static HRESULT WINAPI BPInternetProtocolSink_ReportResult(IInternetProtocolSink *iface, @@ -544,6 +1097,21 @@ return E_FAIL; This->reported_result = TRUE; + + if(!do_direct_notif(This)) { + report_result_task_t *task; + + task = heap_alloc(sizeof(report_result_task_t)); + if(!task) + return E_OUTOFMEMORY; + + task->hres = hrResult; + task->err = dwError; + task->str = heap_strdupW(szResult); + + push_task(This, &task->header, report_result_proc); + return S_OK; + } return IInternetProtocolSink_ReportResult(This->protocol_sink, hrResult, dwError, szResult); } @@ -607,14 +1175,19 @@ { BindProtocol *ret = heap_alloc_zero(sizeof(BindProtocol)); - ret->lpInternetProtocolVtbl = &BindProtocolVtbl; - ret->lpInternetBindInfoVtbl = &InternetBindInfoVtbl; - ret->lpInternetPriorityVtbl = &InternetPriorityVtbl; - ret->lpServiceProviderVtbl = &ServiceProviderVtbl; - ret->lpInternetProtocolSinkVtbl = &InternetProtocolSinkVtbl; + ret->lpIInternetProtocolVtbl = &BindProtocolVtbl; + ret->lpInternetBindInfoVtbl = &InternetBindInfoVtbl; + ret->lpInternetPriorityVtbl = &InternetPriorityVtbl; + ret->lpServiceProviderVtbl = &ServiceProviderVtbl; + ret->lpIInternetProtocolSinkVtbl = &InternetProtocolSinkVtbl; + ret->lpIInternetProtocolHandlerVtbl = &InternetProtocolHandlerVtbl; ret->ref = 1; ret->from_urlmon = from_urlmon; + ret->apartment_thread = GetCurrentThreadId(); + ret->notif_hwnd = get_notif_hwnd(); + ret->protocol_handler = PROTOCOLHANDLER(ret); + InitializeCriticalSection(&ret->section); URLMON_LockModule(); Modified: trunk/reactos/dll/win32/urlmon/file.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/file.c?re…
============================================================================== --- trunk/reactos/dll/win32/urlmon/file.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/urlmon/file.c [iso-8859-1] Sat May 23 14:20:22 2009 @@ -22,7 +22,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(urlmon); typedef struct { - const IInternetProtocolVtbl *lpInternetProtocolVtbl; + const IInternetProtocolVtbl *lpIInternetProtocolVtbl; const IInternetPriorityVtbl *lpInternetPriorityVtbl; HANDLE file; @@ -31,10 +31,9 @@ LONG ref; } FileProtocol; -#define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl) #define PRIORITY(x) ((IInternetPriority*) &(x)->lpInternetPriorityVtbl) -#define PROTOCOL_THIS(iface) DEFINE_THIS(FileProtocol, InternetProtocol, iface) +#define PROTOCOL_THIS(iface) DEFINE_THIS(FileProtocol, IInternetProtocol, iface) static HRESULT WINAPI FileProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv) { @@ -360,7 +359,7 @@ ret = heap_alloc(sizeof(FileProtocol)); - ret->lpInternetProtocolVtbl = &FileProtocolVtbl; + ret->lpIInternetProtocolVtbl = &FileProtocolVtbl; ret->lpInternetPriorityVtbl = &FilePriorityVtbl; ret->file = NULL; ret->priority = 0; Modified: trunk/reactos/dll/win32/urlmon/ftp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/ftp.c?rev…
============================================================================== --- trunk/reactos/dll/win32/urlmon/ftp.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/urlmon/ftp.c [iso-8859-1] Sat May 23 14:20:22 2009 @@ -24,14 +24,13 @@ typedef struct { Protocol base; - const IInternetProtocolVtbl *lpInternetProtocolVtbl; + const IInternetProtocolVtbl *lpIInternetProtocolVtbl; const IInternetPriorityVtbl *lpInternetPriorityVtbl; const IWinInetHttpInfoVtbl *lpWinInetHttpInfoVtbl; LONG ref; } FtpProtocol; -#define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl) #define PRIORITY(x) ((IInternetPriority*) &(x)->lpInternetPriorityVtbl) #define INETHTTPINFO(x) ((IWinInetHttpInfo*) &(x)->lpWinInetHttpInfoVtbl) @@ -80,7 +79,7 @@ FtpProtocol_close_connection }; -#define PROTOCOL_THIS(iface) DEFINE_THIS(FtpProtocol, InternetProtocol, iface) +#define PROTOCOL_THIS(iface) DEFINE_THIS(FtpProtocol, IInternetProtocol, iface) static HRESULT WINAPI FtpProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv) { @@ -360,9 +359,9 @@ ret = heap_alloc_zero(sizeof(FtpProtocol)); ret->base.vtbl = &AsyncProtocolVtbl; - ret->lpInternetProtocolVtbl = &FtpProtocolVtbl; - ret->lpInternetPriorityVtbl = &FtpPriorityVtbl; - ret->lpWinInetHttpInfoVtbl = &WinInetHttpInfoVtbl; + ret->lpIInternetProtocolVtbl = &FtpProtocolVtbl; + ret->lpInternetPriorityVtbl = &FtpPriorityVtbl; + ret->lpWinInetHttpInfoVtbl = &WinInetHttpInfoVtbl; ret->ref = 1; *ppobj = PROTOCOL(ret); Modified: trunk/reactos/dll/win32/urlmon/gopher.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/gopher.c?…
============================================================================== --- trunk/reactos/dll/win32/urlmon/gopher.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/urlmon/gopher.c [iso-8859-1] Sat May 23 14:20:22 2009 @@ -24,13 +24,12 @@ typedef struct { Protocol base; - const IInternetProtocolVtbl *lpInternetProtocolVtbl; + const IInternetProtocolVtbl *lpIInternetProtocolVtbl; const IInternetPriorityVtbl *lpInternetPriorityVtbl; LONG ref; } GopherProtocol; -#define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl) #define PRIORITY(x) ((IInternetPriority*) &(x)->lpInternetPriorityVtbl) #define ASYNCPROTOCOL_THIS(iface) DEFINE_THIS2(GopherProtocol, base, iface) @@ -67,7 +66,7 @@ GopherProtocol_close_connection }; -#define PROTOCOL_THIS(iface) DEFINE_THIS(GopherProtocol, InternetProtocol, iface) +#define PROTOCOL_THIS(iface) DEFINE_THIS(GopherProtocol, IInternetProtocol, iface) static HRESULT WINAPI GopherProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv) { @@ -289,8 +288,8 @@ ret = heap_alloc_zero(sizeof(GopherProtocol)); ret->base.vtbl = &AsyncProtocolVtbl; - ret->lpInternetProtocolVtbl = &GopherProtocolVtbl; - ret->lpInternetPriorityVtbl = &GopherPriorityVtbl; + ret->lpIInternetProtocolVtbl = &GopherProtocolVtbl; + ret->lpInternetPriorityVtbl = &GopherPriorityVtbl; ret->ref = 1; *ppobj = PROTOCOL(ret); Modified: trunk/reactos/dll/win32/urlmon/http.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/http.c?re…
============================================================================== --- trunk/reactos/dll/win32/urlmon/http.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/urlmon/http.c [iso-8859-1] Sat May 23 14:20:22 2009 @@ -32,7 +32,7 @@ typedef struct { Protocol base; - const IInternetProtocolVtbl *lpInternetProtocolVtbl; + const IInternetProtocolVtbl *lpIInternetProtocolVtbl; const IInternetPriorityVtbl *lpInternetPriorityVtbl; const IWinInetHttpInfoVtbl *lpWinInetHttpInfoVtbl; @@ -43,7 +43,6 @@ LONG ref; } HttpProtocol; -#define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl) #define PRIORITY(x) ((IInternetPriority*) &(x)->lpInternetPriorityVtbl) #define INETHTTPINFO(x) ((IWinInetHttpInfo*) &(x)->lpWinInetHttpInfoVtbl) @@ -309,7 +308,7 @@ HttpProtocol_close_connection }; -#define PROTOCOL_THIS(iface) DEFINE_THIS(HttpProtocol, InternetProtocol, iface) +#define PROTOCOL_THIS(iface) DEFINE_THIS(HttpProtocol, IInternetProtocol, iface) static HRESULT WINAPI HttpProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv) { @@ -590,9 +589,9 @@ return E_OUTOFMEMORY; ret->base.vtbl = &AsyncProtocolVtbl; - ret->lpInternetProtocolVtbl = &HttpProtocolVtbl; - ret->lpInternetPriorityVtbl = &HttpPriorityVtbl; - ret->lpWinInetHttpInfoVtbl = &WinInetHttpInfoVtbl; + ret->lpIInternetProtocolVtbl = &HttpProtocolVtbl; + ret->lpInternetPriorityVtbl = &HttpPriorityVtbl; + ret->lpWinInetHttpInfoVtbl = &WinInetHttpInfoVtbl; ret->https = https; ret->ref = 1; Modified: trunk/reactos/dll/win32/urlmon/mk.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/mk.c?rev=…
============================================================================== --- trunk/reactos/dll/win32/urlmon/mk.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/urlmon/mk.c [iso-8859-1] Sat May 23 14:20:22 2009 @@ -22,16 +22,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(urlmon); typedef struct { - const IInternetProtocolVtbl *lpInternetProtocolVtbl; + const IInternetProtocolVtbl *lpIInternetProtocolVtbl; LONG ref; IStream *stream; } MkProtocol; -#define PROTOCOL_THIS(iface) DEFINE_THIS(MkProtocol, InternetProtocol, iface) - -#define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl) +#define PROTOCOL_THIS(iface) DEFINE_THIS(MkProtocol, IInternetProtocol, iface) static HRESULT WINAPI MkProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv) { @@ -293,7 +291,7 @@ ret = heap_alloc(sizeof(MkProtocol)); - ret->lpInternetProtocolVtbl = &MkProtocolVtbl; + ret->lpIInternetProtocolVtbl = &MkProtocolVtbl; ret->ref = 1; ret->stream = NULL; Added: trunk/reactos/dll/win32/urlmon/protproxy.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/protproxy…
============================================================================== --- trunk/reactos/dll/win32/urlmon/protproxy.c (added) +++ trunk/reactos/dll/win32/urlmon/protproxy.c [iso-8859-1] Sat May 23 14:20:22 2009 @@ -1,0 +1,290 @@ +/* + * Copyright 2009 Jacek Caban for CodeWeavers + * + * 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 "urlmon_main.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(urlmon); + +#define PROTOCOL_THIS(iface) DEFINE_THIS(ProtocolProxy, IInternetProtocol, iface) + +static HRESULT WINAPI ProtocolProxy_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv) +{ + ProtocolProxy *This = PROTOCOL_THIS(iface); + + *ppv = NULL; + if(IsEqualGUID(&IID_IUnknown, riid)) { + TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); + *ppv = PROTOCOL(This); + }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) { + TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv); + *ppv = PROTOCOL(This); + }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) { + TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv); + *ppv = PROTOCOL(This); + }else if(IsEqualGUID(&IID_IInternetProtocolSink, riid)) { + TRACE("(%p)->(IID_IInternetProtocolSink %p)\n", This, ppv); + *ppv = PROTSINK(This); + } + + if(*ppv) { + IInternetProtocol_AddRef(iface); + return S_OK; + } + + WARN("not supported interface %s\n", debugstr_guid(riid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI ProtocolProxy_AddRef(IInternetProtocol *iface) +{ + ProtocolProxy *This = PROTOCOL_THIS(iface); + LONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p) ref=%d\n", This, ref); + return ref; +} + +static ULONG WINAPI ProtocolProxy_Release(IInternetProtocol *iface) +{ + ProtocolProxy *This = PROTOCOL_THIS(iface); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + if(!ref) { + if(This->protocol_sink) + IInternetProtocolSink_Release(This->protocol_sink); + if(This->protocol) + IInternetProtocol_Release(This->protocol); + + heap_free(This); + + URLMON_UnlockModule(); + } + + return ref; +} + +static HRESULT WINAPI ProtocolProxy_Start(IInternetProtocol *iface, LPCWSTR szUrl, + IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, + DWORD grfPI, HANDLE_PTR dwReserved) +{ + ProtocolProxy *This = PROTOCOL_THIS(iface); + + TRACE("(%p)->(%s %p %p %08x %lx)\n", This, debugstr_w(szUrl), pOIProtSink, + pOIBindInfo, grfPI, dwReserved); + + return IInternetProtocol_Start(This->protocol, szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved); +} + +static HRESULT WINAPI ProtocolProxy_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData) +{ + ProtocolProxy *This = PROTOCOL_THIS(iface); + + TRACE("(%p)->(%p)\n", This, pProtocolData); + + return IInternetProtocol_Continue(This->protocol, pProtocolData); +} + +static HRESULT WINAPI ProtocolProxy_Abort(IInternetProtocol *iface, HRESULT hrReason, + DWORD dwOptions) +{ + ProtocolProxy *This = PROTOCOL_THIS(iface); + FIXME("(%p)->(%08x %08x)\n", This, hrReason, dwOptions); + return E_NOTIMPL; +} + +static HRESULT WINAPI ProtocolProxy_Terminate(IInternetProtocol *iface, DWORD dwOptions) +{ + ProtocolProxy *This = PROTOCOL_THIS(iface); + + TRACE("(%p)->(%08x)\n", This, dwOptions); + + return IInternetProtocol_Terminate(This->protocol, dwOptions); +} + +static HRESULT WINAPI ProtocolProxy_Suspend(IInternetProtocol *iface) +{ + ProtocolProxy *This = PROTOCOL_THIS(iface); + FIXME("(%p)\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI ProtocolProxy_Resume(IInternetProtocol *iface) +{ + ProtocolProxy *This = PROTOCOL_THIS(iface); + FIXME("(%p)\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI ProtocolProxy_Read(IInternetProtocol *iface, void *pv, + ULONG cb, ULONG *pcbRead) +{ + ProtocolProxy *This = PROTOCOL_THIS(iface); + + TRACE("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead); + + return IInternetProtocol_Read(This->protocol, pv, cb, pcbRead); +} + +static HRESULT WINAPI ProtocolProxy_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove, + DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) +{ + ProtocolProxy *This = PROTOCOL_THIS(iface); + FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition); + return E_NOTIMPL; +} + +static HRESULT WINAPI ProtocolProxy_LockRequest(IInternetProtocol *iface, DWORD dwOptions) +{ + ProtocolProxy *This = PROTOCOL_THIS(iface); + + TRACE("(%p)->(%08x)\n", This, dwOptions); + + return IInternetProtocol_LockRequest(This->protocol, dwOptions); +} + +static HRESULT WINAPI ProtocolProxy_UnlockRequest(IInternetProtocol *iface) +{ + ProtocolProxy *This = PROTOCOL_THIS(iface); + + TRACE("(%p)\n", This); + + return IInternetProtocol_UnlockRequest(This->protocol); +} + +#undef PROTOCOL_THIS + +static const IInternetProtocolVtbl ProtocolProxyVtbl = { + ProtocolProxy_QueryInterface, + ProtocolProxy_AddRef, + ProtocolProxy_Release, + ProtocolProxy_Start, + ProtocolProxy_Continue, + ProtocolProxy_Abort, + ProtocolProxy_Terminate, + ProtocolProxy_Suspend, + ProtocolProxy_Resume, + ProtocolProxy_Read, + ProtocolProxy_Seek, + ProtocolProxy_LockRequest, + ProtocolProxy_UnlockRequest +}; + +#define PROTSINK_THIS(iface) DEFINE_THIS(ProtocolProxy, IInternetProtocolSink, iface) + +static HRESULT WINAPI ProtocolProxySink_QueryInterface(IInternetProtocolSink *iface, + REFIID riid, void **ppv) +{ + ProtocolProxy *This = PROTSINK_THIS(iface); + return IInternetProtocol_QueryInterface(PROTOCOL(This), riid, ppv); +} + +static ULONG WINAPI ProtocolProxySink_AddRef(IInternetProtocolSink *iface) +{ + ProtocolProxy *This = PROTSINK_THIS(iface); + return IInternetProtocol_AddRef(PROTOCOL(This)); +} + +static ULONG WINAPI ProtocolProxySink_Release(IInternetProtocolSink *iface) +{ + ProtocolProxy *This = PROTSINK_THIS(iface); + return IInternetProtocol_Release(PROTOCOL(This)); +} + +static HRESULT WINAPI ProtocolProxySink_Switch(IInternetProtocolSink *iface, + PROTOCOLDATA *pProtocolData) +{ + ProtocolProxy *This = PROTSINK_THIS(iface); + + TRACE("(%p)->(%p)\n", This, pProtocolData); + + return IInternetProtocolSink_Switch(This->protocol_sink, pProtocolData); +} + +static HRESULT WINAPI ProtocolProxySink_ReportProgress(IInternetProtocolSink *iface, + ULONG ulStatusCode, LPCWSTR szStatusText) +{ + ProtocolProxy *This = PROTSINK_THIS(iface); + + TRACE("(%p)->(%u %s)\n", This, ulStatusCode, debugstr_w(szStatusText)); + + switch(ulStatusCode) { + case BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE: + IInternetProtocolSink_ReportProgress(This->protocol_sink, BINDSTATUS_MIMETYPEAVAILABLE, szStatusText); + break; + default: + IInternetProtocolSink_ReportProgress(This->protocol_sink, ulStatusCode, szStatusText); + } + + return S_OK; +} + +static HRESULT WINAPI ProtocolProxySink_ReportData(IInternetProtocolSink *iface, + DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax) +{ + ProtocolProxy *This = PROTSINK_THIS(iface); + + TRACE("(%p)->(%d %u %u)\n", This, grfBSCF, ulProgress, ulProgressMax); + + return IInternetProtocolSink_ReportData(This->protocol_sink, grfBSCF, ulProgress, ulProgressMax); +} + +static HRESULT WINAPI ProtocolProxySink_ReportResult(IInternetProtocolSink *iface, + HRESULT hrResult, DWORD dwError, LPCWSTR szResult) +{ + ProtocolProxy *This = PROTSINK_THIS(iface); + + TRACE("(%p)->(%08x %d %s)\n", This, hrResult, dwError, debugstr_w(szResult)); + + return IInternetProtocolSink_ReportResult(This->protocol_sink, hrResult, dwError, szResult); +} + +#undef PROTSINK_THIS + +static const IInternetProtocolSinkVtbl InternetProtocolSinkVtbl = { + ProtocolProxySink_QueryInterface, + ProtocolProxySink_AddRef, + ProtocolProxySink_Release, + ProtocolProxySink_Switch, + ProtocolProxySink_ReportProgress, + ProtocolProxySink_ReportData, + ProtocolProxySink_ReportResult +}; + +HRESULT create_protocol_proxy(IInternetProtocol *protocol, IInternetProtocolSink *protocol_sink, ProtocolProxy **ret) +{ + ProtocolProxy *sink; + + sink = heap_alloc(sizeof(ProtocolProxy)); + if(!sink) + return E_OUTOFMEMORY; + + sink->lpIInternetProtocolVtbl = &ProtocolProxyVtbl; + sink->lpIInternetProtocolSinkVtbl = &InternetProtocolSinkVtbl; + sink->ref = 1; + + IInternetProtocol_AddRef(protocol); + sink->protocol = protocol; + + IInternetProtocolSink_AddRef(protocol_sink); + sink->protocol_sink = protocol_sink; + + *ret = sink; + return S_OK; +} Propchange: trunk/reactos/dll/win32/urlmon/protproxy.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/dll/win32/urlmon/session.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/session.c…
============================================================================== --- trunk/reactos/dll/win32/urlmon/session.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/urlmon/session.c [iso-8859-1] Sat May 23 14:20:22 2009 @@ -262,6 +262,36 @@ if(urlmon_protocol) *urlmon_protocol = FALSE; return get_protocol_cf(schema, schema_len, clsid, ret); +} + +IInternetProtocol *get_mime_filter(LPCWSTR mime) +{ + IClassFactory *cf = NULL; + IInternetProtocol *ret; + mime_filter *iter; + HRESULT hres; + + EnterCriticalSection(&session_cs); + + for(iter = mime_filter_list; iter; iter = iter->next) { + if(!strcmpW(iter->mime, mime)) { + cf = iter->cf; + break; + } + } + + LeaveCriticalSection(&session_cs); + + if(!cf) + return NULL; + + hres = IClassFactory_CreateInstance(cf, NULL, &IID_IInternetProtocol, (void**)&ret); + if(FAILED(hres)) { + WARN("CreateInstance failed: %08x\n", hres); + return NULL; + } + + return ret; } static HRESULT WINAPI InternetSession_QueryInterface(IInternetSession *iface, Modified: trunk/reactos/dll/win32/urlmon/urlmon.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/urlmon.rb…
============================================================================== --- trunk/reactos/dll/win32/urlmon/urlmon.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/urlmon/urlmon.rbuild [iso-8859-1] Sat May 23 14:20:22 2009 @@ -21,6 +21,7 @@ <file>mimefilter.c</file> <file>mk.c</file> <file>protocol.c</file> + <file>protproxy.c</file> <file>regsvr.c</file> <file>sec_mgr.c</file> <file>session.c</file> Modified: trunk/reactos/dll/win32/urlmon/urlmon_main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/urlmon_ma…
============================================================================== --- trunk/reactos/dll/win32/urlmon/urlmon_main.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/urlmon/urlmon_main.c [iso-8859-1] Sat May 23 14:20:22 2009 @@ -36,8 +36,87 @@ HINSTANCE URLMON_hInstance = 0; static HMODULE hCabinet = NULL; +static DWORD urlmon_tls; static void init_session(BOOL); + +static struct list tls_list = LIST_INIT(tls_list); + +static CRITICAL_SECTION tls_cs; +static CRITICAL_SECTION_DEBUG tls_cs_dbg = +{ + 0, 0, &tls_cs, + { &tls_cs_dbg.ProcessLocksList, &tls_cs_dbg.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": tls") } +}; + +static CRITICAL_SECTION tls_cs = { &tls_cs_dbg, -1, 0, 0, 0, 0 }; + +tls_data_t *get_tls_data(void) +{ + tls_data_t *data; + + if(!urlmon_tls) { + DWORD tls = TlsAlloc(); + tls = InterlockedCompareExchange((LONG*)&urlmon_tls, tls, 0); + if(tls != urlmon_tls) + TlsFree(tls); + } + + data = TlsGetValue(urlmon_tls); + if(!data) { + data = heap_alloc_zero(sizeof(tls_data_t)); + if(!data) + return NULL; + + EnterCriticalSection(&tls_cs); + list_add_tail(&tls_list, &data->entry); + LeaveCriticalSection(&tls_cs); + + TlsSetValue(urlmon_tls, data); + } + + return data; +} + +static void free_tls_list(void) +{ + tls_data_t *data; + + if(!urlmon_tls) + return; + + while(!list_empty(&tls_list)) { + data = LIST_ENTRY(list_head(&tls_list), tls_data_t, entry); + list_remove(&data->entry); + heap_free(data); + } + + TlsFree(urlmon_tls); +} + +static void detach_thread(void) +{ + tls_data_t *data; + + if(!urlmon_tls) + return; + + data = TlsGetValue(urlmon_tls); + if(!data) + return; + + EnterCriticalSection(&tls_cs); + list_remove(&data->entry); + LeaveCriticalSection(&tls_cs); + + if(data->notif_hwnd) { + WARN("notif_hwnd not destroyed\n"); + DestroyWindow(data->notif_hwnd); + } + + heap_free(data); +} /*********************************************************************** * DllMain (URLMON.init) @@ -48,7 +127,6 @@ switch(fdwReason) { case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(hinstDLL); URLMON_hInstance = hinstDLL; init_session(TRUE); break; @@ -58,8 +136,13 @@ FreeLibrary(hCabinet); hCabinet = NULL; init_session(FALSE); + free_tls_list(); URLMON_hInstance = 0; break; + + case DLL_THREAD_DETACH: + detach_thread(); + break; } return TRUE; } Modified: trunk/reactos/dll/win32/urlmon/urlmon_main.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/urlmon_ma…
============================================================================== --- trunk/reactos/dll/win32/urlmon/urlmon_main.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/urlmon/urlmon_main.h [iso-8859-1] Sat May 23 14:20:22 2009 @@ -34,6 +34,7 @@ #include "wininet.h" #include "wine/unicode.h" +#include "wine/list.h" extern HINSTANCE URLMON_hInstance; extern HRESULT SecManagerImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj); @@ -59,6 +60,7 @@ IInternetProtocolInfo *get_protocol_info(LPCWSTR); HRESULT get_protocol_handler(LPCWSTR,CLSID*,BOOL*,IClassFactory**); +IInternetProtocol *get_mime_filter(LPCWSTR); BOOL is_registered_protocol(LPCWSTR); void register_urlmon_namespace(IClassFactory*,REFIID,LPCWSTR,BOOL); @@ -105,6 +107,33 @@ HRESULT protocol_lock_request(Protocol*); HRESULT protocol_unlock_request(Protocol*); void protocol_close_connection(Protocol*); + +typedef struct { + const IInternetProtocolVtbl *lpIInternetProtocolVtbl; + const IInternetProtocolSinkVtbl *lpIInternetProtocolSinkVtbl; + + LONG ref; + + IInternetProtocolSink *protocol_sink; + IInternetProtocol *protocol; +} ProtocolProxy; + +#define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpIInternetProtocolVtbl) +#define PROTSINK(x) ((IInternetProtocolSink*) &(x)->lpIInternetProtocolSinkVtbl) + +HRESULT create_protocol_proxy(IInternetProtocol*,IInternetProtocolSink*,ProtocolProxy**); + +typedef struct { + HWND notif_hwnd; + DWORD notif_hwnd_cnt; + + struct list entry; +} tls_data_t; + +tls_data_t *get_tls_data(void); + +HWND get_notif_hwnd(void); +void release_notif_hwnd(HWND); static inline void *heap_alloc(size_t len) {
15 years, 7 months
1
0
0
0
[dchapyshev] 41059: - Sync wininet with Wine 1.1.22. Tested on Firefox 2.0 and Downloader
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Sat May 23 14:18:19 2009 New Revision: 41059 URL:
http://svn.reactos.org/svn/reactos?rev=41059&view=rev
Log: - Sync wininet with Wine 1.1.22. Tested on Firefox 2.0 and Downloader Modified: trunk/reactos/dll/win32/wininet/cookie.c trunk/reactos/dll/win32/wininet/dialogs.c trunk/reactos/dll/win32/wininet/ftp.c trunk/reactos/dll/win32/wininet/http.c trunk/reactos/dll/win32/wininet/internet.c trunk/reactos/dll/win32/wininet/internet.h trunk/reactos/dll/win32/wininet/netconnection.c trunk/reactos/dll/win32/wininet/urlcache.c trunk/reactos/dll/win32/wininet/utility.c trunk/reactos/dll/win32/wininet/wininet.rbuild trunk/reactos/dll/win32/wininet/wininet.spec [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/reactos/dll/win32/wininet/cookie.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/cookie.c…
Modified: trunk/reactos/dll/win32/wininet/dialogs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/dialogs.…
Modified: trunk/reactos/dll/win32/wininet/ftp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/ftp.c?re…
Modified: trunk/reactos/dll/win32/wininet/http.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/http.c?r…
Modified: trunk/reactos/dll/win32/wininet/internet.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/internet…
Modified: trunk/reactos/dll/win32/wininet/internet.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/internet…
Modified: trunk/reactos/dll/win32/wininet/netconnection.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/netconne…
Modified: trunk/reactos/dll/win32/wininet/urlcache.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/urlcache…
Modified: trunk/reactos/dll/win32/wininet/utility.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/utility.…
Modified: trunk/reactos/dll/win32/wininet/wininet.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/wininet.…
Modified: trunk/reactos/dll/win32/wininet/wininet.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/wininet.…
15 years, 7 months
1
0
0
0
[spetreolle] 41058: LayoutFile directive for additional system-supplied INF files is optional, don't fail if it is not found. Fixes 2 tests in setupapi:devclass
by spetreolle@svn.reactos.org
Author: spetreolle Date: Sat May 23 14:17:24 2009 New Revision: 41058 URL:
http://svn.reactos.org/svn/reactos?rev=41058&view=rev
Log: LayoutFile directive for additional system-supplied INF files is optional, don't fail if it is not found. Fixes 2 tests in setupapi:devclass Modified: trunk/reactos/dll/win32/setupapi/devclass.c Modified: trunk/reactos/dll/win32/setupapi/devclass.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/devclas…
============================================================================== --- trunk/reactos/dll/win32/setupapi/devclass.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/setupapi/devclass.c [iso-8859-1] Sat May 23 14:17:24 2009 @@ -822,9 +822,7 @@ goto cleanup; /* Try to append a layout file */ - ret = SetupOpenAppendInfFileW(NULL, hInf, NULL); - if (!ret) - goto cleanup; + SetupOpenAppendInfFileW(NULL, hInf, NULL); if (InterfaceClassGuid) {
15 years, 7 months
1
0
0
0
← Newer
1
...
15
16
17
18
19
20
21
...
51
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
Results per page:
10
25
50
100
200