Skip to content
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
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Building, testing, and packing this repository can be done by using the standard
The win32metadata has [these little "gems"](https://github.com/microsoft/win32metadata/blob/main/docs/projections.md) that CsWin32 should consider consuming to improve the quality of the generated APIs.
When we identify a gem that we should support but do not yet support, file [an issue with a `metadata gem` label](https://github.com/microsoft/CsWin32/issues?q=is%3Aissue+is%3Aopen+label%3A%22metadata+gem%22).

[pwsh]: https://docs.microsoft.com/powershell/scripting/install/installing-powershell?view=powershell-6
[pwsh]: https://learn.microsoft.com/powershell/scripting/install/installing-powershell

## Releases

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Rapidly add P/Invoke methods and supporting types to your C# project.
* No bulky assemblies to ship alongside your application.
* `SafeHandle`-types automatically generated.
* Generates xml documentation based on and links back to docs.microsoft.com
* Generates xml documentation based on and links back to learn.microsoft.com

![Animation demonstrating p/invoke code generation](docfx/images/demo.gif)

Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).

If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/previous-versions/tn-archive/cc751383(v=technet.10)), please report it to us as described below.
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://learn.microsoft.com/previous-versions/tn-archive/cc751383(v=technet.10)), please report it to us as described below.

## Reporting Security Issues

Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines/PostPRMessage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ param(
$CommentState='Active'
)

# See https://docs.microsoft.com/en-us/dotnet/api/microsoft.teamfoundation.sourcecontrol.webapi.commentthreadstatus?view=azure-devops-dotnet
# See https://learn.microsoft.com/dotnet/api/microsoft.teamfoundation.sourcecontrol.webapi.commentthreadstatus
if ($CommentState -eq 'Active') {
$StatusCode = 1
} elseif ($CommentState -eq 'ByDesign') {
Expand Down Expand Up @@ -38,7 +38,7 @@ $body = ConvertTo-Json @{
Write-Verbose "Posting JSON payload: `n$Body"

# Post the message to the Pull Request
# https://docs.microsoft.com/en-us/rest/api/azure/devops/git/pull%20request%20threads?view=azure-devops-rest-5.1
# https://learn.microsoft.com/rest/api/azure/devops/git/pull-request-threads
$url = "$($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$env:SYSTEM_TEAMPROJECTID/_apis/git/repositories/$($env:BUILD_REPOSITORY_NAME)/pullRequests/$($env:SYSTEM_PULLREQUEST_PULLREQUESTID)/threads?api-version=5.1"
if ($PSCmdlet.ShouldProcess($url, 'Post comment via REST call')) {
try {
Expand Down
2 changes: 1 addition & 1 deletion azurepipelines-coverage.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# https://learn.microsoft.com/azure/devops/pipelines/test/codecoverage-for-pullrequests?view=azure-devops
# https://learn.microsoft.com/azure/devops/pipelines/test/codecoverage-for-pullrequests
coverage:
status:
comments: on # add comment to PRs reporting diff in coverage of modified files
Expand Down
2 changes: 1 addition & 1 deletion docfx/docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
* No bulky assemblies to ship alongside your application.
* Generate the optimal code for your target framework and C# language version.
* `SafeHandle`-types automatically generated.
* Generates xml documentation based on and links back to docs.microsoft.com
* Generates xml documentation based on and links back to learn.microsoft.com

![Animation demonstrating p/invoke code generation](../images/demo.gif)
4 changes: 2 additions & 2 deletions src/Microsoft.Windows.CsWin32/Generator.ApiDocs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private T AddApiDocumentation<T>(string api, T memberDeclaration)
else if (docs.HelpLink is object)
{
docCommentsBuilder.AppendLine();
docCommentsBuilder.AppendLine($@"/// <para><see href=""{docs.HelpLink}"">Learn more about this API from docs.microsoft.com</see>.</para>");
docCommentsBuilder.AppendLine($@"/// <para><see href=""{docs.HelpLink}"">Learn more about this API from learn.microsoft.com</see>.</para>");
docCommentsBuilder.Append("/// ");
}

Expand Down Expand Up @@ -211,7 +211,7 @@ static void EmitDoc(string yamlDocSrc, StringBuilder docCommentsBuilder, ApiDeta

if (docs is object)
{
docCommentsBuilder.AppendLine($@"/// <para><see href=""{docs.HelpLink}#{docsAnchor}"">Read more on docs.microsoft.com</see>.</para>");
docCommentsBuilder.AppendLine($@"/// <para><see href=""{docs.HelpLink}#{docsAnchor}"">Read more on learn.microsoft.com</see>.</para>");
}

docCommentsBuilder.Append("/// ");
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.Windows.CsWin32/Generator.Invariants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public partial class Generator
/// <remarks>
/// This list is combined with an MSBuild item list so that 3rd party metadata can document app-local DLLs.
/// </remarks>
/// <see href="https://docs.microsoft.com/en-us/windows/win32/debug/dbghelp-versions" />
/// <see href="https://learn.microsoft.com/windows/win32/debug/dbghelp-versions" />
private static readonly string[] BuiltInAppLocalLibraries = ["DbgHelp.dll", "SymSrv.dll", "SrcSrv.dll"];

// [DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
Expand Down Expand Up @@ -323,7 +323,7 @@ public partial class Generator
/// Gets a map of interop APIs that should never be generated, whether marshaling is allowed or not, and messages to emit in diagnostics if these APIs are ever directly requested.
/// </summary>
internal static ImmutableDictionary<string, string> BannedAPIsWithoutMarshaling { get; } = ImmutableDictionary<string, string>.Empty
.Add("GetLastError", "Do not generate GetLastError. Call Marshal.GetLastWin32Error() instead. Learn more from https://docs.microsoft.com/dotnet/api/system.runtime.interopservices.marshal.getlastwin32error")
.Add("GetLastError", "Do not generate GetLastError. Call Marshal.GetLastWin32Error() instead. Learn more from https://learn.microsoft.com/dotnet/api/system.runtime.interopservices.marshal.getlastwin32error")
.Add("OLD_LARGE_INTEGER", "Use the C# long keyword instead.")
.Add("LARGE_INTEGER", "Use the C# long keyword instead.")
.Add("ULARGE_INTEGER", "Use the C# ulong keyword instead.")
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.Windows.CsWin32/SimpleSyntaxFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ internal static class SimpleSyntaxFactory
/// C# keywords that must be escaped or changed when they appear as identifiers from metadata.
/// </summary>
/// <remarks>
/// This list comes from <see href="https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/">this documentation</see>.
/// This list comes from <see href="https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/">this documentation</see>.
/// </remarks>
internal static readonly HashSet<string> CSharpKeywords = new HashSet<string>(StringComparer.Ordinal)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.Windows.CsWin32/SourceGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class SourceGenerator : ISourceGenerator
public static readonly DiagnosticDescriptor NoMatchingMethodOrTypeWithBadCharacters = new DiagnosticDescriptor(
"PInvoke001",
"No matching method, type or constant found",
"Method, type or constant \"{0}\" not found. It contains unexpected characters, possibly including invisible characters, which can happen when copying and pasting from docs.microsoft.com among other places. Try deleting the line and retyping it.",
"Method, type or constant \"{0}\" not found. It contains unexpected characters, possibly including invisible characters, which can happen when copying and pasting from learn.microsoft.com among other places. Try deleting the line and retyping it.",
"Functionality",
DiagnosticSeverity.Warning,
isEnabledByDefault: true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ internal class PInvokeClassMacros
/// <param name="error">The win32 error to be wrapped.</param>
/// <returns>An <see cref="global::Windows.Win32.Foundation.HRESULT"/>.</returns>
/// <remarks>
/// Learn more in <see href="https://docs.microsoft.com/windows/win32/api/winerror/nf-winerror-hresult_from_win32">the documentation for this API</see>.
/// Learn more in <see href="https://learn.microsoft.com/windows/win32/api/winerror/nf-winerror-hresult_from_win32">the documentation for this API</see>.
/// </remarks>
internal static global::Windows.Win32.Foundation.HRESULT HRESULT_FROM_WIN32(global::Windows.Win32.Foundation.WIN32_ERROR error) => new(unchecked(error <= 0 ? (int)error : (int)(((uint)error & 0x0000FFFF) | 0x80070000)));

Expand Down
2 changes: 1 addition & 1 deletion test/Microsoft.Windows.CsWin32.Tests/GeneratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ public void MiniDumpWriteDump_AllOptionalPointerParametersAreOptional(string tfm
public void ContainsIllegalCharactersForAPIName_InvisibleCharacters()
{
// You can't see them, but there are invisible hyphens in this name.
// Copy-paste from docs.microsoft.com has been known to include these invisible characters and break matching in NativeMethods.txt.
// Copy-paste from learn.microsoft.com has been known to include these invisible characters and break matching in NativeMethods.txt.
Assert.True(Generator.ContainsIllegalCharactersForAPIName("SHGet­Known­Folder­Item"));
}

Expand Down
4 changes: 2 additions & 2 deletions test/Microsoft.Windows.CsWin32.Tests/HandleTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void MSIHANDLE_BecomesSafeHandle()
public void HandleStructsHaveIsNullProperty(string handleName)
{
// A null HGDIOBJ has a specific meaning beyond just the concept of an invalid handle:
// https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-selectobject#return-value
// https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-selectobject#return-value
this.AssertGeneratedMember(handleName, "IsNull", "internal bool IsNull => Value == default;");
}

Expand All @@ -109,7 +109,7 @@ public void HandleStructsHaveIsNullProperty(string handleName)
public void HandleStructsHaveStaticNullMember(string handleName)
{
// A null HGDIOBJ has a specific meaning beyond just the concept of an invalid handle:
// https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-selectobject#return-value
// https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-selectobject#return-value
this.AssertGeneratedMember(handleName, "Null", $"internal static {handleName} Null => default;");
}

Expand Down
Loading