forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
System.Management. Refactor DllImports (dotnet/corefx#34477)
* System.Management. Refactor DllImports Commit migrated from dotnet/corefx@2905380
- Loading branch information
1 parent
1dbdaea
commit 4bde620
Showing
8 changed files
with
133 additions
and
41 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
src/libraries/Common/src/Interop/Windows/Ole32/Interop.CoGetObjectContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
using System.Runtime.InteropServices.ComTypes; | ||
|
||
internal static partial class Interop | ||
{ | ||
internal static partial class Ole32 | ||
{ | ||
[DllImport(Libraries.Ole32, PreserveSig = false)] | ||
internal static extern IStream CreateStreamOnHGlobal(IntPtr hGlobal, bool fDeleteOnRelease); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/libraries/Common/src/Interop/Windows/Ole32/Interop.CoMarshalInterface.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
using System.Runtime.InteropServices.ComTypes; | ||
|
||
internal static partial class Interop | ||
{ | ||
internal static partial class Ole32 | ||
{ | ||
[DllImport(Libraries.Ole32, PreserveSig = false)] | ||
internal static extern void CoMarshalInterface( | ||
IStream pStm, // Pointer to the stream used for marshaling | ||
[MarshalAs(UnmanagedType.LPStruct)] Guid riid, // Reference to the identifier of the | ||
IntPtr pUnk, // Pointer to the interface to be marshaled | ||
uint dwDestContext, // Destination process | ||
IntPtr pvDestContext, // Reserved for future use | ||
uint mshlflags // Reason for marshaling | ||
); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/libraries/Common/src/Interop/Windows/Ole32/Interop.CoUnmarshalInterface.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
using System.Runtime.InteropServices.ComTypes; | ||
|
||
internal static partial class Interop | ||
{ | ||
internal static partial class Ole32 | ||
{ | ||
[DllImport(Libraries.Ole32, PreserveSig = false)] | ||
internal static extern IntPtr CoUnmarshalInterface( | ||
IStream pStm, // Pointer to the stream | ||
[MarshalAs(UnmanagedType.LPStruct)] Guid riid // Reference to the identifier of the interface | ||
); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/libraries/Common/src/Interop/Windows/Ole32/Interop.CreateStreamOnHGlobal.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
internal static partial class Interop | ||
{ | ||
internal static partial class Ole32 | ||
{ | ||
[DllImport(Libraries.Ole32)] | ||
internal static extern int CoGetObjectContext([MarshalAs(UnmanagedType.LPStruct)] Guid riid, out IntPtr ppv); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/libraries/Common/src/Interop/Windows/Ole32/Interop.GetHGlobalFromStream.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
using System.Runtime.InteropServices.ComTypes; | ||
|
||
internal static partial class Interop | ||
{ | ||
internal static partial class Ole32 | ||
{ | ||
[DllImport(Libraries.Ole32, PreserveSig = false)] | ||
internal static extern IntPtr GetHGlobalFromStream(IStream pstm); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/libraries/Common/src/Interop/Windows/kernel32/Interop.GlobalLock.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
internal partial class Interop | ||
{ | ||
internal partial class Kernel32 | ||
{ | ||
[DllImport(Libraries.Kernel32, PreserveSig = true)] | ||
internal static extern IntPtr GlobalLock(IntPtr hMem); | ||
|
||
[DllImport(Libraries.Kernel32, PreserveSig = true)] | ||
internal static extern int GlobalUnlock(IntPtr hMem); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters