bits: Added constructor for BackgroundCopyJob (23/27)
Roy Shea
roy at cs.hmc.edu
Fri Nov 16 18:20:50 CST 2007
---
dlls/qmgr/job.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++
dlls/qmgr/qmgr_private.h | 3 ++
2 files changed, 52 insertions(+), 0 deletions(-)
diff --git a/dlls/qmgr/job.c b/dlls/qmgr/job.c
index 94f10a3..966909d 100644
--- a/dlls/qmgr/job.c
+++ b/dlls/qmgr/job.c
@@ -394,3 +394,52 @@ static const IBackgroundCopyJobVtbl BITS_IBackgroundCopyJob_Vtbl =
BITS_IBackgroundCopyJob_TakeOwnership,
};
+
+HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type,
+ GUID *pJobId, LPVOID *ppObj)
+{
+ HRESULT hres;
+ BackgroundCopyJobImpl *bcj;
+
+ TRACE("(%s,%d,%p)\n", wine_dbgstr_w(displayName), type, ppObj);
+
+ if (!pJobId || !ppObj)
+ {
+ return E_POINTER;
+ }
+
+ bcj = HeapAlloc(GetProcessHeap(), 0, sizeof(*bcj));
+ if (!bcj)
+ {
+ return E_OUTOFMEMORY;
+ }
+
+ bcj->lpVtbl = &BITS_IBackgroundCopyJob_Vtbl;
+ bcj->ref = 1;
+
+ bcj->displayName = NULL;
+ bcj->displayName = HeapAlloc(GetProcessHeap(), 0,
+ (lstrlenW(displayName) + 1) * sizeof(WCHAR));
+ if (!bcj->displayName)
+ {
+ HeapFree(GetProcessHeap(), 0, bcj);
+ return E_OUTOFMEMORY;
+ }
+ lstrcpyW(bcj->displayName, displayName);
+
+ bcj->type = type;
+
+ hres = CoCreateGuid(&bcj->jobId);
+ if (hres != S_OK)
+ {
+ HeapFree(GetProcessHeap(), 0, bcj->displayName);
+ HeapFree(GetProcessHeap(), 0, bcj);
+ return hres;
+ }
+
+ memcpy(pJobId, &bcj->jobId, sizeof(GUID));
+ *ppObj = &bcj->lpVtbl;
+ return S_OK;
+}
+
+
diff --git a/dlls/qmgr/qmgr_private.h b/dlls/qmgr/qmgr_private.h
index f93ece9..02f8c6d 100644
--- a/dlls/qmgr/qmgr_private.h
+++ b/dlls/qmgr/qmgr_private.h
@@ -64,7 +64,10 @@ typedef struct
extern ClassFactoryImpl BITS_ClassFactory;
extern BackgroundCopyManagerImpl BITS_BackgroundCopyManager;
+/* Constructor functions */
HRESULT BackgroundCopyManagerConstructor(IUnknown *pUnkOuter, LPVOID *ppObj);
+HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type,
+ GUID *pJobId, LPVOID *ppObj);
#endif /* __QMGR_PRIVATE_H__ */
--
1.5.3.1
More information about the wine-patches
mailing list