From 857e7c47032a3889d16b9e9312f84818fb4be742 Mon Sep 17 00:00:00 2001 From: dahall Date: Wed, 21 Oct 2020 18:44:25 -0600 Subject: [PATCH] Changed all methods that returned `SafeCoTaskMemString` to `string`. After much reading and testing I determined this was redundant with marshaling code in .NET. --- BITS/BackgroundCopyException.cs | 3 +- PInvoke/BITS/bits.cs | 86 +++++++++++++++---------------- PInvoke/Ole/Ole32/ComBaseApi.cs | 4 +- PInvoke/Ole/PropSys/PropSys.Interfaces.cs | 24 ++++----- PInvoke/Ole/PropSys/PropvarUtil.cs | 2 +- PInvoke/Opc/MsOpc.cs | 34 ++++++------ PInvoke/Printing/XpsObjectModel.Parts.cs | 32 ++++++------ PInvoke/Printing/XpsObjectModel.cs | 42 +++++++-------- PInvoke/Printing/XpsObjectModel2.cs | 42 +++++++-------- PInvoke/Shell32/ShObjIdl.IFileDialog.cs | 8 +-- PInvoke/Shell32/ShObjIdl.IKnownFolder.cs | 4 +- PInvoke/Shell32/ShObjIdl.IShellItem.cs | 6 +-- PInvoke/Shell32/ShObjIdl.IShellLibrary.cs | 2 +- PInvoke/TaskSchd/MSTask.cs | 18 +++---- PInvoke/UrlMon/UrlMon.cs | 2 +- PInvoke/UserEnv/UserEnv.cs | 2 +- UnitTests/PInvoke/UserEnv/UserEnvTests.cs | 5 +- Windows.Shell/ShellObjects/ShellItem.cs | 6 +-- 18 files changed, 160 insertions(+), 162 deletions(-) diff --git a/BITS/BackgroundCopyException.cs b/BITS/BackgroundCopyException.cs index f1a61762..44e0e30d 100644 --- a/BITS/BackgroundCopyException.cs +++ b/BITS/BackgroundCopyException.cs @@ -11,8 +11,7 @@ namespace Vanara.IO { private HRESULT code; private BG_ERROR_CONTEXT ctx; - private SafeCoTaskMemString ctxDesc, protocol; - private string errDesc; + private string ctxDesc, errDesc, protocol; private IBackgroundCopyFile iVal; internal BackgroundCopyException(IBackgroundCopyError err) diff --git a/PInvoke/BITS/bits.cs b/PInvoke/BITS/bits.cs index d4566138..4baf845b 100644 --- a/PInvoke/BITS/bits.cs +++ b/PInvoke/BITS/bits.cs @@ -935,7 +935,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the error text associated with the error. Call the CoTaskMemFree function to free /// ppErrorDescription when done. /// - SafeCoTaskMemString GetErrorDescription([In] uint LanguageId); + string GetErrorDescription([In] uint LanguageId); /// Retrieves the description of the context in which the error occurred. /// @@ -949,7 +949,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the description of the context in which the error occurred. Call the CoTaskMemFree /// function to free ppContextDescription when done. /// - SafeCoTaskMemString GetErrorContextDescription([In] uint LanguageId); + string GetErrorContextDescription([In] uint LanguageId); /// /// Retrieves the protocol used to transfer the file. The remote file name identifies the protocol to use to transfer the file. @@ -959,7 +959,7 @@ namespace Vanara.PInvoke /// and "file" for the SMB protocol. The ppProtocol parameter is set to NULL if the error is not related to the transfer /// protocol. Call the CoTaskMemFree function to free ppProtocol when done. /// - SafeCoTaskMemString GetProtocol(); + string GetProtocol(); } /// @@ -979,14 +979,14 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the remote name of the file to transfer. The name is fully qualified. Call the /// CoTaskMemFree function to free ppName when done. /// - SafeCoTaskMemString GetRemoteName(); + string GetRemoteName(); /// Retrieves the local name of the file. /// /// Null-terminated string that contains the name of the file on the client. The name is fully qualified. Call the CoTaskMemFree /// function to free ppName when done. /// - SafeCoTaskMemString GetLocalName(); + string GetLocalName(); /// Retrieves information on the progress of the file transfer. /// @@ -1014,14 +1014,14 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the remote name of the file to transfer. The name is fully qualified. Call the /// CoTaskMemFree function to free ppName when done. /// - new SafeCoTaskMemString GetRemoteName(); + new string GetRemoteName(); /// Retrieves the local name of the file. /// /// Null-terminated string that contains the name of the file on the client. The name is fully qualified. Call the CoTaskMemFree /// function to free ppName when done. /// - new SafeCoTaskMemString GetLocalName(); + new string GetLocalName(); /// Retrieves information on the progress of the file transfer. /// @@ -1062,14 +1062,14 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the remote name of the file to transfer. The name is fully qualified. Call the /// CoTaskMemFree function to free ppName when done. /// - new SafeCoTaskMemString GetRemoteName(); + new string GetRemoteName(); /// Retrieves the local name of the file. /// /// Null-terminated string that contains the name of the file on the client. The name is fully qualified. Call the CoTaskMemFree /// function to free ppName when done. /// - new SafeCoTaskMemString GetLocalName(); + new string GetLocalName(); /// Retrieves information on the progress of the file transfer. /// @@ -1097,7 +1097,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the full path of the temporary file. Call the CoTaskMemFree function to free ppFileName /// when done. /// - SafeCoTaskMemString GetTemporaryName(); + string GetTemporaryName(); /// Sets the validation state of this file. /// Set to TRUE if the file content is valid, otherwise, FALSE. @@ -1130,14 +1130,14 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the remote name of the file to transfer. The name is fully qualified. Call the /// CoTaskMemFree function to free ppName when done. /// - new SafeCoTaskMemString GetRemoteName(); + new string GetRemoteName(); /// Retrieves the local name of the file. /// /// Null-terminated string that contains the name of the file on the client. The name is fully qualified. Call the CoTaskMemFree /// function to free ppName when done. /// - new SafeCoTaskMemString GetLocalName(); + new string GetLocalName(); /// Retrieves information on the progress of the file transfer. /// @@ -1165,7 +1165,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the full path of the temporary file. Call the CoTaskMemFree function to free ppFileName /// when done. /// - new SafeCoTaskMemString GetTemporaryName(); + new string GetTemporaryName(); /// Sets the validation state of this file. /// Set to TRUE if the file content is valid, otherwise, FALSE. @@ -1203,14 +1203,14 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the remote name of the file to transfer. The name is fully qualified. Call the /// CoTaskMemFree function to free ppName when done. /// - new SafeCoTaskMemString GetRemoteName(); + new string GetRemoteName(); /// Retrieves the local name of the file. /// /// Null-terminated string that contains the name of the file on the client. The name is fully qualified. Call the CoTaskMemFree /// function to free ppName when done. /// - new SafeCoTaskMemString GetLocalName(); + new string GetLocalName(); /// Retrieves information on the progress of the file transfer. /// @@ -1238,7 +1238,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the full path of the temporary file. Call the CoTaskMemFree function to free ppFileName /// when done. /// - new SafeCoTaskMemString GetTemporaryName(); + new string GetTemporaryName(); /// Sets the validation state of this file. /// Set to TRUE if the file content is valid, otherwise, FALSE. @@ -1285,14 +1285,14 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the remote name of the file to transfer. The name is fully qualified. Call the /// CoTaskMemFree function to free ppName when done. /// - new SafeCoTaskMemString GetRemoteName(); + new string GetRemoteName(); /// Retrieves the local name of the file. /// /// Null-terminated string that contains the name of the file on the client. The name is fully qualified. Call the CoTaskMemFree /// function to free ppName when done. /// - new SafeCoTaskMemString GetLocalName(); + new string GetLocalName(); /// Retrieves information on the progress of the file transfer. /// @@ -1320,7 +1320,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the full path of the temporary file. Call the CoTaskMemFree function to free ppFileName /// when done. /// - new SafeCoTaskMemString GetTemporaryName(); + new string GetTemporaryName(); /// Sets the validation state of this file. /// Set to TRUE if the file content is valid, otherwise, FALSE. @@ -1519,7 +1519,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the string version of the SID that identifies the job's owner. Call the CoTaskMemFree /// function to free ppOwner when done. /// - SafeCoTaskMemString GetOwner(); + string GetOwner(); /// Specifies a display name for the job. Typically, you use the display name to identify the job in a user interface. /// @@ -1533,7 +1533,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the display name that identifies the job. More than one job can have the same display /// name. Call the CoTaskMemFree function to free ppDisplayName when done. /// - SafeCoTaskMemString GetDisplayName(); + string GetDisplayName(); /// Provides a description of the job. /// @@ -1547,7 +1547,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains a short description of the job. Call the CoTaskMemFree function to free ppDescription /// when done. /// - SafeCoTaskMemString GetDescription(); + string GetDescription(); /// /// Specifies the priority level of your job. The priority level determines when your job is processed relative to other jobs in @@ -1786,7 +1786,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the string version of the SID that identifies the job's owner. Call the CoTaskMemFree /// function to free ppOwner when done. /// - new SafeCoTaskMemString GetOwner(); + new string GetOwner(); /// Specifies a display name for the job. Typically, you use the display name to identify the job in a user interface. /// @@ -1800,7 +1800,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the display name that identifies the job. More than one job can have the same display /// name. Call the CoTaskMemFree function to free ppDisplayName when done. /// - new SafeCoTaskMemString GetDisplayName(); + new string GetDisplayName(); /// Provides a description of the job. /// @@ -1814,7 +1814,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains a short description of the job. Call the CoTaskMemFree function to free ppDescription /// when done. /// - new SafeCoTaskMemString GetDescription(); + new string GetDescription(); /// /// Specifies the priority level of your job. The priority level determines when your job is processed relative to other jobs in @@ -2014,7 +2014,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the full path to the reply file. Call the CoTaskMemFree function to free pReplyFileName /// when done. /// - SafeCoTaskMemString GetReplyFileName(); + string GetReplyFileName(); /// Specifies the credentials to use for a proxy or remote server user authentication request. /// @@ -2142,7 +2142,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the string version of the SID that identifies the job's owner. Call the CoTaskMemFree /// function to free ppOwner when done. /// - new SafeCoTaskMemString GetOwner(); + new string GetOwner(); /// Specifies a display name for the job. Typically, you use the display name to identify the job in a user interface. /// @@ -2156,7 +2156,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the display name that identifies the job. More than one job can have the same display /// name. Call the CoTaskMemFree function to free ppDisplayName when done. /// - new SafeCoTaskMemString GetDisplayName(); + new string GetDisplayName(); /// Provides a description of the job. /// @@ -2170,7 +2170,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains a short description of the job. Call the CoTaskMemFree function to free ppDescription /// when done. /// - new SafeCoTaskMemString GetDescription(); + new string GetDescription(); /// /// Specifies the priority level of your job. The priority level determines when your job is processed relative to other jobs in @@ -2370,7 +2370,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the full path to the reply file. Call the CoTaskMemFree function to free pReplyFileName /// when done. /// - new SafeCoTaskMemString GetReplyFileName(); + new string GetReplyFileName(); /// Specifies the credentials to use for a proxy or remote server user authentication request. /// @@ -2530,7 +2530,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the string version of the SID that identifies the job's owner. Call the CoTaskMemFree /// function to free ppOwner when done. /// - new SafeCoTaskMemString GetOwner(); + new string GetOwner(); /// Specifies a display name for the job. Typically, you use the display name to identify the job in a user interface. /// @@ -2544,7 +2544,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the display name that identifies the job. More than one job can have the same display /// name. Call the CoTaskMemFree function to free ppDisplayName when done. /// - new SafeCoTaskMemString GetDisplayName(); + new string GetDisplayName(); /// Provides a description of the job. /// @@ -2558,7 +2558,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains a short description of the job. Call the CoTaskMemFree function to free ppDescription /// when done. /// - new SafeCoTaskMemString GetDescription(); + new string GetDescription(); /// /// Specifies the priority level of your job. The priority level determines when your job is processed relative to other jobs in @@ -2758,7 +2758,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the full path to the reply file. Call the CoTaskMemFree function to free pReplyFileName /// when done. /// - new SafeCoTaskMemString GetReplyFileName(); + new string GetReplyFileName(); /// Specifies the credentials to use for a proxy or remote server user authentication request. /// @@ -2961,7 +2961,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the string version of the SID that identifies the job's owner. Call the CoTaskMemFree /// function to free ppOwner when done. /// - new SafeCoTaskMemString GetOwner(); + new string GetOwner(); /// Specifies a display name for the job. Typically, you use the display name to identify the job in a user interface. /// @@ -2975,7 +2975,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the display name that identifies the job. More than one job can have the same display /// name. Call the CoTaskMemFree function to free ppDisplayName when done. /// - new SafeCoTaskMemString GetDisplayName(); + new string GetDisplayName(); /// Provides a description of the job. /// @@ -2989,7 +2989,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains a short description of the job. Call the CoTaskMemFree function to free ppDescription /// when done. /// - new SafeCoTaskMemString GetDescription(); + new string GetDescription(); /// /// Specifies the priority level of your job. The priority level determines when your job is processed relative to other jobs in @@ -3189,7 +3189,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the full path to the reply file. Call the CoTaskMemFree function to free pReplyFileName /// when done. /// - new SafeCoTaskMemString GetReplyFileName(); + new string GetReplyFileName(); /// Specifies the credentials to use for a proxy or remote server user authentication request. /// @@ -3437,7 +3437,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the custom headers. Each header is terminated by a carriage return and line feed (CR/LF) /// character. To free the string when finished, call the CoTaskMemFree function. /// - SafeCoTaskMemString GetCustomHeaders(); + string GetCustomHeaders(); /// /// Sets flags for HTTP that determine whether the certificate revocation list is checked and certain certificate errors are @@ -3521,7 +3521,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains a description of the error. Call the CoTaskMemFree function to free ppErrorDescription /// when done. /// - SafeCoTaskMemString GetErrorDescription([In] HRESULT hResult, [In] uint LanguageId); + string GetErrorDescription([In] HRESULT hResult, [In] uint LanguageId); } /// @@ -3538,7 +3538,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the server principal name of the peer. The principal name is of the form, /// server$.domain.suffix. Call the CoTaskMemFree function to free pName when done. /// - SafeCoTaskMemString GetPeerName(); + string GetPeerName(); /// Determines whether the peer is authenticated. /// TRUE if the peer is authenticated, otherwise, FALSE. @@ -3667,7 +3667,7 @@ namespace Vanara.PInvoke /// Null-terminated string that contains the origin URL of the cached file. Call the CoTaskMemFree function to free ppOriginUrl /// when done. /// - SafeCoTaskMemString GetOriginUrl(); + string GetOriginUrl(); /// Gets the size of the file. /// Size of the file, in bytes. @@ -3754,7 +3754,7 @@ namespace Vanara.PInvoke /// Returns the SID that is retrieved from the TokenInformation parameter of the GetTokenInformation function. If no SID is /// retrieved, this parameter is set to NULL. /// - SafeCoTaskMemString GetHelperTokenSid(); + string GetHelperTokenSid(); } /// diff --git a/PInvoke/Ole/Ole32/ComBaseApi.cs b/PInvoke/Ole/Ole32/ComBaseApi.cs index 917b09c6..90fccd37 100644 --- a/PInvoke/Ole/Ole32/ComBaseApi.cs +++ b/PInvoke/Ole/Ole32/ComBaseApi.cs @@ -2648,7 +2648,7 @@ namespace Vanara.PInvoke // DWORD *pCapabilities ); [DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)] [PInvokeData("combaseapi.h", MSDNShortId = "58a2c121-c324-4c33-aaca-490b5a09738c")] - public static extern HRESULT CoQueryClientBlanket(out RPC_C_AUTHN pAuthnSvc, out RPC_C_AUTHZ pAuthzSvc, out SafeCoTaskMemString pServerPrincName, + public static extern HRESULT CoQueryClientBlanket(out RPC_C_AUTHN pAuthnSvc, out RPC_C_AUTHZ pAuthzSvc, out string pServerPrincName, out RPC_C_AUTHN_LEVEL pAuthnLevel, out RPC_C_IMP_LEVEL pImpLevel, out RPC_AUTHZ_HANDLE pPrivs, ref EOLE_AUTHENTICATION_CAPABILITIES pCapabilities); /// @@ -3945,7 +3945,7 @@ namespace Vanara.PInvoke // clsid, LPOLESTR *lplpszProgID ); [DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("combaseapi.h", MSDNShortId = "a863cbc2-f8ab-468a-8254-b273077a6a2b")] - public static extern HRESULT ProgIDFromCLSID(in Guid clsid, out SafeCoTaskMemString lplpszProgID); + public static extern HRESULT ProgIDFromCLSID(in Guid clsid, out string lplpszProgID); /// Creates an agile reference for an object specified by the given interface. /// The options. diff --git a/PInvoke/Ole/PropSys/PropSys.Interfaces.cs b/PInvoke/Ole/PropSys/PropSys.Interfaces.cs index 3047e59c..52c8ec26 100644 --- a/PInvoke/Ole/PropSys/PropSys.Interfaces.cs +++ b/PInvoke/Ole/PropSys/PropSys.Interfaces.cs @@ -796,7 +796,7 @@ namespace Vanara.PInvoke /// /// When this method returns, contains the address of a pointer to the property's canonical name as a null-terminated Unicode string. /// - SafeCoTaskMemString GetCanonicalName(); + string GetCanonicalName(); /// Gets the variant type of the property. /// @@ -808,13 +808,13 @@ namespace Vanara.PInvoke /// Gets the display name of the property as it is shown in any UI. /// Contains the address of a pointer to the property's name as a null-terminated Unicode string. [PreserveSig] - HRESULT GetDisplayName(out SafeCoTaskMemString pszName); + HRESULT GetDisplayName(out string pszName); /// Gets the text used in edit controls hosted in various dialog boxes. /// /// When this method returns, contains the address of a pointer to a null-terminated Unicode buffer that holds the invitation text. /// - SafeCoTaskMemString GetEditInvitation(); + string GetEditInvitation(); /// Gets a set of flags that describe the uses and capabilities of the property. /// @@ -886,7 +886,7 @@ namespace Vanara.PInvoke /// /// When this method returns, contains the address of a pointer to the sort description as a null-terminated Unicode string. /// - SafeCoTaskMemString GetSortDescriptionLabel([In, MarshalAs(UnmanagedType.Bool)] bool fDescending); + string GetSortDescriptionLabel([In, MarshalAs(UnmanagedType.Bool)] bool fDescending); /// Gets a value that describes how the property values are displayed when multiple items are selected in the UI. /// When this method returns, contains a pointer to a value that indicates the aggregation type. @@ -924,7 +924,7 @@ namespace Vanara.PInvoke /// When this method returns, contains the formatted value as a null-terminated, Unicode string. The calling application must /// allocate memory for the buffer, and use CoTaskMemFree to release the string specified by pszText when it is no longer needed. /// - SafeCoTaskMemString FormatForDisplay([In] PROPVARIANT propvar, [In] PROPDESC_FORMAT_FLAGS pdfFlags); + string FormatForDisplay([In] PROPVARIANT propvar, [In] PROPDESC_FORMAT_FLAGS pdfFlags); /// Gets a value that indicates whether a property is canonical according to the definition of the property description. /// A reference to a PROPVARIANT structure that contains the type and value of the property. @@ -946,7 +946,7 @@ namespace Vanara.PInvoke /// /// When this method returns, contains the address of a pointer to the property's canonical name as a null-terminated Unicode string. /// - new SafeCoTaskMemString GetCanonicalName(); + new string GetCanonicalName(); /// Gets the variant type of the property. /// @@ -958,13 +958,13 @@ namespace Vanara.PInvoke /// Gets the display name of the property as it is shown in any UI. /// Contains the address of a pointer to the property's name as a null-terminated Unicode string. [PreserveSig] - new HRESULT GetDisplayName(out SafeCoTaskMemString pszName); + new HRESULT GetDisplayName(out string pszName); /// Gets the text used in edit controls hosted in various dialog boxes. /// /// When this method returns, contains the address of a pointer to a null-terminated Unicode buffer that holds the invitation text. /// - new SafeCoTaskMemString GetEditInvitation(); + new string GetEditInvitation(); /// Gets a set of flags that describe the uses and capabilities of the property. /// @@ -1036,7 +1036,7 @@ namespace Vanara.PInvoke /// /// When this method returns, contains the address of a pointer to the sort description as a null-terminated Unicode string. /// - new SafeCoTaskMemString GetSortDescriptionLabel([In, MarshalAs(UnmanagedType.Bool)] bool fDescending); + new string GetSortDescriptionLabel([In, MarshalAs(UnmanagedType.Bool)] bool fDescending); /// Gets a value that describes how the property values are displayed when multiple items are selected in the UI. /// When this method returns, contains a pointer to a value that indicates the aggregation type. @@ -1074,7 +1074,7 @@ namespace Vanara.PInvoke /// When this method returns, contains the formatted value as a null-terminated, Unicode string. The calling application must /// allocate memory for the buffer, and use CoTaskMemFree to release the string specified by pszText when it is no longer needed. /// - new SafeCoTaskMemString FormatForDisplay([In] PROPVARIANT propvar, [In] PROPDESC_FORMAT_FLAGS pdfFlags); + new string FormatForDisplay([In] PROPVARIANT propvar, [In] PROPDESC_FORMAT_FLAGS pdfFlags); /// Gets a value that indicates whether a property is canonical according to the definition of the property description. /// A reference to a PROPVARIANT structure that contains the type and value of the property. @@ -1090,7 +1090,7 @@ namespace Vanara.PInvoke /// /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. [PreserveSig] - HRESULT GetImageReferenceForValue([In] PROPVARIANT propvar, out SafeCoTaskMemString ppszImageRes); + HRESULT GetImageReferenceForValue([In] PROPVARIANT propvar, out string ppszImageRes); } /// Exposes methods that enumerate and retrieve property description list details. @@ -2056,7 +2056,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/propsys/nf-propsys-ipropertysystem-formatfordisplayalloc HRESULT // FormatForDisplayAlloc( REFPROPERTYKEY key, REFPROPVARIANT propvar, PROPDESC_FORMAT_FLAGS pdff, LPWSTR *ppszDisplay ); - SafeCoTaskMemString FormatForDisplayAlloc(ref PROPERTYKEY key, PROPVARIANT propvar, PROPDESC_FORMAT_FLAGS pdff); + string FormatForDisplayAlloc(ref PROPERTYKEY key, PROPVARIANT propvar, PROPDESC_FORMAT_FLAGS pdff); /// Informs the schema subsystem of the addition of a property description schema file. /// diff --git a/PInvoke/Ole/PropSys/PropvarUtil.cs b/PInvoke/Ole/PropSys/PropvarUtil.cs index b0cd2d9e..7c86a3b0 100644 --- a/PInvoke/Ole/PropSys/PropvarUtil.cs +++ b/PInvoke/Ole/PropSys/PropvarUtil.cs @@ -4064,7 +4064,7 @@ namespace Vanara.PInvoke // REFVARIANT varIn, PWSTR *ppszBuf ); [DllImport(Lib.PropSys, SetLastError = false, ExactSpelling = true)] [PInvokeData("propvarutil.h", MSDNShortId = "9cd4433c-d8ad-43ef-bdb9-9c1b8d8bea01")] - public static extern HRESULT VariantToStringAlloc(in VARIANT varIn, out SafeCoTaskMemString ppszBuf); + public static extern HRESULT VariantToStringAlloc(in VARIANT varIn, out string ppszBuf); /// Extracts data from a vector structure into a String array. /// diff --git a/PInvoke/Opc/MsOpc.cs b/PInvoke/Opc/MsOpc.cs index 178a87b1..48515864 100644 --- a/PInvoke/Opc/MsOpc.cs +++ b/PInvoke/Opc/MsOpc.cs @@ -655,7 +655,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/msopc/nf-msopc-iopcdigitalsignature-getnamespaces HRESULT GetNamespaces( // LPWSTR **prefixes, LPWSTR **namespaces, UINT32 *count ); - void GetNamespaces(out SafeCoTaskMemString prefixes, out SafeCoTaskMemString namespaces, out uint count); + void GetNamespaces(out string prefixes, out string namespaces, out uint count); /// Gets the value of the Id attribute from the Signature element of the signature markup. /// @@ -672,7 +672,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/msopc/nf-msopc-iopcdigitalsignature-getsignatureid HRESULT GetSignatureId( // LPWSTR *signatureId ); - SafeCoTaskMemString GetSignatureId(); + string GetSignatureId(); /// Gets the part name of the part that contains the signature markup. /// @@ -722,7 +722,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/msopc/nf-msopc-iopcdigitalsignature-getsignaturemethod HRESULT // GetSignatureMethod( LPWSTR *signatureMethod ); - SafeCoTaskMemString GetSignatureMethod(); + string GetSignatureMethod(); /// Gets the canonicalization method that was applied to the SignedInfo element of the serialized signature. /// @@ -815,7 +815,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/msopc/nf-msopc-iopcdigitalsignature-getsigningtime HRESULT GetSigningTime( // LPWSTR *signingTime ); - SafeCoTaskMemString GetSigningTime(); + string GetSigningTime(); /// Gets the format of the string returned by the GetSigningTime method. /// An OPC_SIGNATURE_TIME_FORMAT value that describes the format of the string returned by GetSigningTime. @@ -2022,7 +2022,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/msopc/nf-msopc-iopcpart-getcontenttype HRESULT GetContentType( LPWSTR // *contentType ); - SafeCoTaskMemString GetContentType(); + string GetContentType(); /// Gets a value that describes the way part content is compressed. /// A value that describes the way part content is compressed. @@ -3262,7 +3262,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/msopc/nf-msopc-iopcrelationship-getid HRESULT GetId( LPWSTR // *relationshipIdentifier ); - SafeCoTaskMemString GetId(); + string GetId(); /// Gets the relationship type. /// @@ -3288,7 +3288,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/msopc/nf-msopc-iopcrelationship-getrelationshiptype HRESULT // GetRelationshipType( LPWSTR *relationshipType ); - SafeCoTaskMemString GetRelationshipType(); + string GetRelationshipType(); /// Gets the URI of the relationship source. /// A pointer to the IOpcUri interface of the OPC URI object that represents the URI of the relationship source. @@ -3682,7 +3682,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/msopc/nf-msopc-iopcrelationshipselector-getselectioncriterion HRESULT // GetSelectionCriterion( LPWSTR *selectionCriterion ); - SafeCoTaskMemString GetSelectionCriterion(); + string GetSelectionCriterion(); } /// A read-only enumerator of IOpcRelationshipSelector interface pointers. @@ -4614,7 +4614,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/msopc/nf-msopc-iopcsignaturepartreference-getcontenttype HRESULT // GetContentType( LPWSTR *contentType ); - SafeCoTaskMemString GetContentType(); + string GetContentType(); /// Gets the digest method to use on part content of the referenced part when the part is signed. /// The digest method to use on part content of the referenced part when the part is signed. @@ -4625,7 +4625,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/msopc/nf-msopc-iopcsignaturepartreference-getdigestmethod HRESULT // GetDigestMethod( LPWSTR *digestMethod ); - SafeCoTaskMemString GetDigestMethod(); + string GetDigestMethod(); /// Gets the digest value that is calculated for part content of the referenced part when the part is signed. /// @@ -4962,7 +4962,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/msopc/nf-msopc-iopcsignaturereference-getid HRESULT GetId( LPWSTR // *referenceId ); - SafeCoTaskMemString GetId(); + string GetId(); /// Gets the URI of the referenced XML element. /// @@ -5020,7 +5020,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/msopc/nf-msopc-iopcsignaturereference-gettype HRESULT GetType( LPWSTR // *type ); - SafeCoTaskMemString GetType(); + string GetType(); /// Gets the canonicalization method to use on the referenced XML element, when the element is signed. /// The canonicalization method to use on the referenced XML element, when the element is signed. @@ -5037,7 +5037,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/msopc/nf-msopc-iopcsignaturereference-getdigestmethod HRESULT // GetDigestMethod( LPWSTR *digestMethod ); - SafeCoTaskMemString GetDigestMethod(); + string GetDigestMethod(); /// Gets the digest value that is calculated for the referenced XML element when the element is signed. /// @@ -5392,7 +5392,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/msopc/nf-msopc-iopcsignaturerelationshipreference-getdigestmethod HRESULT // GetDigestMethod( LPWSTR *digestMethod ); - SafeCoTaskMemString GetDigestMethod(); + string GetDigestMethod(); /// Gets the digest value calculated for the selected relationships when they are signed. /// @@ -5860,7 +5860,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/msopc/nf-msopc-iopcsigningoptions-getsignatureid HRESULT GetSignatureId( // LPWSTR *signatureId ); - SafeCoTaskMemString GetSignatureId(); + string GetSignatureId(); /// Sets the value of the Id attribute of the Signature element. /// The value of the Id attribute. @@ -5912,7 +5912,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/msopc/nf-msopc-iopcsigningoptions-getsignaturemethod HRESULT // GetSignatureMethod( LPWSTR *signatureMethod ); - SafeCoTaskMemString GetSignatureMethod(); + string GetSignatureMethod(); /// /// Sets the signature method to use to calculate and encrypt the hash value of the SignedInfo element, which will be @@ -5961,7 +5961,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/msopc/nf-msopc-iopcsigningoptions-getdefaultdigestmethod HRESULT // GetDefaultDigestMethod( LPWSTR *digestMethod ); - SafeCoTaskMemString GetDefaultDigestMethod(); + string GetDefaultDigestMethod(); /// Sets the default digest method that will be used to compute digest values for objects to be signed. /// The default digest method. diff --git a/PInvoke/Printing/XpsObjectModel.Parts.cs b/PInvoke/Printing/XpsObjectModel.Parts.cs index 3b316db2..58de693e 100644 --- a/PInvoke/Printing/XpsObjectModel.Parts.cs +++ b/PInvoke/Printing/XpsObjectModel.Parts.cs @@ -64,7 +64,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-getcategory HRESULT // GetCategory( LPWSTR *category ); - SafeCoTaskMemString GetCategory(); + string GetCategory(); /// Sets the category property. /// @@ -85,7 +85,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-getcontentstatus // HRESULT GetContentStatus( LPWSTR *contentStatus ); - SafeCoTaskMemString GetContentStatus(); + string GetContentStatus(); /// Sets the contentStatus property. /// @@ -110,7 +110,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-getcontenttype // HRESULT GetContentType( LPWSTR *contentType ); - SafeCoTaskMemString GetContentType(); + string GetContentType(); /// Sets the contentType property. /// @@ -146,7 +146,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-getcreator HRESULT // GetCreator( LPWSTR *creator ); - SafeCoTaskMemString GetCreator(); + string GetCreator(); /// Sets the creator property. /// @@ -166,7 +166,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-getdescription // HRESULT GetDescription( LPWSTR *description ); - SafeCoTaskMemString GetDescription(); + string GetDescription(); /// Sets the description property. /// @@ -186,7 +186,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-getidentifier // HRESULT GetIdentifier( LPWSTR *identifier ); - SafeCoTaskMemString GetIdentifier(); + string GetIdentifier(); /// Sets the identifier property. /// @@ -209,7 +209,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-getkeywords HRESULT // GetKeywords( LPWSTR *keywords ); - SafeCoTaskMemString GetKeywords(); + string GetKeywords(); /// Sets the keywords property. /// @@ -232,7 +232,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-getlanguage HRESULT // GetLanguage( LPWSTR *language ); - SafeCoTaskMemString GetLanguage(); + string GetLanguage(); /// Sets the language property. /// @@ -254,7 +254,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-getlastmodifiedby // HRESULT GetLastModifiedBy( LPWSTR *lastModifiedBy ); - SafeCoTaskMemString GetLastModifiedBy(); + string GetLastModifiedBy(); /// Sets the lastModifiedBy property. /// @@ -305,7 +305,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-getrevision HRESULT // GetRevision( LPWSTR *revision ); - SafeCoTaskMemString GetRevision(); + string GetRevision(); /// Sets the revision property. /// @@ -321,7 +321,7 @@ namespace Vanara.PInvoke /// The subject property contains the topic of the resource's content. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-getsubject HRESULT // GetSubject( LPWSTR *subject ); - SafeCoTaskMemString GetSubject(); + string GetSubject(); /// Sets the subject property. /// @@ -337,7 +337,7 @@ namespace Vanara.PInvoke /// The title property contains the resource's name. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-gettitle HRESULT // GetTitle( LPWSTR *title ); - SafeCoTaskMemString GetTitle(); + string GetTitle(); /// Sets the title property. /// @@ -353,7 +353,7 @@ namespace Vanara.PInvoke /// The version property contains the resource's version number. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-getversion HRESULT // GetVersion( LPWSTR *version ); - SafeCoTaskMemString GetVersion(); + string GetVersion(); /// Sets the version property. /// @@ -1286,7 +1286,7 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompage-getlanguage HRESULT // GetLanguage( LPWSTR *language ); [MethodImpl(MethodImplOptions.InternalCall)] - SafeCoTaskMemString GetLanguage(); + string GetLanguage(); /// Sets the Language property of the page. /// @@ -1308,7 +1308,7 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompage-getname HRESULT GetName( // LPWSTR *name ); [MethodImpl(MethodImplOptions.InternalCall)] - SafeCoTaskMemString GetName(); + string GetName(); /// Sets the Name property of this page. /// @@ -1664,7 +1664,7 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompage-generateunusedlookupkey // HRESULT GenerateUnusedLookupKey( XPS_OBJECT_TYPE type, LPWSTR *key ); [MethodImpl(MethodImplOptions.InternalCall)] - SafeCoTaskMemString GenerateUnusedLookupKey([In] XPS_OBJECT_TYPE type); + string GenerateUnusedLookupKey([In] XPS_OBJECT_TYPE type); /// Makes a deep copy of the interface. /// A pointer to the copy of the interface. diff --git a/PInvoke/Printing/XpsObjectModel.cs b/PInvoke/Printing/XpsObjectModel.cs index 973c576e..852a14b7 100644 --- a/PInvoke/Printing/XpsObjectModel.cs +++ b/PInvoke/Printing/XpsObjectModel.cs @@ -224,7 +224,7 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-gettransformlookup HRESULT // GetTransformLookup( LPWSTR *key ); [MethodImpl(MethodImplOptions.InternalCall)] - new SafeCoTaskMemString GetTransformLookup(); + new string GetTransformLookup(); /// Sets the lookup key name of a shared matrix transform in a resource dictionary. /// The lookup key name of the matrix transform in the dictionary. @@ -413,7 +413,7 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getclipgeometrylookup // HRESULT GetClipGeometryLookup( LPWSTR *key ); [MethodImpl(MethodImplOptions.InternalCall)] - new SafeCoTaskMemString GetClipGeometryLookup(); + new string GetClipGeometryLookup(); /// Sets the lookup key name of a shared clip geometry in a resource dictionary. /// @@ -618,7 +618,7 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getopacitymaskbrushlookup // HRESULT GetOpacityMaskBrushLookup( LPWSTR *key ); [MethodImpl(MethodImplOptions.InternalCall)] - new SafeCoTaskMemString GetOpacityMaskBrushLookup(); + new string GetOpacityMaskBrushLookup(); /// Sets the lookup key name of a shared opacity mask brush in a resource dictionary. /// @@ -670,7 +670,7 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getname HRESULT GetName( // LPWSTR *name ); [MethodImpl(MethodImplOptions.InternalCall)] - new SafeCoTaskMemString GetName(); + new string GetName(); /// Sets the Name property of the visual. /// The name of the visual. A NULL pointer clears the Name property. @@ -765,7 +765,7 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getlanguage HRESULT // GetLanguage( LPWSTR *language ); [MethodImpl(MethodImplOptions.InternalCall)] - new SafeCoTaskMemString GetLanguage(); + new string GetLanguage(); /// Sets the Language property of the visual. /// @@ -877,7 +877,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcanvas-getaccessibilityshortdescription // HRESULT GetAccessibilityShortDescription( LPWSTR *shortDescription ); - SafeCoTaskMemString GetAccessibilityShortDescription(); + string GetAccessibilityShortDescription(); /// /// Sets the short textual description of the object's contents. This text is used by accessibility clients to describe the object. @@ -909,7 +909,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcanvas-getaccessibilitylongdescription // HRESULT GetAccessibilityLongDescription( LPWSTR *longDescription ); - SafeCoTaskMemString GetAccessibilityLongDescription(); + string GetAccessibilityLongDescription(); /// /// Sets the long (detailed) textual description of the object's contents. This text is used by accessibility clients to @@ -1398,7 +1398,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomdictionary-getat HRESULT GetAt( // UINT32 index, LPWSTR *key, IXpsOMShareable **entry ); - IXpsOMShareable GetAt([In] uint index, out SafeCoTaskMemString key); + IXpsOMShareable GetAt([In] uint index, out string key); /// Gets the IXpsOMShareable interface pointer of the entry that contains the specified key. /// The entry's key to be found in the dictionary. @@ -2030,7 +2030,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgeometry-gettransformlookup HRESULT // GetTransformLookup( LPWSTR *lookup ); - SafeCoTaskMemString GetTransformLookup(); + string GetTransformLookup(); /// Sets the lookup key name of a shared matrix transform in a resource dictionary. /// The key name of the shared matrix transform in the resource dictionary. @@ -2782,7 +2782,7 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-gettransformlookup HRESULT // GetTransformLookup( LPWSTR *key ); [MethodImpl(MethodImplOptions.InternalCall)] - new SafeCoTaskMemString GetTransformLookup(); + new string GetTransformLookup(); /// Sets the lookup key name of a shared matrix transform in a resource dictionary. /// The lookup key name of the matrix transform in the dictionary. @@ -2971,7 +2971,7 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getclipgeometrylookup // HRESULT GetClipGeometryLookup( LPWSTR *key ); [MethodImpl(MethodImplOptions.InternalCall)] - new SafeCoTaskMemString GetClipGeometryLookup(); + new string GetClipGeometryLookup(); /// Sets the lookup key name of a shared clip geometry in a resource dictionary. /// @@ -3176,7 +3176,7 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getopacitymaskbrushlookup // HRESULT GetOpacityMaskBrushLookup( LPWSTR *key ); [MethodImpl(MethodImplOptions.InternalCall)] - new SafeCoTaskMemString GetOpacityMaskBrushLookup(); + new string GetOpacityMaskBrushLookup(); /// Sets the lookup key name of a shared opacity mask brush in a resource dictionary. /// @@ -3228,7 +3228,7 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getname HRESULT GetName( // LPWSTR *name ); [MethodImpl(MethodImplOptions.InternalCall)] - new SafeCoTaskMemString GetName(); + new string GetName(); /// Sets the Name property of the visual. /// The name of the visual. A NULL pointer clears the Name property. @@ -3323,7 +3323,7 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getlanguage HRESULT // GetLanguage( LPWSTR *language ); [MethodImpl(MethodImplOptions.InternalCall)] - new SafeCoTaskMemString GetLanguage(); + new string GetLanguage(); /// Sets the Language property of the visual. /// @@ -3342,7 +3342,7 @@ namespace Vanara.PInvoke /// The UTF-16 Unicode string of the text to be displayed. If the string is empty, a NULL pointer is returned. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomglyphs-getunicodestring HRESULT // GetUnicodeString( LPWSTR *unicodeString ); - SafeCoTaskMemString GetUnicodeString(); + string GetUnicodeString(); /// Gets the number of Glyph indices. /// The number of glyph indices. @@ -3481,7 +3481,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomglyphs-getdevicefontname HRESULT // GetDeviceFontName( LPWSTR *deviceFontName ); - SafeCoTaskMemString GetDeviceFontName(); + string GetDeviceFontName(); /// Gets the style simulations that will be applied when rendering the glyphs. /// The XPS_STYLE_SIMULATION value that describes the style simulations to be applied. @@ -3747,7 +3747,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomglyphs-getfillbrushlookup HRESULT // GetFillBrushLookup( LPWSTR *key ); - SafeCoTaskMemString GetFillBrushLookup(); + string GetFillBrushLookup(); /// Sets the lookup key name of a shared fill brush. /// @@ -3826,7 +3826,7 @@ namespace Vanara.PInvoke /// The UTF-16 Unicode string. If the string is empty, a NULL pointer is returned. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomglyphseditor-getunicodestring // HRESULT GetUnicodeString( LPWSTR *unicodeString ); - SafeCoTaskMemString GetUnicodeString(); + string GetUnicodeString(); /// Sets the text in unescaped UTF-16 scalar values. /// The address of a UTF-16 Unicode string. A NULL pointer clears the property. @@ -4054,7 +4054,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomglyphseditor-getdevicefontname // HRESULT GetDeviceFontName( LPWSTR *deviceFontName ); - SafeCoTaskMemString GetDeviceFontName(); + string GetDeviceFontName(); /// Sets the name of the device font. /// @@ -4334,7 +4334,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgradientbrush-gettransformlookup // HRESULT GetTransformLookup( LPWSTR *key ); - SafeCoTaskMemString GetTransformLookup(); + string GetTransformLookup(); /// /// Sets the name of the lookup key of a shared matrix transform that is to be used for the brush. @@ -4815,7 +4815,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomtilebrush-gettransformlookup // HRESULT GetTransformLookup( LPWSTR *key ); - new SafeCoTaskMemString GetTransformLookup(); + new string GetTransformLookup(); /// /// Sets the lookup key name of a shared matrix transform that will be used as the transform for this brush.The shared matrix diff --git a/PInvoke/Printing/XpsObjectModel2.cs b/PInvoke/Printing/XpsObjectModel2.cs index 5a52da6c..80c25b0e 100644 --- a/PInvoke/Printing/XpsObjectModel2.cs +++ b/PInvoke/Printing/XpsObjectModel2.cs @@ -352,7 +352,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgradientbrush-gettransformlookup // HRESULT GetTransformLookup( LPWSTR *key ); - new SafeCoTaskMemString GetTransformLookup(); + new string GetTransformLookup(); /// /// Sets the name of the lookup key of a shared matrix transform that is to be used for the brush. @@ -536,7 +536,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomnamecollection-getat HRESULT GetAt( // UINT32 index, LPWSTR *name ); - SafeCoTaskMemString GetAt([In] uint index); + string GetAt([In] uint index); } /// Describes a non-text visual item. @@ -703,7 +703,7 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-gettransformlookup HRESULT // GetTransformLookup( LPWSTR *key ); [MethodImpl(MethodImplOptions.InternalCall)] - new SafeCoTaskMemString GetTransformLookup(); + new string GetTransformLookup(); /// Sets the lookup key name of a shared matrix transform in a resource dictionary. /// The lookup key name of the matrix transform in the dictionary. @@ -892,7 +892,7 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getclipgeometrylookup // HRESULT GetClipGeometryLookup( LPWSTR *key ); [MethodImpl(MethodImplOptions.InternalCall)] - new SafeCoTaskMemString GetClipGeometryLookup(); + new string GetClipGeometryLookup(); /// Sets the lookup key name of a shared clip geometry in a resource dictionary. /// @@ -1097,7 +1097,7 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getopacitymaskbrushlookup // HRESULT GetOpacityMaskBrushLookup( LPWSTR *key ); [MethodImpl(MethodImplOptions.InternalCall)] - new SafeCoTaskMemString GetOpacityMaskBrushLookup(); + new string GetOpacityMaskBrushLookup(); /// Sets the lookup key name of a shared opacity mask brush in a resource dictionary. /// @@ -1149,7 +1149,7 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getname HRESULT GetName( // LPWSTR *name ); [MethodImpl(MethodImplOptions.InternalCall)] - new SafeCoTaskMemString GetName(); + new string GetName(); /// Sets the Name property of the visual. /// The name of the visual. A NULL pointer clears the Name property. @@ -1244,7 +1244,7 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getlanguage HRESULT // GetLanguage( LPWSTR *language ); [MethodImpl(MethodImplOptions.InternalCall)] - new SafeCoTaskMemString GetLanguage(); + new string GetLanguage(); /// Sets the Language property of the visual. /// @@ -1397,7 +1397,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompath-getgeometrylookup HRESULT // GetGeometryLookup( LPWSTR *lookup ); - SafeCoTaskMemString GetGeometryLookup(); + string GetGeometryLookup(); /// /// Sets the lookup key name of a shared geometry in a resource dictionary. @@ -1457,7 +1457,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompath-getaccessibilityshortdescription // HRESULT GetAccessibilityShortDescription( LPWSTR *shortDescription ); - SafeCoTaskMemString GetAccessibilityShortDescription(); + string GetAccessibilityShortDescription(); /// /// Sets the short textual description of the object's contents. This description is used by accessibility clients to describe @@ -1487,7 +1487,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompath-getaccessibilitylongdescription // HRESULT GetAccessibilityLongDescription( LPWSTR *longDescription ); - SafeCoTaskMemString GetAccessibilityLongDescription(); + string GetAccessibilityLongDescription(); /// /// Sets the long (detailed) textual description of the object's contents. This description is used by accessibility clients to @@ -1688,7 +1688,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompath-getstrokebrushlookup HRESULT // GetStrokeBrushLookup( LPWSTR *lookup ); - SafeCoTaskMemString GetStrokeBrushLookup(); + string GetStrokeBrushLookup(); /// /// Sets the lookup key name of a shared brush to be used as the stroke brush.The shared brush is stored in a resource dictionary. @@ -2003,7 +2003,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompath-getfillbrushlookup HRESULT // GetFillBrushLookup( LPWSTR *lookup ); - SafeCoTaskMemString GetFillBrushLookup(); + string GetFillBrushLookup(); /// Sets the lookup key name of a shared brush in a resource dictionary, to be used as the fill brush. /// The key name of the brush in a resource dictionary, to be used as the fill brush. @@ -2354,7 +2354,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgradientbrush-gettransformlookup // HRESULT GetTransformLookup( LPWSTR *key ); - new SafeCoTaskMemString GetTransformLookup(); + new string GetTransformLookup(); /// /// Sets the name of the lookup key of a shared matrix transform that is to be used for the brush. @@ -3347,7 +3347,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomtilebrush-gettransformlookup // HRESULT GetTransformLookup( LPWSTR *key ); - SafeCoTaskMemString GetTransformLookup(); + string GetTransformLookup(); /// /// Sets the lookup key name of a shared matrix transform that will be used as the transform for this brush.The shared matrix @@ -3658,7 +3658,7 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-gettransformlookup HRESULT // GetTransformLookup( LPWSTR *key ); [MethodImpl(MethodImplOptions.InternalCall)] - SafeCoTaskMemString GetTransformLookup(); + string GetTransformLookup(); /// Sets the lookup key name of a shared matrix transform in a resource dictionary. /// The lookup key name of the matrix transform in the dictionary. @@ -3847,7 +3847,7 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getclipgeometrylookup // HRESULT GetClipGeometryLookup( LPWSTR *key ); [MethodImpl(MethodImplOptions.InternalCall)] - SafeCoTaskMemString GetClipGeometryLookup(); + string GetClipGeometryLookup(); /// Sets the lookup key name of a shared clip geometry in a resource dictionary. /// @@ -4052,7 +4052,7 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getopacitymaskbrushlookup // HRESULT GetOpacityMaskBrushLookup( LPWSTR *key ); [MethodImpl(MethodImplOptions.InternalCall)] - SafeCoTaskMemString GetOpacityMaskBrushLookup(); + string GetOpacityMaskBrushLookup(); /// Sets the lookup key name of a shared opacity mask brush in a resource dictionary. /// @@ -4104,7 +4104,7 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getname HRESULT GetName( // LPWSTR *name ); [MethodImpl(MethodImplOptions.InternalCall)] - SafeCoTaskMemString GetName(); + string GetName(); /// Sets the Name property of the visual. /// The name of the visual. A NULL pointer clears the Name property. @@ -4199,7 +4199,7 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getlanguage HRESULT // GetLanguage( LPWSTR *language ); [MethodImpl(MethodImplOptions.InternalCall)] - SafeCoTaskMemString GetLanguage(); + string GetLanguage(); /// Sets the Language property of the visual. /// @@ -4415,7 +4415,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomtilebrush-gettransformlookup // HRESULT GetTransformLookup( LPWSTR *key ); - new SafeCoTaskMemString GetTransformLookup(); + new string GetTransformLookup(); /// /// Sets the lookup key name of a shared matrix transform that will be used as the transform for this brush.The shared matrix @@ -4705,7 +4705,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisualbrush-getvisuallookup HRESULT // GetVisualLookup( LPWSTR *lookup ); - SafeCoTaskMemString GetVisualLookup(); + string GetVisualLookup(); /// /// Sets the lookup key name of the shared visual, which is stored in a resource dictionary, to be used as the source for the brush. diff --git a/PInvoke/Shell32/ShObjIdl.IFileDialog.cs b/PInvoke/Shell32/ShObjIdl.IFileDialog.cs index c7a736f6..5eb1fa2d 100644 --- a/PInvoke/Shell32/ShObjIdl.IFileDialog.cs +++ b/PInvoke/Shell32/ShObjIdl.IFileDialog.cs @@ -328,7 +328,7 @@ namespace Vanara.PInvoke /// Retrieves the text currently entered in the dialog's File name edit box. /// The address of a pointer to a buffer that, when this method returns successfully, receives the text. - SafeCoTaskMemString GetFileName(); + string GetFileName(); /// Sets the title of the dialog. /// A pointer to a buffer that contains the title text. @@ -469,7 +469,7 @@ namespace Vanara.PInvoke /// Retrieves the text currently entered in the dialog's File name edit box. /// The address of a pointer to a buffer that, when this method returns successfully, receives the text. - new SafeCoTaskMemString GetFileName(); + new string GetFileName(); /// Sets the title of the dialog. /// A pointer to a buffer that contains the title text. @@ -904,7 +904,7 @@ namespace Vanara.PInvoke /// Retrieves the text currently entered in the dialog's File name edit box. /// The address of a pointer to a buffer that, when this method returns successfully, receives the text. - new SafeCoTaskMemString GetFileName(); + new string GetFileName(); /// Sets the title of the dialog. /// A pointer to a buffer that contains the title text. @@ -1277,7 +1277,7 @@ namespace Vanara.PInvoke /// Retrieves the text currently entered in the dialog's File name edit box. /// The address of a pointer to a buffer that, when this method returns successfully, receives the text. - new SafeCoTaskMemString GetFileName(); + new string GetFileName(); /// Sets the title of the dialog. /// A pointer to a buffer that contains the title text. diff --git a/PInvoke/Shell32/ShObjIdl.IKnownFolder.cs b/PInvoke/Shell32/ShObjIdl.IKnownFolder.cs index b376c781..5c1ad118 100644 --- a/PInvoke/Shell32/ShObjIdl.IKnownFolder.cs +++ b/PInvoke/Shell32/ShObjIdl.IKnownFolder.cs @@ -1585,7 +1585,7 @@ namespace Vanara.PInvoke /// When this method returns, contains the address of a pointer to a null-terminated buffer that contains the path. The calling /// application is responsible for calling CoTaskMemFree to free this resource when it is no longer needed. /// - SafeCoTaskMemString GetPath([In] KNOWN_FOLDER_FLAG dwFlags); + string GetPath([In] KNOWN_FOLDER_FLAG dwFlags); /// Assigns a new path to a known folder. /// Either zero or the following value: KF_FLAG_DONT_UNEXPAND @@ -1757,7 +1757,7 @@ namespace Vanara.PInvoke /// When this method returns, contains the address of a pointer to a null-terminated Unicode string that contains an error /// message if one was generated. This value can be NULL. /// - SafeCoTaskMemString Redirect(in Guid rfid, [In, Optional] HWND hwnd, [In] KF_REDIRECT_FLAGS flags, + string Redirect(in Guid rfid, [In, Optional] HWND hwnd, [In] KF_REDIRECT_FLAGS flags, [In, Optional, MarshalAs(UnmanagedType.LPWStr)] string pszTargetPath, [In] uint cFolders, [In] Guid[] pExclusion); } diff --git a/PInvoke/Shell32/ShObjIdl.IShellItem.cs b/PInvoke/Shell32/ShObjIdl.IShellItem.cs index 664fe837..4a05c21f 100644 --- a/PInvoke/Shell32/ShObjIdl.IShellItem.cs +++ b/PInvoke/Shell32/ShObjIdl.IShellItem.cs @@ -465,7 +465,7 @@ namespace Vanara.PInvoke /// /// A value that, when this function returns successfully, receives the address of a pointer to the retrieved display name. /// - SafeCoTaskMemString GetDisplayName(SIGDN sigdnName); + string GetDisplayName(SIGDN sigdnName); /// Gets a requested set of attributes of the IShellItem object. /// @@ -521,7 +521,7 @@ namespace Vanara.PInvoke /// /// A value that, when this function returns successfully, receives the address of a pointer to the retrieved display name. /// - new SafeCoTaskMemString GetDisplayName(SIGDN sigdnName); + new string GetDisplayName(SIGDN sigdnName); /// Gets a requested set of attributes of the IShellItem object. /// @@ -624,7 +624,7 @@ namespace Vanara.PInvoke /// Gets the string value of a specified property key. /// A reference to a PROPERTYKEY structure. /// A pointer to a Unicode string value. - SafeCoTaskMemString GetString(in PROPERTYKEY key); + string GetString(in PROPERTYKEY key); /// Gets the UInt32 value of specified property key. /// A reference to a PROPERTYKEY structure. diff --git a/PInvoke/Shell32/ShObjIdl.IShellLibrary.cs b/PInvoke/Shell32/ShObjIdl.IShellLibrary.cs index 740c6b59..bed698de 100644 --- a/PInvoke/Shell32/ShObjIdl.IShellLibrary.cs +++ b/PInvoke/Shell32/ShObjIdl.IShellLibrary.cs @@ -170,7 +170,7 @@ namespace Vanara.PInvoke /// A null-terminated Unicode string that describes the location of the default icon. The string is returned as /// ModuleFileName,ResourceIndex or ModuleFileName,-ResourceID. /// - SafeCoTaskMemString GetIcon(); + string GetIcon(); /// Sets the default icon for the library. /// diff --git a/PInvoke/TaskSchd/MSTask.cs b/PInvoke/TaskSchd/MSTask.cs index a576bfb1..c5cce622 100644 --- a/PInvoke/TaskSchd/MSTask.cs +++ b/PInvoke/TaskSchd/MSTask.cs @@ -385,7 +385,7 @@ namespace Vanara.PInvoke /// A pointer to a null-terminated string that contains the retrieved trigger description. Note that this string must be release /// by a call to CoTaskMemFree after the string is no longer needed. /// - SafeCoTaskMemString GetTriggerString([In] ushort iTrigger); + string GetTriggerString([In] ushort iTrigger); /// Retrieves the work item run times for a specified time period. /// @@ -466,7 +466,7 @@ namespace Vanara.PInvoke /// Retrieves the comment for the work item. /// A pointer to a null-terminated string that contains the retrieved comment for the current work item. - SafeCoTaskMemString GetComment(); + string GetComment(); /// Sets the name of the work item's creator. /// A null-terminated string that contains the name of the work item's creator. @@ -477,7 +477,7 @@ namespace Vanara.PInvoke /// A pointer to a null-terminated string that contains the name of the creator of the current work item. The application that /// invokes GetCreator is responsible for freeing this string using the CoTaskMemFree function. /// - SafeCoTaskMemString GetCreator(); + string GetCreator(); /// This method stores application-defined data associated with the work item. /// The number of bytes in the data buffer. The caller allocates and frees this memory. @@ -554,7 +554,7 @@ namespace Vanara.PInvoke /// A pointer to a null-terminated string that contains the account name for the current work item. The empty string, L"", is /// returned for the local system account. After processing the account name, be sure to call CoTaskMemFree to free the string. /// - SafeCoTaskMemString GetAccountInformation(); + string GetAccountInformation(); /// This method assigns a specific application to the current task. /// @@ -568,7 +568,7 @@ namespace Vanara.PInvoke /// A pointer to a null-terminated string that contains the name of the application the current task is associated with. After /// processing this name, call CoTaskMemFree to free resources. /// - SafeCoTaskMemString GetApplicationName(); + string GetApplicationName(); /// This method sets the command-line parameters for the task. /// @@ -582,7 +582,7 @@ namespace Vanara.PInvoke /// A pointer to a null-terminated string that contains the command-line parameters for the task. The method that invokes /// GetParameters is responsible for freeing this string using the CoTaskMemFree function. /// - SafeCoTaskMemString GetParameters(); + string GetParameters(); /// This method sets the working directory for the task. /// @@ -600,7 +600,7 @@ namespace Vanara.PInvoke /// A pointer to a null-terminated string that contains the task's working directory. The application that invokes /// GetWorkingDirectory is responsible for freeing this string using the CoTaskMemFree function. /// - SafeCoTaskMemString GetWorkingDirectory(); + string GetWorkingDirectory(); /// This method sets the priority for the task. /// @@ -694,7 +694,7 @@ namespace Vanara.PInvoke /// A pointer to a null-terminated string that contains the name of the target computer for the current task. This string is /// allocated by the application that invokes GetTargetComputer, and must also be freed using CoTaskMemFree. /// - SafeCoTaskMemString GetTargetComputer(); + string GetTargetComputer(); /// /// The Enum method retrieves a pointer to an OLE enumerator object that enumerates the tasks in the current task folder. @@ -783,7 +783,7 @@ namespace Vanara.PInvoke /// A pointer to a pointer to a null-terminated string that describes the current task trigger. The method that invokes /// GetTriggerString is responsible for freeing this string using the CoTaskMemFree function. /// - SafeCoTaskMemString GetTriggerString(); + string GetTriggerString(); /// The SetTrigger method sets the trigger criteria for a task trigger. /// A pointer to a TASK_TRIGGER structure that contains the values that define the new task trigger. diff --git a/PInvoke/UrlMon/UrlMon.cs b/PInvoke/UrlMon/UrlMon.cs index 74492bf0..daad6dc2 100644 --- a/PInvoke/UrlMon/UrlMon.cs +++ b/PInvoke/UrlMon/UrlMon.cs @@ -2736,7 +2736,7 @@ namespace Vanara.PInvoke [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] [PInvokeData("Urlmon.h")] public static extern HRESULT FindMimeFromData([In] IBindCtx pBC, [MarshalAs(UnmanagedType.LPWStr)] string pwzUrl, IntPtr pBuffer, uint cbSize, - [MarshalAs(UnmanagedType.LPWStr)] string pwzMimeProposed, FMFD dwMimeFlags, out SafeCoTaskMemString ppwzMimeOut, uint dwReserved = 0); + [MarshalAs(UnmanagedType.LPWStr)] string pwzMimeProposed, FMFD dwMimeFlags, out string ppwzMimeOut, uint dwReserved = 0); /// Gets the CLSID of the object to instantiate for the specified file. /// diff --git a/PInvoke/UserEnv/UserEnv.cs b/PInvoke/UserEnv/UserEnv.cs index 45032e5f..ee45fef0 100644 --- a/PInvoke/UserEnv/UserEnv.cs +++ b/PInvoke/UserEnv/UserEnv.cs @@ -575,7 +575,7 @@ namespace Vanara.PInvoke // GetAppContainerFolderPath( PCWSTR pszAppContainerSid, PWSTR *ppszPath ); [DllImport(Lib.Userenv, SetLastError = false, ExactSpelling = true)] [PInvokeData("userenv.h", MSDNShortId = "7D3AB78D-C094-4F89-8032-13F3C137E910")] - public static extern HRESULT GetAppContainerFolderPath([MarshalAs(UnmanagedType.LPWStr)] string pszAppContainerSid, out SafeCoTaskMemString ppszPath); + public static extern HRESULT GetAppContainerFolderPath([MarshalAs(UnmanagedType.LPWStr)] string pszAppContainerSid, out string ppszPath); /// Gets the location of the registry storage associated with an app container. /// diff --git a/UnitTests/PInvoke/UserEnv/UserEnvTests.cs b/UnitTests/PInvoke/UserEnv/UserEnvTests.cs index 7550a8f1..27b46dea 100644 --- a/UnitTests/PInvoke/UserEnv/UserEnvTests.cs +++ b/UnitTests/PInvoke/UserEnv/UserEnvTests.cs @@ -28,9 +28,8 @@ namespace Vanara.PInvoke.Tests sid2.Dispose(); Assert.That(GetAppContainerFolderPath(ssid, out var path), ResultIs.Successful); - Assert.That(path.ToString().Length, Is.GreaterThan(0)); - TestContext.WriteLine(path.ToString()); - path.Dispose(); + Assert.That(path.Length, Is.GreaterThan(0)); + TestContext.WriteLine(path); } finally diff --git a/Windows.Shell/ShellObjects/ShellItem.cs b/Windows.Shell/ShellObjects/ShellItem.cs index ca87bdf2..2b818044 100644 --- a/Windows.Shell/ShellObjects/ShellItem.cs +++ b/Windows.Shell/ShellObjects/ShellItem.cs @@ -1005,20 +1005,20 @@ namespace Vanara.Windows.Shell /// A value that, when this function returns successfully, receives the address of a pointer to the retrieved display name. /// /// - public SafeCoTaskMemString GetDisplayName(SIGDN sigdnName) + public string GetDisplayName(SIGDN sigdnName) { if (sigdnName == SIGDN.SIGDN_FILESYSPATH) { var result = new StringBuilder(512); if (!SHGetPathFromIDList(PIDL, result)) throw new ArgumentException(); - return new SafeCoTaskMemString(result.ToString(), CharSet.Unicode); + return result.ToString(); } var parentFolder = InternalGetParent().GetIShellFolder(); var child = PIDL.LastId; parentFolder.GetDisplayNameOf(child, (SHGDNF)((int)sigdnName & 0xffff), out var name); - return new SafeCoTaskMemString(name, CharSet.Unicode); + return name; } /// Gets the parent of an IShellItem object.