Sync with trunk revision 63128.
[reactos.git] / dll / win32 / qmgr / file.c
index 6ba493a..1aee9b8 100644 (file)
@@ -28,7 +28,7 @@ static inline BackgroundCopyFileImpl *impl_from_IBackgroundCopyFile(IBackgroundC
     return CONTAINING_RECORD(iface, BackgroundCopyFileImpl, IBackgroundCopyFile_iface);
 }
 
-static HRESULT WINAPI BITS_IBackgroundCopyFile_QueryInterface(
+static HRESULT WINAPI BackgroundCopyFile_QueryInterface(
     IBackgroundCopyFile* iface,
     REFIID riid,
     void **obj)
@@ -49,7 +49,7 @@ static HRESULT WINAPI BITS_IBackgroundCopyFile_QueryInterface(
     return E_NOINTERFACE;
 }
 
-static ULONG WINAPI BITS_IBackgroundCopyFile_AddRef(IBackgroundCopyFile* iface)
+static ULONG WINAPI BackgroundCopyFile_AddRef(IBackgroundCopyFile* iface)
 {
     BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface);
     ULONG ref = InterlockedIncrement(&This->ref);
@@ -57,7 +57,7 @@ static ULONG WINAPI BITS_IBackgroundCopyFile_AddRef(IBackgroundCopyFile* iface)
     return ref;
 }
 
-static ULONG WINAPI BITS_IBackgroundCopyFile_Release(
+static ULONG WINAPI BackgroundCopyFile_Release(
     IBackgroundCopyFile* iface)
 {
     BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface);
@@ -77,42 +77,36 @@ static ULONG WINAPI BITS_IBackgroundCopyFile_Release(
 }
 
 /* Get the remote name of a background copy file */
-static HRESULT WINAPI BITS_IBackgroundCopyFile_GetRemoteName(
+static HRESULT WINAPI BackgroundCopyFile_GetRemoteName(
     IBackgroundCopyFile* iface,
     LPWSTR *pVal)
 {
     BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface);
-    int n = (lstrlenW(This->info.RemoteName) + 1) * sizeof(WCHAR);
 
-    *pVal = CoTaskMemAlloc(n);
-    if (!*pVal)
-        return E_OUTOFMEMORY;
+    TRACE("(%p)->(%p)\n", This, pVal);
 
-    memcpy(*pVal, This->info.RemoteName, n);
-    return S_OK;
+    return return_strval(This->info.RemoteName, pVal);
 }
 
-static HRESULT WINAPI BITS_IBackgroundCopyFile_GetLocalName(
+static HRESULT WINAPI BackgroundCopyFile_GetLocalName(
     IBackgroundCopyFile* iface,
     LPWSTR *pVal)
 {
     BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface);
-    int n = (lstrlenW(This->info.LocalName) + 1) * sizeof(WCHAR);
 
-    *pVal = CoTaskMemAlloc(n);
-    if (!*pVal)
-        return E_OUTOFMEMORY;
+    TRACE("(%p)->(%p)\n", This, pVal);
 
-    memcpy(*pVal, This->info.LocalName, n);
-    return S_OK;
+    return return_strval(This->info.LocalName, pVal);
 }
 
-static HRESULT WINAPI BITS_IBackgroundCopyFile_GetProgress(
+static HRESULT WINAPI BackgroundCopyFile_GetProgress(
     IBackgroundCopyFile* iface,
     BG_FILE_PROGRESS *pVal)
 {
     BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface);
 
+    TRACE("(%p)->(%p)\n", This, pVal);
+
     EnterCriticalSection(&This->owner->cs);
     pVal->BytesTotal = This->fileProgress.BytesTotal;
     pVal->BytesTransferred = This->fileProgress.BytesTransferred;
@@ -122,14 +116,14 @@ static HRESULT WINAPI BITS_IBackgroundCopyFile_GetProgress(
     return S_OK;
 }
 
-static const IBackgroundCopyFileVtbl BITS_IBackgroundCopyFile_Vtbl =
+static const IBackgroundCopyFileVtbl BackgroundCopyFileVtbl =
 {
-    BITS_IBackgroundCopyFile_QueryInterface,
-    BITS_IBackgroundCopyFile_AddRef,
-    BITS_IBackgroundCopyFile_Release,
-    BITS_IBackgroundCopyFile_GetRemoteName,
-    BITS_IBackgroundCopyFile_GetLocalName,
-    BITS_IBackgroundCopyFile_GetProgress
+    BackgroundCopyFile_QueryInterface,
+    BackgroundCopyFile_AddRef,
+    BackgroundCopyFile_Release,
+    BackgroundCopyFile_GetRemoteName,
+    BackgroundCopyFile_GetLocalName,
+    BackgroundCopyFile_GetProgress
 };
 
 HRESULT BackgroundCopyFileConstructor(BackgroundCopyJobImpl *owner,
@@ -164,7 +158,7 @@ HRESULT BackgroundCopyFileConstructor(BackgroundCopyJobImpl *owner,
     }
     memcpy(This->info.LocalName, localName, n);
 
-    This->IBackgroundCopyFile_iface.lpVtbl = &BITS_IBackgroundCopyFile_Vtbl;
+    This->IBackgroundCopyFile_iface.lpVtbl = &BackgroundCopyFileVtbl;
     This->ref = 1;
 
     This->fileProgress.BytesTotal = BG_SIZE_UNKNOWN;
@@ -217,6 +211,25 @@ static inline DLBindStatusCallback *impl_from_IBindStatusCallback(IBindStatusCal
     return CONTAINING_RECORD(iface, DLBindStatusCallback, IBindStatusCallback_iface);
 }
 
+static HRESULT WINAPI DLBindStatusCallback_QueryInterface(
+    IBindStatusCallback *iface,
+    REFIID riid,
+    void **ppvObject)
+{
+    DLBindStatusCallback *This = impl_from_IBindStatusCallback(iface);
+
+    if (IsEqualGUID(riid, &IID_IUnknown)
+        || IsEqualGUID(riid, &IID_IBindStatusCallback))
+    {
+        *ppvObject = &This->IBindStatusCallback_iface;
+        IBindStatusCallback_AddRef(iface);
+        return S_OK;
+    }
+
+    *ppvObject = NULL;
+    return E_NOINTERFACE;
+}
+
 static ULONG WINAPI DLBindStatusCallback_AddRef(IBindStatusCallback *iface)
 {
     DLBindStatusCallback *This = impl_from_IBindStatusCallback(iface);
@@ -237,25 +250,6 @@ static ULONG WINAPI DLBindStatusCallback_Release(IBindStatusCallback *iface)
     return ref;
 }
 
-static HRESULT WINAPI DLBindStatusCallback_QueryInterface(
-    IBindStatusCallback *iface,
-    REFIID riid,
-    void **ppvObject)
-{
-    DLBindStatusCallback *This = impl_from_IBindStatusCallback(iface);
-
-    if (IsEqualGUID(riid, &IID_IUnknown)
-        || IsEqualGUID(riid, &IID_IBindStatusCallback))
-    {
-        *ppvObject = &This->IBindStatusCallback_iface;
-        DLBindStatusCallback_AddRef(iface);
-        return S_OK;
-    }
-
-    *ppvObject = NULL;
-    return E_NOINTERFACE;
-}
-
 static HRESULT WINAPI DLBindStatusCallback_GetBindInfo(
     IBindStatusCallback *iface,
     DWORD *grfBINDF,