Expand
diff --git a/v2/Generator/MultiGeneratorV2.cs b/v2/Generator/MultiGeneratorV2.cs
index 8aa0f2caa..1810eb6e5 100644
--- a/v2/Generator/MultiGeneratorV2.cs
+++ b/v2/Generator/MultiGeneratorV2.cs
@@ -264,6 +264,7 @@ public MultiGeneratorV2(string root)
{"OptValidator",new(true,new(2023,11,17),Category.EnhancementClass) },
{"ConfigBinder",new(true,new(2023,11,18),Category.API) },
{"RDG",new(true,new(2023,11,19),Category.API) },
+ {"COM",new(true,new(2023,11,20),Category.EnhancementProject) },
};
var noCategory = generators.Where(it=>it.Value.Category == Category.None).ToArray();
@@ -360,7 +361,9 @@ public string[] SourceNoRSCG()
text = text.Replace("(./docs/", $"({d.Generator!.Source}/docs/");
text = text.Replace("(CONTRIBUTING.md)", $"({d.Generator!.Source}/CONTRIBUTING.md)");
text = text.Replace("(./CODE-OF-CONDUCT.md)", $"({d.Generator!.Source}/CODE-OF-CONDUCT.md)");
-
+ text = text.Replace("(docs/project/dogfooding.md)", $"({d.Generator!.Source}/docs/project/dogfooding.md)");
+ text = text.Replace("(docs/workflow/README.md)", $"({d.Generator!.Source}/docs/workflow/README.md)");
+ text = text.Replace("(SECURITY.md)", $"({d.Generator!.Source}/SECURITY.md)");
return text;
}
;
diff --git a/v2/Generator/all.csv b/v2/Generator/all.csv
index cacf3c2f0..3da7f4335 100644
--- a/v2/Generator/all.csv
+++ b/v2/Generator/all.csv
@@ -86,3 +86,4 @@ Nr,Key,Source,Category
85,OptValidator, https://github.com/dotnet/runtime,EnhancementClass
86,ConfigBinder, https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-8#configuration-binding-source-generator,API
87,RDG, https://github.com/dotnet/aspnetcore,API
+88,COM, https://github.com/dotnet/runtime,EnhancementProject
diff --git a/v2/book/examples/Com.html b/v2/book/examples/Com.html
new file mode 100644
index 000000000..078a039f4
--- /dev/null
+++ b/v2/book/examples/Com.html
@@ -0,0 +1,59 @@
+
+RSCG nr 88 : Com
+
+Info
+Nuget : https://www.nuget.org/packages/System.Runtime.InteropServices/
+
+You can find more details at : https://learn.microsoft.com/en-us/dotnet/standard/native-interop/comwrappers-source-generation
+
+Author :Microsoft
+
+Source : https://github.com/dotnet/runtime
+
+About
+
+Generating Com Declarations
+
+
+ How to use
+
+
+ Add reference to the Com in the csproj
+
+
+
+This was for me the starting code
+
+
+ I have coded the file Program.cs
+
+
+
+
+
+ I have coded the file MyShell.cs
+
+
+
+ And here are the generated files
+
+
+ The file generated is test.IShellExecute.cs
+
+
+
+
+ You can download the code and this page as pdf from
+
+ https://ignatandrei.github.io/RSCG_Examples/v2/docs/Com
+
+
+
+
+
+ You can see the whole list at
+
+ https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG
+
+
+
diff --git a/v2/book/examples/images/Com/ComDemo.csproj.png b/v2/book/examples/images/Com/ComDemo.csproj.png
new file mode 100644
index 000000000..f5174a02d
Binary files /dev/null and b/v2/book/examples/images/Com/ComDemo.csproj.png differ
diff --git a/v2/book/examples/images/Com/ComDemo.csproj.txt b/v2/book/examples/images/Com/ComDemo.csproj.txt
new file mode 100644
index 000000000..7d0683842
--- /dev/null
+++ b/v2/book/examples/images/Com/ComDemo.csproj.txt
@@ -0,0 +1,17 @@
+
+
+
+ Exe
+ net8.0
+ enable
+ enable
+ true
+
+
+
+ true
+ $(BaseIntermediateOutputPath)\GX
+
+
diff --git a/v2/book/examples/images/Com/csFiles/MyShell.cs.png b/v2/book/examples/images/Com/csFiles/MyShell.cs.png
new file mode 100644
index 000000000..bc1989360
Binary files /dev/null and b/v2/book/examples/images/Com/csFiles/MyShell.cs.png differ
diff --git a/v2/book/examples/images/Com/csFiles/MyShell.cs.txt b/v2/book/examples/images/Com/csFiles/MyShell.cs.txt
new file mode 100644
index 000000000..a353d16f5
--- /dev/null
+++ b/v2/book/examples/images/Com/csFiles/MyShell.cs.txt
@@ -0,0 +1,50 @@
+using System;
+using System.Runtime.InteropServices;
+using System.Runtime.InteropServices.Marshalling;
+
+namespace test;
+
+// Import the ShellExecute function from Shell32.dll using ComImport
+[ComImport]
+[Guid("00000000-0000-0000-C000-000000000046")]
+[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+public interface IUnknown
+{
+ void QueryInterface(ref Guid riid, out IntPtr ppvObject);
+ void AddRef();
+ void Release();
+}
+
+//[ComImport]
+[GeneratedComInterface(StringMarshalling = StringMarshalling.Utf8)]
+[Guid("000214F9-0000-0000-C000-000000000046")]
+[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+public partial interface IShellExecute
+{
+ IntPtr ShellExecute(IntPtr hwnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, int nShowCmd);
+}
+
+
+// Replace this with your actual ShellExecute COM class
+public class ShellExecuteClass : IShellExecute
+{
+ public IntPtr ShellExecute(IntPtr hwnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, int nShowCmd)
+ {
+ // Implement the ShellExecute functionality
+ return NativeMethods.ShellExecute(hwnd, lpOperation, lpFile, lpParameters, lpDirectory, nShowCmd);
+ }
+}
+
+// NativeMethods class to import necessary functions from Shell32.dll
+static class NativeMethods
+{
+ [DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ public static extern IntPtr ShellExecute(
+ IntPtr hwnd,
+ string lpOperation,
+ string lpFile,
+ string lpParameters,
+ string lpDirectory,
+ int nShowCmd
+ );
+}
diff --git a/v2/book/examples/images/Com/csFiles/Program.cs.png b/v2/book/examples/images/Com/csFiles/Program.cs.png
new file mode 100644
index 000000000..e6a76d23c
Binary files /dev/null and b/v2/book/examples/images/Com/csFiles/Program.cs.png differ
diff --git a/v2/book/examples/images/Com/csFiles/Program.cs.txt b/v2/book/examples/images/Com/csFiles/Program.cs.txt
new file mode 100644
index 000000000..2bb3bfc70
--- /dev/null
+++ b/v2/book/examples/images/Com/csFiles/Program.cs.txt
@@ -0,0 +1,15 @@
+using test;
+
+IShellExecute shellExecute = new ShellExecuteClass();
+
+// Open a file using the default associated program
+IntPtr result = shellExecute.ShellExecute(
+ IntPtr.Zero, // HWND (handle to parent window)
+ "open", // Operation to perform
+ "notepad.exe", // File to open (replace with your file or URL)
+ "", // Parameters
+ "", // Working directory
+ 1 // Show command (SW_SHOWNORMAL)
+);
+
+Console.WriteLine($"ShellExecute Result: {result}");
diff --git a/v2/book/examples/images/Com/generated/test.IShellExecute.cs.png b/v2/book/examples/images/Com/generated/test.IShellExecute.cs.png
new file mode 100644
index 000000000..970c22fb3
Binary files /dev/null and b/v2/book/examples/images/Com/generated/test.IShellExecute.cs.png differ
diff --git a/v2/book/examples/images/Com/generated/test.IShellExecute.cs.txt b/v2/book/examples/images/Com/generated/test.IShellExecute.cs.txt
new file mode 100644
index 000000000..ea3cb0b11
--- /dev/null
+++ b/v2/book/examples/images/Com/generated/test.IShellExecute.cs.txt
@@ -0,0 +1,133 @@
+//
+#pragma warning disable CS0612, CS0618
+file unsafe class InterfaceInformation : global::System.Runtime.InteropServices.Marshalling.IIUnknownInterfaceType
+{
+ public static global::System.Guid Iid { get; } = new(new global::System.ReadOnlySpan(new byte[] { 249, 20, 2, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70 }));
+
+ private static void** _vtable;
+ public static void** ManagedVirtualMethodTable => _vtable != null ? _vtable : (_vtable = InterfaceImplementation.CreateManagedVirtualFunctionTable());
+}
+
+[global::System.Runtime.InteropServices.DynamicInterfaceCastableImplementationAttribute]
+file unsafe partial interface InterfaceImplementation : global::test.IShellExecute
+{
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.ComInterfaceGenerator", "8.0.9.3103")]
+ [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
+ nint global::test.IShellExecute.ShellExecute(nint hwnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, int nShowCmd)
+ {
+ var(__this, __vtable_native) = ((global::System.Runtime.InteropServices.Marshalling.IUnmanagedVirtualMethodTableProvider)this).GetVirtualMethodTableInfoForKey(typeof(global::test.IShellExecute));
+ byte* __lpOperation_native = default;
+ byte* __lpFile_native = default;
+ byte* __lpParameters_native = default;
+ byte* __lpDirectory_native = default;
+ nint __retVal = default;
+ int __invokeRetVal = default;
+ // Setup - Perform required setup.
+ scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __lpDirectory_native__marshaller = new();
+ scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __lpParameters_native__marshaller = new();
+ scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __lpFile_native__marshaller = new();
+ scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __lpOperation_native__marshaller = new();
+ try
+ {
+ // Marshal - Convert managed data to native data.
+ __lpDirectory_native__marshaller.FromManaged(lpDirectory, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
+ __lpParameters_native__marshaller.FromManaged(lpParameters, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
+ __lpFile_native__marshaller.FromManaged(lpFile, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
+ __lpOperation_native__marshaller.FromManaged(lpOperation, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
+ {
+ // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
+ __lpDirectory_native = __lpDirectory_native__marshaller.ToUnmanaged();
+ __lpParameters_native = __lpParameters_native__marshaller.ToUnmanaged();
+ __lpFile_native = __lpFile_native__marshaller.ToUnmanaged();
+ __lpOperation_native = __lpOperation_native__marshaller.ToUnmanaged();
+ __invokeRetVal = ((delegate* unmanaged[MemberFunction] )__vtable_native[3])(__this, hwnd, __lpOperation_native, __lpFile_native, __lpParameters_native, __lpDirectory_native, nShowCmd, &__retVal);
+ }
+
+ // NotifyForSuccessfulInvoke - Keep alive any managed objects that need to stay alive across the call.
+ global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal);
+ global::System.GC.KeepAlive(this);
+ }
+ finally
+ {
+ // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
+ __lpDirectory_native__marshaller.Free();
+ __lpParameters_native__marshaller.Free();
+ __lpFile_native__marshaller.Free();
+ __lpOperation_native__marshaller.Free();
+ }
+
+ return __retVal;
+ }
+}
+
+file unsafe partial interface InterfaceImplementation
+{
+ [global::System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute(CallConvs = new[] { typeof(global::System.Runtime.CompilerServices.CallConvMemberFunction) })]
+ internal static int ABI_ShellExecute(global::System.Runtime.InteropServices.ComWrappers.ComInterfaceDispatch* __this_native, nint hwnd, byte* __lpOperation_native, byte* __lpFile_native, byte* __lpParameters_native, byte* __lpDirectory_native, int nShowCmd, nint* __invokeRetValUnmanaged__param)
+ {
+ global::test.IShellExecute @this = default;
+ string lpOperation = default;
+ string lpFile = default;
+ string lpParameters = default;
+ string lpDirectory = default;
+ ref nint __invokeRetValUnmanaged = ref *__invokeRetValUnmanaged__param;
+ nint __invokeRetVal = default;
+ int __retVal = default;
+ try
+ {
+ // Unmarshal - Convert native data to managed data.
+ lpDirectory = global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ConvertToManaged(__lpDirectory_native);
+ lpParameters = global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ConvertToManaged(__lpParameters_native);
+ lpFile = global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ConvertToManaged(__lpFile_native);
+ lpOperation = global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ConvertToManaged(__lpOperation_native);
+ @this = global::System.Runtime.InteropServices.ComWrappers.ComInterfaceDispatch.GetInstance(__this_native);
+ __invokeRetVal = @this.ShellExecute(hwnd, lpOperation, lpFile, lpParameters, lpDirectory, nShowCmd);
+ // NotifyForSuccessfulInvoke - Keep alive any managed objects that need to stay alive across the call.
+ __retVal = 0; // S_OK
+ // Marshal - Convert managed data to native data.
+ __invokeRetValUnmanaged = __invokeRetVal;
+ }
+ catch (global::System.Exception __exception)
+ {
+ __retVal = global::System.Runtime.InteropServices.Marshalling.ExceptionAsHResultMarshaller.ConvertToUnmanaged(__exception);
+ }
+
+ return __retVal;
+ }
+}
+
+file unsafe partial interface InterfaceImplementation
+{
+ internal static void** CreateManagedVirtualFunctionTable()
+ {
+ void** vtable = (void**)global::System.Runtime.CompilerServices.RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(global::test.IShellExecute), sizeof(void*) * 4);
+ {
+ nint v0, v1, v2;
+ global::System.Runtime.InteropServices.ComWrappers.GetIUnknownImpl(out v0, out v1, out v2);
+ vtable[0] = (void*)v0;
+ vtable[1] = (void*)v1;
+ vtable[2] = (void*)v2;
+ }
+
+ {
+ vtable[3] = (void*)(delegate* unmanaged[MemberFunction] )&ABI_ShellExecute;
+ }
+
+ return vtable;
+ }
+}
+
+namespace test
+{
+ [global::System.Runtime.InteropServices.Marshalling.IUnknownDerivedAttribute]
+ public partial interface IShellExecute
+ {
+ }
+}
+
+namespace test
+{
+ public partial interface IShellExecute
+ {
+ }
+}
\ No newline at end of file
diff --git a/v2/book/list.html b/v2/book/list.html
index 67fde0508..3e56b9024 100644
--- a/v2/book/list.html
+++ b/v2/book/list.html
@@ -17,7 +17,7 @@
-This is the list of 87 RSCG with examples =>
+This is the list of 88 RSCG with examples =>
@@ -374,6 +374,10 @@
87 |
RDG |
+
+ 88 |
+ Com |
+
diff --git a/v2/book/pandocHTML.yaml b/v2/book/pandocHTML.yaml
index 77c8c6a11..8451e6d9a 100644
--- a/v2/book/pandocHTML.yaml
+++ b/v2/book/pandocHTML.yaml
@@ -101,6 +101,7 @@ input-files:
- examples/Microsoft.Extensions.Options.Generators.OptionsValidatorGenerator.html
- examples/Microsoft.Extensions.Configuration.Binder.html
- examples/RDG.html
+- examples/Com.html
# or you may use input-file: with a single value
# defaults:
diff --git a/v2/rscg_examples/Com/description.json b/v2/rscg_examples/Com/description.json
new file mode 100644
index 000000000..c86feeffb
--- /dev/null
+++ b/v2/rscg_examples/Com/description.json
@@ -0,0 +1,20 @@
+{
+ "generator":{
+ "name":"Com",
+ "nuget":[
+ "https://www.nuget.org/packages/System.Runtime.InteropServices/"
+ ],
+ "link":"https://learn.microsoft.com/en-us/dotnet/standard/native-interop/comwrappers-source-generation",
+ "author":"Microsoft",
+ "source":"https://github.com/dotnet/runtime"
+ },
+ "data":{
+ "goodFor":["Generating Com Declarations"],
+ "csprojDemo":"ComDemo.csproj",
+ "csFiles":["Program.cs","MyShell.cs"]
+ },
+ "links":{
+ "blog":"",
+ "video":""
+ }
+}
\ No newline at end of file
diff --git a/v2/rscg_examples/Com/nuget.txt b/v2/rscg_examples/Com/nuget.txt
new file mode 100644
index 000000000..c121d3c43
--- /dev/null
+++ b/v2/rscg_examples/Com/nuget.txt
@@ -0,0 +1,8 @@
+Provides types that support COM interop and platform invoke services.
+
+Commonly Used Types:
+System.Runtime.InteropServices.GCHandle
+System.Runtime.InteropServices.GuidAttribute
+System.Runtime.InteropServices.COMException
+System.DllNotFoundException
+System.Runtime.InteropServices.DllImportAttribute
\ No newline at end of file
diff --git a/v2/rscg_examples/Com/readme.txt b/v2/rscg_examples/Com/readme.txt
new file mode 100644
index 000000000..ea640f804
--- /dev/null
+++ b/v2/rscg_examples/Com/readme.txt
@@ -0,0 +1,75 @@
+# .NET Runtime
+
+[![Build Status](https://dev.azure.com/dnceng-public/public/_apis/build/status/dotnet/runtime/runtime?branchName=main)](https://dev.azure.com/dnceng-public/public/_build/latest?definitionId=129&branchName=main)
+[![Help Wanted](https://img.shields.io/github/issues/dotnet/runtime/help%20wanted?style=flat-square&color=%232EA043&label=help%20wanted)](https://github.com/dotnet/runtime/labels/help%20wanted)
+[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dotnet/runtime)
+[![Discord](https://img.shields.io/discord/732297728826277939?style=flat-square&label=Discord&logo=discord&logoColor=white&color=7289DA)](https://aka.ms/dotnet-discord)
+
+* [What is .NET?](#what-is-net)
+* [How can I contribute?](#how-can-i-contribute)
+* [Reporting security issues and security bugs](#reporting-security-issues-and-security-bugs)
+* [Filing issues](#filing-issues)
+* [Useful Links](#useful-links)
+* [.NET Foundation](#net-foundation)
+* [License](#license)
+
+This repo contains the code to build the .NET runtime, libraries and shared host (`dotnet`) installers for
+all supported platforms, as well as the sources to .NET runtime and libraries.
+
+## What is .NET?
+
+Official Starting Page:
+
+* [How to use .NET](https://docs.microsoft.com/dotnet/core/get-started) (with VS, VS Code, command-line CLI)
+ * [Install official releases](https://dotnet.microsoft.com/download)
+ * [Install daily builds](docs/project/dogfooding.md)
+ * [Documentation](https://docs.microsoft.com/dotnet/core) (Get Started, Tutorials, Porting from .NET Framework, API reference, ...)
+ * [Deploying apps](https://docs.microsoft.com/dotnet/core/deploying)
+ * [Supported OS versions](https://github.com/dotnet/core/blob/main/os-lifecycle-policy.md)
+* [Roadmap](https://github.com/dotnet/core/blob/main/roadmap.md)
+* [Releases](https://github.com/dotnet/core/tree/main/release-notes)
+
+## How can I contribute?
+
+We welcome contributions! Many people all over the world have helped make this project better.
+
+* [Contributing](CONTRIBUTING.md) explains what kinds of contributions we welcome
+* [Workflow Instructions](docs/workflow/README.md) explains how to build and test
+* [Get Up and Running on .NET Core](docs/project/dogfooding.md) explains how to get nightly builds of the runtime and its libraries to test them in your own projects.
+
+## Reporting security issues and security bugs
+
+Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) . You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the [Security TechCenter](https://www.microsoft.com/msrc/faqs-report-an-issue). You can also find these instructions in this repo's [Security doc](SECURITY.md).
+
+Also see info about related [Microsoft .NET Core and ASP.NET Core Bug Bounty Program](https://www.microsoft.com/msrc/bounty-dot-net-core).
+
+## Filing issues
+
+This repo should contain issues that are tied to the runtime, the class libraries and frameworks, the installation of the `dotnet` binary (sometimes known as the `muxer`) and the installation of the .NET runtime and libraries.
+
+For other issues, please file them to their appropriate sibling repos. We have links to many of them on [our new issue page](https://github.com/dotnet/runtime/issues/new/choose).
+
+## Useful Links
+
+* [.NET Core source index](https://source.dot.net) / [.NET Framework source index](https://referencesource.microsoft.com)
+* [API Reference docs](https://docs.microsoft.com/dotnet/api)
+* [.NET API Catalog](https://apisof.net) (incl. APIs from daily builds and API usage info)
+* [API docs writing guidelines](https://github.com/dotnet/dotnet-api-docs/wiki) - useful when writing /// comments
+* [.NET Discord Server](https://aka.ms/dotnet-discord) - a place to discuss the development of .NET and its ecosystem
+
+## .NET Foundation
+
+.NET Runtime is a [.NET Foundation](https://www.dotnetfoundation.org/projects) project.
+
+There are many .NET related projects on GitHub.
+
+* [.NET home repo](https://github.com/Microsoft/dotnet) - links to 100s of .NET projects, from Microsoft and the community.
+* [ASP.NET Core home](https://docs.microsoft.com/aspnet/core) - the best place to start learning about ASP.NET Core.
+
+This project has adopted the code of conduct defined by the [Contributor Covenant](https://contributor-covenant.org) to clarify expected behavior in our community. For more information, see the [.NET Foundation Code of Conduct](https://www.dotnetfoundation.org/code-of-conduct).
+
+General .NET OSS discussions: [.NET Foundation Discussions](https://github.com/dotnet-foundation/Home/discussions)
+
+## License
+
+.NET (including the runtime repo) is licensed under the [MIT](LICENSE.TXT) license.
diff --git a/v2/rscg_examples/Com/src/Com/Com.sln b/v2/rscg_examples/Com/src/Com/Com.sln
new file mode 100644
index 000000000..770b9ee66
--- /dev/null
+++ b/v2/rscg_examples/Com/src/Com/Com.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.8.34309.116
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComDemo", "ComDemo\ComDemo.csproj", "{C7C643B0-E687-4C9B-A694-ED307384C4D2}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {C7C643B0-E687-4C9B-A694-ED307384C4D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C7C643B0-E687-4C9B-A694-ED307384C4D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C7C643B0-E687-4C9B-A694-ED307384C4D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C7C643B0-E687-4C9B-A694-ED307384C4D2}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {AEC0D250-7C7C-4100-8ACE-50C6D7D871B2}
+ EndGlobalSection
+EndGlobal
diff --git a/v2/rscg_examples/Com/src/Com/ComDemo/ComDemo.csproj b/v2/rscg_examples/Com/src/Com/ComDemo/ComDemo.csproj
new file mode 100644
index 000000000..3bd9c5117
--- /dev/null
+++ b/v2/rscg_examples/Com/src/Com/ComDemo/ComDemo.csproj
@@ -0,0 +1,17 @@
+
+
+
+ Exe
+ net8.0
+ enable
+ enable
+ true
+
+
+
+ true
+ $(BaseIntermediateOutputPath)\GX
+
+
diff --git a/v2/rscg_examples/Com/src/Com/ComDemo/MyShell.cs b/v2/rscg_examples/Com/src/Com/ComDemo/MyShell.cs
new file mode 100644
index 000000000..810ed36be
--- /dev/null
+++ b/v2/rscg_examples/Com/src/Com/ComDemo/MyShell.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Runtime.InteropServices;
+using System.Runtime.InteropServices.Marshalling;
+
+namespace test;
+
+// Import the ShellExecute function from Shell32.dll using ComImport
+[ComImport]
+[Guid("00000000-0000-0000-C000-000000000046")]
+[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+public interface IUnknown
+{
+ void QueryInterface(ref Guid riid, out IntPtr ppvObject);
+ void AddRef();
+ void Release();
+}
+
+//[ComImport]
+[GeneratedComInterface(StringMarshalling = StringMarshalling.Utf8)]
+[Guid("000214F9-0000-0000-C000-000000000046")]
+[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+public partial interface IShellExecute
+{
+ IntPtr ShellExecute(IntPtr hwnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, int nShowCmd);
+}
+
+
+// Replace this with your actual ShellExecute COM class
+public class ShellExecuteClass : IShellExecute
+{
+ public IntPtr ShellExecute(IntPtr hwnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, int nShowCmd)
+ {
+ // Implement the ShellExecute functionality
+ return NativeMethods.ShellExecute(hwnd, lpOperation, lpFile, lpParameters, lpDirectory, nShowCmd);
+ }
+}
+
+// NativeMethods class to import necessary functions from Shell32.dll
+static class NativeMethods
+{
+ [DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ public static extern IntPtr ShellExecute(
+ IntPtr hwnd,
+ string lpOperation,
+ string lpFile,
+ string lpParameters,
+ string lpDirectory,
+ int nShowCmd
+ );
+}
diff --git a/v2/rscg_examples/Com/src/Com/ComDemo/Program.cs b/v2/rscg_examples/Com/src/Com/ComDemo/Program.cs
new file mode 100644
index 000000000..09b1915a9
--- /dev/null
+++ b/v2/rscg_examples/Com/src/Com/ComDemo/Program.cs
@@ -0,0 +1,15 @@
+using test;
+
+IShellExecute shellExecute = new ShellExecuteClass();
+
+// Open a file using the default associated program
+IntPtr result = shellExecute.ShellExecute(
+ IntPtr.Zero, // HWND (handle to parent window)
+ "open", // Operation to perform
+ "notepad.exe", // File to open (replace with your file or URL)
+ "", // Parameters
+ "", // Working directory
+ 1 // Show command (SW_SHOWNORMAL)
+);
+
+Console.WriteLine($"ShellExecute Result: {result}");
diff --git a/v2/rscg_examples/Com/video.md b/v2/rscg_examples/Com/video.md
new file mode 100644
index 000000000..070f55f4d
--- /dev/null
+++ b/v2/rscg_examples/Com/video.md
@@ -0,0 +1,31 @@
+{
+ "step_1_exec":"clipchamp.exe launch",
+ "step_2_text": "Welcome to Roslyn Examples - the introduction is automatically generated",
+ "step_3_text":"If you want to see more examples , see [List Of RSCG] https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG",
+ "step_4_browser":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG",
+ "step_5_text": "My name is Andrei Ignat and I am deeply fond of Roslyn Source Code Generator. ",
+
+"step_6_text": "Today I will present Com that is good for Generating Com Declarations .",
+"step_7_browser":"https://www.nuget.org/packages/System.Runtime.InteropServices/",
+"step_8_text": "You can download the code from https://ignatandrei.github.io/RSCG_Examples/v2/docs/Com)",
+"step_9_browser":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/Com",
+"step_10_text":" Here is the code ",
+"step_11_exec":"explorer.exe /select,D:\\gth\\RSCG_Examples\\v2\\rscg_examples\\COM\\src\\Com\\ComDemo\\ComDemo.csproj",
+"step_12_text": "So , let's start the project ",
+"step_13_exec": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\devenv.exe D:\\gth\\RSCG_Examples\\v2\\rscg_examples\\COM\\src\\Com\\ComDemo\\ComDemo.csproj",
+
+"step_14_text": "You put the [System.Runtime.InteropServices](https://www.nuget.org/packages/System.Runtime.InteropServices/) into the csproj ",
+
+"step_15_exec": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\devenv.exe /edit D:\\gth\\RSCG_Examples\\v2\\rscg_examples\\COM\\src\\Com\\ComDemo\\ComDemo.csproj",
+
+"step_16_text": "I have used the Com in those files",
+
+
+ "step_17_exec":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\devenv.exe /edit D:\\gth\\RSCG_Examples\\v2\\rscg_examples\\COM\\src\\Com\\ComDemo\\MyShell.cs",
+
+ "step_18_exec":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\devenv.exe /edit D:\\gth\\RSCG_Examples\\v2\\rscg_examples\\COM\\src\\Com\\ComDemo\\Program.cs",
+
+"step_19_hide": "hide"
+
+
+}
\ No newline at end of file
diff --git a/v2/rscg_examples_site/docs/Microsoft/Microsoft.Interop.JavaScript.JSImportGenerator_Microsoft.Interop.JavaScript.JSExportGenerator.md b/v2/rscg_examples_site/docs/Microsoft/Microsoft.Interop.JavaScript.JSImportGenerator_Microsoft.Interop.JavaScript.JSExportGenerator.md
index e515d840f..c9ee6d5db 100644
--- a/v2/rscg_examples_site/docs/Microsoft/Microsoft.Interop.JavaScript.JSImportGenerator_Microsoft.Interop.JavaScript.JSExportGenerator.md
+++ b/v2/rscg_examples_site/docs/Microsoft/Microsoft.Interop.JavaScript.JSImportGenerator_Microsoft.Interop.JavaScript.JSExportGenerator.md
@@ -43,7 +43,7 @@ namespace TestBlazor.Pages
{
public partial class CallJavaScript1
{
- internal static unsafe void __Wrapper_GetMessageFromDotnet_1441469809(global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument* __arguments_buffer)
+ internal static unsafe void __Wrapper_GetMessageFromDotnet_233030703(global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument* __arguments_buffer)
{
string s;
ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __arg_exception = ref __arguments_buffer[0];
@@ -65,12 +65,12 @@ namespace TestBlazor.Pages
}
[global::System.Runtime.CompilerServices.ModuleInitializerAttribute]
- [global::System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute("__Wrapper_GetMessageFromDotnet_1441469809", typeof(TestBlazor.Pages.CallJavaScript1))]
- internal static void __Register_GetMessageFromDotnet_1441469809()
+ [global::System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute("__Wrapper_GetMessageFromDotnet_233030703", typeof(TestBlazor.Pages.CallJavaScript1))]
+ internal static void __Register_GetMessageFromDotnet_233030703()
{
if (global::System.Runtime.InteropServices.RuntimeInformation.OSArchitecture != global::System.Runtime.InteropServices.Architecture.Wasm)
return;
- global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding.BindManagedFunction("[TestBlazor]TestBlazor.Pages.CallJavaScript1:GetMessageFromDotnet", 1441469809, new global::System.Runtime.InteropServices.JavaScript.JSMarshalerType[] { global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.String, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.String });
+ global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding.BindManagedFunction("[TestBlazor]TestBlazor.Pages.CallJavaScript1:GetMessageFromDotnet", 233030703, new global::System.Runtime.InteropServices.JavaScript.JSMarshalerType[] { global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.String, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.String });
}
}
}
diff --git a/v2/rscg_examples_site/docs/Microsoft/Microsoft.Interop.JavaScript.JSImportGenerator_Microsoft.Interop.JavaScript.JSImportGenerator.md b/v2/rscg_examples_site/docs/Microsoft/Microsoft.Interop.JavaScript.JSImportGenerator_Microsoft.Interop.JavaScript.JSImportGenerator.md
index 90dbddb4c..f107bb34d 100644
--- a/v2/rscg_examples_site/docs/Microsoft/Microsoft.Interop.JavaScript.JSImportGenerator_Microsoft.Interop.JavaScript.JSImportGenerator.md
+++ b/v2/rscg_examples_site/docs/Microsoft/Microsoft.Interop.JavaScript.JSImportGenerator_Microsoft.Interop.JavaScript.JSImportGenerator.md
@@ -46,9 +46,9 @@ namespace TestBlazor.Pages
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.JavaScript.JSImportGenerator", "7.0.9.1910")]
internal static partial string GetWelcomeMessage(string s)
{
- if (__signature_GetWelcomeMessage_1441469809 == null)
+ if (__signature_GetWelcomeMessage_233030703 == null)
{
- __signature_GetWelcomeMessage_1441469809 = global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding.BindJSFunction("getMessage", "CallJavaScript1", new global::System.Runtime.InteropServices.JavaScript.JSMarshalerType[] { global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.String, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.String });
+ __signature_GetWelcomeMessage_233030703 = global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding.BindJSFunction("getMessage", "CallJavaScript1", new global::System.Runtime.InteropServices.JavaScript.JSMarshalerType[] { global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.String, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.String });
}
global::System.Span __arguments_buffer = stackalloc global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument[3];
@@ -60,14 +60,14 @@ namespace TestBlazor.Pages
// Setup - Perform required setup.
ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __s_native__js_arg = ref __arguments_buffer[2];
__s_native__js_arg.ToJS(s);
- global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding.InvokeJS(__signature_GetWelcomeMessage_1441469809, __arguments_buffer);
+ global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding.InvokeJS(__signature_GetWelcomeMessage_233030703, __arguments_buffer);
// Unmarshal - Convert native data to managed data.
__arg_return.ToManaged(out __retVal);
return __retVal;
}
[global::System.ThreadStaticAttribute]
- static global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding __signature_GetWelcomeMessage_1441469809;
+ static global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding __signature_GetWelcomeMessage_233030703;
}
}
diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/Com.md b/v2/rscg_examples_site/docs/RSCG-Examples/Com.md
new file mode 100644
index 000000000..bbafdda58
--- /dev/null
+++ b/v2/rscg_examples_site/docs/RSCG-Examples/Com.md
@@ -0,0 +1,456 @@
+---
+sidebar_position: 880
+title: 88 - Com
+description: Generating Com Declarations
+slug: /Com
+---
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+import TOCInline from '@theme/TOCInline';
+
+# Com by Microsoft
+
+
+
+
+[![Nuget](https://img.shields.io/nuget/dt/System.Runtime.InteropServices?label=System.Runtime.InteropServices)](https://www.nuget.org/packages/System.Runtime.InteropServices/)
+[![GitHub last commit](https://img.shields.io/github/last-commit/dotnet/runtime?label=updated)](https://github.com/dotnet/runtime)
+![GitHub Repo stars](https://img.shields.io/github/stars/dotnet/runtime?style=social)
+
+## Details
+
+### Info
+:::info
+
+Name: **Com**
+
+Provides types that support COM interop and platform invoke services.
+
+Commonly Used Types:
+System.Runtime.InteropServices.GCHandle
+System.Runtime.InteropServices.GuidAttribute
+System.Runtime.InteropServices.COMException
+System.DllNotFoundException
+System.Runtime.InteropServices.DllImportAttribute
+
+Author: Microsoft
+
+NuGet:
+*https://www.nuget.org/packages/System.Runtime.InteropServices/*
+
+
+You can find more details at https://learn.microsoft.com/en-us/dotnet/standard/native-interop/comwrappers-source-generation
+
+Source : https://github.com/dotnet/runtime
+
+:::
+
+### Original Readme
+:::note
+
+# .NET Runtime
+
+[![Build Status](https://dev.azure.com/dnceng-public/public/_apis/build/status/dotnet/runtime/runtime?branchName=main)](https://dev.azure.com/dnceng-public/public/_build/latest?definitionId=129&branchName=main)
+[![Help Wanted](https://img.shields.io/github/issues/dotnet/runtime/help%20wanted?style=flat-square&color=%232EA043&label=help%20wanted)](https://github.com/dotnet/runtime/labels/help%20wanted)
+[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dotnet/runtime)
+[![Discord](https://img.shields.io/discord/732297728826277939?style=flat-square&label=Discord&logo=discord&logoColor=white&color=7289DA)](https://aka.ms/dotnet-discord)
+
+* [What is .NET?](#what-is-net)
+* [How can I contribute?](#how-can-i-contribute)
+* [Reporting security issues and security bugs](#reporting-security-issues-and-security-bugs)
+* [Filing issues](#filing-issues)
+* [Useful Links](#useful-links)
+* [.NET Foundation](#net-foundation)
+* [License](#license)
+
+This repo contains the code to build the .NET runtime, libraries and shared host (`dotnet`) installers for
+all supported platforms, as well as the sources to .NET runtime and libraries.
+
+## What is .NET?
+
+Official Starting Page:
+
+* [How to use .NET](https://docs.microsoft.com/dotnet/core/get-started) (with VS, VS Code, command-line CLI)
+ * [Install official releases](https://dotnet.microsoft.com/download)
+ * [Install daily builds](https://github.com/dotnet/runtime/docs/project/dogfooding.md)
+ * [Documentation](https://docs.microsoft.com/dotnet/core) (Get Started, Tutorials, Porting from .NET Framework, API reference, ...)
+ * [Deploying apps](https://docs.microsoft.com/dotnet/core/deploying)
+ * [Supported OS versions](https://github.com/dotnet/core/blob/main/os-lifecycle-policy.md)
+* [Roadmap](https://github.com/dotnet/core/blob/main/roadmap.md)
+* [Releases](https://github.com/dotnet/core/tree/main/release-notes)
+
+## How can I contribute?
+
+We welcome contributions! Many people all over the world have helped make this project better.
+
+* [Contributing](https://github.com/dotnet/runtime/CONTRIBUTING.md) explains what kinds of contributions we welcome
+* [Workflow Instructions](https://github.com/dotnet/runtime/docs/workflow/README.md) explains how to build and test
+* [Get Up and Running on .NET Core](https://github.com/dotnet/runtime/docs/project/dogfooding.md) explains how to get nightly builds of the runtime and its libraries to test them in your own projects.
+
+## Reporting security issues and security bugs
+
+Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) . You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the [Security TechCenter](https://www.microsoft.com/msrc/faqs-report-an-issue). You can also find these instructions in this repo's [Security doc](https://github.com/dotnet/runtime/SECURITY.md).
+
+Also see info about related [Microsoft .NET Core and ASP.NET Core Bug Bounty Program](https://www.microsoft.com/msrc/bounty-dot-net-core).
+
+## Filing issues
+
+This repo should contain issues that are tied to the runtime, the class libraries and frameworks, the installation of the `dotnet` binary (sometimes known as the `muxer`) and the installation of the .NET runtime and libraries.
+
+For other issues, please file them to their appropriate sibling repos. We have links to many of them on [our new issue page](https://github.com/dotnet/runtime/issues/new/choose).
+
+## Useful Links
+
+* [.NET Core source index](https://source.dot.net) / [.NET Framework source index](https://referencesource.microsoft.com)
+* [API Reference docs](https://docs.microsoft.com/dotnet/api)
+* [.NET API Catalog](https://apisof.net) (incl. APIs from daily builds and API usage info)
+* [API docs writing guidelines](https://github.com/dotnet/dotnet-api-docs/wiki) - useful when writing /// comments
+* [.NET Discord Server](https://aka.ms/dotnet-discord) - a place to discuss the development of .NET and its ecosystem
+
+## .NET Foundation
+
+.NET Runtime is a [.NET Foundation](https://www.dotnetfoundation.org/projects) project.
+
+There are many .NET related projects on GitHub.
+
+* [.NET home repo](https://github.com/Microsoft/dotnet) - links to 100s of .NET projects, from Microsoft and the community.
+* [ASP.NET Core home](https://docs.microsoft.com/aspnet/core) - the best place to start learning about ASP.NET Core.
+
+This project has adopted the code of conduct defined by the [Contributor Covenant](https://contributor-covenant.org) to clarify expected behavior in our community. For more information, see the [.NET Foundation Code of Conduct](https://www.dotnetfoundation.org/code-of-conduct).
+
+General .NET OSS discussions: [.NET Foundation Discussions](https://github.com/dotnet-foundation/Home/discussions)
+
+## License
+
+.NET (including the runtime repo) is licensed under the [MIT](LICENSE.TXT) license.
+
+
+:::
+
+### About
+:::note
+
+Generating Com Declarations
+
+
+:::
+
+## How to use
+
+### Example ( source csproj, source files )
+
+
+
+
+
+This is the CSharp Project that references **Com**
+```xml showLineNumbers {10}
+
+
+
+ Exe
+ net8.0
+ enable
+ enable
+ true
+
+
+
+ true
+ $(BaseIntermediateOutputPath)\GX
+
+
+
+```
+
+
+
+
+
+ This is the use of **Com** in *Program.cs*
+
+```csharp showLineNumbers
+using test;
+
+IShellExecute shellExecute = new ShellExecuteClass();
+
+// Open a file using the default associated program
+IntPtr result = shellExecute.ShellExecute(
+ IntPtr.Zero, // HWND (handle to parent window)
+ "open", // Operation to perform
+ "notepad.exe", // File to open (replace with your file or URL)
+ "", // Parameters
+ "", // Working directory
+ 1 // Show command (SW_SHOWNORMAL)
+);
+
+Console.WriteLine($"ShellExecute Result: {result}");
+
+```
+
+
+
+
+ This is the use of **Com** in *MyShell.cs*
+
+```csharp showLineNumbers
+using System;
+using System.Runtime.InteropServices;
+using System.Runtime.InteropServices.Marshalling;
+
+namespace test;
+
+// Import the ShellExecute function from Shell32.dll using ComImport
+[ComImport]
+[Guid("00000000-0000-0000-C000-000000000046")]
+[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+public interface IUnknown
+{
+ void QueryInterface(ref Guid riid, out IntPtr ppvObject);
+ void AddRef();
+ void Release();
+}
+
+//[ComImport]
+[GeneratedComInterface(StringMarshalling = StringMarshalling.Utf8)]
+[Guid("000214F9-0000-0000-C000-000000000046")]
+[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+public partial interface IShellExecute
+{
+ IntPtr ShellExecute(IntPtr hwnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, int nShowCmd);
+}
+
+
+// Replace this with your actual ShellExecute COM class
+public class ShellExecuteClass : IShellExecute
+{
+ public IntPtr ShellExecute(IntPtr hwnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, int nShowCmd)
+ {
+ // Implement the ShellExecute functionality
+ return NativeMethods.ShellExecute(hwnd, lpOperation, lpFile, lpParameters, lpDirectory, nShowCmd);
+ }
+}
+
+// NativeMethods class to import necessary functions from Shell32.dll
+static class NativeMethods
+{
+ [DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ public static extern IntPtr ShellExecute(
+ IntPtr hwnd,
+ string lpOperation,
+ string lpFile,
+ string lpParameters,
+ string lpDirectory,
+ int nShowCmd
+ );
+}
+
+```
+
+
+
+
+### Generated Files
+
+Those are taken from $(BaseIntermediateOutputPath)\GX
+
+
+
+
+
+
+
+```csharp showLineNumbers
+//
+#pragma warning disable CS0612, CS0618
+file unsafe class InterfaceInformation : global::System.Runtime.InteropServices.Marshalling.IIUnknownInterfaceType
+{
+ public static global::System.Guid Iid { get; } = new(new global::System.ReadOnlySpan(new byte[] { 249, 20, 2, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70 }));
+
+ private static void** _vtable;
+ public static void** ManagedVirtualMethodTable => _vtable != null ? _vtable : (_vtable = InterfaceImplementation.CreateManagedVirtualFunctionTable());
+}
+
+[global::System.Runtime.InteropServices.DynamicInterfaceCastableImplementationAttribute]
+file unsafe partial interface InterfaceImplementation : global::test.IShellExecute
+{
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.ComInterfaceGenerator", "8.0.9.3103")]
+ [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
+ nint global::test.IShellExecute.ShellExecute(nint hwnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, int nShowCmd)
+ {
+ var(__this, __vtable_native) = ((global::System.Runtime.InteropServices.Marshalling.IUnmanagedVirtualMethodTableProvider)this).GetVirtualMethodTableInfoForKey(typeof(global::test.IShellExecute));
+ byte* __lpOperation_native = default;
+ byte* __lpFile_native = default;
+ byte* __lpParameters_native = default;
+ byte* __lpDirectory_native = default;
+ nint __retVal = default;
+ int __invokeRetVal = default;
+ // Setup - Perform required setup.
+ scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __lpDirectory_native__marshaller = new();
+ scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __lpParameters_native__marshaller = new();
+ scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __lpFile_native__marshaller = new();
+ scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __lpOperation_native__marshaller = new();
+ try
+ {
+ // Marshal - Convert managed data to native data.
+ __lpDirectory_native__marshaller.FromManaged(lpDirectory, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
+ __lpParameters_native__marshaller.FromManaged(lpParameters, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
+ __lpFile_native__marshaller.FromManaged(lpFile, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
+ __lpOperation_native__marshaller.FromManaged(lpOperation, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
+ {
+ // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
+ __lpDirectory_native = __lpDirectory_native__marshaller.ToUnmanaged();
+ __lpParameters_native = __lpParameters_native__marshaller.ToUnmanaged();
+ __lpFile_native = __lpFile_native__marshaller.ToUnmanaged();
+ __lpOperation_native = __lpOperation_native__marshaller.ToUnmanaged();
+ __invokeRetVal = ((delegate* unmanaged[MemberFunction] )__vtable_native[3])(__this, hwnd, __lpOperation_native, __lpFile_native, __lpParameters_native, __lpDirectory_native, nShowCmd, &__retVal);
+ }
+
+ // NotifyForSuccessfulInvoke - Keep alive any managed objects that need to stay alive across the call.
+ global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal);
+ global::System.GC.KeepAlive(this);
+ }
+ finally
+ {
+ // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
+ __lpDirectory_native__marshaller.Free();
+ __lpParameters_native__marshaller.Free();
+ __lpFile_native__marshaller.Free();
+ __lpOperation_native__marshaller.Free();
+ }
+
+ return __retVal;
+ }
+}
+
+file unsafe partial interface InterfaceImplementation
+{
+ [global::System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute(CallConvs = new[] { typeof(global::System.Runtime.CompilerServices.CallConvMemberFunction) })]
+ internal static int ABI_ShellExecute(global::System.Runtime.InteropServices.ComWrappers.ComInterfaceDispatch* __this_native, nint hwnd, byte* __lpOperation_native, byte* __lpFile_native, byte* __lpParameters_native, byte* __lpDirectory_native, int nShowCmd, nint* __invokeRetValUnmanaged__param)
+ {
+ global::test.IShellExecute @this = default;
+ string lpOperation = default;
+ string lpFile = default;
+ string lpParameters = default;
+ string lpDirectory = default;
+ ref nint __invokeRetValUnmanaged = ref *__invokeRetValUnmanaged__param;
+ nint __invokeRetVal = default;
+ int __retVal = default;
+ try
+ {
+ // Unmarshal - Convert native data to managed data.
+ lpDirectory = global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ConvertToManaged(__lpDirectory_native);
+ lpParameters = global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ConvertToManaged(__lpParameters_native);
+ lpFile = global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ConvertToManaged(__lpFile_native);
+ lpOperation = global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ConvertToManaged(__lpOperation_native);
+ @this = global::System.Runtime.InteropServices.ComWrappers.ComInterfaceDispatch.GetInstance(__this_native);
+ __invokeRetVal = @this.ShellExecute(hwnd, lpOperation, lpFile, lpParameters, lpDirectory, nShowCmd);
+ // NotifyForSuccessfulInvoke - Keep alive any managed objects that need to stay alive across the call.
+ __retVal = 0; // S_OK
+ // Marshal - Convert managed data to native data.
+ __invokeRetValUnmanaged = __invokeRetVal;
+ }
+ catch (global::System.Exception __exception)
+ {
+ __retVal = global::System.Runtime.InteropServices.Marshalling.ExceptionAsHResultMarshaller.ConvertToUnmanaged(__exception);
+ }
+
+ return __retVal;
+ }
+}
+
+file unsafe partial interface InterfaceImplementation
+{
+ internal static void** CreateManagedVirtualFunctionTable()
+ {
+ void** vtable = (void**)global::System.Runtime.CompilerServices.RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(global::test.IShellExecute), sizeof(void*) * 4);
+ {
+ nint v0, v1, v2;
+ global::System.Runtime.InteropServices.ComWrappers.GetIUnknownImpl(out v0, out v1, out v2);
+ vtable[0] = (void*)v0;
+ vtable[1] = (void*)v1;
+ vtable[2] = (void*)v2;
+ }
+
+ {
+ vtable[3] = (void*)(delegate* unmanaged[MemberFunction] )&ABI_ShellExecute;
+ }
+
+ return vtable;
+ }
+}
+
+namespace test
+{
+ [global::System.Runtime.InteropServices.Marshalling.IUnknownDerivedAttribute]
+ public partial interface IShellExecute
+ {
+ }
+}
+
+namespace test
+{
+ public partial interface IShellExecute
+ {
+ }
+}
+```
+
+
+
+
+
+
+## Usefull
+
+### Download Example (.NET C# )
+
+:::tip
+
+[Download Example project Com ](/sources/Com.zip)
+
+:::
+
+
+### Share Com
+
+
+
+https://ignatandrei.github.io/RSCG_Examples/v2/docs/Com
+
+## In the same category (EnhancementProject)
+
+
+### [DeeDee](/docs/DeeDee)
+
+
+### [Matryoshki](/docs/Matryoshki)
+
+
+### [Mediator](/docs/Mediator)
+
+
+### [ProxyGen](/docs/ProxyGen)
+
+
+### [RSCG_AMS](/docs/RSCG_AMS)
+
+
+### [RSCG_FunctionsWithDI](/docs/RSCG_FunctionsWithDI)
+
+
+### [RSCG_TimeBombComment](/docs/RSCG_TimeBombComment)
+
+
+### [SourceGenerator.Helper.CopyCode](/docs/SourceGenerator.Helper.CopyCode)
+
+
+### [ThisAssembly](/docs/ThisAssembly)
+
diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/DeeDee.md b/v2/rscg_examples_site/docs/RSCG-Examples/DeeDee.md
index d0e07baa3..140d72469 100644
--- a/v2/rscg_examples_site/docs/RSCG-Examples/DeeDee.md
+++ b/v2/rscg_examples_site/docs/RSCG-Examples/DeeDee.md
@@ -408,6 +408,9 @@ https://ignatandrei.github.io/RSCG_Examples/v2/docs/DeeDee
## In the same category (EnhancementProject)
+### [Com](/docs/Com)
+
+
### [Matryoshki](/docs/Matryoshki)
diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/Matryoshki.md b/v2/rscg_examples_site/docs/RSCG-Examples/Matryoshki.md
index 2aacc46e8..22cdfe8cb 100644
--- a/v2/rscg_examples_site/docs/RSCG-Examples/Matryoshki.md
+++ b/v2/rscg_examples_site/docs/RSCG-Examples/Matryoshki.md
@@ -548,6 +548,9 @@ https://ignatandrei.github.io/RSCG_Examples/v2/docs/Matryoshki
## In the same category (EnhancementProject)
+### [Com](/docs/Com)
+
+
### [DeeDee](/docs/DeeDee)
diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/Mediator.md b/v2/rscg_examples_site/docs/RSCG-Examples/Mediator.md
index 395d632fd..32cb8792d 100644
--- a/v2/rscg_examples_site/docs/RSCG-Examples/Mediator.md
+++ b/v2/rscg_examples_site/docs/RSCG-Examples/Mediator.md
@@ -1658,6 +1658,9 @@ https://ignatandrei.github.io/RSCG_Examples/v2/docs/Mediator
## In the same category (EnhancementProject)
+### [Com](/docs/Com)
+
+
### [DeeDee](/docs/DeeDee)
diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/ProxyGen.md b/v2/rscg_examples_site/docs/RSCG-Examples/ProxyGen.md
index 858444ef5..4e427ed9f 100644
--- a/v2/rscg_examples_site/docs/RSCG-Examples/ProxyGen.md
+++ b/v2/rscg_examples_site/docs/RSCG-Examples/ProxyGen.md
@@ -399,6 +399,9 @@ https://ignatandrei.github.io/RSCG_Examples/v2/docs/ProxyGen
## In the same category (EnhancementProject)
+### [Com](/docs/Com)
+
+
### [DeeDee](/docs/DeeDee)
diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/RSCG_AMS.md b/v2/rscg_examples_site/docs/RSCG-Examples/RSCG_AMS.md
index 5eb25f197..e3aeea6c5 100644
--- a/v2/rscg_examples_site/docs/RSCG-Examples/RSCG_AMS.md
+++ b/v2/rscg_examples_site/docs/RSCG-Examples/RSCG_AMS.md
@@ -1117,6 +1117,9 @@ https://ignatandrei.github.io/RSCG_Examples/v2/docs/RSCG_AMS
## In the same category (EnhancementProject)
+### [Com](/docs/Com)
+
+
### [DeeDee](/docs/DeeDee)
diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/RSCG_FunctionsWithDI.md b/v2/rscg_examples_site/docs/RSCG-Examples/RSCG_FunctionsWithDI.md
index 9b84b044c..cd052b210 100644
--- a/v2/rscg_examples_site/docs/RSCG-Examples/RSCG_FunctionsWithDI.md
+++ b/v2/rscg_examples_site/docs/RSCG-Examples/RSCG_FunctionsWithDI.md
@@ -379,6 +379,9 @@ https://ignatandrei.github.io/RSCG_Examples/v2/docs/RSCG_FunctionsWithDI
## In the same category (EnhancementProject)
+### [Com](/docs/Com)
+
+
### [DeeDee](/docs/DeeDee)
diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/RSCG_TimeBombComment.md b/v2/rscg_examples_site/docs/RSCG-Examples/RSCG_TimeBombComment.md
index d2334a620..5eede3cb1 100644
--- a/v2/rscg_examples_site/docs/RSCG-Examples/RSCG_TimeBombComment.md
+++ b/v2/rscg_examples_site/docs/RSCG-Examples/RSCG_TimeBombComment.md
@@ -234,6 +234,9 @@ https://ignatandrei.github.io/RSCG_Examples/v2/docs/RSCG_TimeBombComment
## In the same category (EnhancementProject)
+### [Com](/docs/Com)
+
+
### [DeeDee](/docs/DeeDee)
diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/SourceGenerator.Helper.CopyCode.md b/v2/rscg_examples_site/docs/RSCG-Examples/SourceGenerator.Helper.CopyCode.md
index fec0b2f79..b15ed3765 100644
--- a/v2/rscg_examples_site/docs/RSCG-Examples/SourceGenerator.Helper.CopyCode.md
+++ b/v2/rscg_examples_site/docs/RSCG-Examples/SourceGenerator.Helper.CopyCode.md
@@ -283,6 +283,9 @@ https://ignatandrei.github.io/RSCG_Examples/v2/docs/SourceGenerator.Helper.CopyC
## In the same category (EnhancementProject)
+### [Com](/docs/Com)
+
+
### [DeeDee](/docs/DeeDee)
diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/ThisAssembly.md b/v2/rscg_examples_site/docs/RSCG-Examples/ThisAssembly.md
index 2235ce76c..98110d2c4 100644
--- a/v2/rscg_examples_site/docs/RSCG-Examples/ThisAssembly.md
+++ b/v2/rscg_examples_site/docs/RSCG-Examples/ThisAssembly.md
@@ -907,6 +907,9 @@ https://ignatandrei.github.io/RSCG_Examples/v2/docs/ThisAssembly
## In the same category (EnhancementProject)
+### [Com](/docs/Com)
+
+
### [DeeDee](/docs/DeeDee)
diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/index.md b/v2/rscg_examples_site/docs/RSCG-Examples/index.md
index 0a93b4f83..902e6bd33 100644
--- a/v2/rscg_examples_site/docs/RSCG-Examples/index.md
+++ b/v2/rscg_examples_site/docs/RSCG-Examples/index.md
@@ -1,7 +1,7 @@
---
sidebar_position: 30
-title: 87 RSCG by category
-description: 87 RSCG by category
+title: 88 RSCG by category
+description: 88 RSCG by category
slug: /rscg-examples
---
@@ -260,7 +260,7 @@ import DocCardList from '@theme/DocCardList';
## EnhancementProject
- Expand EnhancementProject =>examples:9
+ Expand EnhancementProject =>examples:10
@@ -306,6 +306,11 @@ import DocCardList from '@theme/DocCardList';
[SourceGenerator.Helper.CopyCode](/docs/SourceGenerator.Helper.CopyCode)
+
+
+
+[Com](/docs/Com)
+
@@ -669,6 +674,8 @@ flowchart LR;
EnhancementProject--> SourceGenerator.Helper.CopyCode((SourceGenerator.Helper.CopyCode))
+ EnhancementProject--> Com((Com))
+
Enum--> NetEscapades.EnumGenerators((NetEscapades.EnumGenerators))
Enum--> EnumClass((EnumClass))
diff --git a/v2/rscg_examples_site/docs/about.md b/v2/rscg_examples_site/docs/about.md
index f67c03459..ce6b5a94f 100644
--- a/v2/rscg_examples_site/docs/about.md
+++ b/v2/rscg_examples_site/docs/about.md
@@ -6,7 +6,7 @@ title: About
## Content
You will find here code examples
-of 87 Roslyn Source Code Generator (RSCG)
+of 88 Roslyn Source Code Generator (RSCG)
that can be useful for you. That means, you will write more elegant and concise code - even if the generators code is not always nice to look.
## Are those examples ready for production?
diff --git a/v2/rscg_examples_site/docs/indexRSCG.md b/v2/rscg_examples_site/docs/indexRSCG.md
index a28a837e0..a5eb703d8 100644
--- a/v2/rscg_examples_site/docs/indexRSCG.md
+++ b/v2/rscg_examples_site/docs/indexRSCG.md
@@ -10,9 +10,9 @@ import useBaseUrl from '@docusaurus/useBaseUrl';
;
-## 87 RSCG with examples in descending chronological order
+## 88 RSCG with examples in descending chronological order
-This is the list of 87 ( 9 from Microsoft) RSCG with examples
+This is the list of 88 ( 9 from Microsoft) RSCG with examples
[See as json](/exports/RSCG.json) [See as Excel](/exports/RSCG.xlsx)
@@ -23,6 +23,7 @@ This is the list of 87 ( 9 from Microsoft) RSCG with examples
| No | Name | Date | Category |
| --------- | ----- | ---- | -------- |
+|88| [Com by Microsoft ](/docs/Com)|2023-11-20 => 20 November 2023 | EnhancementProject |
|87| [RDG by Microsoft ](/docs/RDG)|2023-11-19 => 19 November 2023 | API |
|86| [Microsoft.Extensions.Configuration.Binder by Microsoft ](/docs/Microsoft.Extensions.Configuration.Binder)|2023-11-18 => 18 November 2023 | API |
|85| [Microsoft.Extensions.Options.Generators.OptionsValidatorGenerator by Microsoft ](/docs/Microsoft.Extensions.Options.Generators.OptionsValidatorGenerator)|2023-11-17 => 17 November 2023 | EnhancementClass |
diff --git a/v2/rscg_examples_site/src/components/HomepageFeatures/index.tsx b/v2/rscg_examples_site/src/components/HomepageFeatures/index.tsx
index 671cbe533..4b6f254af 100644
--- a/v2/rscg_examples_site/src/components/HomepageFeatures/index.tsx
+++ b/v2/rscg_examples_site/src/components/HomepageFeatures/index.tsx
@@ -10,7 +10,7 @@ type FeatureItem = {
const FeatureList: FeatureItem[] = [
{
-title: '87 Examples (9 from MSFT)',
+title: '88 Examples (9 from MSFT)',
Svg: require('@site/static/img/undraw_docusaurus_mountain.svg').default,
description: (
<>
diff --git a/v2/rscg_examples_site/static/exports/RSCG.json b/v2/rscg_examples_site/static/exports/RSCG.json
index 253f3665c..f516ea942 100644
--- a/v2/rscg_examples_site/static/exports/RSCG.json
+++ b/v2/rscg_examples_site/static/exports/RSCG.json
@@ -697,6 +697,14 @@
"Source": "https://github.com/dotnet/aspnetcore",
"Category": "API",
"AddedOn": "2023-11-19T00:00:00"
+ },
+ {
+ "Name": "Com",
+ "Link": "https://ignatandrei.github.io/RSCG_Examples/v2/docs/COM",
+ "NuGet": "https://www.nuget.org/packages/System.Runtime.InteropServices/",
+ "Source": "https://github.com/dotnet/runtime",
+ "Category": "EnhancementProject",
+ "AddedOn": "2023-11-20T00:00:00"
}
]
}
\ No newline at end of file
diff --git a/v2/rscg_examples_site/static/exports/RSCG.xlsx b/v2/rscg_examples_site/static/exports/RSCG.xlsx
index 5b88318e9..803d14381 100644
Binary files a/v2/rscg_examples_site/static/exports/RSCG.xlsx and b/v2/rscg_examples_site/static/exports/RSCG.xlsx differ
diff --git a/v2/rscg_examples_site/static/sources/Com.zip b/v2/rscg_examples_site/static/sources/Com.zip
new file mode 100644
index 000000000..121039300
Binary files /dev/null and b/v2/rscg_examples_site/static/sources/Com.zip differ