Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenqmgr.h
Go to the documentation of this file.
00001 /* 00002 * Queue Manager definitions 00003 * 00004 * Copyright 2007 Google (Roy Shea) 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00019 */ 00020 00021 #ifndef __QMGR_H__ 00022 #define __QMGR_H__ 00023 00024 #include "windef.h" 00025 #include "objbase.h" 00026 00027 #define COBJMACROS 00028 #include "bits1_5.h" 00029 00030 #include <string.h> 00031 #include "wine/list.h" 00032 00033 /* Background copy job vtbl and related data */ 00034 typedef struct 00035 { 00036 const IBackgroundCopyJob2Vtbl *lpVtbl; 00037 LONG ref; 00038 LPWSTR displayName; 00039 BG_JOB_TYPE type; 00040 GUID jobId; 00041 struct list files; 00042 BG_JOB_PROGRESS jobProgress; 00043 BG_JOB_STATE state; 00044 /* Protects file list, and progress */ 00045 CRITICAL_SECTION cs; 00046 struct list entryFromQmgr; 00047 } BackgroundCopyJobImpl; 00048 00049 /* Enum background copy jobs vtbl and related data */ 00050 typedef struct 00051 { 00052 const IEnumBackgroundCopyJobsVtbl *lpVtbl; 00053 LONG ref; 00054 IBackgroundCopyJob **jobs; 00055 ULONG numJobs; 00056 ULONG indexJobs; 00057 } EnumBackgroundCopyJobsImpl; 00058 00059 /* Enum background copy files vtbl and related data */ 00060 typedef struct 00061 { 00062 const IEnumBackgroundCopyFilesVtbl *lpVtbl; 00063 LONG ref; 00064 IBackgroundCopyFile **files; 00065 ULONG numFiles; 00066 ULONG indexFiles; 00067 } EnumBackgroundCopyFilesImpl; 00068 00069 /* Background copy file vtbl and related data */ 00070 typedef struct 00071 { 00072 const IBackgroundCopyFileVtbl *lpVtbl; 00073 LONG ref; 00074 BG_FILE_INFO info; 00075 BG_FILE_PROGRESS fileProgress; 00076 WCHAR tempFileName[MAX_PATH]; 00077 struct list entryFromJob; 00078 BackgroundCopyJobImpl *owner; 00079 } BackgroundCopyFileImpl; 00080 00081 /* Background copy manager vtbl and related data */ 00082 typedef struct 00083 { 00084 const IBackgroundCopyManagerVtbl *lpVtbl; 00085 /* Protects job list, job states, and jobEvent */ 00086 CRITICAL_SECTION cs; 00087 HANDLE jobEvent; 00088 struct list jobs; 00089 } BackgroundCopyManagerImpl; 00090 00091 typedef struct 00092 { 00093 const IClassFactoryVtbl *lpVtbl; 00094 } ClassFactoryImpl; 00095 00096 extern HANDLE stop_event; 00097 extern ClassFactoryImpl BITS_ClassFactory; 00098 extern BackgroundCopyManagerImpl globalMgr; 00099 00100 HRESULT BackgroundCopyManagerConstructor(IUnknown *pUnkOuter, LPVOID *ppObj); 00101 HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type, 00102 GUID *pJobId, LPVOID *ppObj); 00103 HRESULT EnumBackgroundCopyJobsConstructor(LPVOID *ppObj, 00104 IBackgroundCopyManager* copyManager); 00105 HRESULT BackgroundCopyFileConstructor(BackgroundCopyJobImpl *owner, 00106 LPCWSTR remoteName, LPCWSTR localName, 00107 LPVOID *ppObj); 00108 HRESULT EnumBackgroundCopyFilesConstructor(LPVOID *ppObj, 00109 IBackgroundCopyJob2 *copyJob); 00110 DWORD WINAPI fileTransfer(void *param); 00111 void processJob(BackgroundCopyJobImpl *job); 00112 BOOL processFile(BackgroundCopyFileImpl *file, BackgroundCopyJobImpl *job); 00113 00114 /* Little helper functions */ 00115 static inline char * 00116 qmgr_strdup(const char *s) 00117 { 00118 size_t n = strlen(s) + 1; 00119 char *d = HeapAlloc(GetProcessHeap(), 0, n); 00120 return d ? memcpy(d, s, n) : NULL; 00121 } 00122 00123 static inline BOOL 00124 transitionJobState(BackgroundCopyJobImpl *job, BG_JOB_STATE fromState, 00125 BG_JOB_STATE toState) 00126 { 00127 BOOL rv = FALSE; 00128 EnterCriticalSection(&globalMgr.cs); 00129 if (job->state == fromState) 00130 { 00131 job->state = toState; 00132 rv = TRUE; 00133 } 00134 LeaveCriticalSection(&globalMgr.cs); 00135 return rv; 00136 } 00137 00138 #endif /* __QMGR_H__ */ Generated on Wed May 23 2012 04:23:40 for ReactOS by
1.7.6.1
|