Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
QGA VSS: Replace 'fprintf(stderr' with qga_debug
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
  • Loading branch information
kostyanf14 committed Jul 10, 2023
1 parent 925d05d commit 2f84cf6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
12 changes: 6 additions & 6 deletions qga/vss-win32/install.cpp
Expand Up @@ -13,6 +13,7 @@
#include "qemu/osdep.h"

#include "vss-common.h"
#include "vss-debug.h"
#ifdef HAVE_VSS_SDK
#include <vscoordint.h>
#else
Expand Down Expand Up @@ -54,7 +55,7 @@ void errmsg(DWORD err, const char *text)
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(char *)&msg, 0, NULL);
fprintf(stderr, "%.*s. (Error: %lx) %s\n", len, text, err, msg);
qga_debug("%.*s. (Error: %lx) %s", len, text, err, msg);
LocalFree(msg);
}

Expand Down Expand Up @@ -219,7 +220,7 @@ static HRESULT QGAProviderRemove(ICatalogCollection *coll, int i, void *arg)
{
HRESULT hr;

fprintf(stderr, "Removing COM+ Application: %s\n", QGA_PROVIDER_NAME);
qga_debug("Removing COM+ Application: %s", QGA_PROVIDER_NAME);
chk(coll->Remove(i));
out:
return hr;
Expand Down Expand Up @@ -304,9 +305,8 @@ STDAPI COMRegister(void)
}
strcpy(tlbPath, dllPath);
strcpy(tlbPath+n-3, "tlb");
fprintf(stderr, "Registering " QGA_PROVIDER_NAME ":\n");
fprintf(stderr, " %s\n", dllPath);
fprintf(stderr, " %s\n", tlbPath);
qga_debug("Registering " QGA_PROVIDER_NAME ": %s %s",
dllPath, tlbPath);
if (!PathFileExists(tlbPath)) {
hr = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
errmsg(hr, "Failed to lookup tlb");
Expand Down Expand Up @@ -517,7 +517,7 @@ namespace _com_util
}

if (mbstowcs(bstr, ascii, len) == (size_t)-1) {
fprintf(stderr, "Failed to convert string '%s' into BSTR", ascii);
qga_debug("Failed to convert string '%s' into BSTR", ascii);
bstr[0] = 0;
}
return bstr;
Expand Down
9 changes: 5 additions & 4 deletions qga/vss-win32/requester.cpp
Expand Up @@ -12,6 +12,7 @@

#include "qemu/osdep.h"
#include "vss-common.h"
#include "vss-debug.h"
#include "requester.h"
#include "install.h"
#include <vswriter.h>
Expand Down Expand Up @@ -59,13 +60,13 @@ STDAPI requester_init(void)
NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
RPC_C_IMP_LEVEL_IDENTIFY, NULL, EOAC_NONE, NULL);
if (FAILED(hr)) {
fprintf(stderr, "failed to CoInitializeSecurity (error %lx)\n", hr);
qga_debug("failed to CoInitializeSecurity (error %lx)", hr);
return hr;
}

hLib = LoadLibraryA("VSSAPI.DLL");
if (!hLib) {
fprintf(stderr, "failed to load VSSAPI.DLL\n");
qga_debug("failed to load VSSAPI.DLL");
return HRESULT_FROM_WIN32(GetLastError());
}

Expand All @@ -78,14 +79,14 @@ STDAPI requester_init(void)
#endif
);
if (!pCreateVssBackupComponents) {
fprintf(stderr, "failed to get proc address from VSSAPI.DLL\n");
qga_debug("failed to get proc address from VSSAPI.DLL");
return HRESULT_FROM_WIN32(GetLastError());
}

pVssFreeSnapshotProperties = (t_VssFreeSnapshotProperties)
GetProcAddress(hLib, "VssFreeSnapshotProperties");
if (!pVssFreeSnapshotProperties) {
fprintf(stderr, "failed to get proc address from VSSAPI.DLL\n");
qga_debug("failed to get proc address from VSSAPI.DLL");
return HRESULT_FROM_WIN32(GetLastError());
}

Expand Down

0 comments on commit 2f84cf6

Please sign in to comment.