Skip to content

Commit

Permalink
Merge pull request #283 from microsoft/razzlemergefixes2
Browse files Browse the repository at this point in the history
oacr and build compatibility fixes
  • Loading branch information
Psychlist1972 authored Feb 23, 2024
2 parents 05cb403 + 24fc137 commit 33f9b1f
Show file tree
Hide file tree
Showing 24 changed files with 68 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ CMidi2BluetoothMidiConfigurationManager::UpdateConfiguration(

return E_FAIL;
}

_Use_decl_annotations_

HRESULT
CMidi2BluetoothMidiConfigurationManager::Cleanup()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,8 @@ CMidi2KSMidiConfigurationManager::UpdateConfiguration(LPCWSTR configurationJson,
}



_Use_decl_annotations_
HRESULT
CMidi2KSMidiConfigurationManager::Cleanup()
{
return S_OK;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ GetMidiSrvBindingHandle(handle_t* BindingHandle

RETURN_IF_WIN32_ERROR(RpcStringBindingCompose(
nullptr,
reinterpret_cast<RPC_WSTR>(MIDISRV_LRPC_PROTOCOL),
(RPC_WSTR) MIDISRV_LRPC_PROTOCOL,
nullptr,
reinterpret_cast<RPC_WSTR>(MIDISRV_ENDPOINT),
(RPC_WSTR) MIDISRV_ENDPOINT,
nullptr,
&stringBinding));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ CMidi2MidiSrvConfigurationManager::Initialize(GUID abstractionGuid, IUnknown* de

}

_Use_decl_annotations_
HRESULT
CMidi2MidiSrvConfigurationManager::Cleanup()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,10 @@ CMidi2VirtualPatchBayEndpointManager::Initialize(
return S_OK;
}




_Use_decl_annotations_
HRESULT
CMidi2VirtualPatchBayEndpointManager::CreateEndpoint(
)
{



return S_OK;
}

Expand All @@ -75,7 +68,6 @@ CMidi2VirtualPatchBayEndpointManager::Cleanup()
TraceLoggingPointer(this, "this")
);


return S_OK;
}

1 change: 0 additions & 1 deletion src/api/Client/Midi2Client/MidiMessage64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

namespace winrt::Windows::Devices::Midi2::implementation
{
_Use_decl_annotations_
collections::IVectorView<uint32_t> MidiMessage64::GetAllWords() const noexcept
{
auto vec = winrt::single_threaded_vector<uint32_t>();
Expand Down
2 changes: 1 addition & 1 deletion src/api/Client/Midi2Client/MidiService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ namespace winrt::Windows::Devices::Midi2::implementation

// parse it into json objects

if (sessionListJson != nullptr && sessionListJson.Length() > 0)
if (sessionListJson.m_str != nullptr && sessionListJson.Length() > 0)
{
winrt::hstring hstr(sessionListJson, sessionListJson.Length());

Expand Down
2 changes: 1 addition & 1 deletion src/api/Client/Midi2Client/MidiService.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace winrt::Windows::Devices::Midi2::implementation



static json::JsonObject MidiService::InternalSendConfigurationJsonAndGetResponse(_In_ winrt::guid const& abstractionId, _In_ json::JsonObject const& configObject) noexcept;
static json::JsonObject InternalSendConfigurationJsonAndGetResponse(_In_ winrt::guid const& abstractionId, _In_ json::JsonObject const& configObject) noexcept;

private:

Expand Down
Binary file modified src/api/Client/Midi2Client/Windows.Devices.Midi2.rc
Binary file not shown.
Binary file modified src/api/Drivers/MinMidi/Driver/MinMidi.inf
Binary file not shown.
Binary file modified src/api/Drivers/MinMidi2/Driver/MinMidi2.inf
Binary file not shown.
Binary file modified src/api/Drivers/USBMIDI2/Driver/USBMidi2.inf
Binary file not shown.
2 changes: 1 addition & 1 deletion src/api/InBoxApps/mididmp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void OutputError(_In_ std::wstring errorMessage)
#define RETURN_SUCCESS return 0
#define RETURN_FAIL return 1

int main()
int __cdecl main()
{
winrt::init_apartment();

Expand Down
16 changes: 11 additions & 5 deletions src/api/Inc/MidiKSDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ typedef enum _MidiTransport
DEFINE_GUIDSTRUCT("1F306BA6-FD9B-427A-BCB3-27CBCF0E0F19", KSPROPSETID_MidiLoopedStreaming);
#define KSPROPSETID_MidiLoopedStreaming DEFINE_GUIDNAMED(KSPROPSETID_MidiLoopedStreaming)

typedef struct {
LONGLONG Position;
ULONG ByteCount;
} LOOPEDDATAFORMAT, *PLOOPEDDATAFORMAT, UMPDATAFORMAT, *PUMPDATAFORMAT;

typedef enum {
KSPROPERTY_MIDILOOPEDSTREAMING_BUFFER,
KSPROPERTY_MIDILOOPEDSTREAMING_REGISTERS,
Expand All @@ -83,6 +78,17 @@ typedef struct {
KSPROPERTY Property;
ULONG RequestedBufferSize;
} KSMIDILOOPED_BUFFER_PROPERTY, *PKSMIDILOOPED_BUFFER_PROPERTY;

// Data format for KSDATAFORMAT_SUBTYPE_UNIVERSALMIDIPACKET
typedef struct {
LONGLONG Position;
ULONG ByteCount;
} UMPDATAFORMAT, *PUMPDATAFORMAT;
#endif

#ifndef LOOPEDDATAFORMAT
#define LOOPEDDATAFORMAT UMPDATAFORMAT
#define PLOOPEDDATAFORMAT PUMPDATAFORMAT
#endif

#ifndef KSPROPSETID_MIDI2_ENDPOINT_INFORMATION
Expand Down
13 changes: 5 additions & 8 deletions src/api/Inc/midi_ump.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ namespace Windows::Devices::Midi2::Internal
return (wordCount >= 1 && wordCount <= 4);
}

inline bool FillPackedUmp32FromBytePointer(_In_ uint8_t* data, _In_ uint8_t byteCount, _Inout_ PackedUmp32& ump)
inline bool FillPackedUmp32FromBytePointer(_In_reads_bytes_(byteCount) uint8_t* data, _In_ uint8_t byteCount, _Inout_ PackedUmp32& ump)
{
if (byteCount == sizeof(ump))
{
Expand All @@ -87,7 +87,7 @@ namespace Windows::Devices::Midi2::Internal
return false;
}

inline bool FillPackedUmp64FromBytePointer(_In_ uint8_t* data, _In_ uint8_t byteCount, _Inout_ PackedUmp64& ump)
inline bool FillPackedUmp64FromBytePointer(_In_reads_bytes_(byteCount) uint8_t* data, _In_ uint8_t byteCount, _Inout_ PackedUmp64& ump)
{
if (byteCount == sizeof(ump))
{
Expand All @@ -99,7 +99,7 @@ namespace Windows::Devices::Midi2::Internal
return false;
}

inline bool FillPackedUmp96FromBytePointer(_In_ uint8_t* data, _In_ uint8_t byteCount, _Inout_ PackedUmp96& ump)
inline bool FillPackedUmp96FromBytePointer(_In_reads_bytes_(byteCount) uint8_t* data, _In_ uint8_t byteCount, _Inout_ PackedUmp96& ump)
{
if (byteCount == sizeof(ump))
{
Expand All @@ -111,7 +111,7 @@ namespace Windows::Devices::Midi2::Internal
return false;
}

inline bool FillPackedUmp128FromBytePointer(_In_ uint8_t* data, _In_ uint8_t byteCount, _Inout_ PackedUmp128& ump)
inline bool FillPackedUmp128FromBytePointer(_In_reads_bytes_(byteCount) uint8_t* data, _In_ uint8_t byteCount, _Inout_ PackedUmp128& ump)
{
if (byteCount == sizeof(ump))
{
Expand All @@ -122,7 +122,4 @@ namespace Windows::Devices::Midi2::Internal

return false;
}



}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ namespace Windows::Devices::Midi2::Internal
{
// NOTE: The parameters in here are all passed to the API by ref, so the
// calling code needs to keep them around until the device creation returns.

_Use_decl_annotations_
bool AddStandardEndpointProperties(

)
{
try
Expand Down
10 changes: 6 additions & 4 deletions src/api/Libs/AbstractionUtilities/src/swd_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
namespace Windows::Devices::Midi2::Internal
{

_Use_decl_annotations_
std::wstring GetStringSwdProperty(std::wstring deviceInterfaceId, std::wstring propertyName, std::wstring defaultValue)
std::wstring
GetStringSwdProperty(_In_ std::wstring deviceInterfaceId, _In_ std::wstring propertyName, _In_ std::wstring defaultValue)
{
auto propertyKey = winrt::to_hstring(propertyName.c_str());

Expand Down Expand Up @@ -48,7 +48,8 @@ namespace Windows::Devices::Midi2::Internal


_Use_decl_annotations_
std::wstring GetSwdPropertyVirtualEndpointAssociationId(std::wstring deviceInterfaceId)
std::wstring
GetSwdPropertyVirtualEndpointAssociationId(std::wstring deviceInterfaceId)
{
std::wstring cleanId = internal::NormalizeEndpointInterfaceIdWStringCopy(deviceInterfaceId);

Expand All @@ -57,7 +58,8 @@ namespace Windows::Devices::Midi2::Internal


_Use_decl_annotations_
std::wstring GetSwdPropertyInstanceId(std::wstring deviceInterfaceId)
std::wstring
GetSwdPropertyInstanceId(std::wstring deviceInterfaceId)
{
std::wstring cleanId = internal::NormalizeEndpointInterfaceIdWStringCopy(deviceInterfaceId);

Expand Down
6 changes: 3 additions & 3 deletions src/api/Service/Exe/MidiService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

#include "stdafx.h"

#define SVCNAME TEXT("MidiSrv")
#define SVCDISPLAYNAME TEXT("Microsoft MIDI Service")
#define SVCNAME L"MidiSrv"
#define SVCDISPLAYNAME L"Microsoft MIDI Service"

//#ifdef _DEBUG
//#define SVCDESCRIPTION TEXT("Windows MIDI Services core service (Debug Build)")
Expand Down Expand Up @@ -392,7 +392,7 @@ int __cdecl _tmain(_In_ int ArgC, _In_reads_(ArgC) TCHAR *ArgV[])

SERVICE_TABLE_ENTRY DispatchTable[] =
{
{ SVCNAME, (LPSERVICE_MAIN_FUNCTION) SvcMain },
{ (LPWSTR) SVCNAME, (LPSERVICE_MAIN_FUNCTION) SvcMain },
{ NULL, NULL }
};

Expand Down
10 changes: 5 additions & 5 deletions src/api/Service/Exe/MidiSessionTracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,20 @@ class CMidiSessionTracker : public Microsoft::WRL::RuntimeClass<
CMidiSessionTracker() {}
~CMidiSessionTracker() {}

HRESULT Initialize();
STDMETHOD(Initialize)();

// These are called from the API
HRESULT AddClientSession(_In_ GUID SessionId, _In_ LPCWSTR SessionName, _In_ DWORD ClientProcessId, _In_ LPCWSTR ClientProcessName);
HRESULT RemoveClientSession(_In_ GUID SessionId);
STDMETHOD(AddClientSession)(_In_ GUID SessionId, _In_ LPCWSTR SessionName, _In_ DWORD ClientProcessId, _In_ LPCWSTR ClientProcessName);
STDMETHOD(RemoveClientSession)(_In_ GUID SessionId);

// These are called from within the service
HRESULT AddClientEndpointConnection(_In_ GUID SessionId, _In_ LPCWSTR ConnectionEndpointInterfaceId);
HRESULT RemoveClientEndpointConnection(_In_ GUID SessionId, _In_ LPCWSTR ConnectionEndpointInterfaceId);

// This is called from the API
HRESULT GetSessionListJson(_Out_ BSTR* SessionList);
STDMETHOD(GetSessionListJson)(_Out_ BSTR* SessionList);

HRESULT Cleanup();
STDMETHOD(Cleanup)();

private:
std::map<GUID, MidiSessionEntry, GUIDCompare> m_sessions{};
Expand Down
4 changes: 2 additions & 2 deletions src/api/Service/Exe/MidiSrv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ CMidiSrv::Initialize()
NULL));

RETURN_IF_FAILED(HRESULT_FROM_RPCSTATUS(RpcServerUseProtseqEp(
reinterpret_cast<RPC_WSTR>(MIDISRV_LRPC_PROTOCOL),
(RPC_WSTR)MIDISRV_LRPC_PROTOCOL,
RPC_C_PROTSEQ_MAX_REQS_DEFAULT,
reinterpret_cast<RPC_WSTR>(MIDISRV_ENDPOINT),
(RPC_WSTR)MIDISRV_ENDPOINT,
rpcSecurityDescriptor.get())));

RETURN_IF_FAILED(HRESULT_FROM_RPCSTATUS(RpcServerRegisterIf3(
Expand Down
50 changes: 25 additions & 25 deletions src/api/Service/Inc/MidiClientManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,37 +50,37 @@ class CMidiClientManager
// discrete methods for each type of transform. But right now, it's about making the
// transform process work properly
HRESULT
CMidiClientManager::GetMidiTransform(
_In_ handle_t,
_In_ MidiFlow,
_In_ MidiDataFormat,
_In_ MidiDataFormat,
_In_ wil::com_ptr_nothrow<CMidiPipe>&,
_In_ wil::com_ptr_nothrow<CMidiPipe>&);
GetMidiTransform(
_In_ handle_t,
_In_ MidiFlow,
_In_ MidiDataFormat,
_In_ MidiDataFormat,
_In_ wil::com_ptr_nothrow<CMidiPipe>&,
_In_ wil::com_ptr_nothrow<CMidiPipe>&);

HRESULT
CMidiClientManager::GetMidiScheduler(
_In_ handle_t,
_In_ MidiFlow,
_In_ wil::com_ptr_nothrow<CMidiPipe>&,
_In_ wil::com_ptr_nothrow<CMidiPipe>&,
_In_ wil::com_ptr_nothrow<CMidiPipe>&);
GetMidiScheduler(
_In_ handle_t,
_In_ MidiFlow,
_In_ wil::com_ptr_nothrow<CMidiPipe>&,
_In_ wil::com_ptr_nothrow<CMidiPipe>&,
_In_ wil::com_ptr_nothrow<CMidiPipe>&);

HRESULT
CMidiClientManager::GetMidiJRTimestampHandler(
_In_ handle_t,
_In_ MidiFlow,
_In_ wil::com_ptr_nothrow<CMidiPipe>&,
_In_ wil::com_ptr_nothrow<CMidiPipe>&,
_In_ wil::com_ptr_nothrow<CMidiPipe>&);
GetMidiJRTimestampHandler(
_In_ handle_t,
_In_ MidiFlow,
_In_ wil::com_ptr_nothrow<CMidiPipe>&,
_In_ wil::com_ptr_nothrow<CMidiPipe>&,
_In_ wil::com_ptr_nothrow<CMidiPipe>&);

HRESULT
CMidiClientManager::GetMidiEndpointMetadataHandler(
_In_ handle_t,
_In_ MidiFlow,
_In_ wil::com_ptr_nothrow<CMidiPipe>&,
_In_ wil::com_ptr_nothrow<CMidiPipe>&,
_In_ wil::com_ptr_nothrow<CMidiPipe>&);
GetMidiEndpointMetadataHandler(
_In_ handle_t,
_In_ MidiFlow,
_In_ wil::com_ptr_nothrow<CMidiPipe>&,
_In_ wil::com_ptr_nothrow<CMidiPipe>&,
_In_ wil::com_ptr_nothrow<CMidiPipe>&);


wil::critical_section m_ClientManagerLock;
Expand Down
2 changes: 1 addition & 1 deletion src/api/Service/Inc/MidiDeviceManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class CMidiDeviceManager :
_In_ PVOID,
_In_ PVOID,
_In_ PVOID,
_Out_writes_opt_z_(CreatedSwDeviceInterfaceIdCharCount) PWSTR CreatedDeviceInterfaceId,
_Out_writes_opt_z_(CreatedSwDeviceInterfaceIdWCharCount) PWSTR CreatedDeviceInterfaceId,
_In_ ULONG CreatedSwDeviceInterfaceIdWCharCount
);

Expand Down
4 changes: 2 additions & 2 deletions src/api/Test/Midi2.Service.unittests/Midi2ServiceTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ HRESULT GetMidiSrvBindingHandle(handle_t* BindingHandle)

RETURN_IF_WIN32_ERROR(RpcStringBindingCompose(
nullptr,
reinterpret_cast<RPC_WSTR>(MIDISRV_LRPC_PROTOCOL),
(RPC_WSTR)MIDISRV_LRPC_PROTOCOL,
nullptr,
reinterpret_cast<RPC_WSTR>(MIDISRV_ENDPOINT),
(RPC_WSTR)MIDISRV_ENDPOINT,
nullptr,
&stringBinding));

Expand Down
2 changes: 1 addition & 1 deletion src/api/Transform/SchedulerTransform/ScheduledUmpMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct ScheduledUmpMessage
BYTE Data[MAXIMUM_UMP_DATASIZE]; // pre-define this array to avoid another allocation/indirection


ScheduledUmpMessage(_In_ internal::MidiTimestamp timestamp, _In_ uint64_t receivedIndex, _In_ UINT byteCount, _In_ BYTE* data)
ScheduledUmpMessage(_In_ internal::MidiTimestamp timestamp, _In_ uint64_t receivedIndex, _In_ UINT byteCount, _In_reads_bytes_(byteCount) BYTE* data)
{
if (byteCount <= MAXIMUM_UMP_DATASIZE)
{
Expand Down

0 comments on commit 33f9b1f

Please sign in to comment.