Skip to content

Fix GUID interop in distributed transactions and block ARM #74226

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

Merged
merged 1 commit into from
Sep 11, 2022
Merged
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 @@ -420,7 +420,10 @@
<data name="TraceSourceBase" xml:space="preserve">
<value>[Base]</value>
</data>
<data name="DistributedNotSupportOn32Bits" xml:space="preserve">
<data name="DistributedNotSupportedOn32Bits" xml:space="preserve">
<value>Distributed transactions are currently unsupported in 32-bit processes.</value>
</data>
</root>
<data name="DistributedNotSupportedOnArm" xml:space="preserve">
<value>Distributed transactions are currently unsupported on ARM.</value>
</data>
</root>
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.InteropServices;

namespace System.Transactions.DtcProxyShim.DtcInterfaces;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ namespace System.Transactions.DtcProxyShim.DtcInterfaces;
internal interface IResourceManagerFactory2
{
internal void Create(
Guid pguidRM,
in Guid pguidRM,
[MarshalAs(UnmanagedType.LPStr)] string pszRMName,
[MarshalAs(UnmanagedType.Interface)] IResourceManagerSink pIResMgrSink,
[MarshalAs(UnmanagedType.Interface)] out IResourceManager rm);

internal void CreateEx(
Guid pguidRM,
in Guid pguidRM,
[MarshalAs(UnmanagedType.LPStr)] string pszRMName,
[MarshalAs(UnmanagedType.Interface)] IResourceManagerSink pIResMgrSink,
Guid riidRequested,
in Guid riidRequested,
[MarshalAs(UnmanagedType.Interface)] out object rm);
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.InteropServices;
using System.Transactions.Oletx;

namespace System.Transactions.DtcProxyShim.DtcInterfaces;

Expand All @@ -12,7 +10,7 @@ namespace System.Transactions.DtcProxyShim.DtcInterfaces;
internal interface ITransaction
{
void Commit(
[MarshalAs(UnmanagedType.Bool)] bool fRetainingt,
[MarshalAs(UnmanagedType.Bool)] bool fRetaining,
[MarshalAs(UnmanagedType.U4)] OletxXacttc grfTC,
uint grfRM);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.InteropServices;

namespace System.Transactions.DtcProxyShim.DtcInterfaces;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace System.Transactions.DtcProxyShim.DtcInterfaces;

// https://docs.microsoft.com/previous-versions/windows/desktop/ms679525(v=vs.85)
// https://docs.microsoft.com/previous-versions/windows/desktop/ms687604(v=vs.85)
[ComImport, Guid(Guids.IID_ITransactionDispenser), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
internal interface ITransactionDispenser
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.InteropServices;

namespace System.Transactions.DtcProxyShim.DtcInterfaces;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.InteropServices;

namespace System.Transactions.DtcProxyShim.DtcInterfaces;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.InteropServices;

namespace System.Transactions.DtcProxyShim.DtcInterfaces;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.InteropServices;

namespace System.Transactions.DtcProxyShim.DtcInterfaces;
Expand All @@ -13,6 +12,6 @@ internal interface ITransactionImport
void Import(
uint cbTransactionCookie,
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] byte[] rgbTransactionCookie,
Guid piid,
in Guid piid,
[MarshalAs(UnmanagedType.Interface)] out object ppvTransaction);
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.InteropServices;

namespace System.Transactions.DtcProxyShim.DtcInterfaces;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,21 @@ namespace System.Transactions.DtcProxyShim.DtcInterfaces;
[ComImport, Guid("3A6AD9E2-23B9-11cf-AD60-00AA00A74CCD"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
internal interface ITransactionOutcomeEvents
{
void Committed([MarshalAs(UnmanagedType.Bool)] bool fRetaining, IntPtr pNewUOW /* always null? */, int hresult);
void Committed(
[MarshalAs(UnmanagedType.Bool)] bool fRetaining,
IntPtr pNewUOW,
int hresult);

void Aborted(IntPtr pboidReason, [MarshalAs(UnmanagedType.Bool)] bool fRetaining, IntPtr pNewUOW, int hresult);
void Aborted(
IntPtr pboidReason,
[MarshalAs(UnmanagedType.Bool)] bool fRetaining,
IntPtr pNewUOW,
int hresult);

void HeuristicDecision([MarshalAs(UnmanagedType.U4)] OletxTransactionHeuristic dwDecision, IntPtr pboidReason, int hresult);
void HeuristicDecision(
[MarshalAs(UnmanagedType.U4)] OletxTransactionHeuristic dwDecision,
IntPtr pboidReason,
int hresult);

void Indoubt();
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.InteropServices;

namespace System.Transactions.DtcProxyShim.DtcInterfaces;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.InteropServices;

namespace System.Transactions.DtcProxyShim.DtcInterfaces;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.InteropServices;
using System.Transactions.Oletx;

namespace System.Transactions.DtcProxyShim.DtcInterfaces;

Expand All @@ -19,7 +17,10 @@ void PrepareRequest(

void CommitRequest(OletxXactRm grfRM, IntPtr pNewUOW);

void AbortRequest(IntPtr pboidReason, [MarshalAs(UnmanagedType.Bool)] bool fRetaining, IntPtr pNewUOW);
void AbortRequest(
IntPtr pboidReason,
[MarshalAs(UnmanagedType.Bool)] bool fRetaining,
IntPtr pNewUOW);

void TMDown();
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.InteropServices;

namespace System.Transactions.DtcProxyShim.DtcInterfaces;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.InteropServices;

namespace System.Transactions.DtcProxyShim.DtcInterfaces;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,21 @@ namespace System.Transactions.DtcProxyShim.DtcInterfaces;
[ComImport, Guid("5433376B-414D-11d3-B206-00C04FC2F3EF"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
internal interface ITransactionVoterNotifyAsync2
{
void Committed([MarshalAs(UnmanagedType.Bool)] bool fRetaining, IntPtr pNewUOW /* always null? */, uint hresult);
void Committed(
[MarshalAs(UnmanagedType.Bool)] bool fRetaining,
IntPtr pNewUOW,
uint hresult);

void Aborted(IntPtr pboidReason, [MarshalAs(UnmanagedType.Bool)] bool fRetaining, IntPtr pNewUOW, uint hresult);
void Aborted(
IntPtr pboidReason,
[MarshalAs(UnmanagedType.Bool)] bool fRetaining,
IntPtr pNewUOW,
uint hresult);

void HeuristicDecision([MarshalAs(UnmanagedType.U4)] OletxTransactionHeuristic dwDecision, IntPtr pboidReason, uint hresult);
void HeuristicDecision(
[MarshalAs(UnmanagedType.U4)] OletxTransactionHeuristic dwDecision,
IntPtr pboidReason,
uint hresult);

void Indoubt();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,14 @@ public void ConnectToProxy(
out byte[] whereabouts,
out ResourceManagerShim resourceManagerShim)
{
if (RuntimeInformation.ProcessArchitecture == Architecture.X86)
switch (RuntimeInformation.ProcessArchitecture)
{
throw new PlatformNotSupportedException(SR.DistributedNotSupportOn32Bits);
case Architecture.X86:
throw new PlatformNotSupportedException(SR.DistributedNotSupportedOn32Bits);

case Architecture.Armv6: // #74170
case Architecture.Arm64:
throw new PlatformNotSupportedException(SR.DistributedNotSupportedOnArm);
}

lock (_proxyInitLock)
Expand Down