File: _generated\197\Windows.Win32.PInvokeCore.api-ms-win-core-winrt-string-l1-1-0.dll.g.cs
Web Access
Project: src\winforms\src\System.Private.Windows.Core\src\System.Private.Windows.Core.csproj (System.Private.Windows.Core)
// ------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981,SYSLIB1092,CS3021,CS3019
using global::System;
using global::System.Diagnostics;
using global::System.Diagnostics.CodeAnalysis;
using global::System.Runtime.CompilerServices;
using global::System.Runtime.InteropServices;
using global::System.Runtime.Versioning;
using winmdroot = global::Windows.Win32;
namespace Windows.Win32
{

	/// <content>
	/// Contains extern methods from "api-ms-win-core-winrt-string-l1-1-0.dll".
	/// </content>
	internal static partial class PInvokeCore
	{
		/// <summary>Decrements the reference count of a string buffer.</summary>
		/// <returns>
		/// <para>Type: <b>HRESULT</b> This function always returns <b>S_OK</b>.</para>
		/// </returns>
		/// <remarks>Use the <b>WindowsDeleteString</b> function to de-allocate an [**HSTRING**](/windows/win32/winrt/hstring). Calling <b>WindowsDeleteString</b> decrements the reference count of the backing buffer, and if the reference count reaches 0, the Windows Runtime de-allocates the buffer.</remarks>
		[DllImport("api-ms-win-core-winrt-string-l1-1-0.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
		[SupportedOSPlatform("windows8.0")]
		internal static extern winmdroot.Foundation.HRESULT WindowsDeleteString([Optional] winmdroot.System.WinRT.HSTRING @string);

		/// <inheritdoc cref="WindowsCreateString(winmdroot.Foundation.PCWSTR, uint, winmdroot.System.WinRT.HSTRING*)"/>
		[SupportedOSPlatform("windows8.0")]
		[OverloadResolutionPriority(1)]
		internal static unsafe winmdroot.Foundation.HRESULT WindowsCreateString([Optional] string sourceString, uint length, out winmdroot.System.WinRT.HSTRING @string)
		{
			fixed (winmdroot.System.WinRT.HSTRING* @stringLocal = &@string)
			{
				fixed (char* sourceStringLocal = sourceString)
				{
					winmdroot.Foundation.HRESULT __result = PInvokeCore.WindowsCreateString(sourceStringLocal, length, @stringLocal);
					return __result;
				}
			}
		}

		/// <summary>Creates a new HSTRING based on the specified source string.</summary>
		/// <param name="sourceString">
		/// <para>Type: [in, optional] <b>LPCWSTR</b> A null-terminated string to use as the source for the new [**HSTRING**](/windows/win32/winrt/hstring). To create a new, empty, or <b>NULL</b> string, pass <b>NULL</b> for <i>sourceString</i> and 0 for <i>length</i>.</para>
		/// <para><see href="https://learn.microsoft.com/windows/win32/api/winstring/nf-winstring-windowscreatestring#parameters">Read more on learn.microsoft.com</see>.</para>
		/// </param>
		/// <param name="length">
		/// <para>Type: [in] <b>UINT32</b> The length of <i>sourceString</i>, in Unicode characters. Must be 0 if <i>sourceString</i> is <b>NULL</b>.</para>
		/// <para><see href="https://learn.microsoft.com/windows/win32/api/winstring/nf-winstring-windowscreatestring#parameters">Read more on learn.microsoft.com</see>.</para>
		/// </param>
		/// <returns>
		/// <para>Type: <b>HRESULT</b> This function can return one of these values. </para>
		/// <para>This doc was truncated.</para>
		/// </returns>
		/// <remarks>
		/// <para>Use the <b>WindowsCreateString</b> function to allocate a new [**HSTRING**](/windows/win32/winrt/hstring). The Windows Runtime copies <i>string</i> to the backing buffer of the new <b>HSTRING</b> and   manages the buffer lifetime by using a reference count. Call the <a href="https://docs.microsoft.com/windows/desktop/api/winstring/nf-winstring-windowscreatestringreference">WindowsCreateStringReference</a> function to create a <i>fast-pass string</i>, which uses an existing string without copying it. Call the <a href="https://docs.microsoft.com/windows/desktop/api/winstring/nf-winstring-windowsdeletestring">WindowsDeleteString</a> function to de-allocate the [**HSTRING**](/windows/win32/winrt/hstring). Each call to the <b>WindowsCreateString</b> function must be matched by a call to  <b>WindowsDeleteString</b>. To create a new, empty, or <b>NULL</b> string, pass <b>NULL</b> for <i>sourceString</i> and 0 for <i>length</i>. If <i>sourceString</i> has embedded null characters, the <b>WindowsCreateString</b> function copies all characters to the terminating null character.</para>
		/// <para><see href="https://learn.microsoft.com/windows/win32/api/winstring/nf-winstring-windowscreatestring#">Read more on learn.microsoft.com</see>.</para>
		/// </remarks>
		[DllImport("api-ms-win-core-winrt-string-l1-1-0.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
		[SupportedOSPlatform("windows8.0")]
		internal static extern unsafe winmdroot.Foundation.HRESULT WindowsCreateString([Optional] winmdroot.Foundation.PCWSTR sourceString, uint length, winmdroot.System.WinRT.HSTRING* @string);
	}
}