Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unpackaged App CTA compliance code changes #4927

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,15 @@ STDMETHODIMP_(HRESULT __stdcall) NotificationListener::OnToastNotificationReceiv
return S_OK;
}
CATCH_RETURN()

STDMETHODIMP_(HRESULT __stdcall) NotificationListener::GetAppProcessName(
_Out_ HSTRING* appProcessName) noexcept try
{
auto lock{ m_lock.lock_shared() };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason we are acquiring lock here? We're just reading m_processName here and it is not updated after initialization of the class.

*appProcessName = ((m_processName.c_str() == nullptr || wcslen(m_processName.c_str()) == 0) ?
wil::unique_hstring() :
wil::make_unique_string<wil::unique_hstring>(m_processName.c_str())).release();

return S_OK;
}
CATCH_RETURN()
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
#include "ToastRegistrationManager.h"

class NotificationListener : public Microsoft::WRL::RuntimeClass<::ABI::Microsoft::Internal::PushNotifications::INotificationListener,
::ABI::Microsoft::Internal::PushNotifications::INotificationListener2>
::ABI::Microsoft::Internal::PushNotifications::INotificationListener2,
::ABI::Microsoft::Internal::PushNotifications::INotificationListener3>
{
public:
HRESULT RuntimeClassInitialize(
Expand All @@ -21,6 +22,8 @@ class NotificationListener : public Microsoft::WRL::RuntimeClass<::ABI::Microsof
STDMETHOD(OnRawNotificationReceived)(unsigned int payloadLength, _In_ byte* payload, _In_ HSTRING correlationVector) noexcept;
STDMETHOD(OnToastNotificationReceived)(ABI::Microsoft::Internal::ToastNotifications::INotificationProperties* notificationProperties,
ABI::Microsoft::Internal::ToastNotifications::INotificationTransientProperties*) noexcept;
STDMETHOD(GetAppProcessName)(_Out_ HSTRING* appProcessName) noexcept;

private:
std::shared_ptr<ForegroundSinkManager> m_foregroundSinkManager;
std::shared_ptr<ToastRegistrationManager> m_toastRegistrationManager;
Expand Down