@@ -42,29 +42,48 @@ CMidi2MidiSrvConfigurationManager::Initialize(
42
42
43
43
_Use_decl_annotations_
44
44
HRESULT
45
- CMidi2MidiSrvConfigurationManager::UpdateConfiguration (LPCWSTR configurationJson, LPWSTR* response )
45
+ CMidi2MidiSrvConfigurationManager::UpdateConfiguration (LPCWSTR configurationJson, LPWSTR* responseJson )
46
46
{
47
47
TraceLoggingWrite (
48
48
MidiSrvAbstractionTelemetryProvider::Provider (),
49
49
MIDI_TRACE_EVENT_INFO,
50
50
TraceLoggingString (__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD),
51
51
TraceLoggingLevel (WINEVENT_LEVEL_INFO),
52
- TraceLoggingPointer (this , " this" )
53
- );
52
+ TraceLoggingPointer (this , " this" ),
53
+ TraceLoggingWideString (L" Entering UpdateConfiguration" , MIDI_TRACE_EVENT_MESSAGE_FIELD),
54
+ TraceLoggingWideString (configurationJson, " config json" ),
55
+ TraceLoggingPointer (responseJson, " Response pointer" )
56
+ );
54
57
55
- wil::unique_rpc_binding bindingHandle;
58
+ RETURN_HR_IF_NULL (E_INVALIDARG, responseJson);
59
+
60
+ // requirement for RPC and also in case of failure
61
+ *responseJson = NULL ;
56
62
57
- RETURN_IF_FAILED (GetMidiSrvBindingHandle (&bindingHandle));
58
- RETURN_HR_IF_NULL (E_INVALIDARG, response);
59
63
RETURN_HR_IF_NULL (E_INVALIDARG, configurationJson);
60
64
65
+ wil::unique_rpc_binding bindingHandle;
66
+ RETURN_IF_FAILED (GetMidiSrvBindingHandle (&bindingHandle));
67
+
61
68
RETURN_IF_FAILED ([&]()
62
69
{
63
70
// RPC calls are placed in a lambda to work around compiler error C2712, limiting use of try/except blocks
64
71
// with structured exception handling.
65
- RpcTryExcept RETURN_IF_FAILED (MidiSrvUpdateConfiguration (bindingHandle.get (), configurationJson, response ));
72
+ RpcTryExcept RETURN_IF_FAILED (MidiSrvUpdateConfiguration (bindingHandle.get (), configurationJson, responseJson ));
66
73
RpcExcept (I_RpcExceptionFilter (RpcExceptionCode ())) RETURN_IF_FAILED (HRESULT_FROM_WIN32 (RpcExceptionCode ()));
67
74
RpcEndExcept
75
+
76
+ TraceLoggingWrite (
77
+ MidiSrvAbstractionTelemetryProvider::Provider (),
78
+ MIDI_TRACE_EVENT_INFO,
79
+ TraceLoggingString (__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD),
80
+ TraceLoggingLevel (WINEVENT_LEVEL_INFO),
81
+ TraceLoggingPointer (this , " this" ),
82
+ TraceLoggingWideString (L" Completed RPC call" , MIDI_TRACE_EVENT_MESSAGE_FIELD),
83
+ TraceLoggingWideString (configurationJson, " config json" ),
84
+ TraceLoggingPointer (responseJson, " Response pointer" )
85
+ );
86
+
68
87
return S_OK;
69
88
}());
70
89
@@ -84,16 +103,17 @@ CMidi2MidiSrvConfigurationManager::GetTransportList(LPWSTR* transportListJson)
84
103
TraceLoggingPointer (this , " this" )
85
104
);
86
105
87
- wil::unique_rpc_binding bindingHandle ;
106
+ RETURN_HR_IF_NULL (E_INVALIDARG, transportListJson) ;
88
107
108
+ // requirement for RPC and also in case of failure
109
+ *transportListJson = NULL ;
110
+
111
+ wil::unique_rpc_binding bindingHandle;
89
112
RETURN_IF_FAILED (GetMidiSrvBindingHandle (&bindingHandle));
90
- RETURN_HR_IF_NULL (E_INVALIDARG, transportListJson);
113
+
91
114
92
115
RETURN_IF_FAILED ([&]()
93
116
{
94
- // RPC requirement
95
- // *transportListJson = nullptr;
96
-
97
117
// RPC calls are placed in a lambda to work around compiler error C2712, limiting use of try/except blocks
98
118
// with structured exception handling.
99
119
RpcTryExcept RETURN_IF_FAILED (MidiSrvGetTransportList (bindingHandle.get (), transportListJson));
@@ -118,19 +138,24 @@ CMidi2MidiSrvConfigurationManager::GetTransformList(LPWSTR* transformListJson)
118
138
TraceLoggingPointer (this , " this" )
119
139
);
120
140
121
- wil::unique_rpc_binding bindingHandle ;
141
+ RETURN_HR_IF_NULL (E_INVALIDARG, transformListJson) ;
122
142
143
+ // requirement for RPC and also in case of failure
144
+ *transformListJson = NULL ;
145
+
146
+ wil::unique_rpc_binding bindingHandle;
123
147
RETURN_IF_FAILED (GetMidiSrvBindingHandle (&bindingHandle));
124
- RETURN_HR_IF_NULL (E_INVALIDARG, transformListJson);
148
+
125
149
126
150
RETURN_IF_FAILED ([&]()
127
151
{
152
+
128
153
// RPC calls are placed in a lambda to work around compiler error C2712, limiting use of try/except blocks
129
154
// with structured exception handling.
130
155
RpcTryExcept RETURN_IF_FAILED (MidiSrvGetTransformList (bindingHandle.get (), transformListJson));
131
156
RpcExcept (I_RpcExceptionFilter (RpcExceptionCode ())) RETURN_IF_FAILED (HRESULT_FROM_WIN32 (RpcExceptionCode ()));
132
157
RpcEndExcept
133
- return S_OK;
158
+ return S_OK;
134
159
}());
135
160
136
161
return S_OK;
0 commit comments