winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
March 2008
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
4 participants
1001 discussions
Start a n
N
ew thread
Maarten Lankhorst : qcap: Implement a stubby CaptureGraphBuilder2:: RenderStream.
by Alexandre Julliard
14 Mar '08
14 Mar '08
Module: wine Branch: master Commit: 950d3443e768550062f2d0ca506b4d6ee00367cd URL:
http://source.winehq.org/git/wine.git/?a=commit;h=950d3443e768550062f2d0ca5…
Author: Maarten Lankhorst <m.b.lankhorst(a)gmail.com> Date: Wed Mar 12 17:18:12 2008 -0700 qcap: Implement a stubby CaptureGraphBuilder2::RenderStream. This just uses enumeratepins to find 2 non-connected pins and connects them using the filtergraph. --- dlls/qcap/capturegraph.c | 37 +++++++++++++++++++++++++++++++++++-- 1 files changed, 35 insertions(+), 2 deletions(-) diff --git a/dlls/qcap/capturegraph.c b/dlls/qcap/capturegraph.c index 6dec92a..f439f3b 100644 --- a/dlls/qcap/capturegraph.c +++ b/dlls/qcap/capturegraph.c @@ -270,12 +270,38 @@ fnCaptureGraphBuilder2_RenderStream(ICaptureGraphBuilder2 * iface, IBaseFilter *pfRenderer) { CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder2(iface); + IPin *pin_in = NULL; + IPin *pin_out = NULL; + HRESULT hr; FIXME("(%p/%p)->(%s, %s, %p, %p, %p) Stub!\n", This, iface, debugstr_guid(pCategory), debugstr_guid(pType), pSource, pfCompressor, pfRenderer); - return E_NOTIMPL; + if (pfCompressor) + FIXME("Intermediate streams not supported yet\n"); + + if (!This->mygraph) + { + FIXME("Need a capture graph\n"); + return E_UNEXPECTED; + } + + ICaptureGraphBuilder2_FindPin(iface, pSource, PINDIR_OUTPUT, pCategory, pType, TRUE, 0, &pin_in); + if (!pin_in) + return E_FAIL; + ICaptureGraphBuilder2_FindPin(iface, (IUnknown*)pfRenderer, PINDIR_INPUT, pCategory, pType, TRUE, 0, &pin_out); + if (!pin_out) + { + IPin_Release(pin_in); + return E_FAIL; + } + + /* Uses 'Intelligent Connect', so Connect, not ConnectDirect here */ + hr = IFilterGraph2_Connect(This->mygraph, pin_in, pin_out); + IPin_Release(pin_in); + IPin_Release(pin_out); + return hr; } static HRESULT WINAPI @@ -333,17 +359,23 @@ static BOOL pin_matches(IPin *pin, PIN_DIRECTION direction, const GUID *cat, con IPin_QueryDirection(pin, &pindir); if (pindir != direction) + { + TRACE("No match, wrong direction\n"); return FALSE; + } if (unconnected && IPin_ConnectedTo(pin, &partner) == S_OK) { IPin_Release(partner); + TRACE("No match, %p already connected to %p\n", pin, partner); return FALSE; } if (cat || type) FIXME("Ignoring category/type\n"); + TRACE("Match made in heaven\n"); + return TRUE; } @@ -403,6 +435,7 @@ fnCaptureGraphBuilder2_FindPin(ICaptureGraphBuilder2 * iface, if (hr != S_OK) break; + TRACE("Testing match\n"); if (pin_matches(pin, pindir, pCategory, pType, fUnconnected) && numcurrent++ == num) break; IPin_Release(pin); @@ -412,7 +445,7 @@ fnCaptureGraphBuilder2_FindPin(ICaptureGraphBuilder2 * iface, if (hr != S_OK) { - WARN("Could not find pin # %d\n", numcurrent); + WARN("Could not find %s pin # %d\n", (pindir == PINDIR_OUTPUT ? "output" : "input"), numcurrent); return E_FAIL; } }
1
0
0
0
Maarten Lankhorst : qcap: Add better findpin stub for CaptureGraphBuilder.
by Alexandre Julliard
14 Mar '08
14 Mar '08
Module: wine Branch: master Commit: 7e32b11ab6ec2a53f70e6bf19144c04680011f1a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7e32b11ab6ec2a53f70e6bf19…
Author: Maarten Lankhorst <m.b.lankhorst(a)gmail.com> Date: Tue Mar 11 16:24:54 2008 -0700 qcap: Add better findpin stub for CaptureGraphBuilder. ICaptureGraphBuilder::RenderStream needs to enumerate pins, and to prevent duplication I implemented a bit of findpin first. --- dlls/qcap/capturegraph.c | 89 +++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 85 insertions(+), 4 deletions(-) diff --git a/dlls/qcap/capturegraph.c b/dlls/qcap/capturegraph.c index c5631b1..6dec92a 100644 --- a/dlls/qcap/capturegraph.c +++ b/dlls/qcap/capturegraph.c @@ -34,10 +34,10 @@ #include "evcode.h" #include "strmif.h" #include "control.h" +#include "vfwmsgs.h" /* *#include "amvideo.h" *#include "mmreg.h" - *#include "vfwmsgs.h" *#include "dshow.h" *#include "ddraw.h" */ @@ -326,6 +326,27 @@ fnCaptureGraphBuilder2_CopyCaptureFile(ICaptureGraphBuilder2 * iface, return E_NOTIMPL; } +static BOOL pin_matches(IPin *pin, PIN_DIRECTION direction, const GUID *cat, const GUID *type, BOOL unconnected) +{ + IPin *partner; + PIN_DIRECTION pindir; + + IPin_QueryDirection(pin, &pindir); + if (pindir != direction) + return FALSE; + + if (unconnected && IPin_ConnectedTo(pin, &partner) == S_OK) + { + IPin_Release(partner); + return FALSE; + } + + if (cat || type) + FIXME("Ignoring category/type\n"); + + return TRUE; +} + static HRESULT WINAPI fnCaptureGraphBuilder2_FindPin(ICaptureGraphBuilder2 * iface, IUnknown *pSource, @@ -333,16 +354,76 @@ fnCaptureGraphBuilder2_FindPin(ICaptureGraphBuilder2 * iface, const GUID *pCategory, const GUID *pType, BOOL fUnconnected, - int num, + INT num, IPin **ppPin) { + HRESULT hr; + IEnumPins *enumpins = NULL; + IPin *pin; CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder2(iface); - FIXME("(%p/%p)->(%p, %x, %s, %s, %d, %i, %p) Stub!\n", This, iface, + TRACE("(%p/%p)->(%p, %x, %s, %s, %d, %i, %p)\n", This, iface, pSource, pindir, debugstr_guid(pCategory), debugstr_guid(pType), fUnconnected, num, ppPin); - return E_NOTIMPL; + pin = NULL; + + hr = IUnknown_QueryInterface(pSource, &IID_IPin, (void**)&pin); + if (hr == E_NOINTERFACE) + { + IBaseFilter *filter = NULL; + int numcurrent = 0; + + hr = IUnknown_QueryInterface(pSource, &IID_IBaseFilter, (void**)&filter); + if (hr == E_NOINTERFACE) + { + WARN("Input not filter or pin?!\n"); + return E_FAIL; + } + + hr = IBaseFilter_EnumPins(filter, &enumpins); + if (FAILED(hr)) + { + WARN("Could not enumerate\n"); + return hr; + } + + IEnumPins_Reset(enumpins); + + while (1) + { + hr = IEnumPins_Next(enumpins, 1, &pin, NULL); + if (hr == VFW_E_ENUM_OUT_OF_SYNC) + { + numcurrent = 0; + IEnumPins_Reset(enumpins); + pin = NULL; + continue; + } + + if (hr != S_OK) + break; + if (pin_matches(pin, pindir, pCategory, pType, fUnconnected) && numcurrent++ == num) + break; + IPin_Release(pin); + pin = NULL; + } + IEnumPins_Release(enumpins); + + if (hr != S_OK) + { + WARN("Could not find pin # %d\n", numcurrent); + return E_FAIL; + } + } + else if (!pin_matches(pin, pindir, pCategory, pType, fUnconnected)) + { + IPin_Release(pin); + return E_FAIL; + } + + *ppPin = pin; + return S_OK; } static const ICaptureGraphBuilder2Vtbl builder2_Vtbl =
1
0
0
0
Dan Hipschman : qmgr: Implement progress updates for downloads given by URL .
by Alexandre Julliard
14 Mar '08
14 Mar '08
Module: wine Branch: master Commit: 9617b326182ab01e7b286b7a0e0fd4d0bcb8eebc URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9617b326182ab01e7b286b7a0…
Author: Dan Hipschman <dsh(a)linux.ucla.edu> Date: Thu Mar 13 15:57:54 2008 -0700 qmgr: Implement progress updates for downloads given by URL. --- dlls/qmgr/file.c | 180 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 170 insertions(+), 10 deletions(-) diff --git a/dlls/qmgr/file.c b/dlls/qmgr/file.c index fea84ec..84cd30c 100644 --- a/dlls/qmgr/file.c +++ b/dlls/qmgr/file.c @@ -20,6 +20,8 @@ #include <stdarg.h> +#define COBJMACROS + #include "windef.h" #include "winbase.h" #include "winuser.h" @@ -209,9 +211,165 @@ static DWORD CALLBACK copyProgressCallback(LARGE_INTEGER totalSize, : PROGRESS_CANCEL); } +typedef struct +{ + const IBindStatusCallbackVtbl *lpVtbl; + BackgroundCopyFileImpl *file; + LONG ref; +} DLBindStatusCallback; + +static ULONG WINAPI DLBindStatusCallback_AddRef(IBindStatusCallback *iface) +{ + DLBindStatusCallback *This = (DLBindStatusCallback *) iface; + return InterlockedIncrement(&This->ref); +} + +static ULONG WINAPI DLBindStatusCallback_Release(IBindStatusCallback *iface) +{ + DLBindStatusCallback *This = (DLBindStatusCallback *) iface; + ULONG ref = InterlockedDecrement(&This->ref); + + if (ref == 0) + { + IBackgroundCopyFile_Release((IBackgroundCopyFile *) This->file); + HeapFree(GetProcessHeap(), 0, This); + } + + return ref; +} + +static HRESULT WINAPI DLBindStatusCallback_QueryInterface( + IBindStatusCallback *iface, + REFIID riid, + void **ppvObject) +{ + DLBindStatusCallback *This = (DLBindStatusCallback *) iface; + + if (IsEqualGUID(riid, &IID_IUnknown) + || IsEqualGUID(riid, &IID_IBindStatusCallback)) + { + *ppvObject = &This->lpVtbl; + DLBindStatusCallback_AddRef(iface); + return S_OK; + } + + *ppvObject = NULL; + return E_NOINTERFACE; +} + +static HRESULT WINAPI DLBindStatusCallback_GetBindInfo( + IBindStatusCallback *iface, + DWORD *grfBINDF, + BINDINFO *pbindinfo) +{ + return E_NOTIMPL; +} + +static HRESULT WINAPI DLBindStatusCallback_GetPriority( + IBindStatusCallback *iface, + LONG *pnPriority) +{ + return E_NOTIMPL; +} + +static HRESULT WINAPI DLBindStatusCallback_OnDataAvailable( + IBindStatusCallback *iface, + DWORD grfBSCF, + DWORD dwSize, + FORMATETC *pformatetc, + STGMEDIUM *pstgmed) +{ + return E_NOTIMPL; +} + +static HRESULT WINAPI DLBindStatusCallback_OnLowResource( + IBindStatusCallback *iface, + DWORD reserved) +{ + return E_NOTIMPL; +} + +static HRESULT WINAPI DLBindStatusCallback_OnObjectAvailable( + IBindStatusCallback *iface, + REFIID riid, + IUnknown *punk) +{ + return E_NOTIMPL; +} + +static HRESULT WINAPI DLBindStatusCallback_OnProgress( + IBindStatusCallback *iface, + ULONG progress, + ULONG progressMax, + ULONG statusCode, + LPCWSTR statusText) +{ + DLBindStatusCallback *This = (DLBindStatusCallback *) iface; + BackgroundCopyFileImpl *file = This->file; + BackgroundCopyJobImpl *job = file->owner; + ULONG64 diff; + + EnterCriticalSection(&job->cs); + diff = (file->fileProgress.BytesTotal == BG_SIZE_UNKNOWN + ? progress + : progress - file->fileProgress.BytesTransferred); + file->fileProgress.BytesTotal = progressMax ? progressMax : BG_SIZE_UNKNOWN; + file->fileProgress.BytesTransferred = progress; + job->jobProgress.BytesTransferred += diff; + LeaveCriticalSection(&job->cs); + + return S_OK; +} + +static HRESULT WINAPI DLBindStatusCallback_OnStartBinding( + IBindStatusCallback *iface, + DWORD dwReserved, + IBinding *pib) +{ + return E_NOTIMPL; +} + +static HRESULT WINAPI DLBindStatusCallback_OnStopBinding( + IBindStatusCallback *iface, + HRESULT hresult, + LPCWSTR szError) +{ + return E_NOTIMPL; +} + +static const IBindStatusCallbackVtbl DLBindStatusCallback_Vtbl = +{ + DLBindStatusCallback_QueryInterface, + DLBindStatusCallback_AddRef, + DLBindStatusCallback_Release, + DLBindStatusCallback_OnStartBinding, + DLBindStatusCallback_GetPriority, + DLBindStatusCallback_OnLowResource, + DLBindStatusCallback_OnProgress, + DLBindStatusCallback_OnStopBinding, + DLBindStatusCallback_GetBindInfo, + DLBindStatusCallback_OnDataAvailable, + DLBindStatusCallback_OnObjectAvailable +}; + +static DLBindStatusCallback *DLBindStatusCallbackConstructor( + BackgroundCopyFileImpl *file) +{ + DLBindStatusCallback *This = HeapAlloc(GetProcessHeap(), 0, sizeof This); + if (!This) + return NULL; + + This->lpVtbl = &DLBindStatusCallback_Vtbl; + IBackgroundCopyFile_AddRef((IBackgroundCopyFile *) file); + This->file = file; + This->ref = 1; + return This; +} + BOOL processFile(BackgroundCopyFileImpl *file, BackgroundCopyJobImpl *job) { static WCHAR prefix[] = {'B','I','T', 0}; + IBindStatusCallback *callbackObj; WCHAR tmpDir[MAX_PATH]; WCHAR tmpName[MAX_PATH]; HRESULT hr; @@ -232,6 +390,14 @@ BOOL processFile(BackgroundCopyFileImpl *file, BackgroundCopyJobImpl *job) return FALSE; } + callbackObj = (IBindStatusCallback *) DLBindStatusCallbackConstructor(file); + if (!callbackObj) + { + ERR("Out of memory\n"); + transitionJobState(job, BG_JOB_STATE_QUEUED, BG_JOB_STATE_TRANSIENT_ERROR); + return FALSE; + } + EnterCriticalSection(&job->cs); file->fileProgress.BytesTotal = BG_SIZE_UNKNOWN; file->fileProgress.BytesTransferred = 0; @@ -246,15 +412,9 @@ BOOL processFile(BackgroundCopyFileImpl *file, BackgroundCopyJobImpl *job) transitionJobState(job, BG_JOB_STATE_QUEUED, BG_JOB_STATE_TRANSFERRING); DeleteUrlCacheEntryW(file->info.RemoteName); - hr = URLDownloadToFileW(NULL, file->info.RemoteName, tmpName, 0, NULL); - if (SUCCEEDED(hr)) - { - FIXME("Do progress updates correctly with IBindStatusCallback\n"); - EnterCriticalSection(&job->cs); - file->fileProgress.BytesTotal = 0; - LeaveCriticalSection(&job->cs); - } - else if (hr == INET_E_DOWNLOAD_FAILURE) + hr = URLDownloadToFileW(NULL, file->info.RemoteName, tmpName, 0, callbackObj); + IBindStatusCallback_Release(callbackObj); + if (hr == INET_E_DOWNLOAD_FAILURE) { TRACE("URLDownload failed, trying local file copy\n"); if (!CopyFileExW(file->info.RemoteName, tmpName, copyProgressCallback, @@ -265,7 +425,7 @@ BOOL processFile(BackgroundCopyFileImpl *file, BackgroundCopyJobImpl *job) return FALSE; } } - else + else if (!SUCCEEDED(hr)) { ERR("URLDownload failed: eh 0x%08x\n", hr); transitionJobState(job, BG_JOB_STATE_TRANSFERRING, BG_JOB_STATE_ERROR);
1
0
0
0
Dan Hipschman : qmgr: Transfer files given by URL (including HTTP, etc).
by Alexandre Julliard
14 Mar '08
14 Mar '08
Module: wine Branch: master Commit: 8199e3dfa261b65cfeab039939c0ab28bbbc5f3e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8199e3dfa261b65cfeab03993…
Author: Dan Hipschman <dsh(a)linux.ucla.edu> Date: Thu Mar 13 15:57:19 2008 -0700 qmgr: Transfer files given by URL (including HTTP, etc). --- dlls/qmgr/tests/job.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/dlls/qmgr/tests/job.c b/dlls/qmgr/tests/job.c index 971d885..f06a619 100644 --- a/dlls/qmgr/tests/job.c +++ b/dlls/qmgr/tests/job.c @@ -375,6 +375,8 @@ static void test_CompleteLocal(void) ok(DeleteFileW(test_remotePathA), "DeleteFile\n"); ok(DeleteFileW(test_remotePathB), "DeleteFile\n"); + DeleteFileW(test_localPathA); + DeleteFileW(test_localPathB); } /* Test a complete transfer for local files */ @@ -448,6 +450,8 @@ static void test_CompleteLocalURL(void) ok(DeleteFileW(test_remotePathA), "DeleteFile\n"); ok(DeleteFileW(test_remotePathB), "DeleteFile\n"); + DeleteFileW(test_localPathA); + DeleteFileW(test_localPathB); HeapFree(GetProcessHeap(), 0, urlA); HeapFree(GetProcessHeap(), 0, urlB);
1
0
0
0
Dan Hipschman : qmgr: Transfer files given by URL (including HTTP, etc).
by Alexandre Julliard
14 Mar '08
14 Mar '08
Module: wine Branch: master Commit: 2f2b3303d75a516877c88319f83a9a680464fe72 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2f2b3303d75a516877c88319f…
Author: Dan Hipschman <dsh(a)linux.ucla.edu> Date: Thu Mar 13 15:57:19 2008 -0700 qmgr: Transfer files given by URL (including HTTP, etc). --- dlls/qmgr/Makefile.in | 2 +- dlls/qmgr/file.c | 39 ++++++++++++++++++++++-- dlls/qmgr/tests/job.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 113 insertions(+), 5 deletions(-) diff --git a/dlls/qmgr/Makefile.in b/dlls/qmgr/Makefile.in index 30c699b..de636db 100644 --- a/dlls/qmgr/Makefile.in +++ b/dlls/qmgr/Makefile.in @@ -3,7 +3,7 @@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = qmgr.dll -IMPORTS = advpack ole32 advapi32 kernel32 +IMPORTS = advpack wininet urlmon ole32 advapi32 kernel32 EXTRALIBS = -luuid C_SRCS = \ diff --git a/dlls/qmgr/file.c b/dlls/qmgr/file.c index a874062..fea84ec 100644 --- a/dlls/qmgr/file.c +++ b/dlls/qmgr/file.c @@ -1,7 +1,7 @@ /* * Queue Manager (BITS) File * - * Copyright 2007 Google (Roy Shea) + * Copyright 2007, 2008 Google (Roy Shea, Dan Hipschman) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -18,6 +18,16 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winreg.h" +#include "ole2.h" +#include "urlmon.h" +#include "wininet.h" + #include "qmgr.h" #include "wine/debug.h" @@ -204,6 +214,7 @@ BOOL processFile(BackgroundCopyFileImpl *file, BackgroundCopyJobImpl *job) static WCHAR prefix[] = {'B','I','T', 0}; WCHAR tmpDir[MAX_PATH]; WCHAR tmpName[MAX_PATH]; + HRESULT hr; if (!GetTempPathW(MAX_PATH, tmpDir)) { @@ -233,10 +244,30 @@ BOOL processFile(BackgroundCopyFileImpl *file, BackgroundCopyJobImpl *job) debugstr_w(file->info.LocalName)); transitionJobState(job, BG_JOB_STATE_QUEUED, BG_JOB_STATE_TRANSFERRING); - if (!CopyFileExW(file->info.RemoteName, tmpName, copyProgressCallback, - file, NULL, 0)) + + DeleteUrlCacheEntryW(file->info.RemoteName); + hr = URLDownloadToFileW(NULL, file->info.RemoteName, tmpName, 0, NULL); + if (SUCCEEDED(hr)) + { + FIXME("Do progress updates correctly with IBindStatusCallback\n"); + EnterCriticalSection(&job->cs); + file->fileProgress.BytesTotal = 0; + LeaveCriticalSection(&job->cs); + } + else if (hr == INET_E_DOWNLOAD_FAILURE) + { + TRACE("URLDownload failed, trying local file copy\n"); + if (!CopyFileExW(file->info.RemoteName, tmpName, copyProgressCallback, + file, NULL, 0)) + { + ERR("Local file copy failed: error %d\n", GetLastError()); + transitionJobState(job, BG_JOB_STATE_TRANSFERRING, BG_JOB_STATE_ERROR); + return FALSE; + } + } + else { - ERR("Local file copy failed: error %d\n", GetLastError()); + ERR("URLDownload failed: eh 0x%08x\n", hr); transitionJobState(job, BG_JOB_STATE_TRANSFERRING, BG_JOB_STATE_ERROR); return FALSE; } diff --git a/dlls/qmgr/tests/job.c b/dlls/qmgr/tests/job.c index 726624a..971d885 100644 --- a/dlls/qmgr/tests/job.c +++ b/dlls/qmgr/tests/job.c @@ -377,6 +377,82 @@ static void test_CompleteLocal(void) ok(DeleteFileW(test_remotePathB), "DeleteFile\n"); } +/* Test a complete transfer for local files */ +static void test_CompleteLocalURL(void) +{ + static const WCHAR prot[] = {'f','i','l','e',':','/','/', 0}; + static const int timeout_sec = 30; + WCHAR *urlA, *urlB; + HRESULT hres; + BG_JOB_STATE state; + int i; + + DeleteFileW(test_localPathA); + DeleteFileW(test_localPathB); + makeFile(test_remotePathA, "This is a WINE test file for BITS\n"); + makeFile(test_remotePathB, "This is another WINE test file for BITS\n"); + + urlA = HeapAlloc(GetProcessHeap(), 0, + (7 + lstrlenW(test_remotePathA) + 1) * sizeof urlA[0]); + urlB = HeapAlloc(GetProcessHeap(), 0, + (7 + lstrlenW(test_remotePathB) + 1) * sizeof urlB[0]); + if (!urlA || !urlB) + { + skip("Unable to allocate memory for URLs\n"); + return; + } + + lstrcpyW(urlA, prot); + lstrcatW(urlA, test_remotePathA); + lstrcpyW(urlB, prot); + lstrcatW(urlB, test_remotePathB); + + hres = IBackgroundCopyJob_AddFile(test_job, urlA, test_localPathA); + if (hres != S_OK) + { + skip("Unable to add file to job\n"); + return; + } + + hres = IBackgroundCopyJob_AddFile(test_job, urlB, test_localPathB); + if (hres != S_OK) + { + skip("Unable to add file to job\n"); + return; + } + + hres = IBackgroundCopyJob_Resume(test_job); + ok(hres == S_OK, "IBackgroundCopyJob_Resume\n"); + + for (i = 0; i < timeout_sec; ++i) + { + hres = IBackgroundCopyJob_GetState(test_job, &state); + ok(hres == S_OK, "IBackgroundCopyJob_GetState\n"); + ok(state == BG_JOB_STATE_QUEUED || state == BG_JOB_STATE_CONNECTING + || state == BG_JOB_STATE_TRANSFERRING || state == BG_JOB_STATE_TRANSFERRED, + "Bad state: %d\n", state); + if (state == BG_JOB_STATE_TRANSFERRED) + break; + Sleep(1000); + } + + ok(i < timeout_sec, "BITS jobs timed out\n"); + hres = IBackgroundCopyJob_Complete(test_job); + ok(hres == S_OK, "IBackgroundCopyJob_Complete\n"); + hres = IBackgroundCopyJob_GetState(test_job, &state); + ok(hres == S_OK, "IBackgroundCopyJob_GetState\n"); + ok(state == BG_JOB_STATE_ACKNOWLEDGED, "Bad state: %d\n", state); + + compareFiles(test_remotePathA, test_localPathA); + compareFiles(test_remotePathB, test_localPathB); + + ok(DeleteFileW(test_remotePathA), "DeleteFile\n"); + ok(DeleteFileW(test_remotePathB), "DeleteFile\n"); + + HeapFree(GetProcessHeap(), 0, urlA); + HeapFree(GetProcessHeap(), 0, urlB); +} + typedef void (*test_t)(void); START_TEST(job) @@ -391,6 +467,7 @@ START_TEST(job) test_GetState, test_ResumeEmpty, test_CompleteLocal, + test_CompleteLocalURL, 0 }; const test_t *test;
1
0
0
0
Dan Hipschman : qmgr: Implement BackgroundCopyJob_Complete.
by Alexandre Julliard
14 Mar '08
14 Mar '08
Module: wine Branch: master Commit: 1c93ee77e5cdf4e1fececbf576908889bcbe80dc URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1c93ee77e5cdf4e1fececbf57…
Author: Dan Hipschman <dsh(a)linux.ucla.edu> Date: Thu Mar 13 15:56:28 2008 -0700 qmgr: Implement BackgroundCopyJob_Complete. --- dlls/qmgr/job.c | 44 +++++++++++++++++++++- dlls/qmgr/tests/job.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+), 2 deletions(-) diff --git a/dlls/qmgr/job.c b/dlls/qmgr/job.c index 3b94a79..eb337c0 100644 --- a/dlls/qmgr/job.c +++ b/dlls/qmgr/job.c @@ -18,6 +18,11 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" + #include "qmgr.h" #include "wine/debug.h" @@ -157,8 +162,43 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_Cancel( static HRESULT WINAPI BITS_IBackgroundCopyJob_Complete( IBackgroundCopyJob* iface) { - FIXME("Not implemented\n"); - return E_NOTIMPL; + BackgroundCopyJobImpl *This = (BackgroundCopyJobImpl *) iface; + HRESULT rv = S_OK; + + EnterCriticalSection(&This->cs); + + if (This->state == BG_JOB_STATE_CANCELLED + || This->state == BG_JOB_STATE_ACKNOWLEDGED) + { + rv = BG_E_INVALID_STATE; + } + else + { + BackgroundCopyFileImpl *file; + LIST_FOR_EACH_ENTRY(file, &This->files, BackgroundCopyFileImpl, entryFromJob) + { + if (file->fileProgress.Completed) + { + if (!MoveFileExW(file->tempFileName, file->info.LocalName, + (MOVEFILE_COPY_ALLOWED + | MOVEFILE_REPLACE_EXISTING + | MOVEFILE_WRITE_THROUGH))) + { + ERR("Couldn't rename file %s -> %s\n", + debugstr_w(file->tempFileName), + debugstr_w(file->info.LocalName)); + rv = BG_S_PARTIAL_COMPLETE; + } + } + else + rv = BG_S_PARTIAL_COMPLETE; + } + } + + This->state = BG_JOB_STATE_ACKNOWLEDGED; + LeaveCriticalSection(&This->cs); + + return rv; } static HRESULT WINAPI BITS_IBackgroundCopyJob_GetId( diff --git a/dlls/qmgr/tests/job.c b/dlls/qmgr/tests/job.c index fab1c8d..726624a 100644 --- a/dlls/qmgr/tests/job.c +++ b/dlls/qmgr/tests/job.c @@ -280,6 +280,103 @@ static void test_ResumeEmpty(void) ok(state == BG_JOB_STATE_SUSPENDED, "Incorrect job state: %d\n", state); } +static void makeFile(WCHAR *name, const char *contents) +{ + HANDLE file; + DWORD w, len = strlen(contents); + + DeleteFileW(name); + file = CreateFileW(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, NULL); + ok(file != INVALID_HANDLE_VALUE, "CreateFile\n"); + ok(WriteFile(file, contents, len, &w, NULL), "WriteFile\n"); + CloseHandle(file); +} + +static void compareFiles(WCHAR *n1, WCHAR *n2) +{ + char b1[256]; + char b2[256]; + DWORD s1, s2; + HANDLE f1, f2; + + f1 = CreateFileW(n1, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, NULL); + ok(f1 != INVALID_HANDLE_VALUE, "CreateFile\n"); + + f2 = CreateFileW(n2, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, NULL); + ok(f1 != INVALID_HANDLE_VALUE, "CreateFile\n"); + + /* Neither of these files is very big */ + ok(ReadFile(f1, b1, sizeof b1, &s1, NULL), "ReadFile\n"); + ok(ReadFile(f2, b2, sizeof b2, &s2, NULL), "ReadFile\n"); + + CloseHandle(f1); + CloseHandle(f2); + + ok(s1 == s2, "Files differ in length\n"); + ok(memcmp(b1, b2, s1) == 0, "Files differ in contents\n"); +} + +/* Test a complete transfer for local files */ +static void test_CompleteLocal(void) +{ + static const int timeout_sec = 30; + HRESULT hres; + BG_JOB_STATE state; + int i; + + DeleteFileW(test_localPathA); + DeleteFileW(test_localPathB); + makeFile(test_remotePathA, "This is a WINE test file for BITS\n"); + makeFile(test_remotePathB, "This is another WINE test file for BITS\n"); + + hres = IBackgroundCopyJob_AddFile(test_job, test_remotePathA, + test_localPathA); + if (hres != S_OK) + { + skip("Unable to add file to job\n"); + return; + } + + hres = IBackgroundCopyJob_AddFile(test_job, test_remotePathB, + test_localPathB); + if (hres != S_OK) + { + skip("Unable to add file to job\n"); + return; + } + + hres = IBackgroundCopyJob_Resume(test_job); + ok(hres == S_OK, "IBackgroundCopyJob_Resume\n"); + + for (i = 0; i < timeout_sec; ++i) + { + hres = IBackgroundCopyJob_GetState(test_job, &state); + ok(hres == S_OK, "IBackgroundCopyJob_GetState\n"); + ok(state == BG_JOB_STATE_QUEUED || state == BG_JOB_STATE_CONNECTING + || state == BG_JOB_STATE_TRANSFERRING || state == BG_JOB_STATE_TRANSFERRED, + "Bad state: %d\n", state); + if (state == BG_JOB_STATE_TRANSFERRED) + break; + Sleep(1000); + } + + ok(i < timeout_sec, "BITS jobs timed out\n"); + hres = IBackgroundCopyJob_Complete(test_job); + ok(hres == S_OK, "IBackgroundCopyJob_Complete\n"); + hres = IBackgroundCopyJob_GetState(test_job, &state); + ok(hres == S_OK, "IBackgroundCopyJob_GetState\n"); + ok(state == BG_JOB_STATE_ACKNOWLEDGED, "Bad state: %d\n", state); + + compareFiles(test_remotePathA, test_localPathA); + compareFiles(test_remotePathB, test_localPathB); + + ok(DeleteFileW(test_remotePathA), "DeleteFile\n"); + ok(DeleteFileW(test_remotePathB), "DeleteFile\n"); +} + typedef void (*test_t)(void); START_TEST(job) @@ -293,6 +390,7 @@ START_TEST(job) test_GetProgress_preTransfer, test_GetState, test_ResumeEmpty, + test_CompleteLocal, 0 }; const test_t *test;
1
0
0
0
Dan Hipschman : kernel32: Add the MOVEFILE_WRITE_THROUGH flag for MoveFileEx (stub).
by Alexandre Julliard
14 Mar '08
14 Mar '08
Module: wine Branch: master Commit: 0e8f1931846669818787255867397c415f5afd86 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0e8f193184666981878725586…
Author: Dan Hipschman <dsh(a)linux.ucla.edu> Date: Thu Mar 13 15:55:46 2008 -0700 kernel32: Add the MOVEFILE_WRITE_THROUGH flag for MoveFileEx (stub). --- dlls/kernel32/path.c | 3 +++ include/winbase.h | 1 + 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c index f0f713f..aad260f 100644 --- a/dlls/kernel32/path.c +++ b/dlls/kernel32/path.c @@ -1010,6 +1010,9 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest, if (!dest) return DeleteFileW( source ); + if (flag & MOVEFILE_WRITE_THROUGH) + FIXME("MOVEFILE_WRITE_THROUGH unimplemented\n"); + /* check if we are allowed to rename the source */ if (!RtlDosPathNameToNtPathName_U( source, &nt_name, NULL, NULL )) diff --git a/include/winbase.h b/include/winbase.h index e2ee515..f3130a0 100644 --- a/include/winbase.h +++ b/include/winbase.h @@ -845,6 +845,7 @@ typedef DWORD (CALLBACK *LPPROGRESS_ROUTINE)(LARGE_INTEGER, LARGE_INTEGER, LARGE #define MOVEFILE_REPLACE_EXISTING 0x00000001 #define MOVEFILE_COPY_ALLOWED 0x00000002 #define MOVEFILE_DELAY_UNTIL_REBOOT 0x00000004 +#define MOVEFILE_WRITE_THROUGH 0x00000008 #define REPLACEFILE_WRITE_THROUGH 0x00000001 #define REPLACEFILE_IGNORE_MERGE_ERRORS 0x00000002
1
0
0
0
Dan Hipschman : qmgr: Implement local file background "downloads."
by Alexandre Julliard
14 Mar '08
14 Mar '08
Module: wine Branch: master Commit: b329a2ef3cdb17f4b301adcbe5beddf57506ace6 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b329a2ef3cdb17f4b301adcbe…
Author: Dan Hipschman <dsh(a)linux.ucla.edu> Date: Thu Mar 13 15:54:35 2008 -0700 qmgr: Implement local file background "downloads." --- dlls/qmgr/file.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ dlls/qmgr/job.c | 27 ++++++++++++++++ dlls/qmgr/qmgr.c | 7 +---- dlls/qmgr/qmgr.h | 18 +++++++++++ 4 files changed, 134 insertions(+), 6 deletions(-) diff --git a/dlls/qmgr/file.c b/dlls/qmgr/file.c index f1ae06a..a874062 100644 --- a/dlls/qmgr/file.c +++ b/dlls/qmgr/file.c @@ -170,3 +170,91 @@ HRESULT BackgroundCopyFileConstructor(BackgroundCopyJobImpl *owner, *ppObj = &This->lpVtbl; return S_OK; } + +static DWORD CALLBACK copyProgressCallback(LARGE_INTEGER totalSize, + LARGE_INTEGER totalTransferred, + LARGE_INTEGER streamSize, + LARGE_INTEGER streamTransferred, + DWORD streamNum, + DWORD reason, + HANDLE srcFile, + HANDLE dstFile, + LPVOID obj) +{ + BackgroundCopyFileImpl *file = (BackgroundCopyFileImpl *) obj; + BackgroundCopyJobImpl *job = file->owner; + ULONG64 diff; + + EnterCriticalSection(&job->cs); + diff = (file->fileProgress.BytesTotal == BG_SIZE_UNKNOWN + ? totalTransferred.QuadPart + : totalTransferred.QuadPart - file->fileProgress.BytesTransferred); + file->fileProgress.BytesTotal = totalSize.QuadPart; + file->fileProgress.BytesTransferred = totalTransferred.QuadPart; + job->jobProgress.BytesTransferred += diff; + LeaveCriticalSection(&job->cs); + + return (job->state == BG_JOB_STATE_TRANSFERRING + ? PROGRESS_CONTINUE + : PROGRESS_CANCEL); +} + +BOOL processFile(BackgroundCopyFileImpl *file, BackgroundCopyJobImpl *job) +{ + static WCHAR prefix[] = {'B','I','T', 0}; + WCHAR tmpDir[MAX_PATH]; + WCHAR tmpName[MAX_PATH]; + + if (!GetTempPathW(MAX_PATH, tmpDir)) + { + ERR("Couldn't create temp file name: %d\n", GetLastError()); + /* Guessing on what state this should give us */ + transitionJobState(job, BG_JOB_STATE_QUEUED, BG_JOB_STATE_TRANSIENT_ERROR); + return FALSE; + } + + if (!GetTempFileNameW(tmpDir, prefix, 0, tmpName)) + { + ERR("Couldn't create temp file: %d\n", GetLastError()); + /* Guessing on what state this should give us */ + transitionJobState(job, BG_JOB_STATE_QUEUED, BG_JOB_STATE_TRANSIENT_ERROR); + return FALSE; + } + + EnterCriticalSection(&job->cs); + file->fileProgress.BytesTotal = BG_SIZE_UNKNOWN; + file->fileProgress.BytesTransferred = 0; + file->fileProgress.Completed = FALSE; + LeaveCriticalSection(&job->cs); + + TRACE("Transferring: %s -> %s -> %s\n", + debugstr_w(file->info.RemoteName), + debugstr_w(tmpName), + debugstr_w(file->info.LocalName)); + + transitionJobState(job, BG_JOB_STATE_QUEUED, BG_JOB_STATE_TRANSFERRING); + if (!CopyFileExW(file->info.RemoteName, tmpName, copyProgressCallback, + file, NULL, 0)) + { + ERR("Local file copy failed: error %d\n", GetLastError()); + transitionJobState(job, BG_JOB_STATE_TRANSFERRING, BG_JOB_STATE_ERROR); + return FALSE; + } + + if (transitionJobState(job, BG_JOB_STATE_TRANSFERRING, BG_JOB_STATE_QUEUED)) + { + lstrcpyW(file->tempFileName, tmpName); + + EnterCriticalSection(&job->cs); + file->fileProgress.Completed = TRUE; + job->jobProgress.FilesTransferred++; + LeaveCriticalSection(&job->cs); + + return TRUE; + } + else + { + DeleteFileW(tmpName); + return FALSE; + } +} diff --git a/dlls/qmgr/job.c b/dlls/qmgr/job.c index 2fbf1bc..3b94a79 100644 --- a/dlls/qmgr/job.c +++ b/dlls/qmgr/job.c @@ -98,6 +98,7 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_AddFile( file = (BackgroundCopyFileImpl *) pFile; EnterCriticalSection(&This->cs); list_add_head(&This->files, &file->entryFromJob); + This->jobProgress.BytesTotal = BG_SIZE_UNKNOWN; ++This->jobProgress.FilesTotal; LeaveCriticalSection(&This->cs); @@ -485,3 +486,29 @@ HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type, *ppObj = &This->lpVtbl; return S_OK; } + +void processJob(BackgroundCopyJobImpl *job) +{ + for (;;) + { + BackgroundCopyFileImpl *file; + BOOL done = TRUE; + + EnterCriticalSection(&job->cs); + LIST_FOR_EACH_ENTRY(file, &job->files, BackgroundCopyFileImpl, entryFromJob) + if (!file->fileProgress.Completed) + { + done = FALSE; + break; + } + LeaveCriticalSection(&job->cs); + if (done) + { + transitionJobState(job, BG_JOB_STATE_QUEUED, BG_JOB_STATE_TRANSFERRED); + return; + } + + if (!processFile(file, job)) + return; + } +} diff --git a/dlls/qmgr/qmgr.c b/dlls/qmgr/qmgr.c index 608e01a..4e3d259 100644 --- a/dlls/qmgr/qmgr.c +++ b/dlls/qmgr/qmgr.c @@ -189,11 +189,6 @@ DWORD WINAPI fileTransfer(void *param) LeaveCriticalSection(&qmgr->cs); if (haveJob) - { - FIXME("Actually process job %p; setting error state\n", job); - EnterCriticalSection(&qmgr->cs); - job->state = BG_JOB_STATE_ERROR; - LeaveCriticalSection(&qmgr->cs); - } + processJob(job); } } diff --git a/dlls/qmgr/qmgr.h b/dlls/qmgr/qmgr.h index fce84d9..9530b97 100644 --- a/dlls/qmgr/qmgr.h +++ b/dlls/qmgr/qmgr.h @@ -73,6 +73,7 @@ typedef struct LONG ref; BG_FILE_INFO info; BG_FILE_PROGRESS fileProgress; + WCHAR tempFileName[MAX_PATH]; struct list entryFromJob; BackgroundCopyJobImpl *owner; } BackgroundCopyFileImpl; @@ -107,6 +108,8 @@ HRESULT BackgroundCopyFileConstructor(BackgroundCopyJobImpl *owner, HRESULT EnumBackgroundCopyFilesConstructor(LPVOID *ppObj, IBackgroundCopyJob* copyJob); DWORD WINAPI fileTransfer(void *param); +void processJob(BackgroundCopyJobImpl *job); +BOOL processFile(BackgroundCopyFileImpl *file, BackgroundCopyJobImpl *job); /* Little helper functions */ static inline char * @@ -117,4 +120,19 @@ qmgr_strdup(const char *s) return d ? memcpy(d, s, n) : NULL; } +static inline BOOL +transitionJobState(BackgroundCopyJobImpl *job, BG_JOB_STATE fromState, + BG_JOB_STATE toState) +{ + BOOL rv = FALSE; + EnterCriticalSection(&globalMgr.cs); + if (job->state == fromState) + { + job->state = toState; + rv = TRUE; + } + LeaveCriticalSection(&globalMgr.cs); + return rv; +} + #endif /* __QMGR_H__ */
1
0
0
0
Dan Hipschman : qmgr: Add infrastructure for background file transferring.
by Alexandre Julliard
14 Mar '08
14 Mar '08
Module: wine Branch: master Commit: 374fea0a71cd7f141f491ec0abee9b5f14168d4a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=374fea0a71cd7f141f491ec0a…
Author: Dan Hipschman <dsh(a)linux.ucla.edu> Date: Thu Mar 13 15:54:01 2008 -0700 qmgr: Add infrastructure for background file transferring. --- dlls/qmgr/job.c | 1 + dlls/qmgr/qmgr.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++ dlls/qmgr/qmgr.h | 5 +++- dlls/qmgr/service.c | 22 +++++++++++++++++- 4 files changed, 82 insertions(+), 3 deletions(-) diff --git a/dlls/qmgr/job.c b/dlls/qmgr/job.c index 6bc63f4..2fbf1bc 100644 --- a/dlls/qmgr/job.c +++ b/dlls/qmgr/job.c @@ -139,6 +139,7 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_Resume( && This->state != BG_JOB_STATE_TRANSFERRING) { This->state = BG_JOB_STATE_QUEUED; + SetEvent(globalMgr.jobEvent); } LeaveCriticalSection(&globalMgr.cs); diff --git a/dlls/qmgr/qmgr.c b/dlls/qmgr/qmgr.c index b0a6013..608e01a 100644 --- a/dlls/qmgr/qmgr.c +++ b/dlls/qmgr/qmgr.c @@ -130,6 +130,7 @@ static const IBackgroundCopyManagerVtbl BITS_IBackgroundCopyManager_Vtbl = BackgroundCopyManagerImpl globalMgr = { &BITS_IBackgroundCopyManager_Vtbl, { NULL, -1, 0, 0, 0, 0 }, + NULL, LIST_INIT(globalMgr.jobs) }; @@ -140,3 +141,59 @@ HRESULT BackgroundCopyManagerConstructor(IUnknown *pUnkOuter, LPVOID *ppObj) *ppObj = (IBackgroundCopyManager *) &globalMgr; return S_OK; } + +DWORD WINAPI fileTransfer(void *param) +{ + BackgroundCopyManagerImpl *qmgr = &globalMgr; + HANDLE events[2]; + + events[0] = stop_event; + events[1] = qmgr->jobEvent; + + for (;;) + { + BackgroundCopyJobImpl *job, *jobCur; + BOOL haveJob = FALSE; + + /* Check if it's the stop_event */ + if (WaitForMultipleObjects(2, events, FALSE, INFINITE) == WAIT_OBJECT_0) + return 0; + + /* Note that other threads may add files to the job list, but only + this thread ever deletes them so we don't need to worry about jobs + magically disappearing from the list. */ + EnterCriticalSection(&qmgr->cs); + + LIST_FOR_EACH_ENTRY_SAFE(job, jobCur, &qmgr->jobs, BackgroundCopyJobImpl, entryFromQmgr) + { + if (job->state == BG_JOB_STATE_ACKNOWLEDGED || job->state == BG_JOB_STATE_CANCELLED) + { + list_remove(&job->entryFromQmgr); + IBackgroundCopyJob_Release((IBackgroundCopyJob *) job); + } + else if (job->state == BG_JOB_STATE_QUEUED) + { + haveJob = TRUE; + break; + } + else if (job->state == BG_JOB_STATE_CONNECTING + || job->state == BG_JOB_STATE_TRANSFERRING) + { + ERR("Invalid state for job %p: %d\n", job, job->state); + } + } + + if (!haveJob) + ResetEvent(qmgr->jobEvent); + + LeaveCriticalSection(&qmgr->cs); + + if (haveJob) + { + FIXME("Actually process job %p; setting error state\n", job); + EnterCriticalSection(&qmgr->cs); + job->state = BG_JOB_STATE_ERROR; + LeaveCriticalSection(&qmgr->cs); + } + } +} diff --git a/dlls/qmgr/qmgr.h b/dlls/qmgr/qmgr.h index a584694..fce84d9 100644 --- a/dlls/qmgr/qmgr.h +++ b/dlls/qmgr/qmgr.h @@ -81,8 +81,9 @@ typedef struct typedef struct { const IBackgroundCopyManagerVtbl *lpVtbl; - /* Protects job list and job states */ + /* Protects job list, job states, and jobEvent */ CRITICAL_SECTION cs; + HANDLE jobEvent; struct list jobs; } BackgroundCopyManagerImpl; @@ -91,6 +92,7 @@ typedef struct const IClassFactoryVtbl *lpVtbl; } ClassFactoryImpl; +extern HANDLE stop_event; extern ClassFactoryImpl BITS_ClassFactory; extern BackgroundCopyManagerImpl globalMgr; @@ -104,6 +106,7 @@ HRESULT BackgroundCopyFileConstructor(BackgroundCopyJobImpl *owner, LPVOID *ppObj); HRESULT EnumBackgroundCopyFilesConstructor(LPVOID *ppObj, IBackgroundCopyJob* copyJob); +DWORD WINAPI fileTransfer(void *param); /* Little helper functions */ static inline char * diff --git a/dlls/qmgr/service.c b/dlls/qmgr/service.c index 5e31b8f..50d5156 100644 --- a/dlls/qmgr/service.c +++ b/dlls/qmgr/service.c @@ -28,10 +28,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(qmgr); +HANDLE stop_event = NULL; + static WCHAR qmgr_nameW[] = {'B','I','T','S',0}; static SERVICE_STATUS_HANDLE status_handle; static SERVICE_STATUS status; -static HANDLE stop_event = NULL; static VOID UpdateStatus(DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint) @@ -108,6 +109,8 @@ StartCount(void) VOID WINAPI ServiceMain(DWORD dwArgc, LPWSTR *lpszArgv) { + HANDLE fileTxThread; + DWORD threadId; TRACE("\n"); stop_event = CreateEventW(NULL, TRUE, FALSE, NULL); @@ -129,9 +132,24 @@ ServiceMain(DWORD dwArgc, LPWSTR *lpszArgv) return; } + globalMgr.jobEvent = CreateEventW(NULL, TRUE, FALSE, NULL); + if (!globalMgr.jobEvent) { + ERR("Couldn't create event: error %d\n", GetLastError()); + UpdateStatus(SERVICE_STOPPED, NO_ERROR, 0); + return; + } + + fileTxThread = CreateThread(NULL, 0, fileTransfer, NULL, 0, &threadId); + if (!fileTxThread) + { + ERR("Failed starting file transfer thread\n"); + UpdateStatus(SERVICE_STOPPED, NO_ERROR, 0); + return; + } + UpdateStatus(SERVICE_RUNNING, NO_ERROR, 0); - WaitForSingleObject(stop_event, INFINITE); + WaitForSingleObject(fileTxThread, INFINITE); UpdateStatus(SERVICE_STOPPED, NO_ERROR, 0); CloseHandle(stop_event); TRACE("service stoped\n");
1
0
0
0
Stefan Leichter : shell32: Fix SHGetFolderPathAndSubDir tests.
by Alexandre Julliard
14 Mar '08
14 Mar '08
Module: wine Branch: master Commit: a7ebdf2ebad97929577165cba765f9f0a7ca9d28 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a7ebdf2ebad97929577165cba…
Author: Stefan Leichter <Stefan.Leichter(a)camline.com> Date: Thu Mar 13 23:23:44 2008 +0100 shell32: Fix SHGetFolderPathAndSubDir tests. --- dlls/shell32/tests/shlfolder.c | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c index 033447d..5c43d38 100644 --- a/dlls/shell32/tests/shlfolder.c +++ b/dlls/shell32/tests/shlfolder.c @@ -1414,7 +1414,18 @@ static void testSHGetFolderPathAndSubDirA(void) /* test invalid forth parameter */ ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, 2, wine, testpath); - ok(E_INVALIDARG == ret, "expected E_INVALIDARG, got %x\n", ret); + switch(ret) { + case S_OK: /* winvista */ + ok(!strncmp(appdata, testpath, strlen(appdata)), + "expected %s to start with %s\n", testpath, appdata); + ok(!lstrcmpA(&testpath[1 + strlen(appdata)], winetemp), + "expected %s to end with %s\n", testpath, winetemp); + break; + case E_INVALIDARG: /* winxp, win2k3 */ + break; + default: + ok(0, "expected S_OK or E_INVALIDARG, got %x\n", ret); + } /* test fifth parameter */ testpath[0] = '\0'; @@ -1438,7 +1449,7 @@ static void testSHGetFolderPathAndSubDirA(void) testpath[0] = '\0'; ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, wine, NULL); - ok(S_OK == ret, "expected S_OK, got %x\n", ret); + ok((S_OK == ret) || (E_INVALIDARG == ret), "expected S_OK or E_INVALIDARG, got %x\n", ret); /* test a not existing path */ testpath[0] = '\0';
1
0
0
0
← Newer
1
...
60
61
62
63
64
65
66
...
101
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
Results per page:
10
25
50
100
200