2007-12-20 05:02:23 +01: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__
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#define COBJMACROS
|
2015-06-05 10:33:53 +02:00
|
|
|
#include "bits.h"
|
2008-03-19 23:02:02 +01:00
|
|
|
#include "bits1_5.h"
|
2015-06-05 10:33:53 +02:00
|
|
|
#include "bits2_0.h"
|
|
|
|
#include "bits2_5.h"
|
2013-11-28 06:31:24 +01:00
|
|
|
#include "bits3_0.h"
|
2007-12-20 05:02:23 +01:00
|
|
|
|
2008-02-11 20:09:02 +01:00
|
|
|
#include <string.h>
|
2008-02-27 02:51:20 +01:00
|
|
|
#include "wine/list.h"
|
2008-02-11 20:09:02 +01:00
|
|
|
|
2008-02-23 00:05:26 +01:00
|
|
|
/* Background copy job vtbl and related data */
|
|
|
|
typedef struct
|
|
|
|
{
|
2015-06-05 10:34:21 +02:00
|
|
|
IBackgroundCopyJob3 IBackgroundCopyJob3_iface;
|
2015-06-12 15:05:11 +02:00
|
|
|
IBackgroundCopyJobHttpOptions IBackgroundCopyJobHttpOptions_iface;
|
2008-02-23 00:05:26 +01:00
|
|
|
LONG ref;
|
2008-02-23 00:06:17 +01:00
|
|
|
LPWSTR displayName;
|
2013-11-25 07:42:31 +01:00
|
|
|
LPWSTR description;
|
2008-02-23 00:06:17 +01:00
|
|
|
BG_JOB_TYPE type;
|
|
|
|
GUID jobId;
|
2008-02-27 02:51:20 +01:00
|
|
|
struct list files;
|
|
|
|
BG_JOB_PROGRESS jobProgress;
|
2008-03-05 01:01:43 +01:00
|
|
|
BG_JOB_STATE state;
|
2013-11-27 13:49:55 +01:00
|
|
|
ULONG notify_flags;
|
2013-11-28 06:31:24 +01:00
|
|
|
IBackgroundCopyCallback2 *callback;
|
|
|
|
BOOL callback2; /* IBackgroundCopyCallback2 is supported in addition to IBackgroundCopyCallback */
|
2008-03-12 19:56:13 +01:00
|
|
|
/* Protects file list, and progress */
|
|
|
|
CRITICAL_SECTION cs;
|
2008-02-29 04:01:29 +01:00
|
|
|
struct list entryFromQmgr;
|
2015-06-05 10:35:09 +02:00
|
|
|
struct
|
2015-06-12 15:05:11 +02:00
|
|
|
{
|
|
|
|
WCHAR *headers;
|
|
|
|
ULONG flags;
|
2015-06-12 15:06:26 +02:00
|
|
|
BG_AUTH_CREDENTIALS creds[BG_AUTH_TARGET_PROXY][BG_AUTH_SCHEME_PASSPORT];
|
2015-06-12 15:05:11 +02:00
|
|
|
} http_options;
|
|
|
|
struct
|
2015-06-05 10:35:09 +02:00
|
|
|
{
|
|
|
|
BG_ERROR_CONTEXT context;
|
|
|
|
HRESULT code;
|
|
|
|
IBackgroundCopyFile2 *file;
|
|
|
|
} error;
|
2015-06-12 15:04:44 +02:00
|
|
|
HANDLE wait;
|
|
|
|
HANDLE cancel;
|
|
|
|
HANDLE done;
|
2008-02-23 00:05:26 +01:00
|
|
|
} BackgroundCopyJobImpl;
|
|
|
|
|
2008-02-27 02:50:43 +01:00
|
|
|
/* Background copy file vtbl and related data */
|
|
|
|
typedef struct
|
|
|
|
{
|
2015-06-05 10:33:53 +02:00
|
|
|
IBackgroundCopyFile2 IBackgroundCopyFile2_iface;
|
2008-02-27 02:50:43 +01:00
|
|
|
LONG ref;
|
|
|
|
BG_FILE_INFO info;
|
2008-02-29 04:00:12 +01:00
|
|
|
BG_FILE_PROGRESS fileProgress;
|
2008-03-13 23:54:35 +01:00
|
|
|
WCHAR tempFileName[MAX_PATH];
|
2008-02-27 02:51:20 +01:00
|
|
|
struct list entryFromJob;
|
2008-03-12 19:56:13 +01:00
|
|
|
BackgroundCopyJobImpl *owner;
|
2015-06-12 15:04:44 +02:00
|
|
|
DWORD read_size;
|
2008-02-27 02:50:43 +01:00
|
|
|
} BackgroundCopyFileImpl;
|
|
|
|
|
2007-12-20 05:02:23 +01:00
|
|
|
/* Background copy manager vtbl and related data */
|
|
|
|
typedef struct
|
|
|
|
{
|
2012-12-04 00:57:09 +01:00
|
|
|
IBackgroundCopyManager IBackgroundCopyManager_iface;
|
2008-03-13 23:54:01 +01:00
|
|
|
/* Protects job list, job states, and jobEvent */
|
2008-03-07 04:04:35 +01:00
|
|
|
CRITICAL_SECTION cs;
|
2008-03-13 23:54:01 +01:00
|
|
|
HANDLE jobEvent;
|
2008-02-29 04:01:29 +01:00
|
|
|
struct list jobs;
|
2007-12-20 05:02:23 +01:00
|
|
|
} BackgroundCopyManagerImpl;
|
|
|
|
|
2008-01-22 20:55:16 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
2011-07-20 15:43:49 +02:00
|
|
|
IClassFactory IClassFactory_iface;
|
2008-01-22 20:55:16 +01:00
|
|
|
} ClassFactoryImpl;
|
|
|
|
|
2011-05-13 17:51:15 +02:00
|
|
|
extern HANDLE stop_event DECLSPEC_HIDDEN;
|
|
|
|
extern ClassFactoryImpl BITS_ClassFactory DECLSPEC_HIDDEN;
|
|
|
|
extern BackgroundCopyManagerImpl globalMgr DECLSPEC_HIDDEN;
|
2008-01-22 20:55:16 +01:00
|
|
|
|
2013-12-30 10:20:33 +01:00
|
|
|
HRESULT BackgroundCopyManagerConstructor(LPVOID *ppObj) DECLSPEC_HIDDEN;
|
2008-02-23 00:06:17 +01:00
|
|
|
HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type,
|
2013-01-17 19:39:26 +01:00
|
|
|
GUID *pJobId, BackgroundCopyJobImpl **job) DECLSPEC_HIDDEN;
|
2012-12-04 00:59:02 +01:00
|
|
|
HRESULT enum_copy_job_create(BackgroundCopyManagerImpl *qmgr,
|
|
|
|
IEnumBackgroundCopyJobs **enumjob) DECLSPEC_HIDDEN;
|
2008-03-12 19:56:13 +01:00
|
|
|
HRESULT BackgroundCopyFileConstructor(BackgroundCopyJobImpl *owner,
|
|
|
|
LPCWSTR remoteName, LPCWSTR localName,
|
2013-01-18 05:38:49 +01:00
|
|
|
BackgroundCopyFileImpl **file) DECLSPEC_HIDDEN;
|
2013-01-17 19:39:26 +01:00
|
|
|
HRESULT EnumBackgroundCopyFilesConstructor(BackgroundCopyJobImpl*, IEnumBackgroundCopyFiles**) DECLSPEC_HIDDEN;
|
2011-05-13 17:51:15 +02:00
|
|
|
DWORD WINAPI fileTransfer(void *param) DECLSPEC_HIDDEN;
|
|
|
|
void processJob(BackgroundCopyJobImpl *job) DECLSPEC_HIDDEN;
|
|
|
|
BOOL processFile(BackgroundCopyFileImpl *file, BackgroundCopyJobImpl *job) DECLSPEC_HIDDEN;
|
2015-06-12 15:07:22 +02:00
|
|
|
BOOL transitionJobState(BackgroundCopyJobImpl *job, BG_JOB_STATE from, BG_JOB_STATE to) DECLSPEC_HIDDEN;
|
2007-12-20 05:02:23 +01:00
|
|
|
|
2008-02-11 20:09:02 +01:00
|
|
|
/* Little helper functions */
|
2015-06-12 15:05:59 +02:00
|
|
|
static inline WCHAR *strdupW(const WCHAR *src)
|
|
|
|
{
|
2019-06-19 10:28:11 +02:00
|
|
|
WCHAR *dst = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(src) + 1) * sizeof(WCHAR));
|
|
|
|
if (dst) lstrcpyW(dst, src);
|
2015-06-12 15:05:59 +02:00
|
|
|
return dst;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline WCHAR *co_strdupW(const WCHAR *src)
|
|
|
|
{
|
2019-06-19 10:28:11 +02:00
|
|
|
WCHAR *dst = CoTaskMemAlloc((lstrlenW(src) + 1) * sizeof(WCHAR));
|
|
|
|
if (dst) lstrcpyW(dst, src);
|
2015-06-12 15:05:59 +02:00
|
|
|
return dst;
|
|
|
|
}
|
|
|
|
|
2013-11-26 10:21:43 +01:00
|
|
|
static inline HRESULT return_strval(const WCHAR *str, WCHAR **ret)
|
|
|
|
{
|
|
|
|
int len;
|
|
|
|
|
|
|
|
if (!ret) return E_INVALIDARG;
|
|
|
|
|
2019-06-19 10:28:11 +02:00
|
|
|
len = lstrlenW(str);
|
2013-11-26 10:21:43 +01:00
|
|
|
*ret = CoTaskMemAlloc((len+1)*sizeof(WCHAR));
|
|
|
|
if (!*ret) return E_OUTOFMEMORY;
|
2019-06-19 10:28:11 +02:00
|
|
|
lstrcpyW(*ret, str);
|
2013-11-26 10:21:43 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2007-12-20 05:02:23 +01:00
|
|
|
#endif /* __QMGR_H__ */
|