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

Add DataObject CCW implementation #52

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
19 changes: 19 additions & 0 deletions WinFormsComInterop/WinFormsComWrappers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ namespace WinFormsComInterop
[ComCallableWrapper(typeof(primitives::Interop.Ole32.ISimpleFrameSite))]
[ComCallableWrapper(typeof(primitives::Interop.Ole32.IPropertyNotifySink))]
[ComCallableWrapper(typeof(primitives::Interop.Shell32.IFileDialogEvents))]
[ComCallableWrapper(typeof(System.Runtime.InteropServices.ComTypes.IDataObject))]
#if !NET7_0_OR_GREATER
[ComCallableWrapper(typeof(System.Runtime.InteropServices.ComTypes.IEnumString))]
#endif
Expand All @@ -50,6 +51,7 @@ public unsafe partial class WinFormsComWrappers : ComWrappers
static ComWrappers.ComInterfaceEntry* formsWebBrowserContainerEntry;
static ComWrappers.ComInterfaceEntry* formsWebBrowserEventEntry;
static ComWrappers.ComInterfaceEntry* formsFileDialogEventsEntry;
static ComWrappers.ComInterfaceEntry* dataObjectEntry;
#if !NET7_0_OR_GREATER
static ComWrappers.ComInterfaceEntry* enumVariantEntry;
#endif
Expand Down Expand Up @@ -89,6 +91,7 @@ public unsafe partial class WinFormsComWrappers : ComWrappers
internal static Guid IID_IFileSaveDialog = new Guid("84bccd23-5fde-4cdb-aea4-af64b83d78ab");
internal static Guid IID_IFileDialogEvents = new Guid("973510DB-7D7F-452B-8975-74A85828D354");
internal static Guid IID_IDropTarget = new Guid("00000122-0000-0000-C000-000000000046");
internal static Guid IID_IDataObject = new Guid("0000010E-0000-0000-C000-000000000046");
internal static Guid IID_IOleInPlaceActiveObject = new Guid("00000117-0000-0000-C000-000000000046");
internal static Guid IID_IHTMLDocument4 = new Guid("3050F69A-98B5-11CF-BB82-00AA00BDCE0B");
internal static Guid IID_IHTMLLocation = new Guid("163BB1E0-6E00-11CF-837A-48DC04C10000");
Expand All @@ -103,6 +106,7 @@ static WinFormsComWrappers()
{
accessibleObjectEntry = CreateAccessibleObjectEntry();
primitivesStreamEntry = CreatePrimitivesStreamEntry();
dataObjectEntry = CreateDataObjectEntry();
#if !NET7_0_OR_GREATER
enumVariantEntry = CreateEnumVariantEntry();
#endif
Expand Down Expand Up @@ -159,7 +163,16 @@ static WinFormsComWrappers()
return wrapperEntry;
}
#endif
private static ComInterfaceEntry* CreateDataObjectEntry()
{
CreateIDataObjectProxyVtbl(out var vtbl);

var comInterfaceEntryMemory = RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(WinFormsComWrappers), sizeof(ComInterfaceEntry) * 1);
var wrapperEntry = (ComInterfaceEntry*)comInterfaceEntryMemory.ToPointer();
wrapperEntry->IID = IID_IDataObject;
wrapperEntry->Vtable = vtbl;
return wrapperEntry;
}
private static ComInterfaceEntry* CreatePrimitivesDropTargetEntry()
{
CreatePrimitivesIDropTargetProxyVtbl(out var vtbl);
Expand Down Expand Up @@ -381,6 +394,12 @@ static WinFormsComWrappers()
return formsFileDialogEventsEntry;
}

if (obj is forms::System.Windows.Forms.DataObject)
{
count = 1;
return dataObjectEntry;
}

throw new NotImplementedException();
}

Expand Down
12 changes: 12 additions & 0 deletions facades/System.Windows.Forms/DataObject.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace System.Windows.Forms
{
public class DataObject
{
}
}