2009-01-31 15:32:09 +00:00
|
|
|
/*
|
|
|
|
* Queue Manager definitions
|
|
|
|
*
|
|
|
|
* Copyright 2007 Google (Roy Shea)
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __QMGR_H__
|
|
|
|
#define __QMGR_H__
|
|
|
|
|
2018-03-21 12:12:06 +00:00
|
|
|
#include "windef.h"
|
2013-12-26 19:19:09 +00:00
|
|
|
#define COBJMACROS
|
2018-03-21 12:12:06 +00:00
|
|
|
#include "bits.h"
|
|
|
|
#include "bits1_5.h"
|
|
|
|
#include "bits2_0.h"
|
|
|
|
#include "bits2_5.h"
|
|
|
|
#include "bits3_0.h"
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include "wine/list.h"
|
2009-01-31 15:32:09 +00:00
|
|
|
|
|
|
|
/* Background copy job vtbl and related data */
|
|
|
|
typedef struct
|
|
|
|
{
|
2015-07-20 22:48:28 +00:00
|
|
|
IBackgroundCopyJob3 IBackgroundCopyJob3_iface;
|
|
|
|
IBackgroundCopyJobHttpOptions IBackgroundCopyJobHttpOptions_iface;
|
2009-01-31 15:32:09 +00:00
|
|
|
LONG ref;
|
|
|
|
LPWSTR displayName;
|
2014-04-26 18:04:41 +00:00
|
|
|
LPWSTR description;
|
2009-01-31 15:32:09 +00:00
|
|
|
BG_JOB_TYPE type;
|
|
|
|
GUID jobId;
|
|
|
|
struct list files;
|
|
|
|
BG_JOB_PROGRESS jobProgress;
|
|
|
|
BG_JOB_STATE state;
|
2014-04-26 18:04:41 +00:00
|
|
|
ULONG notify_flags;
|
|
|
|
IBackgroundCopyCallback2 *callback;
|
|
|
|
BOOL callback2; /* IBackgroundCopyCallback2 is supported in addition to IBackgroundCopyCallback */
|
2009-01-31 15:32:09 +00:00
|
|
|
/* Protects file list, and progress */
|
|
|
|
CRITICAL_SECTION cs;
|
|
|
|
struct list entryFromQmgr;
|
2015-07-20 22:48:28 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
WCHAR *headers;
|
|
|
|
ULONG flags;
|
|
|
|
BG_AUTH_CREDENTIALS creds[BG_AUTH_TARGET_PROXY][BG_AUTH_SCHEME_PASSPORT];
|
|
|
|
} http_options;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
BG_ERROR_CONTEXT context;
|
|
|
|
HRESULT code;
|
|
|
|
IBackgroundCopyFile2 *file;
|
|
|
|
} error;
|
|
|
|
HANDLE wait;
|
|
|
|
HANDLE cancel;
|
|
|
|
HANDLE done;
|
2009-01-31 15:32:09 +00:00
|
|
|
} BackgroundCopyJobImpl;
|
|
|
|
|
|
|
|
/* Background copy file vtbl and related data */
|
|
|
|
typedef struct
|
|
|
|
{
|
2015-07-20 22:48:28 +00:00
|
|
|
IBackgroundCopyFile2 IBackgroundCopyFile2_iface;
|
2009-01-31 15:32:09 +00:00
|
|
|
LONG ref;
|
|
|
|
BG_FILE_INFO info;
|
|
|
|
BG_FILE_PROGRESS fileProgress;
|
|
|
|
WCHAR tempFileName[MAX_PATH];
|
|
|
|
struct list entryFromJob;
|
|
|
|
BackgroundCopyJobImpl *owner;
|
2015-07-20 22:48:28 +00:00
|
|
|
DWORD read_size;
|
2009-01-31 15:32:09 +00:00
|
|
|
} BackgroundCopyFileImpl;
|
|
|
|
|
|
|
|
/* Background copy manager vtbl and related data */
|
|
|
|
typedef struct
|
|
|
|
{
|
2013-06-16 11:10:20 +00:00
|
|
|
IBackgroundCopyManager IBackgroundCopyManager_iface;
|
2009-01-31 15:32:09 +00:00
|
|
|
/* Protects job list, job states, and jobEvent */
|
|
|
|
CRITICAL_SECTION cs;
|
|
|
|
HANDLE jobEvent;
|
|
|
|
struct list jobs;
|
|
|
|
} BackgroundCopyManagerImpl;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2013-06-16 11:10:20 +00:00
|
|
|
IClassFactory IClassFactory_iface;
|
2009-01-31 15:32:09 +00:00
|
|
|
} ClassFactoryImpl;
|
|
|
|
|
2013-06-16 11:10:20 +00:00
|
|
|
extern HANDLE stop_event DECLSPEC_HIDDEN;
|
|
|
|
extern ClassFactoryImpl BITS_ClassFactory DECLSPEC_HIDDEN;
|
|
|
|
extern BackgroundCopyManagerImpl globalMgr DECLSPEC_HIDDEN;
|
2009-01-31 15:32:09 +00:00
|
|
|
|
2014-04-26 18:04:41 +00:00
|
|
|
HRESULT BackgroundCopyManagerConstructor(LPVOID *ppObj) DECLSPEC_HIDDEN;
|
2009-01-31 15:32:09 +00:00
|
|
|
HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type,
|
2013-06-16 11:10:20 +00:00
|
|
|
GUID *pJobId, BackgroundCopyJobImpl **job) DECLSPEC_HIDDEN;
|
|
|
|
HRESULT enum_copy_job_create(BackgroundCopyManagerImpl *qmgr,
|
|
|
|
IEnumBackgroundCopyJobs **enumjob) DECLSPEC_HIDDEN;
|
2009-01-31 15:32:09 +00:00
|
|
|
HRESULT BackgroundCopyFileConstructor(BackgroundCopyJobImpl *owner,
|
|
|
|
LPCWSTR remoteName, LPCWSTR localName,
|
2013-06-16 11:10:20 +00:00
|
|
|
BackgroundCopyFileImpl **file) DECLSPEC_HIDDEN;
|
|
|
|
HRESULT EnumBackgroundCopyFilesConstructor(BackgroundCopyJobImpl*, IEnumBackgroundCopyFiles**) DECLSPEC_HIDDEN;
|
|
|
|
DWORD WINAPI fileTransfer(void *param) DECLSPEC_HIDDEN;
|
|
|
|
void processJob(BackgroundCopyJobImpl *job) DECLSPEC_HIDDEN;
|
|
|
|
BOOL processFile(BackgroundCopyFileImpl *file, BackgroundCopyJobImpl *job) DECLSPEC_HIDDEN;
|
2015-07-20 22:48:28 +00:00
|
|
|
BOOL transitionJobState(BackgroundCopyJobImpl *job, BG_JOB_STATE from, BG_JOB_STATE to) DECLSPEC_HIDDEN;
|
2009-01-31 15:32:09 +00:00
|
|
|
|
|
|
|
/* Little helper functions */
|
2015-07-20 22:48:28 +00:00
|
|
|
static inline WCHAR *strdupW(const WCHAR *src)
|
|
|
|
{
|
2019-11-23 11:10:04 +00:00
|
|
|
WCHAR *dst = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(src) + 1) * sizeof(WCHAR));
|
|
|
|
if (dst) lstrcpyW(dst, src);
|
2015-07-20 22:48:28 +00:00
|
|
|
return dst;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline WCHAR *co_strdupW(const WCHAR *src)
|
2009-01-31 15:32:09 +00:00
|
|
|
{
|
2019-11-23 11:10:04 +00:00
|
|
|
WCHAR *dst = CoTaskMemAlloc((lstrlenW(src) + 1) * sizeof(WCHAR));
|
|
|
|
if (dst) lstrcpyW(dst, src);
|
2015-07-20 22:48:28 +00:00
|
|
|
return dst;
|
2009-01-31 15:32:09 +00:00
|
|
|
}
|
|
|
|
|
2014-04-26 18:04:41 +00:00
|
|
|
static inline HRESULT return_strval(const WCHAR *str, WCHAR **ret)
|
|
|
|
{
|
|
|
|
int len;
|
|
|
|
|
|
|
|
if (!ret) return E_INVALIDARG;
|
|
|
|
|
2019-11-23 11:10:04 +00:00
|
|
|
len = lstrlenW(str);
|
2014-04-26 18:04:41 +00:00
|
|
|
*ret = CoTaskMemAlloc((len+1)*sizeof(WCHAR));
|
|
|
|
if (!*ret) return E_OUTOFMEMORY;
|
2019-11-23 11:10:04 +00:00
|
|
|
lstrcpyW(*ret, str);
|
2014-04-26 18:04:41 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2009-01-31 15:32:09 +00:00
|
|
|
#endif /* __QMGR_H__ */
|