2 * Queue Manager definitions
4 * Copyright 2007 Google (Roy Shea)
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
31 #include "wine/list.h"
33 /* Background copy job vtbl and related data */
36 const IBackgroundCopyJob2Vtbl
*lpVtbl
;
42 BG_JOB_PROGRESS jobProgress
;
44 /* Protects file list, and progress */
46 struct list entryFromQmgr
;
47 } BackgroundCopyJobImpl
;
49 /* Enum background copy files vtbl and related data */
52 const IEnumBackgroundCopyFilesVtbl
*lpVtbl
;
54 IBackgroundCopyFile
**files
;
57 } EnumBackgroundCopyFilesImpl
;
59 /* Background copy file vtbl and related data */
62 const IBackgroundCopyFileVtbl
*lpVtbl
;
65 BG_FILE_PROGRESS fileProgress
;
66 WCHAR tempFileName
[MAX_PATH
];
67 struct list entryFromJob
;
68 BackgroundCopyJobImpl
*owner
;
69 } BackgroundCopyFileImpl
;
71 /* Background copy manager vtbl and related data */
74 IBackgroundCopyManager IBackgroundCopyManager_iface
;
75 /* Protects job list, job states, and jobEvent */
79 } BackgroundCopyManagerImpl
;
83 IClassFactory IClassFactory_iface
;
86 extern HANDLE stop_event DECLSPEC_HIDDEN
;
87 extern ClassFactoryImpl BITS_ClassFactory DECLSPEC_HIDDEN
;
88 extern BackgroundCopyManagerImpl globalMgr DECLSPEC_HIDDEN
;
90 HRESULT
BackgroundCopyManagerConstructor(IUnknown
*pUnkOuter
, LPVOID
*ppObj
) DECLSPEC_HIDDEN
;
91 HRESULT
BackgroundCopyJobConstructor(LPCWSTR displayName
, BG_JOB_TYPE type
,
92 GUID
*pJobId
, LPVOID
*ppObj
) DECLSPEC_HIDDEN
;
93 HRESULT
enum_copy_job_create(BackgroundCopyManagerImpl
*qmgr
,
94 IEnumBackgroundCopyJobs
**enumjob
) DECLSPEC_HIDDEN
;
95 HRESULT
BackgroundCopyFileConstructor(BackgroundCopyJobImpl
*owner
,
96 LPCWSTR remoteName
, LPCWSTR localName
,
97 LPVOID
*ppObj
) DECLSPEC_HIDDEN
;
98 HRESULT
EnumBackgroundCopyFilesConstructor(LPVOID
*ppObj
,
99 IBackgroundCopyJob2
*copyJob
) DECLSPEC_HIDDEN
;
100 DWORD WINAPI
fileTransfer(void *param
) DECLSPEC_HIDDEN
;
101 void processJob(BackgroundCopyJobImpl
*job
) DECLSPEC_HIDDEN
;
102 BOOL
processFile(BackgroundCopyFileImpl
*file
, BackgroundCopyJobImpl
*job
) DECLSPEC_HIDDEN
;
104 /* Little helper functions */
106 qmgr_strdup(const char *s
)
108 size_t n
= strlen(s
) + 1;
109 char *d
= HeapAlloc(GetProcessHeap(), 0, n
);
110 return d
? memcpy(d
, s
, n
) : NULL
;
114 transitionJobState(BackgroundCopyJobImpl
*job
, BG_JOB_STATE fromState
,
115 BG_JOB_STATE toState
)
118 EnterCriticalSection(&globalMgr
.cs
);
119 if (job
->state
== fromState
)
121 job
->state
= toState
;
124 LeaveCriticalSection(&globalMgr
.cs
);
128 #endif /* __QMGR_H__ */