Skip to content

Commit

Permalink
Fixed telemetry calls in Image Resizer (#1983)
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunbalgovind committed Apr 7, 2020
1 parent c241d48 commit 4f29f99
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/modules/imageresizer/dll/ContextMenuHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ HRESULT CContextMenuHandler::QueryContextMenu(_In_ HMENU hmenu, UINT indexMenu,
if (!InsertMenuItem(hmenu, indexMenu, TRUE, &mii))
{
hr = HRESULT_FROM_WIN32(GetLastError());
Trace::QueryContextMenuError(hr);
}
else
{
Expand Down Expand Up @@ -220,12 +221,12 @@ HRESULT CContextMenuHandler::ResizePictures(CMINVOKECOMMANDINFO* pici, IShellIte
HRESULT hr = E_FAIL;
if (!CreatePipe(&hReadPipe, &hWritePipe, &sa, 0))
{
Trace::InvokedRet(hr);
hr = HRESULT_FROM_WIN32(GetLastError());
return hr;
}
if (!SetHandleInformation(hWritePipe, HANDLE_FLAG_INHERIT, 0))
{
Trace::InvokedRet(hr);
hr = HRESULT_FROM_WIN32(GetLastError());
return hr;
}
CAtlFile writePipe(hWritePipe);
Expand Down Expand Up @@ -277,12 +278,12 @@ HRESULT CContextMenuHandler::ResizePictures(CMINVOKECOMMANDINFO* pici, IShellIte
delete[] lpszCommandLine;
if (!CloseHandle(processInformation.hProcess))
{
Trace::InvokedRet(hr);
hr = HRESULT_FROM_WIN32(GetLastError());
return hr;
}
if (!CloseHandle(processInformation.hThread))
{
Trace::InvokedRet(hr);
hr = HRESULT_FROM_WIN32(GetLastError());
return hr;
}

Expand Down Expand Up @@ -322,7 +323,6 @@ HRESULT CContextMenuHandler::ResizePictures(CMINVOKECOMMANDINFO* pici, IShellIte

writePipe.Close();
hr = S_OK;
Trace::InvokedRet(hr);
return hr;
}

Expand Down
10 changes: 10 additions & 0 deletions src/modules/imageresizer/dll/trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,13 @@ void Trace::InvokedRet(_In_ HRESULT hr) noexcept
TraceLoggingHResult(hr),
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
}

void Trace::QueryContextMenuError(_In_ HRESULT hr) noexcept
{
TraceLoggingWrite(
g_hProvider,
"ImageResizer_QueryContextMenuError",
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
TraceLoggingHResult(hr),
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
}
1 change: 1 addition & 0 deletions src/modules/imageresizer/dll/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ class Trace
static void EnableImageResizer(_In_ bool enabled) noexcept;
static void Invoked() noexcept;
static void InvokedRet(_In_ HRESULT hr) noexcept;
static void QueryContextMenuError(_In_ HRESULT hr) noexcept;
};

0 comments on commit 4f29f99

Please sign in to comment.