diff --git a/PInvoke/Printing/PrntvPt.cs b/PInvoke/Printing/PrntvPt.cs index 825a20d0..54a3b714 100644 --- a/PInvoke/Printing/PrntvPt.cs +++ b/PInvoke/Printing/PrntvPt.cs @@ -134,7 +134,7 @@ public static partial class PrntvPt [PInvokeData("prntvpt.h", MSDNShortId = "3b0a6afd-fa9d-434e-a95f-b051296d4567")] public static extern HRESULT ConvertPrintTicketToDevModeThunk2(HPTPROVIDER hProvider, [In] IntPtr pPrintTicket, uint cbSize, EDefaultDevmodeType baseType, EPrintTicketScope scope, out SafeCoTaskMemHandle ppDevmode, out uint pcbDevModeLength, - [MarshalAs(UnmanagedType.BStr)] out string errMsg); + [MarshalAs(UnmanagedType.BStr)] out string? errMsg); /// /// @@ -168,7 +168,7 @@ public static partial class PrntvPt [DllImport(Lib.PrntvPt, SetLastError = false, ExactSpelling = true)] [PInvokeData("winspool.h", MSDNShortId = "15219c19-b64c-4c51-9357-15a797557693")] public static extern HRESULT GetPrintCapabilitiesThunk2(HPTPROVIDER hProvider, [In] IntPtr pPrintTicket, int cbPrintTicket, out IntPtr ppbPrintCapabilities, - out int pcbPrintCapabilitiesLength, [MarshalAs(UnmanagedType.BStr)] out string pbstrErrorMessage); + out int pcbPrintCapabilitiesLength, [MarshalAs(UnmanagedType.BStr)] out string? pbstrErrorMessage); /// /// @@ -215,8 +215,8 @@ public static partial class PrntvPt [DllImport(Lib.PrntvPt, SetLastError = false, ExactSpelling = true)] [PInvokeData("prntvpt.h", MSDNShortId = "4aa7b9de-abf2-4781-942e-0b992a6bffed")] public static extern HRESULT MergeAndValidatePrintTicketThunk2(HPTPROVIDER hProvider, [In] IntPtr pBasePrintTicket, int basePrintTicketLength, - [In] IntPtr pDeltaPrintTicket, int deltaPrintTicketLength, EPrintTicketScope scope, out SafeCoTaskMemHandle ppValidatedPrintTicket, - out int pValidatedPrintTicketLength, [MarshalAs(UnmanagedType.BStr)] out string pbstrErrorMessage); + [In, Optional] IntPtr pDeltaPrintTicket, int deltaPrintTicketLength, EPrintTicketScope scope, out SafeCoTaskMemHandle ppValidatedPrintTicket, + out int pValidatedPrintTicketLength, [MarshalAs(UnmanagedType.BStr)] out string? pbstrErrorMessage); /// Closes a print ticket provider handle. /// A handle to the provider. This handle is returned by the PTOpenProvider or PTOpenProviderEx function. @@ -344,7 +344,7 @@ public static partial class PrntvPt [DllImport(Lib.PrntvPt, SetLastError = false, ExactSpelling = true)] [PInvokeData("prntvpt.h", MSDNShortId = "5eec91b9-d554-4440-bc9e-6a26af34994b")] public static extern HRESULT PTConvertPrintTicketToDevMode(HPTPROVIDER hProvider, IStream pPrintTicket, EDefaultDevmodeType baseDevmodeType, - EPrintTicketScope scope, out uint pcbDevmode, out SafePTMemory ppDevmode, [MarshalAs(UnmanagedType.BStr)] out string pbstrErrorMessage); + EPrintTicketScope scope, out uint pcbDevmode, out SafePTMemory ppDevmode, [MarshalAs(UnmanagedType.BStr)] out string? pbstrErrorMessage); /// Retrieves the printer's capabilities formatted in compliance with the XML Print Schema. /// @@ -393,8 +393,8 @@ public static partial class PrntvPt // HPTPROVIDER hProvider, IStream *pPrintTicket, IStream *pCapabilities, BSTR *pbstrErrorMessage ); [DllImport(Lib.PrntvPt, SetLastError = false, ExactSpelling = true)] [PInvokeData("prntvpt.h", MSDNShortId = "925e314c-85ff-4c1b-b3c9-f36aa4b55e01")] - public static extern HRESULT PTGetPrintCapabilities(HPTPROVIDER hProvider, [Optional] IStream pPrintTicket, IStream pCapabilities, - [MarshalAs(UnmanagedType.BStr)] out string pbstrErrorMessage); + public static extern HRESULT PTGetPrintCapabilities(HPTPROVIDER hProvider, [Optional] IStream? pPrintTicket, IStream pCapabilities, + [MarshalAs(UnmanagedType.BStr)] out string? pbstrErrorMessage); /// Retrieves the device printer's capabilities formatted in compliance with the XML Print Schema. /// @@ -416,8 +416,8 @@ public static partial class PrntvPt // PTGetPrintDeviceCapabilities( HPTPROVIDER hProvider, IStream *pPrintTicket, IStream *pDeviceCapabilities, BSTR *pbstrErrorMessage ); [DllImport(Lib.PrntvPt, SetLastError = false, ExactSpelling = true)] [PInvokeData("prntvpt.h", MSDNShortId = "DB9D63B1-2703-47F7-8F31-30FA0110E1E9")] - public static extern HRESULT PTGetPrintDeviceCapabilities(HPTPROVIDER hProvider, [Optional] IStream pPrintTicket, IStream pDeviceCapabilities, - [MarshalAs(UnmanagedType.BStr)] out string pbstrErrorMessage); + public static extern HRESULT PTGetPrintDeviceCapabilities(HPTPROVIDER hProvider, [Optional] IStream? pPrintTicket, IStream pDeviceCapabilities, + [MarshalAs(UnmanagedType.BStr)] out string? pbstrErrorMessage); /// It retrieves the print devices resources for a printer formatted in compliance with the XML Print Schema. /// @@ -440,8 +440,8 @@ public static partial class PrntvPt // *pbstrErrorMessage ); [DllImport(Lib.PrntvPt, SetLastError = false, ExactSpelling = true)] [PInvokeData("prntvpt.h", MSDNShortId = "39F17562-B8EB-41AF-BA55-42FE35B4560F")] - public static extern HRESULT PTGetPrintDeviceResources(HPTPROVIDER hProvider, [MarshalAs(UnmanagedType.LPWStr)] string pszLocaleName, - [Optional] IStream pPrintTicket, IStream pDeviceResources, [MarshalAs(UnmanagedType.BStr)] out string pbstrErrorMessage); + public static extern HRESULT PTGetPrintDeviceResources(HPTPROVIDER hProvider, [MarshalAs(UnmanagedType.LPWStr)] string? pszLocaleName, + [Optional] IStream? pPrintTicket, IStream pDeviceResources, [MarshalAs(UnmanagedType.BStr)] out string? pbstrErrorMessage); /// Merges two print tickets and returns a valid, viable print ticket. /// @@ -530,8 +530,8 @@ public static partial class PrntvPt // IStream *pResultTicket, BSTR *pbstrErrorMessage ); [DllImport(Lib.PrntvPt, SetLastError = false, ExactSpelling = true)] [PInvokeData("prntvpt.h", MSDNShortId = "97691930-d76a-48c9-80b9-8413d96322a9")] - public static extern HRESULT PTMergeAndValidatePrintTicket(HPTPROVIDER hProvider, IStream pBaseTicket, [Optional] IStream pDeltaTicket, - EPrintTicketScope scope, IStream pResultTicket, [MarshalAs(UnmanagedType.BStr)] out string pbstrErrorMessage); + public static extern HRESULT PTMergeAndValidatePrintTicket(HPTPROVIDER hProvider, IStream pBaseTicket, [Optional] IStream? pDeltaTicket, + EPrintTicketScope scope, IStream pResultTicket, [MarshalAs(UnmanagedType.BStr)] out string? pbstrErrorMessage); /// Opens an instance of a print ticket provider. /// A pointer to the full name of a print queue. @@ -694,7 +694,7 @@ public static partial class PrntvPt public static bool operator ==(HPTPROVIDER h1, HPTPROVIDER h2) => h1.Equals(h2); /// - public override bool Equals(object? obj) => obj is HPTPROVIDER h ? handle == h.handle : false; + public override bool Equals(object? obj) => obj is HPTPROVIDER h && handle == h.handle; /// public override int GetHashCode() => handle.GetHashCode(); @@ -741,7 +741,7 @@ public static partial class PrntvPt /// Converts the memory held by this object to a structure. /// The type of the structure. /// A structure marshaled from this memory. - public T ToStructure() => IsInvalid ? default : handle.ToStructure(); + public T? ToStructure() => IsInvalid ? default : handle.ToStructure(); /// protected override bool InternalReleaseHandle() => PTReleaseMemory(handle).Succeeded; diff --git a/PInvoke/Printing/WinSpool.DrvFuncs.cs b/PInvoke/Printing/WinSpool.DrvFuncs.cs index 67a8a07c..a0d8d671 100644 --- a/PInvoke/Printing/WinSpool.DrvFuncs.cs +++ b/PInvoke/Printing/WinSpool.DrvFuncs.cs @@ -950,11 +950,11 @@ public static partial class WinSpool const string subKey64 = @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\PackageInstallation\Windows x64\CorePrinterDrivers"; var is64bit = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432")); - using var baseKey = string.IsNullOrEmpty(pszServer) ? null : RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, pszServer); + using var baseKey = string.IsNullOrEmpty(pszServer) ? null : RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, pszServer!); using var reg = (baseKey ?? Registry.LocalMachine).OpenSubKey(is64bit ? subKey64 : subKey32, false);// RegistryKeyPermissionCheck.ReadSubTree, RegistryRights.EnumerateSubKeys); var keys = reg?.GetSubKeyNames(); if (keys?.Length == 0) return new CORE_PRINTER_DRIVER[0]; - var drvs = new CORE_PRINTER_DRIVER[keys.Length]; + var drvs = new CORE_PRINTER_DRIVER[keys!.Length]; GetCorePrinterDrivers(pszServer, pszEnvironment, keys, (uint)keys.Length, drvs).ThrowIfFailed(); return drvs; } @@ -1011,19 +1011,8 @@ public static partial class WinSpool /// A sequence of MONITOR_INFO_1 structures or MONITOR_INFO_2 structures. /// [PInvokeData("winspool.h", MSDNShortId = "4d4fbed2-193f-426c-8463-eeb6b1eaf316")] - public static IEnumerable EnumMonitors([Optional] string? pName) where T : struct - { - if (!TryGetLevel("MONITOR_INFO_", out var lvl)) - throw new ArgumentException($"{nameof(EnumMonitors)} cannot process a structure of type {typeof(T).Name}."); - if (!EnumMonitors(pName, lvl, default, 0, out var bytes, out var count)) - Win32Error.ThrowLastErrorUnless(Win32Error.ERROR_INSUFFICIENT_BUFFER); - if (bytes == 0) - return new T[0]; - using var mem = new SafeCoTaskMemHandle(bytes); - if (!EnumMonitors(pName, lvl, mem, mem.Size, out bytes, out count)) - Win32Error.ThrowLastError(); - return mem.ToArray((int)count); - } + public static IEnumerable EnumMonitors([Optional] string? pName) where T : struct => + WSEnum("MONITOR_INFO_", (uint l, IntPtr p, uint cb, out uint pcb, out uint c) => EnumMonitors(pName, l, p, cb, out pcb, out c)); /// The EnumPorts function enumerates the ports that are available for printing on a specified server. /// @@ -1075,19 +1064,8 @@ public static partial class WinSpool /// A sequence of PORT_INFO_1 structures or PORT_INFO_2 structures. /// The EnumPorts function can succeed even if the server specified by pName does not have a printer defined. [PInvokeData("winspool.h", MSDNShortId = "72ea0e35-bf26-4c12-9451-8f6941990d82")] - public static IEnumerable EnumPorts([Optional] string? pName) where T : struct - { - if (!TryGetLevel("PORT_INFO_", out var lvl)) - throw new ArgumentException($"{nameof(EnumPorts)} cannot process a structure of type {typeof(T).Name}."); - if (!EnumPorts(pName, lvl, default, 0, out var bytes, out var count)) - Win32Error.ThrowLastErrorUnless(Win32Error.ERROR_INSUFFICIENT_BUFFER); - if (bytes == 0) - return new T[0]; - using var mem = new SafeCoTaskMemHandle(bytes); - if (!EnumPorts(pName, lvl, mem, mem.Size, out bytes, out count)) - Win32Error.ThrowLastError(); - return mem.ToArray((int)count); - } + public static IEnumerable EnumPorts([Optional] string? pName) where T : struct => + WSEnum("PORT_INFO_", (uint l, IntPtr p, uint cb, out uint pcb, out uint c) => EnumPorts(pName, l, p, cb, out pcb, out c)); /// The EnumPrinterDrivers function enumerates the printer drivers installed on a specified printer server. /// @@ -1199,19 +1177,8 @@ public static partial class WinSpool /// DRIVER_INFO_6, or DRIVER_INFO_8 structures. /// [PInvokeData("winspool.h", MSDNShortId = "fa3d8cf4-70bc-4362-833e-e4217ed5d43b")] - public static IEnumerable EnumPrinterDrivers([Optional] string? pName, [Optional] string? pEnvironment) where T : struct - { - if (!TryGetLevel("DRIVER_INFO_", out var lvl)) - throw new ArgumentException($"{nameof(EnumPrinterDrivers)} cannot process a structure of type {typeof(T).Name}."); - if (!EnumPrinterDrivers(pName, pEnvironment, lvl, default, 0, out var bytes, out var count)) - Win32Error.ThrowLastErrorUnless(Win32Error.ERROR_INSUFFICIENT_BUFFER); - if (bytes == 0) - return new T[0]; - using var mem = new SafeCoTaskMemHandle(bytes); - if (!EnumPrinterDrivers(pName, pEnvironment, lvl, mem, mem.Size, out bytes, out count)) - Win32Error.ThrowLastError(); - return mem.ToArray((int)count); - } + public static IEnumerable EnumPrinterDrivers([Optional] string? pName, [Optional] string? pEnvironment) where T : struct => + WSEnum("DRIVER_INFO_", (uint l, IntPtr p, uint cb, out uint pcb, out uint c) => EnumPrinterDrivers(pName, pEnvironment, l, p, cb, out pcb, out c)); /// The EnumPrintProcessorDatatypes function enumerates the data types that a specified print processor supports. /// @@ -1271,19 +1238,8 @@ public static partial class WinSpool /// A sequence of DATATYPES_INFO_1 structures. /// Starting with Windows Vista, the data type information from remote print servers is retrieved from a local cache. [PInvokeData("winspool.h", MSDNShortId = "27b6e074-d303-446b-9e5f-6cfa55c30d26")] - public static IEnumerable EnumPrintProcessorDatatypes(string pPrintProcessorName, [Optional] string? pName) where T : struct - { - if (!TryGetLevel("DATATYPES_INFO_", out var lvl)) - throw new ArgumentException($"{nameof(EnumPrintProcessorDatatypes)} cannot process a structure of type {typeof(T).Name}."); - if (!EnumPrintProcessorDatatypes(pName, pPrintProcessorName, lvl, default, 0, out var bytes, out var count)) - Win32Error.ThrowLastErrorUnless(Win32Error.ERROR_INSUFFICIENT_BUFFER); - if (bytes == 0) - return new T[0]; - using var mem = new SafeCoTaskMemHandle(bytes); - if (!EnumPrintProcessorDatatypes(pName, pPrintProcessorName, lvl, mem, mem.Size, out bytes, out count)) - Win32Error.ThrowLastError(); - return mem.ToArray((int)count); - } + public static IEnumerable EnumPrintProcessorDatatypes(string pPrintProcessorName, [Optional] string? pName) where T : struct => + WSEnum("DATATYPES_INFO_", (uint l, IntPtr p, uint cb, out uint pcb, out uint c) => EnumPrintProcessorDatatypes(pName, pPrintProcessorName, l, p, cb, out pcb, out c)); /// The EnumPrintProcessors function enumerates the print processors installed on the specified server. /// @@ -1597,7 +1553,7 @@ public static partial class WinSpool [DllImport(Lib.Winspool, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("winspool.h", MSDNShortId = "0d482d28-7668-4734-ba71-5b355c18ddec")] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool GetPrinterDriver2([Optional] HWND hWnd, HPRINTER hPrinter, [Optional] string? pEnvironment, uint Level, IntPtr pDriverInfo, uint cbBuf, out uint pcbNeeded); + public static extern bool GetPrinterDriver2([Optional] HWND hWnd, HPRINTER hPrinter, [Optional] string? pEnvironment, uint Level, [Optional] IntPtr pDriverInfo, [Optional] uint cbBuf, out uint pcbNeeded); /// /// The GetPrinterDriver2 function retrieves driver data for the specified printer. If the driver is not installed on the @@ -1672,7 +1628,7 @@ public static partial class WinSpool [DllImport(Lib.Winspool, SetLastError = false, CharSet = CharSet.Auto)] [PInvokeData("winspool.h", MSDNShortId = "69c9cc87-d7e3-496a-b631-b3ae30cdb3fd")] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool GetPrinterDriverDirectory([Optional] string? pName, [Optional] string? pEnvironment, uint Level, StringBuilder pDriverDirectory, int cbBuf, out int pcbNeeded); + public static extern bool GetPrinterDriverDirectory([Optional] string? pName, [Optional] string? pEnvironment, uint Level, StringBuilder? pDriverDirectory, int cbBuf, out int pcbNeeded); /// Retrieves the path to the specified printer driver package on a print server. /// @@ -1709,7 +1665,8 @@ public static partial class WinSpool // pszDriverPackageCab, _In_ DWORD cchDriverPackageCab, _Out_ LPDWORD pcchRequiredSize ); [DllImport(Lib.Winspool, SetLastError = false, CharSet = CharSet.Auto)] [PInvokeData("winspool.h", MSDNShortId = "e88e984b-d2c0-43b4-8f70-b05ec202ab14")] - public static extern HRESULT GetPrinterDriverPackagePath([Optional] string? pszServer, [Optional] string? pszEnvironment, [Optional] string? pszLanguage, string pszPackageID, StringBuilder pszDriverPackageCab, int cchDriverPackageCab, out int pcchRequiredSize); + public static extern HRESULT GetPrinterDriverPackagePath([Optional] string? pszServer, [Optional] string? pszEnvironment, [Optional] string? pszLanguage, + string pszPackageID, StringBuilder? pszDriverPackageCab, int cchDriverPackageCab, out int pcchRequiredSize); /// /// The GetPrintProcessorDirectory function retrieves the path to the print processor directory on the specified server. @@ -1744,7 +1701,7 @@ public static partial class WinSpool [DllImport(Lib.Winspool, SetLastError = false, CharSet = CharSet.Auto)] [PInvokeData("winspool.h", MSDNShortId = "a2443cfd-e5ba-41c6-aaf4-45051a3d0e26")] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool GetPrintProcessorDirectory([Optional] string? pName, [Optional] string? pEnvironment, uint Level, StringBuilder pPrintProcessorInfo, int cbBuf, out int pcbNeeded); + public static extern bool GetPrintProcessorDirectory([Optional] string? pName, [Optional] string? pEnvironment, uint Level, StringBuilder? pPrintProcessorInfo, int cbBuf, out int pcbNeeded); /// Installs a printer driver from a driver package that is in the print server's driver store. /// diff --git a/PInvoke/Printing/WinSpool.Funcs.cs b/PInvoke/Printing/WinSpool.Funcs.cs index 86da7d04..83ad88e4 100644 --- a/PInvoke/Printing/WinSpool.Funcs.cs +++ b/PInvoke/Printing/WinSpool.Funcs.cs @@ -1,5 +1,8 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; +using System.Runtime.CompilerServices; +using System.Security.Cryptography; namespace Vanara.PInvoke; @@ -163,7 +166,7 @@ public static partial class WinSpool /// print spooler that the print job can now be scheduled by the spooler for printing. /// [PInvokeData("winspool.h", MSDNShortId = "cfafa874-6022-4bf4-bf3d-096213eb0c98")] - public static bool AddJob(HPRINTER hPrinter, out string path, out uint jobId) + public static bool AddJob(HPRINTER hPrinter, out string? path, out uint jobId) { path = null; jobId = 0; AddJob(hPrinter, 1, default, 0, out var sz); @@ -451,7 +454,7 @@ public static partial class WinSpool // https://docs.microsoft.com/en-us/windows/win32/printdocs/addprinterconnection2 BOOL AddPrinterConnection2( _In_ HWND hWnd, _In_ // LPCTSTR pszName, DWORD dwLevel, _In_ PVOID pConnectionInfo ); [PInvokeData("winspool.h", MSDNShortId = "5ae98157-5978-449e-beb1-4787110925fa")] - public static bool AddPrinterConnection2([Optional] HWND hWnd, string pszName, PRINTER_CONNECTION_FLAGS flags, string driverName = null) => + public static bool AddPrinterConnection2([Optional] HWND hWnd, string pszName, PRINTER_CONNECTION_FLAGS flags, string? driverName = null) => AddPrinterConnection2(hWnd, pszName, 1, new PRINTER_CONNECTION_INFO_1 { dwFlags = flags, pszDriverName = driverName }); /// @@ -1909,7 +1912,7 @@ public static partial class WinSpool // hPrinter, _In_ LPTSTR pDeviceName, _Out_ PDEVMODE pDevModeOutput, _In_ PDEVMODE pDevModeInput, _In_ DWORD fMode ); [DllImport(Lib.Winspool, SetLastError = false, CharSet = CharSet.Auto)] [PInvokeData("winspool.h", MSDNShortId = "e89a2f6f-2bac-4369-b526-f8e15028698b")] - public static extern int DocumentProperties(HWND hWnd, HPRINTER hPrinter, string pDeviceName, IntPtr pDevModeOutput, in DEVMODE pDevModeInput, DM fMode); + public static extern int DocumentProperties(HWND hWnd, HPRINTER hPrinter, string pDeviceName, IntPtr pDevModeOutput, in DEVMODE pDevModeInput, [Optional] DM fMode); /// /// The DocumentProperties function retrieves or modifies printer initialization information or displays a @@ -2034,7 +2037,7 @@ public static partial class WinSpool // hPrinter, _In_ LPTSTR pDeviceName, _Out_ PDEVMODE pDevModeOutput, _In_ PDEVMODE pDevModeInput, _In_ DWORD fMode ); [DllImport(Lib.Winspool, SetLastError = false, CharSet = CharSet.Auto)] [PInvokeData("winspool.h", MSDNShortId = "e89a2f6f-2bac-4369-b526-f8e15028698b")] - public static extern int DocumentProperties(HWND hWnd, HPRINTER hPrinter, string pDeviceName, IntPtr pDevModeOutput, [Optional] IntPtr pDevModeInput, DM fMode); + public static extern int DocumentProperties(HWND hWnd, HPRINTER hPrinter, string pDeviceName, IntPtr pDevModeOutput, [Optional] IntPtr pDevModeInput, [Optional] DM fMode); /// The EndDocPrinter function ends a print job for the specified printer. /// @@ -2175,20 +2178,38 @@ public static partial class WinSpool /// /// A sequence of FORM_INFO_1 or FORM_INFO_2 structures. All the structures will be of . [PInvokeData("winspool.h", MSDNShortId = "b13b515a-c764-4a80-ab85-95fb4abb2a6b")] - public static IEnumerable EnumForms(HPRINTER hPrinter) where T : struct + public static IEnumerable EnumForms(HPRINTER hPrinter) where T : struct => + WSEnum("FORM_INFO_", (uint l, IntPtr p, uint cb, out uint pcb, out uint c) => EnumForms(hPrinter, l, p, cb, out pcb, out c)); + + private delegate bool F1(uint l, IntPtr p, uint cb, out uint pcb, out uint pcr); + private delegate bool T1(uint l, IntPtr p, uint cb, out uint pcb); + + private static IEnumerable WSEnum(string prefix, F1 f, [CallerMemberName] string? caller = null) where T : struct { - if (!TryGetLevel("FORM_INFO_", out var lvl)) - throw new ArgumentException($"{nameof(EnumForms)} cannot process a structure of type {typeof(T).Name}."); - if (!EnumForms(hPrinter, lvl, default, 0, out var bytes, out var count)) + if (!TryGetLevel(prefix, out var lvl)) + throw new ArgumentException($"{caller} cannot process a structure of type {typeof(T).Name}."); + if (!f(lvl, default, 0, out var bytes, out var count)) Win32Error.ThrowLastErrorUnless(Win32Error.ERROR_INSUFFICIENT_BUFFER); if (bytes == 0) return new T[0]; - using var mem = new SafeCoTaskMemHandle(bytes); - if (!EnumForms(hPrinter, lvl, mem, mem.Size, out bytes, out count)) + using SafeCoTaskMemHandle mem = new(bytes); + if (!f(lvl, mem, mem.Size, out bytes, out count)) Win32Error.ThrowLastError(); return mem.ToArray((int)count); } + private static T WSGet(string prefix, T1 f, [CallerMemberName] string? caller = null) where T : struct + { + if (!TryGetLevel(prefix, out var lvl)) + throw new ArgumentException($"{caller} cannot process a structure of type {typeof(T).Name}."); + if (!f(lvl, default, 0, out var bytes)) + Win32Error.ThrowLastErrorUnless(Win32Error.ERROR_INSUFFICIENT_BUFFER); + using SafeCoTaskMemStruct mem = new(bytes); + if (!f(lvl, mem, mem.Size, out bytes)) + Win32Error.ThrowLastError(); + return mem.Value; + } + /// The EnumJobs function retrieves information about a specified set of print jobs for a specified printer. /// /// A handle to the printer object whose print jobs the function enumerates. Use the OpenPrinter or AddPrinter @@ -2279,19 +2300,8 @@ public static partial class WinSpool /// A sequence of JOB_INFO_1, JOB_INFO_2, or JOB_INFO_3 structures. All the structures will be of . /// [PInvokeData("winspool.h", MSDNShortId = "1cf429ea-b40e-4063-b6de-c43b7b87f3d3")] - public static IEnumerable EnumJobs(HPRINTER hPrinter, uint FirstJob = 0, uint NoJobs = uint.MaxValue) where T : struct - { - if (!TryGetLevel("JOB_INFO_", out var lvl)) - throw new ArgumentException($"{nameof(EnumJobs)} cannot process a structure of type {typeof(T).Name}."); - if (!EnumJobs(hPrinter, FirstJob, NoJobs, lvl, default, 0, out var bytes, out var count)) - Win32Error.ThrowLastErrorUnless(Win32Error.ERROR_INSUFFICIENT_BUFFER); - if (bytes == 0) - return new T[0]; - using var mem = new SafeCoTaskMemHandle(bytes); - if (!EnumJobs(hPrinter, FirstJob, NoJobs, lvl, mem, mem.Size, out bytes, out count)) - Win32Error.ThrowLastError(); - return mem.ToArray((int)count); - } + public static IEnumerable EnumJobs(HPRINTER hPrinter, uint FirstJob = 0, uint NoJobs = uint.MaxValue) where T : struct => + WSEnum("JOB_INFO_", (uint l, IntPtr p, uint cb, out uint pcb, out uint c) => EnumJobs(hPrinter, FirstJob, NoJobs, l, p, cb, out pcb, out c)); /// /// The EnumPrinterData function enumerates configuration data for a specified printer. @@ -2385,8 +2395,8 @@ public static partial class WinSpool // _In_ DWORD cbData, _Out_ LPDWORD pcbData ); [DllImport(Lib.Winspool, SetLastError = false, CharSet = CharSet.Auto)] [PInvokeData("winspool.h", MSDNShortId = "0a4c8436-46fe-4e21-8d55-c5031a3d1b38")] - public static extern Win32Error EnumPrinterData(HPRINTER hPrinter, uint dwIndex, StringBuilder pValueName, uint cbValueName, - out uint pcbValueName, out REG_VALUE_TYPE pType, IntPtr pData, uint cbData, out uint pcbData); + public static extern Win32Error EnumPrinterData(HPRINTER hPrinter, uint dwIndex, StringBuilder? pValueName, uint cbValueName, + out uint pcbValueName, out REG_VALUE_TYPE pType, [Optional] IntPtr pData, uint cbData, out uint pcbData); /// /// The EnumPrinterData function enumerates configuration data for a specified printer. @@ -2414,7 +2424,7 @@ public static partial class WinSpool /// /// [PInvokeData("winspool.h", MSDNShortId = "0a4c8436-46fe-4e21-8d55-c5031a3d1b38")] - public static IEnumerable<(string valueName, REG_VALUE_TYPE valueType, object value)> EnumPrinterData(HPRINTER hPrinter) + public static IEnumerable<(string valueName, REG_VALUE_TYPE valueType, object? value)> EnumPrinterData(HPRINTER hPrinter) { var idx = 0U; EnumPrinterData(hPrinter, idx, null, 0, out var valueNameSz, out _, default, 0, out var dataSz).ThrowIfFailed(); @@ -2517,7 +2527,7 @@ public static partial class WinSpool /// /// [PInvokeData("winspool.h", MSDNShortId = "bc5ecc46-24a4-4b54-9431-0eaf6446e2d6")] - public static IEnumerable<(string valueName, REG_VALUE_TYPE valueType, object value)> EnumPrinterDataEx(HPRINTER hPrinter, string pKeyName = "PrinterDriverData") + public static IEnumerable<(string valueName, REG_VALUE_TYPE valueType, object? value)> EnumPrinterDataEx(HPRINTER hPrinter, string pKeyName = "PrinterDriverData") { EnumPrinterDataEx(hPrinter, pKeyName, default, 0, out var sz, out var cnt).ThrowUnless(Win32Error.ERROR_MORE_DATA); using var mem = new SafeCoTaskMemHandle(sz); @@ -2828,7 +2838,7 @@ public static partial class WinSpool [DllImport(Lib.Winspool, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("winspool.h", MSDNShortId = "0d0cc726-c515-4146-9273-cdf1db3c76b7")] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool EnumPrinters(PRINTER_ENUM Flags, string Name, uint Level, IntPtr pPrinterEnum, uint cbBuf, out uint pcbNeeded, out uint pcReturned); + public static extern bool EnumPrinters(PRINTER_ENUM Flags, string? Name, uint Level, IntPtr pPrinterEnum, uint cbBuf, out uint pcbNeeded, out uint pcReturned); /// The EnumPrinters function enumerates available printers, print servers, domains, or print providers. /// @@ -2921,19 +2931,8 @@ public static partial class WinSpool /// /// [PInvokeData("winspool.h", MSDNShortId = "0d0cc726-c515-4146-9273-cdf1db3c76b7")] - public static IEnumerable EnumPrinters(PRINTER_ENUM Flags = PRINTER_ENUM.PRINTER_ENUM_LOCAL, string Name = null) where T : struct - { - if (!TryGetLevel("PRINTER_INFO_", out var lvl)) - throw new ArgumentException($"{nameof(EnumPrinters)} cannot process a structure of type {typeof(T).Name}."); - if (!EnumPrinters(Flags, Name, lvl, default, 0, out var bytes, out var count)) - Win32Error.ThrowLastErrorUnless(Win32Error.ERROR_INSUFFICIENT_BUFFER); - if (bytes == 0) - return new T[0]; - using var mem = new SafeCoTaskMemHandle(bytes); - if (!EnumPrinters(Flags, Name, lvl, mem, mem.Size, out bytes, out count)) - Win32Error.ThrowLastError(); - return mem.ToArray((int)count); - } + public static IEnumerable EnumPrinters(PRINTER_ENUM Flags = PRINTER_ENUM.PRINTER_ENUM_LOCAL, string? Name = null) where T : struct => + WSEnum("PRINTER_INFO_", (uint l, IntPtr p, uint cb, out uint pcb, out uint c) => EnumPrinters(Flags, Name, l, p, cb, out pcb, out c)); /// /// The FindClosePrinterChangeNotification function closes a change notification object created by calling the @@ -3777,7 +3776,7 @@ public static partial class WinSpool [DllImport(Lib.Winspool, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("winspool.h", MSDNShortId = "8ec06743-43ce-4fac-83c4-f09eac7ee333")] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool GetDefaultPrinter(StringBuilder pszBuffer, ref int pcchBuffer); + public static extern bool GetDefaultPrinter(StringBuilder? pszBuffer, ref int pcchBuffer); /// The GetForm function retrieves information about a specified form. /// @@ -3823,17 +3822,8 @@ public static partial class WinSpool /// If the caller is remote, and the Level is 2, the StringType value of the returned FORM_INFO_2 will always be STRING_LANGPAIR. /// [PInvokeData("winspool.h", MSDNShortId = "10b25748-6d7c-46ab-bd2c-9b6126a1d7d1")] - public static T GetForm(HPRINTER hPrinter, string pFormName) where T : struct - { - if (!TryGetLevel("FORM_INFO_", out var lvl)) - throw new ArgumentException($"{nameof(GetForm)} cannot process a structure of type {typeof(T).Name}."); - if (!GetForm(hPrinter, pFormName, lvl, default, 0, out var sz)) - Win32Error.ThrowLastErrorUnless(Win32Error.ERROR_INSUFFICIENT_BUFFER); - using var mem = new SafeCoTaskMemHandle(sz); - if (!GetForm(hPrinter, pFormName, lvl, mem, mem.Size, out sz)) - Win32Error.ThrowLastError(); - return mem.ToStructure(); - } + public static T GetForm(HPRINTER hPrinter, string pFormName) where T : struct => + WSGet("FORM_INFO_", (uint l, IntPtr p, uint cb, out uint pcb) => GetForm(hPrinter, pFormName, l, p, cb, out pcb)); /// The GetJob function retrieves information about a specified print job. /// @@ -3889,17 +3879,8 @@ public static partial class WinSpool /// A JOB_INFO_1 or a JOB_INFO_2 structure containing information about the job as specified by . /// [PInvokeData("winspool.h", MSDNShortId = "57e59f84-d2a0-4722-b0fc-6673f7bb5c57")] - public static T GetJob(HPRINTER hPrinter, uint JobId) where T : struct - { - if (!TryGetLevel("JOB_INFO_", out var lvl)) - throw new ArgumentException($"{nameof(GetJob)} cannot process a structure of type {typeof(T).Name}."); - if (!GetJob(hPrinter, JobId, lvl, default, 0, out var sz)) - Win32Error.ThrowLastErrorUnless(Win32Error.ERROR_INSUFFICIENT_BUFFER); - using var mem = new SafeCoTaskMemHandle(sz); - if (!GetJob(hPrinter, JobId, lvl, mem, mem.Size, out sz)) - Win32Error.ThrowLastError(); - return mem.ToStructure(); - } + public static T GetJob(HPRINTER hPrinter, uint JobId) where T : struct => + WSGet("JOB_INFO_", (uint l, IntPtr p, uint cb, out uint pcb) => GetJob(hPrinter, JobId, l, p, cb, out pcb)); /// The GetPrinter function retrieves information about a specified printer. /// @@ -4112,17 +4093,8 @@ public static partial class WinSpool /// configurations, the printer data is queried from the print server. /// /// - public static T GetPrinter(HPRINTER hPrinter) where T : struct - { - if (!TryGetLevel("PRINTER_INFO_", out var lvl)) - throw new ArgumentException($"{nameof(GetPrinter)} cannot process a structure of type {typeof(T).Name}."); - if (!GetPrinter(hPrinter, lvl, default, 0, out var sz)) - Win32Error.ThrowLastErrorUnless(Win32Error.ERROR_INSUFFICIENT_BUFFER); - using var mem = new SafeCoTaskMemHandle(sz); - if (!GetPrinter(hPrinter, lvl, mem, mem.Size, out sz)) - Win32Error.ThrowLastError(); - return mem.ToStructure(); - } + public static T GetPrinter(HPRINTER hPrinter) where T : struct => + WSGet("PRINTER_INFO_", (uint l, IntPtr p, uint cb, out uint pcb) => GetPrinter(hPrinter, l, p, cb, out pcb)); /// /// The GetPrinterData function retrieves configuration data for the specified printer or print server. @@ -4578,7 +4550,7 @@ public static partial class WinSpool /// /// [PInvokeData("winspool.h", MSDNShortId = "b5a44b27-a4aa-4e58-9a64-05be87d12ab5")] - public static object GetPrinterData(HPRINTER hPrinter, string pValueName) + public static object? GetPrinterData(HPRINTER hPrinter, string pValueName) { GetPrinterData(hPrinter, pValueName, out _, default, 0, out var sz).ThrowUnless(Win32Error.ERROR_MORE_DATA); using var mem = new SafeCoTaskMemHandle(sz); @@ -5068,7 +5040,7 @@ public static partial class WinSpool /// /// [PInvokeData("winspool.h", MSDNShortId = "5d9183a7-97cc-46de-848e-e37ce51396eb")] - public static object GetPrinterDataEx(HPRINTER hPrinter, string pKeyName, string pValueName) + public static object? GetPrinterDataEx(HPRINTER hPrinter, string pKeyName, string pValueName) { GetPrinterDataEx(hPrinter, pKeyName, pValueName, out _, default, 0, out var sz).ThrowUnless(Win32Error.ERROR_MORE_DATA); using var mem = new SafeCoTaskMemHandle(sz); @@ -5252,8 +5224,8 @@ public static partial class WinSpool [DllImport(Lib.Winspool, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("winspool.h", MSDNShortId = "96763220-d851-46f0-8be8-403f3356edb9")] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool OpenPrinter(string pPrinterName, out SafeHPRINTER phPrinter, - [In, Optional, MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(PRINTER_DEFAULTS_Marshaler))] PRINTER_DEFAULTS pDefault); + public static extern bool OpenPrinter(string? pPrinterName, out SafeHPRINTER phPrinter, + [In, Optional, MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(PRINTER_DEFAULTS_Marshaler))] PRINTER_DEFAULTS? pDefault); /// /// Retrieves a handle to the specified printer, print server, or other types of handles in the print subsystem, while setting some @@ -5345,8 +5317,101 @@ public static partial class WinSpool [DllImport(Lib.Winspool, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("winspool.h", MSDNShortId = "e2370ae4-4475-4ccc-a6f9-3d33d1370054")] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool OpenPrinter2(string pPrinterName, out SafeHPRINTER phPrinter, - [In, Optional, MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(PRINTER_DEFAULTS_Marshaler))] PRINTER_DEFAULTS pDefault, in PRINTER_OPTIONS pOptions); + public static extern bool OpenPrinter2(string? pPrinterName, out SafeHPRINTER phPrinter, + [In, Optional, MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(PRINTER_DEFAULTS_Marshaler))] PRINTER_DEFAULTS? pDefault, in PRINTER_OPTIONS pOptions); + + /// + /// Retrieves a handle to the specified printer, print server, or other types of handles in the print subsystem, while setting some + /// of the printer options. + /// + /// + /// + /// A pointer to a constant null-terminated string that specifies the name of the printer or print server, the printer object, the + /// XcvMonitor, or the XcvPort. + /// + /// + /// For a printer object, use: PrinterName,Job xxxx. For an XcvMonitor, use: ServerName,XcvMonitor MonitorName. For an XcvPort, use: + /// ServerName,XcvPort PortName. + /// + /// Windows Vista: If NULL, it indicates the local print server. + /// + /// A pointer to a variable that receives a handle to the open printer or print server object. + /// A pointer to a PRINTER_DEFAULTS structure. This value can be NULL. + /// A pointer to a PRINTER_OPTIONS structure. This value can be NULL. + /// + /// If the function succeeds, the return value is a nonzero value. + /// If the function fails, the return value is zero. For extended error information, call GetLastError. + /// + /// + /// Do not call this method in DllMain. + /// The ANSI version of this function is not implemented and returns ERROR_NOT_SUPPORTED. + /// + /// The pDefault parameter enables you to specify the data type and device mode values that are used for printing documents + /// submitted by the StartDocPrinter function. However, you can override these values by using the SetJob function + /// after a document has been started. + /// + /// + /// You can call the OpenPrinter2 function to open a handle to a print server or to determine client access rights to a print + /// server. To do this, specify the name of the print server in the pPrinterName parameter, set the pDatatype and + /// pDevMode members of the PRINTER_DEFAULTS structure to NULL, and set the DesiredAccess member to + /// specify a server access mask value such as SERVER_ALL_ACCESS. When you are finished with the handle, pass it to the + /// ClosePrinter function to close it. + /// + /// + /// Use the DesiredAccess member of the PRINTER_DEFAULTS structure to specify the necessary access rights. The access + /// rights can be one of the following. + /// + /// + /// + /// Desired Access value + /// Meaning + /// + /// + /// PRINTER_ACCESS_ADMINISTER + /// To perform administrative tasks, such as those provided by SetPrinter. + /// + /// + /// PRINTER_ACCESS_USE + /// To perform basic printing operations. + /// + /// + /// PRINTER_ALL_ACCESS + /// To perform all administrative tasks and basic printing operations except SYNCHRONIZE. See Standard Access Rights. + /// + /// + /// PRINTER_ACCESS_MANAGE_LIMITED + /// + /// To perform administrative tasks, such as those provided by SetPrinter and SetPrinterData. This value is available starting from + /// Windows 8.1. + /// + /// + /// + /// generic security values, such as WRITE_DAC + /// To allow specific control access rights. See Standard Access Rights. + /// + /// + /// + /// If a user does not have permission to open a specified printer or print server with the desired access, the OpenPrinter2 + /// call will fail, and GetLastError will return the value ERROR_ACCESS_DENIED. + /// + /// + /// When pPrinterName is a local printer, then OpenPrinter2 ignores all values of the dwFlags that the + /// PRINTER_OPTIONS structure pointed to using pOptions, except PRINTER_OPTION_CLIENT_CHANGE. If the latter is passed, then + /// OpenPrinter2 will return ERROR_ACCESS_DENIED. Accordingly, when opening a local printer, OpenPrinter2 provides no + /// advantage over OpenPrinter. + /// + /// + /// Windows Vista: The printer data returned by OpenPrinter2 is retrieved from a local cache unless the + /// PRINTER_OPTION_NO_CACHE flag is set in the dwFlags field of the PRINTER_OPTIONS structure referenced by pOptions. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/printdocs/openprinter2 BOOL OpenPrinter2( _In_ LPCTSTR pPrinterName, _Out_ + // LPHANDLE phPrinter, _In_ LPPRINTER_DEFAULTS pDefault, _In_ PPRINTER_OPTIONS pOptions ); + [DllImport(Lib.Winspool, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("winspool.h", MSDNShortId = "e2370ae4-4475-4ccc-a6f9-3d33d1370054")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool OpenPrinter2(string? pPrinterName, out SafeHPRINTER phPrinter, + [In, Optional, MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(PRINTER_DEFAULTS_Marshaler))] PRINTER_DEFAULTS? pDefault, [In, Optional] IntPtr pOptions); /// The PrinterProperties function displays a printer-properties property sheet for the specified printer. /// A handle to the parent window of the property sheet. @@ -5499,7 +5564,7 @@ public static partial class WinSpool [DllImport(Lib.Winspool, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("winspool.h", MSDNShortId = "55eec548-577f-422b-80e3-8b23aa4d2159")] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool SetDefaultPrinter(string pszPrinter); + public static extern bool SetDefaultPrinter(string? pszPrinter); /// The SetForm function sets the form information for the specified printer. /// @@ -5976,7 +6041,7 @@ public static partial class WinSpool [PInvokeData("winspool.h", MSDNShortId = "1b80ad93-aaa1-41ed-a668-a944fa62c3eb")] public static bool SetPort([Optional] string? pName, string pPortName, PORT_STATUS status, PORT_STATUS_TYPE severity) { - using var mem = SafeCoTaskMemHandle.CreateFromStructure(new PORT_INFO_3 { dwStatus = status, dwSeverity = severity }); + using SafeCoTaskMemStruct mem = new PORT_INFO_3 { dwStatus = status, dwSeverity = severity }; return SetPort(pName, pPortName, 3, mem); } @@ -6008,7 +6073,7 @@ public static partial class WinSpool [PInvokeData("winspool.h", MSDNShortId = "1b80ad93-aaa1-41ed-a668-a944fa62c3eb")] public static bool SetPort([Optional] string? pName, string pPortName, string status, PORT_STATUS_TYPE severity) { - using var mem = SafeCoTaskMemHandle.CreateFromStructure(new PORT_INFO_3 { pszStatus = status, dwSeverity = severity }); + using SafeCoTaskMemStruct mem = new PORT_INFO_3 { pszStatus = status, dwSeverity = severity }; return SetPort(pName, pPortName, 3, mem); } @@ -6988,7 +7053,7 @@ public static partial class WinSpool { return InlineSetPrinterData(SetData, hPrinter, null, pValueName, pData, type); - static Win32Error SetData(HPRINTER p1, string p2, string p3, REG_VALUE_TYPE p4, IntPtr p5, uint p6) => + static Win32Error SetData(HPRINTER p1, string? p2, string p3, REG_VALUE_TYPE p4, IntPtr p5, uint p6) => SetPrinterData(p1, p3, p4, p5, p6); } @@ -7226,7 +7291,7 @@ public static partial class WinSpool // LPCTSTR pKeyName, _In_ LPCTSTR pValueName, _In_ DWORD Type, _In_ LPBYTE pData, _In_ DWORD cbData ); [DllImport(Lib.Winspool, SetLastError = false, CharSet = CharSet.Auto)] [PInvokeData("winspool.h", MSDNShortId = "b7faadfc-1c81-4ddf-8fe5-68f4cc0376f1")] - public static extern Win32Error SetPrinterDataEx(HPRINTER hPrinter, string pKeyName, string pValueName, REG_VALUE_TYPE Type, IntPtr pData, uint cbData); + public static extern Win32Error SetPrinterDataEx(HPRINTER hPrinter, string? pKeyName, string pValueName, REG_VALUE_TYPE Type, IntPtr pData, uint cbData); /// /// The SetPrinterDataEx function sets the configuration data for a printer or print server. The function stores the @@ -7462,7 +7527,7 @@ public static partial class WinSpool // LPCTSTR pKeyName, _In_ LPCTSTR pValueName, _In_ DWORD Type, _In_ LPBYTE pData, _In_ DWORD cbData ); [DllImport(Lib.Winspool, SetLastError = false, CharSet = CharSet.Auto)] [PInvokeData("winspool.h", MSDNShortId = "b7faadfc-1c81-4ddf-8fe5-68f4cc0376f1")] - public static extern Win32Error SetPrinterDataEx(HPRINTER hPrinter, string pKeyName, string pValueName, REG_VALUE_TYPE Type, byte[] pData, uint cbData); + public static extern Win32Error SetPrinterDataEx(HPRINTER hPrinter, string? pKeyName, string pValueName, REG_VALUE_TYPE Type, byte[] pData, uint cbData); /// /// The SetPrinterDataEx function sets the configuration data for a printer or print server. The function stores the @@ -7694,7 +7759,7 @@ public static partial class WinSpool /// /// [PInvokeData("winspool.h", MSDNShortId = "b7faadfc-1c81-4ddf-8fe5-68f4cc0376f1")] - public static Win32Error SetPrinterDataEx(HPRINTER hPrinter, string pKeyName, string pValueName, object pData, REG_VALUE_TYPE type = 0) => + public static Win32Error SetPrinterDataEx(HPRINTER hPrinter, string? pKeyName, string pValueName, object pData, REG_VALUE_TYPE type = 0) => InlineSetPrinterData(SetPrinterDataEx, hPrinter, pKeyName, pValueName, pData, type); /// The StartDocPrinter function notifies the print spooler that a document is to be spooled for printing. @@ -7903,7 +7968,7 @@ public static partial class WinSpool [return: MarshalAs(UnmanagedType.Bool)] private static extern bool AddPrinterConnection2([Optional] HWND hWnd, string pszName, uint dwLevel, in PRINTER_CONNECTION_INFO_1 pConnectionInfo); - private static Win32Error InlineSetPrinterData(Func f, HPRINTER hPrinter, string pKeyName, string pValueName, object pData, REG_VALUE_TYPE type) + private static Win32Error InlineSetPrinterData(Func f, HPRINTER hPrinter, string? pKeyName, string pValueName, object pData, REG_VALUE_TYPE type) { var pDataType = pData.GetType(); if (type == 0) type = RegistryTypeExt.GetFromType(pDataType); diff --git a/PInvoke/Printing/WinSpool.Structs.cs b/PInvoke/Printing/WinSpool.Structs.cs index 5520f0cf..6610c846 100644 --- a/PInvoke/Printing/WinSpool.Structs.cs +++ b/PInvoke/Printing/WinSpool.Structs.cs @@ -71,7 +71,7 @@ public static partial class WinSpool /// Pointer to a null-terminated string that specifies the name of an output file. To print to a printer, set this to NULL. /// [MarshalAs(UnmanagedType.LPTStr)] - public string pOutputFile; + public string? pOutputFile; /// Pointer to a null-terminated string that identifies the type of data used to record the document. [MarshalAs(UnmanagedType.LPTStr)] @@ -273,7 +273,7 @@ public static partial class WinSpool /// NULL and should be specified only for printers capable of bidirectional communication. /// [MarshalAs(UnmanagedType.LPTStr)] - public string pMonitorName; + public string? pMonitorName; /// A pointer to a null-terminated string that specifies the default data type of the print job (for example, "EMF"). [MarshalAs(UnmanagedType.LPTStr)] @@ -343,7 +343,7 @@ public static partial class WinSpool /// NULL and should be specified only for printers capable of bidirectional communication. /// [MarshalAs(UnmanagedType.LPTStr)] - public string pMonitorName; + public string? pMonitorName; /// A pointer to a null-terminated string that specifies the default data type of the print job (for example, EMF). [MarshalAs(UnmanagedType.LPTStr)] @@ -486,7 +486,7 @@ public static partial class WinSpool /// NULL and should be specified only for printers capable of bidirectional communication. /// [MarshalAs(UnmanagedType.LPTStr)] - public string pMonitorName; + public string? pMonitorName; /// A pointer to a null-terminated string that specifies the default data type of the print job (for example, "EMF"). [MarshalAs(UnmanagedType.LPTStr)] @@ -507,21 +507,21 @@ public static partial class WinSpool /// Pointer to a null-terminated string that specifies the manufacturer's name. [MarshalAs(UnmanagedType.LPTStr)] - public string pszMfgName; + public string? pszMfgName; /// Pointer to a null-terminated string that specifies the URL for the manufacturer. [MarshalAs(UnmanagedType.LPTStr)] - public string pszOEMUrl; + public string? pszOEMUrl; /// Pointer to a null-terminated string that specifies the hardware ID for the printer driver. [MarshalAs(UnmanagedType.LPTStr)] - public string pszHardwareID; + public string? pszHardwareID; /// /// Pointer to a null-terminated string that specifies the provider of the printer driver (for example, "Microsoft Windows 2000") /// [MarshalAs(UnmanagedType.LPTStr)] - public string pszProvider; + public string? pszProvider; } /// Contains printer driver information. @@ -591,7 +591,7 @@ public static partial class WinSpool /// NULL and should be specified only for printers capable of bidirectional communication. /// [MarshalAs(UnmanagedType.LPTStr)] - public string pMonitorName; + public string? pMonitorName; /// A pointer to a null-terminated string that specifies the default data type of the print job (for example, "EMF"). [MarshalAs(UnmanagedType.LPTStr)] @@ -612,21 +612,21 @@ public static partial class WinSpool /// A pointer to a null-terminated string that specifies the manufacturer's name. [MarshalAs(UnmanagedType.LPTStr)] - public string pszMfgName; + public string? pszMfgName; /// A pointer to a null-terminated string that specifies the URL for the manufacturer. [MarshalAs(UnmanagedType.LPTStr)] - public string pszOEMUrl; + public string? pszOEMUrl; /// A pointer to a null-terminated string that specifies the hardware ID for the printer driver. [MarshalAs(UnmanagedType.LPTStr)] - public string pszHardwareID; + public string? pszHardwareID; /// /// A pointer to a null-terminated string that specifies the provider of the printer driver (for example, "Microsoft Windows 2000"). /// [MarshalAs(UnmanagedType.LPTStr)] - public string pszProvider; + public string? pszProvider; /// A pointer to a null-terminated string that specifies the print processor (for example, "WinPrint"). [MarshalAs(UnmanagedType.LPTStr)] @@ -645,7 +645,7 @@ public static partial class WinSpool /// This must be NULL if the DRIVER_INFO_8 is being passed to AddPrinterDriver or AddPrinterDriverEx. /// [MarshalAs(UnmanagedType.LPTStr)] - public string pszInfPath; + public string? pszInfPath; /// /// @@ -730,7 +730,7 @@ public static partial class WinSpool /// must be NULL if the DRIVER_INFO_8 is being passed to AddPrinterDriver or AddPrinterDriverEx. /// [MarshalAs(UnmanagedType.LPTStr)] - public string pszzCoreDriverDependencies; + public string? pszzCoreDriverDependencies; /// The earliest allowed date of any drivers that shipped with Windows and on which this driver depends. public FILETIME ftMinInboxDriverVerDate; @@ -909,14 +909,14 @@ public static partial class WinSpool /// The Multilingual User Interface localized resource DLL that contains the localized display name. [MarshalAs(UnmanagedType.LPTStr)] - public string pMuiDll; + public string? pMuiDll; /// The resource ID of the form's display name in pMuiDll. public uint dwResourceId; /// The form's display name in the language specified by wLangId. [MarshalAs(UnmanagedType.LPTStr)] - public string pDisplayName; + public string? pDisplayName; /// The language of the pDisplayName. public ushort wLangId; @@ -961,7 +961,7 @@ public static partial class WinSpool public static bool operator ==(HPRINTER h1, HPRINTER h2) => h1.Equals(h2); /// - public override bool Equals(object? obj) => obj is HPRINTER h ? handle == h.handle : false; + public override bool Equals(object? obj) => obj is HPRINTER h && handle == h.handle; /// public override int GetHashCode() => handle.GetHashCode(); @@ -1009,7 +1009,7 @@ public static partial class WinSpool public static bool operator ==(HPRINTERCHANGENOTIFICATION h1, HPRINTERCHANGENOTIFICATION h2) => h1.Equals(h2); /// - public override bool Equals(object? obj) => obj is HPRINTERCHANGENOTIFICATION h ? handle == h.handle : false; + public override bool Equals(object? obj) => obj is HPRINTERCHANGENOTIFICATION h && handle == h.handle; /// public override int GetHashCode() => handle.GetHashCode(); @@ -1057,7 +1057,7 @@ public static partial class WinSpool public static bool operator ==(HSPOOLFILE h1, HSPOOLFILE h2) => h1.Equals(h2); /// - public override bool Equals(object? obj) => obj is HSPOOLFILE h ? handle == h.handle : false; + public override bool Equals(object? obj) => obj is HSPOOLFILE h && handle == h.handle; /// public override int GetHashCode() => handle.GetHashCode(); @@ -1109,7 +1109,7 @@ public static partial class WinSpool /// Status and, if pStatus is NULL, the status is defined by the contents of the Status member. /// [MarshalAs(UnmanagedType.LPTStr)] - public string pStatus; + public string? pStatus; /// /// @@ -1304,7 +1304,7 @@ public static partial class WinSpool /// Status and, if pStatus is NULL, the status is defined by the contents of the Status member. /// [MarshalAs(UnmanagedType.LPTStr)] - public string pStatus; + public string? pStatus; /// /// The value of this member is NULL. Retrieval and setting of document security descriptors is not supported in this release. @@ -1537,7 +1537,7 @@ public static partial class WinSpool /// Status and, if pStatus is NULL, the status is defined by the contents of the Status member. /// [MarshalAs(UnmanagedType.LPTStr)] - public string pStatus; + public string? pStatus; /// /// The value of this member is NULL. Retrieval and setting of document security descriptors is not supported in this release. @@ -1762,7 +1762,7 @@ public static partial class WinSpool /// pDescription is "printer port"). This can be NULL. /// [MarshalAs(UnmanagedType.LPTStr)] - public string pDescription; + public string? pDescription; /// Bitmask describing the type of port. This member can be a combination of the following values: public PORT_TYPE fPortType; @@ -1932,7 +1932,7 @@ public static partial class WinSpool /// A pointer to the name of the driver. [MarshalAs(UnmanagedType.LPTStr)] - public string pszDriverName; + public string? pszDriverName; } /// @@ -2041,7 +2041,7 @@ public static partial class WinSpool /// Pointer to a null-terminated string that contains additional data describing the structure. [MarshalAs(UnmanagedType.LPTStr)] - public string pComment; + public string? pComment; } /// The PRINTER_INFO_2 structure specifies detailed printer information. @@ -2059,7 +2059,7 @@ public static partial class WinSpool /// printer is controlled locally. /// [MarshalAs(UnmanagedType.LPTStr)] - public string pServerName; + public string? pServerName; /// A pointer to a null-terminated string that specifies the name of the printer. [MarshalAs(UnmanagedType.LPTStr)] @@ -2070,7 +2070,7 @@ public static partial class WinSpool /// PRINTER_ATTRIBUTE_SHARED constant was set for the Attributes member.) /// [MarshalAs(UnmanagedType.LPTStr)] - public string pShareName; + public string? pShareName; /// /// A pointer to a null-terminated string that identifies the port(s) used to transmit data to the printer. If a printer is @@ -2085,13 +2085,13 @@ public static partial class WinSpool /// A pointer to a null-terminated string that provides a brief description of the printer. [MarshalAs(UnmanagedType.LPTStr)] - public string pComment; + public string? pComment; /// /// A pointer to a null-terminated string that specifies the physical location of the printer (for example, "Bldg. 38, Room 1164"). /// [MarshalAs(UnmanagedType.LPTStr)] - public string pLocation; + public string? pLocation; /// /// A pointer to a DEVMODE structure that defines default printer data such as the paper orientation and the resolution. @@ -2103,7 +2103,7 @@ public static partial class WinSpool /// used to separate print jobs sent to the printer. /// [MarshalAs(UnmanagedType.LPTStr)] - public string pSepFile; + public string? pSepFile; /// /// A pointer to a null-terminated string that specifies the name of the print processor used by the printer. You can use the @@ -2117,11 +2117,11 @@ public static partial class WinSpool /// EnumPrintProcessorDatatypes function to obtain a list of data types supported by a specific print processor. /// [MarshalAs(UnmanagedType.LPTStr)] - public string pDatatype; + public string? pDatatype; /// A pointer to a null-terminated string that specifies the default print-processor parameters. [MarshalAs(UnmanagedType.LPTStr)] - public string pParameters; + public string? pParameters; /// A pointer to a SECURITY_DESCRIPTOR structure for the printer. This member may be NULL. public PSECURITY_DESCRIPTOR pSecurityDescriptor; @@ -2431,7 +2431,7 @@ public static partial class WinSpool /// Pointer to a null-terminated string that is the name of the server. [MarshalAs(UnmanagedType.LPTStr)] - public string pServerName; + public string? pServerName; /// /// Specifies information about the returned data. @@ -2730,7 +2730,7 @@ public static partial class WinSpool /// Before calling SetPrinter, set pszObjectGUID to NULL. /// [MarshalAs(UnmanagedType.LPTStr)] - public string pszObjectGUID; + public string? pszObjectGUID; /// /// @@ -3612,7 +3612,7 @@ public static partial class WinSpool public ACCESS_MASK DesiredAccess; /// Pointer to a null-terminated string that specifies the default data type for a printer. - public string pDatatype; + public string? pDatatype; /// A DEVMODE structure that identifies the default environment and initialization data for a printer. public DEVMODE? pDevMode; @@ -3733,14 +3733,14 @@ public static partial class WinSpool public IntPtr MarshalManagedToNative(object ManagedObj) { - if (!(ManagedObj is PRINTER_DEFAULTS pd)) throw new ArgumentException("Type of managed object must be PRINTER_DEFAULTS."); + if (ManagedObj is not PRINTER_DEFAULTS pd) throw new ArgumentException("Type of managed object must be PRINTER_DEFAULTS."); var sz = IntPtr.Size * 2 + 4 + StringHelper.GetByteCount(pd.pDatatype) + (pd.pDevMode?.dmSize ?? 0); var mem = new SafeCoTaskMemHandle(sz); using (var str = new NativeMemoryStream(mem)) { str.WriteReference(pd.pDatatype); - str.WriteReferenceObject(pd.pDevMode.HasValue ? (object)pd.pDevMode.Value : null); + str.WriteReferenceObject(pd.pDevMode.HasValue ? pd.pDevMode.Value : null); str.Write((uint)pd.DesiredAccess); } diff --git a/PInvoke/Printing/XpsObjectModel.Factory.cs b/PInvoke/Printing/XpsObjectModel.Factory.cs index 27002587..b652af1b 100644 --- a/PInvoke/Printing/XpsObjectModel.Factory.cs +++ b/PInvoke/Printing/XpsObjectModel.Factory.cs @@ -460,7 +460,7 @@ public static partial class XpsObjectModel // HRESULT CreateSolidColorBrush( const XPS_COLOR *color, IXpsOMColorProfileResource *colorProfile, IXpsOMSolidColorBrush // **solidColorBrush ); [MethodImpl(MethodImplOptions.InternalCall)] - IXpsOMSolidColorBrush CreateSolidColorBrush(in XPS_COLOR color, [In] IXpsOMColorProfileResource colorProfile); + IXpsOMSolidColorBrush CreateSolidColorBrush(in XPS_COLOR color, [In] IXpsOMColorProfileResource? colorProfile); /// Creates an IXpsOMColorProfileResource interface, which is used to access a color profile resource stream. /// @@ -643,7 +643,7 @@ public static partial class XpsObjectModel // HRESULT CreateGradientStop( const XPS_COLOR *color, IXpsOMColorProfileResource *colorProfile, FLOAT offset, // IXpsOMGradientStop **gradientStop ); [MethodImpl(MethodImplOptions.InternalCall)] - IXpsOMGradientStop CreateGradientStop(in XPS_COLOR color, [In] IXpsOMColorProfileResource colorProfile, [In] float offset); + IXpsOMGradientStop CreateGradientStop(in XPS_COLOR color, [In] IXpsOMColorProfileResource? colorProfile, [In] float offset); /// Creates an IXpsOMLinearGradientBrush interface. /// @@ -765,24 +765,21 @@ public static partial class XpsObjectModel /// bInheritHandle: a Boolean value that determines whether the returned handle can be inherited by child processes /// /// - /// If - /// lpSecurityDescriptor - /// is - /// NULL - /// , the file or device associated with the returned handle is assigned a default security descriptor. + /// + /// If lpSecurityDescriptor is NULL, the file or device associated with the returned handle is assigned a default security descriptor. + /// /// For more information about securityAttributes, see CreateFile. /// /// /// - /// Specifies the settings and attributes of the file to be created. For most files, the FILE_ATTRIBUTE_NORMAL value can - /// be used. + /// Specifies the settings and attributes of the file to be created. For most files, the FILE_ATTRIBUTE_NORMAL value can be used. /// /// See CreateFile for more information about this parameter. /// /// /// - /// A Boolean value that indicates whether the document markup will be optimized for size when the contents of the XPS OM are - /// written to the XPS package. + /// A Boolean value that indicates whether the document markup will be optimized for size when the contents of the XPS OM are written + /// to the XPS package. /// /// /// @@ -804,12 +801,11 @@ public static partial class XpsObjectModel /// The IOpcPartUri interface that contains the part name of the document sequence in the new file. /// /// - /// The IXpsOMCoreProperties interface that contains the core document properties to be given to the new file. This parameter - /// can be set to NULL. + /// The IXpsOMCoreProperties interface that contains the core document properties to be given to the new file. This parameter can be + /// set to NULL. /// /// - /// The IXpsOMImageResource interface that contains the thumbnail image to be assigned to the new file. This parameter can be - /// set to NULL. + /// The IXpsOMImageResource interface that contains the thumbnail image to be assigned to the new file. This parameter can be set to NULL. /// /// /// The IXpsOMPrintTicketResource interface that contains the package-level print ticket to be assigned to the new file. This @@ -821,17 +817,17 @@ public static partial class XpsObjectModel /// A pointer to the new IXpsOMPackageWriter interface created by this method. /// /// - /// The file is opened and initialized and the IXpsOMPackageWriter interface that is returned is then used to write content - /// types, package relationships, core properties, document sequence resources, and document sequence relationships. + /// The file is opened and initialized and the IXpsOMPackageWriter interface that is returned is then used to write content types, + /// package relationships, core properties, document sequence resources, and document sequence relationships. /// /// - /// If documentSequencePrintTicket is set to NULL and the value of interleaving is XPS_INTERLEAVING_ON, this - /// method creates a blank job-level print ticket and adds a relationship to the blank print ticket. This is done to provide - /// more efficient streaming consumption of the package. + /// If documentSequencePrintTicket is set to NULL and the value of interleaving is XPS_INTERLEAVING_ON, this method + /// creates a blank job-level print ticket and adds a relationship to the blank print ticket. This is done to provide more efficient + /// streaming consumption of the package. /// /// - /// If documentSequencePrintTicket is set to NULL and the value of interleaving is XPS_INTERLEAVING_OFF, no blank - /// print ticket is created. + /// If documentSequencePrintTicket is set to NULL and the value of interleaving is XPS_INTERLEAVING_OFF, no blank print + /// ticket is created. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createpackagewriteronfile @@ -840,7 +836,10 @@ public static partial class XpsObjectModel // *coreProperties, IXpsOMImageResource *packageThumbnail, IXpsOMPrintTicketResource *documentSequencePrintTicket, IOpcPartUri // *discardControlPartName, IXpsOMPackageWriter **packageWriter ); [MethodImpl(MethodImplOptions.InternalCall)] - IXpsOMPackageWriter CreatePackageWriterOnFile([In, MarshalAs(UnmanagedType.LPWStr)] string fileName, [In] IntPtr securityAttributes, [In] uint flagsAndAttributes, [In] int optimizeMarkupSize, [In] XPS_INTERLEAVING interleaving, [In] IOpcPartUri documentSequencePartName, [In] IXpsOMCoreProperties coreProperties, [In] IXpsOMImageResource packageThumbnail, [In] IXpsOMPrintTicketResource documentSequencePrintTicket, [In] IOpcPartUri discardControlPartName); + IXpsOMPackageWriter CreatePackageWriterOnFile([In, MarshalAs(UnmanagedType.LPWStr)] string fileName, [In] SECURITY_ATTRIBUTES? securityAttributes, + [In] uint flagsAndAttributes, [In] int optimizeMarkupSize, [In] XPS_INTERLEAVING interleaving, [In] IOpcPartUri documentSequencePartName, + [In, Optional] IXpsOMCoreProperties? coreProperties, [In, Optional] IXpsOMImageResource? packageThumbnail, + [In, Optional] IXpsOMPrintTicketResource? documentSequencePrintTicket, [In, Optional] IOpcPartUri? discardControlPartName); /// Opens a stream for writing the contents of an XPS OM to an XPS package. /// The stream to be used for writing. @@ -904,7 +903,9 @@ public static partial class XpsObjectModel // IXpsOMPrintTicketResource *documentSequencePrintTicket, IOpcPartUri *discardControlPartName, IXpsOMPackageWriter // **packageWriter ); [MethodImpl(MethodImplOptions.InternalCall)] - IXpsOMPackageWriter CreatePackageWriterOnStream([In] ISequentialStream outputStream, [In] int optimizeMarkupSize, [In] XPS_INTERLEAVING interleaving, [In] IOpcPartUri documentSequencePartName, [In] IXpsOMCoreProperties coreProperties, [In] IXpsOMImageResource packageThumbnail, [In] IXpsOMPrintTicketResource documentSequencePrintTicket, [In] IOpcPartUri discardControlPartName); + IXpsOMPackageWriter CreatePackageWriterOnStream([In] ISequentialStream outputStream, [In] int optimizeMarkupSize, [In] XPS_INTERLEAVING interleaving, + [In] IOpcPartUri documentSequencePartName, [In, Optional] IXpsOMCoreProperties? coreProperties, [In, Optional] IXpsOMImageResource? packageThumbnail, + [In, Optional] IXpsOMPrintTicketResource? documentSequencePrintTicket, [In, Optional] IOpcPartUri? discardControlPartName); /// Creates an IOpcPartUri interface that uses the specified URI. /// The URI string. diff --git a/PInvoke/Printing/XpsObjectModel.Parts.cs b/PInvoke/Printing/XpsObjectModel.Parts.cs index 9f2f7610..8985168a 100644 --- a/PInvoke/Printing/XpsObjectModel.Parts.cs +++ b/PInvoke/Printing/XpsObjectModel.Parts.cs @@ -28,7 +28,7 @@ public static partial class XpsObjectModel // GetPartName( IOpcPartUri **partUri ); [MethodImpl(MethodImplOptions.InternalCall)] [return: MarshalAs(UnmanagedType.Interface)] - new IOpcPartUri GetPartName(); + new IOpcPartUri? GetPartName(); /// Sets the name that will be used when the part is serialized. /// @@ -41,7 +41,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompart-setpartname HRESULT // SetPartName( IOpcPartUri *partUri ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetPartName([In] IOpcPartUri partUri); + new void SetPartName([In] IOpcPartUri? partUri); /// Gets a pointer to the IXpsOMPackage interface that contains the core properties. /// @@ -50,7 +50,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-getowner HRESULT // GetOwner( IXpsOMPackage **package ); - IXpsOMPackage GetOwner(); + IXpsOMPackage? GetOwner(); /// Gets the category property. /// The string that is read from the category property. @@ -60,7 +60,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-getcategory HRESULT // GetCategory( LPWSTR *category ); [return: MarshalAs(UnmanagedType.LPWStr)] - string GetCategory(); + string? GetCategory(); /// Sets the category property. /// @@ -69,7 +69,7 @@ public static partial class XpsObjectModel /// The category property contains a categorization of the content. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-setcategory HRESULT // SetCategory( LPCWSTR category ); - void SetCategory([In, MarshalAs(UnmanagedType.LPWStr)] string category); + void SetCategory([In, MarshalAs(UnmanagedType.LPWStr)] string? category); /// Gets the contentStatus property. /// The string that is read from the contentStatus property. @@ -82,7 +82,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-getcontentstatus // HRESULT GetContentStatus( LPWSTR *contentStatus ); [return: MarshalAs(UnmanagedType.LPWStr)] - string GetContentStatus(); + string? GetContentStatus(); /// Sets the contentStatus property. /// @@ -94,7 +94,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-setcontentstatus // HRESULT SetContentStatus( LPCWSTR contentStatus ); - void SetContentStatus([In, MarshalAs(UnmanagedType.LPWStr)] string contentStatus); + void SetContentStatus([In, MarshalAs(UnmanagedType.LPWStr)] string? contentStatus); /// Gets the contentType property. /// The string that is read from the contentType property. @@ -108,7 +108,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-getcontenttype // HRESULT GetContentType( LPWSTR *contentType ); [return: MarshalAs(UnmanagedType.LPWStr)] - string GetContentType(); + string? GetContentType(); /// Sets the contentType property. /// @@ -121,7 +121,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-setcontenttype // HRESULT SetContentType( LPCWSTR contentType ); - void SetContentType([In, MarshalAs(UnmanagedType.LPWStr)] string contentType); + void SetContentType([In, MarshalAs(UnmanagedType.LPWStr)] string? contentType); /// Gets the created property. /// The date and time that are read from the created property. @@ -145,7 +145,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-getcreator HRESULT // GetCreator( LPWSTR *creator ); [return: MarshalAs(UnmanagedType.LPWStr)] - string GetCreator(); + string? GetCreator(); /// Sets the creator property. /// @@ -156,7 +156,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-setcreator HRESULT // SetCreator( LPCWSTR creator ); - void SetCreator([In, MarshalAs(UnmanagedType.LPWStr)] string creator); + void SetCreator([In, MarshalAs(UnmanagedType.LPWStr)] string? creator); /// Gets the description property. /// The string that is read from the description property. @@ -166,7 +166,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-getdescription // HRESULT GetDescription( LPWSTR *description ); [return: MarshalAs(UnmanagedType.LPWStr)] - string GetDescription(); + string? GetDescription(); /// Sets the description property. /// @@ -175,7 +175,7 @@ public static partial class XpsObjectModel /// The description property explains the content. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-setdescription // HRESULT SetDescription( LPCWSTR description ); - void SetDescription([In, MarshalAs(UnmanagedType.LPWStr)] string description); + void SetDescription([In, MarshalAs(UnmanagedType.LPWStr)] string? description); /// Gets the identifier property. /// The string that is read from the identifier property. @@ -187,7 +187,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-getidentifier // HRESULT GetIdentifier( LPWSTR *identifier ); [return: MarshalAs(UnmanagedType.LPWStr)] - string GetIdentifier(); + string? GetIdentifier(); /// Sets the identifier property. /// @@ -198,7 +198,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-setidentifier // HRESULT SetIdentifier( LPCWSTR identifier ); - void SetIdentifier([In, MarshalAs(UnmanagedType.LPWStr)] string identifier); + void SetIdentifier([In, MarshalAs(UnmanagedType.LPWStr)] string? identifier); /// Gets the keywords property. /// The string that is read from the keywords property. @@ -211,7 +211,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-getkeywords HRESULT // GetKeywords( LPWSTR *keywords ); [return: MarshalAs(UnmanagedType.LPWStr)] - string GetKeywords(); + string? GetKeywords(); /// Sets the keywords property. /// @@ -224,7 +224,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-setkeywords HRESULT // SetKeywords( LPCWSTR keywords ); - void SetKeywords([In, MarshalAs(UnmanagedType.LPWStr)] string keywords); + void SetKeywords([In, MarshalAs(UnmanagedType.LPWStr)] string? keywords); /// Gets the language property. /// The value that is read from the language property. @@ -235,7 +235,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-getlanguage HRESULT // GetLanguage( LPWSTR *language ); [return: MarshalAs(UnmanagedType.LPWStr)] - string GetLanguage(); + string? GetLanguage(); /// Sets the language property. /// @@ -248,7 +248,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-setlanguage HRESULT // SetLanguage( LPCWSTR language ); - void SetLanguage([In, MarshalAs(UnmanagedType.LPWStr)] string language); + void SetLanguage([In, MarshalAs(UnmanagedType.LPWStr)] string? language); /// Gets the lastModifiedBy property. /// The value that is read from the lastModifiedBy property. @@ -258,7 +258,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-getlastmodifiedby // HRESULT GetLastModifiedBy( LPWSTR *lastModifiedBy ); [return: MarshalAs(UnmanagedType.LPWStr)] - string GetLastModifiedBy(); + string? GetLastModifiedBy(); /// Sets the lastModifiedBy property. /// @@ -268,7 +268,7 @@ public static partial class XpsObjectModel /// The lastModifiedBy property describes the user who performs the last modification. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-setlastmodifiedby // HRESULT SetLastModifiedBy( LPCWSTR lastModifiedBy ); - void SetLastModifiedBy([In, MarshalAs(UnmanagedType.LPWStr)] string lastModifiedBy); + void SetLastModifiedBy([In, MarshalAs(UnmanagedType.LPWStr)] string? lastModifiedBy); /// Gets the lastPrinted property. /// The date and time that are read from the lastPrinted property. @@ -284,7 +284,7 @@ public static partial class XpsObjectModel /// The lastPrinted property contains the date and time the package was last printed. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-setlastprinted // HRESULT SetLastPrinted( const SYSTEMTIME *lastPrinted ); - void SetLastPrinted(in SYSTEMTIME lastPrinted); + void SetLastPrinted([In, Optional] PSYSTEMTIME? lastPrinted); /// Gets the modified property. /// The date and time that are read from the modified property. @@ -300,7 +300,7 @@ public static partial class XpsObjectModel /// The modified property contains the date and time the package was last changed. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-setmodified HRESULT // SetModified( const SYSTEMTIME *modified ); - void SetModified(in SYSTEMTIME modified); + void SetModified([In, Optional] PSYSTEMTIME? modified); /// Gets the revision property. /// The string that is read from the revision property. @@ -310,7 +310,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-getrevision HRESULT // GetRevision( LPWSTR *revision ); [return: MarshalAs(UnmanagedType.LPWStr)] - string GetRevision(); + string? GetRevision(); /// Sets the revision property. /// @@ -319,7 +319,7 @@ public static partial class XpsObjectModel /// The revision property contains the revision number of the resource. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-setrevision HRESULT // SetRevision( LPCWSTR revision ); - void SetRevision([In, MarshalAs(UnmanagedType.LPWStr)] string revision); + void SetRevision([In, MarshalAs(UnmanagedType.LPWStr)] string? revision); /// Gets the subject property. /// The string that is read from the subject property. @@ -327,7 +327,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-getsubject HRESULT // GetSubject( LPWSTR *subject ); [return: MarshalAs(UnmanagedType.LPWStr)] - string GetSubject(); + string? GetSubject(); /// Sets the subject property. /// @@ -336,7 +336,7 @@ public static partial class XpsObjectModel /// The subject property contains the topic of the resource content. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-setsubject HRESULT // SetSubject( LPCWSTR subject ); - void SetSubject([In, MarshalAs(UnmanagedType.LPWStr)] string subject); + void SetSubject([In, MarshalAs(UnmanagedType.LPWStr)] string? subject); /// Gets the title property. /// The string that is read from the title property. @@ -344,7 +344,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-gettitle HRESULT // GetTitle( LPWSTR *title ); [return: MarshalAs(UnmanagedType.LPWStr)] - string GetTitle(); + string? GetTitle(); /// Sets the title property. /// @@ -353,7 +353,7 @@ public static partial class XpsObjectModel /// The title property contains the name given to the resource. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-settitle HRESULT // SetTitle( LPCWSTR title ); - void SetTitle([In, MarshalAs(UnmanagedType.LPWStr)] string title); + void SetTitle([In, MarshalAs(UnmanagedType.LPWStr)] string? title); /// Gets the version property. /// The string that is read from the version property. @@ -361,7 +361,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-getversion HRESULT // GetVersion( LPWSTR *version ); [return: MarshalAs(UnmanagedType.LPWStr)] - string GetVersion(); + string? GetVersion(); /// Sets the version property. /// @@ -370,7 +370,7 @@ public static partial class XpsObjectModel /// The version property contains the version number of the resource. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcoreproperties-setversion HRESULT // SetVersion( LPCWSTR version ); - void SetVersion([In, MarshalAs(UnmanagedType.LPWStr)] string version); + void SetVersion([In, MarshalAs(UnmanagedType.LPWStr)] string? version); /// Makes a deep copy of the interface. /// A pointer to the copy of the interface. @@ -397,7 +397,7 @@ public static partial class XpsObjectModel // GetPartName( IOpcPartUri **partUri ); [MethodImpl(MethodImplOptions.InternalCall)] [return: MarshalAs(UnmanagedType.Interface)] - new IOpcPartUri GetPartName(); + new IOpcPartUri? GetPartName(); /// Sets the name that will be used when the part is serialized. /// @@ -410,7 +410,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompart-setpartname HRESULT // SetPartName( IOpcPartUri *partUri ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetPartName([In] IOpcPartUri partUri); + new void SetPartName([In] IOpcPartUri? partUri); /// Gets a pointer to the IXpsOMDocumentSequence interface that contains the document. /// @@ -606,7 +606,7 @@ public static partial class XpsObjectModel // GetPartName( IOpcPartUri **partUri ); [MethodImpl(MethodImplOptions.InternalCall)] [return: MarshalAs(UnmanagedType.Interface)] - new IOpcPartUri GetPartName(); + new IOpcPartUri? GetPartName(); /// Sets the name that will be used when the part is serialized. /// @@ -619,7 +619,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompart-setpartname HRESULT // SetPartName( IOpcPartUri *partUri ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetPartName([In] IOpcPartUri partUri); + new void SetPartName([In] IOpcPartUri? partUri); /// Gets a pointer to the IXpsOMPackage interface that contains the document sequence. /// @@ -628,7 +628,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomdocumentsequence-getowner HRESULT // GetOwner( IXpsOMPackage **package ); - IXpsOMPackage GetOwner(); + IXpsOMPackage? GetOwner(); /// /// Gets a pointer to the IXpsOMDocumentCollection interface, which contains the documents specified in the document sequence. @@ -659,7 +659,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomdocumentsequence-getprintticketresource // HRESULT GetPrintTicketResource( IXpsOMPrintTicketResource **printTicketResource ); - IXpsOMPrintTicketResource GetPrintTicketResource(); + IXpsOMPrintTicketResource? GetPrintTicketResource(); /// Sets the job-level print ticket resource for the document sequence. /// @@ -672,7 +672,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomdocumentsequence-setprintticketresource // HRESULT SetPrintTicketResource( IXpsOMPrintTicketResource *printTicketResource ); - void SetPrintTicketResource([In] IXpsOMPrintTicketResource printTicketResource); + void SetPrintTicketResource([In] IXpsOMPrintTicketResource? printTicketResource); } /// @@ -698,7 +698,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompackage-getdocumentsequence HRESULT // GetDocumentSequence( IXpsOMDocumentSequence **documentSequence ); - IXpsOMDocumentSequence GetDocumentSequence(); + IXpsOMDocumentSequence? GetDocumentSequence(); /// Sets the IXpsOMDocumentSequence interface of the XPS package. /// @@ -706,7 +706,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompackage-setdocumentsequence HRESULT // SetDocumentSequence( IXpsOMDocumentSequence *documentSequence ); - void SetDocumentSequence([In] IXpsOMDocumentSequence documentSequence); + void SetDocumentSequence([In] IXpsOMDocumentSequence? documentSequence); /// Gets a pointer to the IXpsOMCoreProperties interface of the XPS package. /// @@ -715,7 +715,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompackage-getcoreproperties HRESULT // GetCoreProperties( IXpsOMCoreProperties **coreProperties ); - IXpsOMCoreProperties GetCoreProperties(); + IXpsOMCoreProperties? GetCoreProperties(); /// Sets the IXpsOMCoreProperties interface of the XPS package. /// @@ -724,7 +724,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompackage-setcoreproperties HRESULT // SetCoreProperties( IXpsOMCoreProperties *coreProperties ); - void SetCoreProperties([In] IXpsOMCoreProperties coreProperties); + void SetCoreProperties([In] IXpsOMCoreProperties? coreProperties); /// Gets the name of the discard control part in the XPS package. /// @@ -733,7 +733,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompackage-getdiscardcontrolpartname // HRESULT GetDiscardControlPartName( IOpcPartUri **discardControlPartUri ); - IOpcPartUri GetDiscardControlPartName(); + IOpcPartUri? GetDiscardControlPartName(); /// Sets the name of the discard control part in the XPS package. /// @@ -742,7 +742,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompackage-setdiscardcontrolpartname // HRESULT SetDiscardControlPartName( IOpcPartUri *discardControlPartUri ); - void SetDiscardControlPartName([In] IOpcPartUri discardControlPartUri); + void SetDiscardControlPartName([In] IOpcPartUri? discardControlPartUri); /// /// Gets a pointer to the IXpsOMImageResource interface of the thumbnail resource that is associated with the XPS package. @@ -757,7 +757,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompackage-getthumbnailresource // HRESULT GetThumbnailResource( IXpsOMImageResource **imageResource ); - IXpsOMImageResource GetThumbnailResource(); + IXpsOMImageResource? GetThumbnailResource(); /// Sets the thumbnail image of the XPS document. /// @@ -770,7 +770,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompackage-setthumbnailresource // HRESULT SetThumbnailResource( IXpsOMImageResource *imageResource ); - void SetThumbnailResource([In] IXpsOMImageResource imageResource); + void SetThumbnailResource([In] IXpsOMImageResource? imageResource); /// Writes the XPS package to a specified file. /// The name of the file to be created. This parameter must not be NULL. @@ -827,7 +827,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompackage-writetofile HRESULT // WriteToFile( LPCWSTR fileName, LPSECURITY_ATTRIBUTES securityAttributes, DWORD flagsAndAttributes, BOOL optimizeMarkupSize ); - void WriteToFile([In, MarshalAs(UnmanagedType.LPWStr)] string fileName, [In] SECURITY_ATTRIBUTES securityAttributes, [In] FileFlagsAndAttributes flagsAndAttributes, [In, MarshalAs(UnmanagedType.Bool)] bool optimizeMarkupSize); + void WriteToFile([In, MarshalAs(UnmanagedType.LPWStr)] string fileName, [In] SECURITY_ATTRIBUTES? securityAttributes, [In] FileFlagsAndAttributes flagsAndAttributes, [In, MarshalAs(UnmanagedType.Bool)] bool optimizeMarkupSize); /// Writes the XPS package to a specified stream. /// The stream that receives the serialized contents of the package. This parameter must not be NULL. @@ -931,8 +931,9 @@ public static partial class XpsObjectModel // IXpsOMDocumentStructureResource *documentStructure, IXpsOMSignatureBlockResourceCollection *signatureBlockResources, // IXpsOMPartUriCollection *restrictedFonts ); [MethodImpl(MethodImplOptions.InternalCall)] - void StartNewDocument([In] IOpcPartUri documentPartName, [In] IXpsOMPrintTicketResource documentPrintTicket, [In] IXpsOMDocumentStructureResource documentStructure, - [In] IXpsOMSignatureBlockResourceCollection signatureBlockResources, [In] IXpsOMPartUriCollection restrictedFonts); + void StartNewDocument([In] IOpcPartUri documentPartName, [In, Optional] IXpsOMPrintTicketResource? documentPrintTicket, + [In, Optional] IXpsOMDocumentStructureResource? documentStructure, + [In, Optional] IXpsOMSignatureBlockResourceCollection? signatureBlockResources, [In, Optional] IXpsOMPartUriCollection? restrictedFonts); /// Writes a new FixedPage part to the currently open FixedDocument part in the package. /// @@ -974,8 +975,8 @@ public static partial class XpsObjectModel // AddPage( IXpsOMPage *page, const XPS_SIZE *advisoryPageDimensions, IXpsOMPartUriCollection *discardableResourceParts, // IXpsOMStoryFragmentsResource *storyFragments, IXpsOMPrintTicketResource *pagePrintTicket, IXpsOMImageResource *pageThumbnail ); [MethodImpl(MethodImplOptions.InternalCall)] - void AddPage([In] IXpsOMPage page, in XPS_SIZE advisoryPageDimensions, [In] IXpsOMPartUriCollection discardableResourceParts, - [In] IXpsOMStoryFragmentsResource storyFragments, [In] IXpsOMPrintTicketResource pagePrintTicket, [In] IXpsOMImageResource pageThumbnail); + void AddPage([In] IXpsOMPage page, in XPS_SIZE advisoryPageDimensions, [In, Optional] IXpsOMPartUriCollection? discardableResourceParts, + [In, Optional] IXpsOMStoryFragmentsResource? storyFragments, [In] IXpsOMPrintTicketResource? pagePrintTicket, [In, Optional] IXpsOMImageResource? pageThumbnail); /// Creates a new part resource in the package. /// @@ -1104,7 +1105,7 @@ public static partial class XpsObjectModel // GetPartName( IOpcPartUri **partUri ); [MethodImpl(MethodImplOptions.InternalCall)] [return: MarshalAs(UnmanagedType.Interface)] - new IOpcPartUri GetPartName(); + new IOpcPartUri? GetPartName(); /// Sets the name that will be used when the part is serialized. /// @@ -1117,7 +1118,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompart-setpartname HRESULT // SetPartName( IOpcPartUri *partUri ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetPartName([In] IOpcPartUri partUri); + new void SetPartName([In] IOpcPartUri? partUri); /// Gets a pointer to the IXpsOMPageReference interface that contains the page. /// A pointer to the IXpsOMPageReference interface that contains the page. @@ -1125,7 +1126,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompage-getowner HRESULT GetOwner( // IXpsOMPageReference **pageReference ); [MethodImpl(MethodImplOptions.InternalCall)] - IXpsOMPageReference GetOwner(); + IXpsOMPageReference? GetOwner(); /// Gets a pointer to an IXpsOMVisualCollection interface that contains a collection of the page's visual objects. /// A pointer to the IXpsOMVisualCollection interface that contains a collection of the page's visual objects. @@ -1295,7 +1296,7 @@ public static partial class XpsObjectModel // GetLanguage( LPWSTR *language ); [MethodImpl(MethodImplOptions.InternalCall)] [return: MarshalAs(UnmanagedType.LPWStr)] - string GetLanguage(); + string? GetLanguage(); /// Sets the Language property of the page. /// @@ -1308,7 +1309,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompage-setlanguage HRESULT // SetLanguage( LPCWSTR language ); [MethodImpl(MethodImplOptions.InternalCall)] - void SetLanguage([In, MarshalAs(UnmanagedType.LPWStr)] string language); + void SetLanguage([In, MarshalAs(UnmanagedType.LPWStr)] string? language); /// Gets the Name property of the page. /// @@ -1318,7 +1319,7 @@ public static partial class XpsObjectModel // LPWSTR *name ); [MethodImpl(MethodImplOptions.InternalCall)] [return: MarshalAs(UnmanagedType.LPWStr)] - string GetName(); + string? GetName(); /// Sets the Name property of this page. /// @@ -1332,7 +1333,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompage-setname HRESULT SetName( // LPCWSTR name ); [MethodImpl(MethodImplOptions.InternalCall)] - void SetName([In, MarshalAs(UnmanagedType.LPWStr)] string name); + void SetName([In, MarshalAs(UnmanagedType.LPWStr)] string? name); /// Gets a Boolean value that indicates whether the page is the target of a hyperlink. /// @@ -1424,7 +1425,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompage-getdictionary HRESULT // GetDictionary( IXpsOMDictionary **resourceDictionary ); [MethodImpl(MethodImplOptions.InternalCall)] - IXpsOMDictionary GetDictionary(); + IXpsOMDictionary? GetDictionary(); /// /// Gets a pointer to the IXpsOMDictionary interface of the local, unshared dictionary that is associated with this page. @@ -1457,7 +1458,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompage-getdictionarylocal HRESULT // GetDictionaryLocal( IXpsOMDictionary **resourceDictionary ); [MethodImpl(MethodImplOptions.InternalCall)] - IXpsOMDictionary GetDictionaryLocal(); + IXpsOMDictionary? GetDictionaryLocal(); /// Sets the IXpsOMDictionary interface pointer of the page's local dictionary resource. /// @@ -1499,7 +1500,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompage-setdictionarylocal HRESULT // SetDictionaryLocal( IXpsOMDictionary *resourceDictionary ); [MethodImpl(MethodImplOptions.InternalCall)] - void SetDictionaryLocal([In] IXpsOMDictionary resourceDictionary); + void SetDictionaryLocal([In] IXpsOMDictionary? resourceDictionary); /// /// Gets a pointer to the IXpsOMRemoteDictionaryResource interface of the shared dictionary resource that is used by this page. @@ -1535,7 +1536,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompage-getdictionaryresource HRESULT // GetDictionaryResource( IXpsOMRemoteDictionaryResource **remoteDictionaryResource ); [MethodImpl(MethodImplOptions.InternalCall)] - IXpsOMRemoteDictionaryResource GetDictionaryResource(); + IXpsOMRemoteDictionaryResource? GetDictionaryResource(); /// Sets the IXpsOMRemoteDictionaryResource interface pointer of the page's remote dictionary resource. /// @@ -1574,7 +1575,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompage-setdictionaryresource HRESULT // SetDictionaryResource( IXpsOMRemoteDictionaryResource *remoteDictionaryResource ); [MethodImpl(MethodImplOptions.InternalCall)] - void SetDictionaryResource([In] IXpsOMRemoteDictionaryResource remoteDictionaryResource); + void SetDictionaryResource([In] IXpsOMRemoteDictionaryResource? remoteDictionaryResource); /// Writes the page to the specified stream. /// The stream that receives the serialized contents of the page. @@ -1712,7 +1713,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompagereference-getowner HRESULT // GetOwner( IXpsOMDocument **document ); - IXpsOMDocument GetOwner(); + IXpsOMDocument? GetOwner(); /// Gets a pointer to the IXpsOMPage interface that contains the page. /// A pointer to the IXpsOMPage interface of the page. If a page has not been set, a NULL pointer is returned. @@ -1730,7 +1731,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompagereference-getpage HRESULT // GetPage( IXpsOMPage **page ); - IXpsOMPage GetPage(); + IXpsOMPage? GetPage(); /// Sets the IXpsOMPage interface of the page reference. /// The IXpsOMPage interface pointer of the page. @@ -1849,7 +1850,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompagereference-getstoryfragmentsresource // HRESULT GetStoryFragmentsResource( IXpsOMStoryFragmentsResource **storyFragmentsResource ); - IXpsOMStoryFragmentsResource GetStoryFragmentsResource(); + IXpsOMStoryFragmentsResource? GetStoryFragmentsResource(); /// /// Sets the IXpsOMStoryFragmentsResource interface pointer of the StoryFragments resource to be assigned to the page. @@ -1868,7 +1869,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompagereference-setstoryfragmentsresource // HRESULT SetStoryFragmentsResource( IXpsOMStoryFragmentsResource *storyFragmentsResource ); - void SetStoryFragmentsResource([In] IXpsOMStoryFragmentsResource storyFragmentsResource); + void SetStoryFragmentsResource([In] IXpsOMStoryFragmentsResource? storyFragmentsResource); /// /// Gets a pointer to the IXpsOMPrintTicketResource interface of the page-level print ticket resource that is associated with @@ -1884,7 +1885,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompagereference-getprintticketresource // HRESULT GetPrintTicketResource( IXpsOMPrintTicketResource **printTicketResource ); - IXpsOMPrintTicketResource GetPrintTicketResource(); + IXpsOMPrintTicketResource? GetPrintTicketResource(); /// /// Sets the IXpsOMPrintTicketResource interface pointer of the page-level print ticket resource that is to be assigned to the page. @@ -1895,7 +1896,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompagereference-setprintticketresource // HRESULT SetPrintTicketResource( IXpsOMPrintTicketResource *printTicketResource ); - void SetPrintTicketResource([In] IXpsOMPrintTicketResource printTicketResource); + void SetPrintTicketResource([In] IXpsOMPrintTicketResource? printTicketResource); /// /// Gets a pointer to the IXpsOMImageResource interface of the thumbnail image resource that is associated with the page. @@ -1913,7 +1914,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompagereference-getthumbnailresource // HRESULT GetThumbnailResource( IXpsOMImageResource **imageResource ); - IXpsOMImageResource GetThumbnailResource(); + IXpsOMImageResource? GetThumbnailResource(); /// /// Sets the pointer to the IXpsOMImageResource interface of the thumbnail image resource to be assigned to the page. @@ -1928,7 +1929,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompagereference-setthumbnailresource // HRESULT SetThumbnailResource( IXpsOMImageResource *imageResource ); - void SetThumbnailResource([In] IXpsOMImageResource imageResource); + void SetThumbnailResource([In] IXpsOMImageResource? imageResource); /// /// Gets an IXpsOMNameCollection interface that contains the names of all the document subtree objects whose @@ -2124,7 +2125,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompart-getpartname HRESULT // GetPartName( IOpcPartUri **partUri ); [MethodImpl(MethodImplOptions.InternalCall)] - IOpcPartUri GetPartName(); + IOpcPartUri? GetPartName(); /// Sets the name that will be used when the part is serialized. /// @@ -2137,7 +2138,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompart-setpartname HRESULT // SetPartName( IOpcPartUri *partUri ); [MethodImpl(MethodImplOptions.InternalCall)] - void SetPartName([In] IOpcPartUri partUri); + void SetPartName([In] IOpcPartUri? partUri); } /// Provides access to all shared, part-based resources of the XPS document. diff --git a/PInvoke/Printing/XpsObjectModel.cs b/PInvoke/Printing/XpsObjectModel.cs index 3ccca96d..e290d9ff 100644 --- a/PInvoke/Printing/XpsObjectModel.cs +++ b/PInvoke/Printing/XpsObjectModel.cs @@ -1,5 +1,8 @@ -using System.Runtime.CompilerServices; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices.ComTypes; +using Vanara.Collections; +using Vanara.Extensions.Reflection; using static Vanara.PInvoke.Opc; using static Vanara.PInvoke.UrlMon; @@ -106,7 +109,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-gettransform HRESULT // GetTransform( IXpsOMMatrixTransform **matrixTransform ); [MethodImpl(MethodImplOptions.InternalCall)] - new IXpsOMMatrixTransform GetTransform(); + new IXpsOMMatrixTransform? GetTransform(); /// /// Gets a pointer to the IXpsOMMatrixTransform interface that contains the local, unshared, resolved matrix transform for the visual. @@ -139,7 +142,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-gettransformlocal HRESULT // GetTransformLocal( IXpsOMMatrixTransform **matrixTransform ); [MethodImpl(MethodImplOptions.InternalCall)] - new IXpsOMMatrixTransform GetTransformLocal(); + new IXpsOMMatrixTransform? GetTransformLocal(); /// Sets the local, unshared matrix transform. /// @@ -184,7 +187,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-settransformlocal HRESULT // SetTransformLocal( IXpsOMMatrixTransform *matrixTransform ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetTransformLocal([In] IXpsOMMatrixTransform matrixTransform); + new void SetTransformLocal([In] IXpsOMMatrixTransform? matrixTransform); /// /// Gets the lookup key name of the IXpsOMMatrixTransform interface in a resource dictionary that contains the resolved matrix @@ -219,7 +222,7 @@ public static partial class XpsObjectModel // GetTransformLookup( LPWSTR *key ); [MethodImpl(MethodImplOptions.InternalCall)] [return: MarshalAs(UnmanagedType.LPWStr)] - new string 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. @@ -262,7 +265,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-settransformlookup HRESULT // SetTransformLookup( LPCWSTR key ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetTransformLookup([In, MarshalAs(UnmanagedType.LPWStr)] string key); + new void SetTransformLookup([In, MarshalAs(UnmanagedType.LPWStr)] string? key); /// /// Gets a pointer to the IXpsOMGeometry interface that contains the resolved geometry of the visual's clipping region. @@ -298,7 +301,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getclipgeometry HRESULT // GetClipGeometry( IXpsOMGeometry **clipGeometry ); [MethodImpl(MethodImplOptions.InternalCall)] - new IXpsOMGeometry GetClipGeometry(); + new IXpsOMGeometry? GetClipGeometry(); /// /// Gets a pointer to the IXpsOMGeometry interface that contains the local, unshared geometry of the visual's clipping region. @@ -330,7 +333,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getclipgeometrylocal HRESULT // GetClipGeometryLocal( IXpsOMGeometry **clipGeometry ); [MethodImpl(MethodImplOptions.InternalCall)] - new IXpsOMGeometry GetClipGeometryLocal(); + new IXpsOMGeometry? GetClipGeometryLocal(); /// Sets the local, unshared clipping region for the visual. /// @@ -376,7 +379,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-setclipgeometrylocal HRESULT // SetClipGeometryLocal( IXpsOMGeometry *clipGeometry ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetClipGeometryLocal([In] IXpsOMGeometry clipGeometry); + new void SetClipGeometryLocal([In] IXpsOMGeometry? clipGeometry); /// /// Gets the lookup key for the IXpsOMGeometry interface in a resource dictionary that contains the visual's clipping region. @@ -409,7 +412,7 @@ public static partial class XpsObjectModel // HRESULT GetClipGeometryLookup( LPWSTR *key ); [MethodImpl(MethodImplOptions.InternalCall)] [return: MarshalAs(UnmanagedType.LPWStr)] - new string GetClipGeometryLookup(); + new string? GetClipGeometryLookup(); /// Sets the lookup key name of a shared clip geometry in a resource dictionary. /// @@ -454,7 +457,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-setclipgeometrylookup // HRESULT SetClipGeometryLookup( LPCWSTR key ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetClipGeometryLookup([In, MarshalAs(UnmanagedType.LPWStr)] string key); + new void SetClipGeometryLookup([In, MarshalAs(UnmanagedType.LPWStr)] string? key); /// Gets the opacity value of this visual. /// The opacity value. @@ -508,7 +511,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getopacitymaskbrush HRESULT // GetOpacityMaskBrush( IXpsOMBrush **opacityMaskBrush ); [MethodImpl(MethodImplOptions.InternalCall)] - new IXpsOMBrush GetOpacityMaskBrush(); + new IXpsOMBrush? GetOpacityMaskBrush(); /// Gets the local, unshared opacity mask brush for the visual. /// @@ -538,7 +541,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getopacitymaskbrushlocal // HRESULT GetOpacityMaskBrushLocal( IXpsOMBrush **opacityMaskBrush ); [MethodImpl(MethodImplOptions.InternalCall)] - new IXpsOMBrush GetOpacityMaskBrushLocal(); + new IXpsOMBrush? GetOpacityMaskBrushLocal(); /// Sets the IXpsOMBrush interface pointer as the local, unshared opacity mask brush. /// @@ -584,7 +587,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-setopacitymaskbrushlocal // HRESULT SetOpacityMaskBrushLocal( IXpsOMBrush *opacityMaskBrush ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetOpacityMaskBrushLocal([In] IXpsOMBrush opacityMaskBrush); + new void SetOpacityMaskBrushLocal([In] IXpsOMBrush? opacityMaskBrush); /// Gets the name of the lookup key of the shared opacity mask brush in a resource dictionary. /// @@ -615,7 +618,7 @@ public static partial class XpsObjectModel // HRESULT GetOpacityMaskBrushLookup( LPWSTR *key ); [MethodImpl(MethodImplOptions.InternalCall)] [return: MarshalAs(UnmanagedType.LPWStr)] - new string GetOpacityMaskBrushLookup(); + new string? GetOpacityMaskBrushLookup(); /// Sets the lookup key name of a shared opacity mask brush in a resource dictionary. /// @@ -660,7 +663,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-setopacitymaskbrushlookup // HRESULT SetOpacityMaskBrushLookup( LPCWSTR key ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetOpacityMaskBrushLookup([In, MarshalAs(UnmanagedType.LPWStr)] string key); + new void SetOpacityMaskBrushLookup([In, MarshalAs(UnmanagedType.LPWStr)] string? key); /// Gets the Name property of the visual. /// The Name property string. If the Name property has not been set, a NULL pointer is returned. @@ -668,7 +671,7 @@ public static partial class XpsObjectModel // LPWSTR *name ); [MethodImpl(MethodImplOptions.InternalCall)] [return: MarshalAs(UnmanagedType.LPWStr)] - new string GetName(); + new string? GetName(); /// Sets the Name property of the visual. /// The name of the visual. A NULL pointer clears the Name property. @@ -681,7 +684,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-setname HRESULT SetName( // LPCWSTR name ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetName([In, MarshalAs(UnmanagedType.LPWStr)] string name); + new void SetName([In, MarshalAs(UnmanagedType.LPWStr)] string? name); /// Gets a value that indicates whether the visual is the target of a hyperlink. /// @@ -739,7 +742,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-gethyperlinknavigateuri // HRESULT GetHyperlinkNavigateUri( IUri **hyperlinkUri ); [MethodImpl(MethodImplOptions.InternalCall)] - new IUri GetHyperlinkNavigateUri(); + new IUri? GetHyperlinkNavigateUri(); /// Sets the destination URI of the visual's hyperlink. /// The IUri interface that contains the destination URI of the visual's hyperlink. @@ -750,7 +753,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-sethyperlinknavigateuri // HRESULT SetHyperlinkNavigateUri( IUri *hyperlinkUri ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetHyperlinkNavigateUri([In] IUri hyperlinkUri); + new void SetHyperlinkNavigateUri([In] IUri? hyperlinkUri); /// Gets the Language property of the visual and of its contents. /// @@ -764,7 +767,7 @@ public static partial class XpsObjectModel // GetLanguage( LPWSTR *language ); [MethodImpl(MethodImplOptions.InternalCall)] [return: MarshalAs(UnmanagedType.LPWStr)] - new string GetLanguage(); + new string? GetLanguage(); /// Sets the Language property of the visual. /// @@ -777,7 +780,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-setlanguage HRESULT // SetLanguage( LPCWSTR language ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetLanguage([In, MarshalAs(UnmanagedType.LPWStr)] string language); + new void SetLanguage([In, MarshalAs(UnmanagedType.LPWStr)] string? language); /// /// Gets a pointer to an IXpsOMVisualCollection interface that contains a collection of the visual objects in the canvas. @@ -877,7 +880,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcanvas-getaccessibilityshortdescription // HRESULT GetAccessibilityShortDescription( LPWSTR *shortDescription ); [return: MarshalAs(UnmanagedType.LPWStr)] - string GetAccessibilityShortDescription(); + string? GetAccessibilityShortDescription(); /// /// Sets the short textual description of the object's contents. This text is used by accessibility clients to describe the object. @@ -891,7 +894,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcanvas-setaccessibilityshortdescription // HRESULT SetAccessibilityShortDescription( LPCWSTR shortDescription ); - void SetAccessibilityShortDescription([In, MarshalAs(UnmanagedType.LPWStr)] string shortDescription); + void SetAccessibilityShortDescription([In, MarshalAs(UnmanagedType.LPWStr)] string? shortDescription); /// /// Gets the long (detailed) textual description of the object's contents. This text is used by accessibility clients to @@ -910,7 +913,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcanvas-getaccessibilitylongdescription // HRESULT GetAccessibilityLongDescription( LPWSTR *longDescription ); [return: MarshalAs(UnmanagedType.LPWStr)] - string GetAccessibilityLongDescription(); + string? GetAccessibilityLongDescription(); /// /// Sets the long (detailed) textual description of the object's contents. This text is used by accessibility clients to @@ -925,7 +928,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcanvas-setaccessibilitylongdescription // HRESULT SetAccessibilityLongDescription( LPCWSTR longDescription ); - void SetAccessibilityLongDescription([In, MarshalAs(UnmanagedType.LPWStr)] string longDescription); + void SetAccessibilityLongDescription([In, MarshalAs(UnmanagedType.LPWStr)] string? longDescription); /// Gets a pointer to the resolved IXpsOMDictionary interface of the dictionary associated with the canvas. /// @@ -962,7 +965,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcanvas-getdictionary HRESULT // GetDictionary( IXpsOMDictionary **resourceDictionary ); - IXpsOMDictionary GetDictionary(); + IXpsOMDictionary? GetDictionary(); /// Gets a pointer to the IXpsOMDictionary interface of the local, unshared dictionary. /// @@ -998,7 +1001,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcanvas-getdictionarylocal HRESULT // GetDictionaryLocal( IXpsOMDictionary **resourceDictionary ); - IXpsOMDictionary GetDictionaryLocal(); + IXpsOMDictionary? GetDictionaryLocal(); /// Sets the IXpsOMDictionary interface pointer of the local, unshared dictionary. /// @@ -1040,7 +1043,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcanvas-setdictionarylocal HRESULT // SetDictionaryLocal( IXpsOMDictionary *resourceDictionary ); - void SetDictionaryLocal([In] IXpsOMDictionary resourceDictionary); + void SetDictionaryLocal([In] IXpsOMDictionary? resourceDictionary); /// Gets a pointer to the IXpsOMRemoteDictionaryResource interface of the remote dictionary resource. /// @@ -1073,7 +1076,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcanvas-getdictionaryresource // HRESULT GetDictionaryResource( IXpsOMRemoteDictionaryResource **remoteDictionaryResource ); - IXpsOMRemoteDictionaryResource GetDictionaryResource(); + IXpsOMRemoteDictionaryResource? GetDictionaryResource(); /// Sets the IXpsOMRemoteDictionaryResource interface pointer of the remote dictionary resource. /// @@ -1111,7 +1114,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcanvas-setdictionaryresource // HRESULT SetDictionaryResource( IXpsOMRemoteDictionaryResource *remoteDictionaryResource ); - void SetDictionaryResource([In] IXpsOMRemoteDictionaryResource remoteDictionaryResource); + void SetDictionaryResource([In] IXpsOMRemoteDictionaryResource? remoteDictionaryResource); /// Makes a deep copy of the interface. /// A pointer to the copy of the interface. @@ -1136,7 +1139,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompart-getpartname HRESULT // GetPartName( IOpcPartUri **partUri ); [MethodImpl(MethodImplOptions.InternalCall)] - new IOpcPartUri GetPartName(); + new IOpcPartUri? GetPartName(); /// Sets the name that will be used when the part is serialized. /// @@ -1149,7 +1152,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompart-setpartname HRESULT // SetPartName( IOpcPartUri *partUri ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetPartName([In] IOpcPartUri partUri); + new void SetPartName([In] IOpcPartUri? partUri); /// Gets a new, read-only copy of the stream that is associated with this resource. /// A new, read-only copy of the stream that is associated with this resource. @@ -1209,7 +1212,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcolorprofileresourcecollection-getat // HRESULT GetAt( UINT32 index, IXpsOMColorProfileResource **object ); [MethodImpl(MethodImplOptions.InternalCall)] - IXpsOMColorProfileResource GetAt([In] uint index); + IXpsOMColorProfileResource? GetAt([In] uint index); /// Inserts an IXpsOMColorProfileResource interface pointer at a specified location in the collection. /// @@ -1282,7 +1285,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomcolorprofileresourcecollection-getbypartname // HRESULT GetByPartName( IOpcPartUri *partName, IXpsOMColorProfileResource **part ); [MethodImpl(MethodImplOptions.InternalCall)] - IXpsOMColorProfileResource GetByPartName([In] IOpcPartUri partName); + IXpsOMColorProfileResource? GetByPartName([In] IOpcPartUri partName); } /// A collection of XPS_DASH structures. @@ -1414,7 +1417,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomdictionary-getbykey HRESULT // GetByKey( LPCWSTR key, IXpsOMShareable *beforeEntry, IXpsOMShareable **entry ); - IXpsOMShareable GetByKey([In, MarshalAs(UnmanagedType.LPWStr)] string key, [In] IXpsOMShareable beforeEntry); + IXpsOMShareable GetByKey([In, MarshalAs(UnmanagedType.LPWStr)] string key, [In] IXpsOMShareable? beforeEntry); /// Gets the index of an IXpsOMShareable interface from the dictionary. /// The IXpsOMShareable interface pointer to be found in the dictionary. @@ -1556,7 +1559,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompart-getpartname HRESULT // GetPartName( IOpcPartUri **partUri ); [MethodImpl(MethodImplOptions.InternalCall)] - new IOpcPartUri GetPartName(); + new IOpcPartUri? GetPartName(); /// Sets the name that will be used when the part is serialized. /// @@ -1578,7 +1581,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomdocumentstructureresource-getowner [MethodImpl(MethodImplOptions.InternalCall)] - IXpsOMDocument GetOwner(); + IXpsOMDocument? GetOwner(); /// Gets a new, read-only copy of the stream that is associated with this resource. /// A new, read-only copy of the stream that is associated with this resource. @@ -1633,7 +1636,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompart-getpartname HRESULT // GetPartName( IOpcPartUri **partUri ); [MethodImpl(MethodImplOptions.InternalCall)] - new IOpcPartUri GetPartName(); + new IOpcPartUri? GetPartName(); /// Sets the name that will be used when the part is serialized. /// @@ -1836,7 +1839,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomfontresourcecollection-getbypartname // HRESULT GetByPartName( IOpcPartUri *partName, IXpsOMFontResource **part ); [MethodImpl(MethodImplOptions.InternalCall)] - IXpsOMFontResource GetByPartName([In] IOpcPartUri partName); + IXpsOMFontResource? GetByPartName([In] IOpcPartUri partName); } /// Describes the shape of a path or of a clipping region. @@ -1923,7 +1926,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgeometry-gettransform HRESULT // GetTransform( IXpsOMMatrixTransform **transform ); - IXpsOMMatrixTransform GetTransform(); + IXpsOMMatrixTransform? GetTransform(); /// /// Gets a pointer to the IXpsOMMatrixTransform interface that contains the local, unshared matrix transform for the geometry. @@ -1955,7 +1958,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgeometry-gettransformlocal HRESULT // GetTransformLocal( IXpsOMMatrixTransform **transform ); - IXpsOMMatrixTransform GetTransformLocal(); + IXpsOMMatrixTransform? GetTransformLocal(); /// Sets the local, unshared matrix transform. /// @@ -1998,7 +2001,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgeometry-settransformlocal HRESULT // SetTransformLocal( IXpsOMMatrixTransform *transform ); - void SetTransformLocal([In] IXpsOMMatrixTransform transform); + void SetTransformLocal([In] IXpsOMMatrixTransform? transform); /// /// Gets the lookup key for the IXpsOMMatrixTransform interface that contains the resolved matrix transform for the geometry. @@ -2032,7 +2035,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgeometry-gettransformlookup HRESULT // GetTransformLookup( LPWSTR *lookup ); [return: MarshalAs(UnmanagedType.LPWStr)] - string 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. @@ -2073,7 +2076,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgeometry-settransformlookup HRESULT // SetTransformLookup( LPCWSTR lookup ); - void SetTransformLookup([In, MarshalAs(UnmanagedType.LPWStr)] string lookup); + void SetTransformLookup([In, MarshalAs(UnmanagedType.LPWStr)] string? lookup); /// Makes a deep copy of the interface. /// A pointer to the copy of the interface. @@ -2099,7 +2102,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgeometryfigure-getowner HRESULT // GetOwner( IXpsOMGeometry **owner ); - IXpsOMGeometry GetOwner(); + IXpsOMGeometry? GetOwner(); /// Gets the segment data points for the geometry figure. /// @@ -2232,7 +2235,7 @@ public static partial class XpsObjectModel /// For an example of how to use this method in a program, see the code example in GetSegmentData. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgeometryfigure-getsegmenttypes // HRESULT GetSegmentTypes( UINT32 *segmentCount, XPS_SEGMENT_TYPE *segmentTypes ); - void GetSegmentTypes([In, Out] ref uint segmentCount, [In, Out] XPS_SEGMENT_TYPE[] segmentTypes); + void GetSegmentTypes([In, Out] ref uint segmentCount, [In, Out] XPS_SEGMENT_TYPE[]? segmentTypes); /// Gets stroke definitions for the figure's segments. /// @@ -2276,7 +2279,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgeometryfigure-getsegmentstrokes // HRESULT GetSegmentStrokes( UINT32 *segmentCount, BOOL *segmentStrokes ); - void GetSegmentStrokes([In, Out] ref uint segmentCount, [In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Bool)] bool[] segmentStrokes); + void GetSegmentStrokes([In, Out] ref uint segmentCount, [In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Bool)] bool[]? segmentStrokes); /// Sets the segment information and data points for segments in the figure. /// @@ -2672,7 +2675,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-gettransform HRESULT // GetTransform( IXpsOMMatrixTransform **matrixTransform ); [MethodImpl(MethodImplOptions.InternalCall)] - new IXpsOMMatrixTransform GetTransform(); + new IXpsOMMatrixTransform? GetTransform(); /// /// Gets a pointer to the IXpsOMMatrixTransform interface that contains the local, unshared, resolved matrix transform for the visual. @@ -2705,7 +2708,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-gettransformlocal HRESULT // GetTransformLocal( IXpsOMMatrixTransform **matrixTransform ); [MethodImpl(MethodImplOptions.InternalCall)] - new IXpsOMMatrixTransform GetTransformLocal(); + new IXpsOMMatrixTransform? GetTransformLocal(); /// Sets the local, unshared matrix transform. /// @@ -2750,7 +2753,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-settransformlocal HRESULT // SetTransformLocal( IXpsOMMatrixTransform *matrixTransform ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetTransformLocal([In] IXpsOMMatrixTransform matrixTransform); + new void SetTransformLocal([In] IXpsOMMatrixTransform? matrixTransform); /// /// Gets the lookup key name of the IXpsOMMatrixTransform interface in a resource dictionary that contains the resolved matrix @@ -2785,7 +2788,7 @@ public static partial class XpsObjectModel // GetTransformLookup( LPWSTR *key ); [MethodImpl(MethodImplOptions.InternalCall)] [return: MarshalAs(UnmanagedType.LPWStr)] - new string 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. @@ -2828,7 +2831,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-settransformlookup HRESULT // SetTransformLookup( LPCWSTR key ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetTransformLookup([In, MarshalAs(UnmanagedType.LPWStr)] string key); + new void SetTransformLookup([In, MarshalAs(UnmanagedType.LPWStr)] string? key); /// /// Gets a pointer to the IXpsOMGeometry interface that contains the resolved geometry of the visual's clipping region. @@ -2864,7 +2867,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getclipgeometry HRESULT // GetClipGeometry( IXpsOMGeometry **clipGeometry ); [MethodImpl(MethodImplOptions.InternalCall)] - new IXpsOMGeometry GetClipGeometry(); + new IXpsOMGeometry? GetClipGeometry(); /// /// Gets a pointer to the IXpsOMGeometry interface that contains the local, unshared geometry of the visual's clipping region. @@ -2896,7 +2899,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getclipgeometrylocal HRESULT // GetClipGeometryLocal( IXpsOMGeometry **clipGeometry ); [MethodImpl(MethodImplOptions.InternalCall)] - new IXpsOMGeometry GetClipGeometryLocal(); + new IXpsOMGeometry? GetClipGeometryLocal(); /// Sets the local, unshared clipping region for the visual. /// @@ -2942,7 +2945,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-setclipgeometrylocal HRESULT // SetClipGeometryLocal( IXpsOMGeometry *clipGeometry ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetClipGeometryLocal([In] IXpsOMGeometry clipGeometry); + new void SetClipGeometryLocal([In] IXpsOMGeometry? clipGeometry); /// /// Gets the lookup key for the IXpsOMGeometry interface in a resource dictionary that contains the visual's clipping region. @@ -2975,7 +2978,7 @@ public static partial class XpsObjectModel // HRESULT GetClipGeometryLookup( LPWSTR *key ); [MethodImpl(MethodImplOptions.InternalCall)] [return: MarshalAs(UnmanagedType.LPWStr)] - new string GetClipGeometryLookup(); + new string? GetClipGeometryLookup(); /// Sets the lookup key name of a shared clip geometry in a resource dictionary. /// @@ -3020,7 +3023,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-setclipgeometrylookup // HRESULT SetClipGeometryLookup( LPCWSTR key ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetClipGeometryLookup([In, MarshalAs(UnmanagedType.LPWStr)] string key); + new void SetClipGeometryLookup([In, MarshalAs(UnmanagedType.LPWStr)] string? key); /// Gets the opacity value of this visual. /// The opacity value. @@ -3074,7 +3077,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getopacitymaskbrush HRESULT // GetOpacityMaskBrush( IXpsOMBrush **opacityMaskBrush ); [MethodImpl(MethodImplOptions.InternalCall)] - new IXpsOMBrush GetOpacityMaskBrush(); + new IXpsOMBrush? GetOpacityMaskBrush(); /// Gets the local, unshared opacity mask brush for the visual. /// @@ -3104,7 +3107,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getopacitymaskbrushlocal // HRESULT GetOpacityMaskBrushLocal( IXpsOMBrush **opacityMaskBrush ); [MethodImpl(MethodImplOptions.InternalCall)] - new IXpsOMBrush GetOpacityMaskBrushLocal(); + new IXpsOMBrush? GetOpacityMaskBrushLocal(); /// Sets the IXpsOMBrush interface pointer as the local, unshared opacity mask brush. /// @@ -3150,7 +3153,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-setopacitymaskbrushlocal // HRESULT SetOpacityMaskBrushLocal( IXpsOMBrush *opacityMaskBrush ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetOpacityMaskBrushLocal([In] IXpsOMBrush opacityMaskBrush); + new void SetOpacityMaskBrushLocal([In] IXpsOMBrush? opacityMaskBrush); /// Gets the name of the lookup key of the shared opacity mask brush in a resource dictionary. /// @@ -3181,7 +3184,7 @@ public static partial class XpsObjectModel // HRESULT GetOpacityMaskBrushLookup( LPWSTR *key ); [MethodImpl(MethodImplOptions.InternalCall)] [return: MarshalAs(UnmanagedType.LPWStr)] - new string GetOpacityMaskBrushLookup(); + new string? GetOpacityMaskBrushLookup(); /// Sets the lookup key name of a shared opacity mask brush in a resource dictionary. /// @@ -3226,7 +3229,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-setopacitymaskbrushlookup // HRESULT SetOpacityMaskBrushLookup( LPCWSTR key ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetOpacityMaskBrushLookup([In, MarshalAs(UnmanagedType.LPWStr)] string key); + new void SetOpacityMaskBrushLookup([In, MarshalAs(UnmanagedType.LPWStr)] string? key); /// Gets the Name property of the visual. /// The Name property string. If the Name property has not been set, a NULL pointer is returned. @@ -3234,7 +3237,7 @@ public static partial class XpsObjectModel // LPWSTR *name ); [MethodImpl(MethodImplOptions.InternalCall)] [return: MarshalAs(UnmanagedType.LPWStr)] - new string GetName(); + new string? GetName(); /// Sets the Name property of the visual. /// The name of the visual. A NULL pointer clears the Name property. @@ -3247,7 +3250,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-setname HRESULT SetName( // LPCWSTR name ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetName([In, MarshalAs(UnmanagedType.LPWStr)] string name); + new void SetName([In, MarshalAs(UnmanagedType.LPWStr)] string? name); /// Gets a value that indicates whether the visual is the target of a hyperlink. /// @@ -3305,7 +3308,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-gethyperlinknavigateuri // HRESULT GetHyperlinkNavigateUri( IUri **hyperlinkUri ); [MethodImpl(MethodImplOptions.InternalCall)] - new IUri GetHyperlinkNavigateUri(); + new IUri? GetHyperlinkNavigateUri(); /// Sets the destination URI of the visual's hyperlink. /// The IUri interface that contains the destination URI of the visual's hyperlink. @@ -3316,7 +3319,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-sethyperlinknavigateuri // HRESULT SetHyperlinkNavigateUri( IUri *hyperlinkUri ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetHyperlinkNavigateUri([In] IUri hyperlinkUri); + new void SetHyperlinkNavigateUri([In] IUri? hyperlinkUri); /// Gets the Language property of the visual and of its contents. /// @@ -3330,7 +3333,7 @@ public static partial class XpsObjectModel // GetLanguage( LPWSTR *language ); [MethodImpl(MethodImplOptions.InternalCall)] [return: MarshalAs(UnmanagedType.LPWStr)] - new string GetLanguage(); + new string? GetLanguage(); /// Sets the Language property of the visual. /// @@ -3343,14 +3346,14 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-setlanguage HRESULT // SetLanguage( LPCWSTR language ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetLanguage([In, MarshalAs(UnmanagedType.LPWStr)] string language); + new void SetLanguage([In, MarshalAs(UnmanagedType.LPWStr)] string? language); /// Gets the text in unescaped UTF-16 scalar values. /// 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 ); [return: MarshalAs(UnmanagedType.LPWStr)] - string GetUnicodeString(); + string? GetUnicodeString(); /// Gets the number of Glyph indices. /// The number of glyph indices. @@ -3433,7 +3436,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomglyphs-getprohibitedcaretstops // HRESULT GetProhibitedCaretStops( UINT32 *prohibitedCaretStopCount, UINT32 *prohibitedCaretStops ); - void GetProhibitedCaretStops(ref uint prohibitedCaretStopCount, [In, Out] uint[] prohibitedCaretStops); + void GetProhibitedCaretStops(ref uint prohibitedCaretStopCount, [In, Out] uint[]? prohibitedCaretStops); /// Gets the level of bidirectional text. /// @@ -3490,7 +3493,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomglyphs-getdevicefontname HRESULT // GetDeviceFontName( LPWSTR *deviceFontName ); [return: MarshalAs(UnmanagedType.LPWStr)] - string 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. @@ -3652,7 +3655,7 @@ public static partial class XpsObjectModel /// The fill brush is used to fill the shape of the rendered glyphs. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomglyphs-getfillbrush HRESULT // GetFillBrush( IXpsOMBrush **fillBrush ); - IXpsOMBrush GetFillBrush(); + IXpsOMBrush? GetFillBrush(); /// Gets a pointer to the local, unshared IXpsOMBrush interface of the fill brush to be used for the text. /// @@ -3681,7 +3684,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomglyphs-getfillbrushlocal HRESULT // GetFillBrushLocal( IXpsOMBrush **fillBrush ); - IXpsOMBrush GetFillBrushLocal(); + IXpsOMBrush? GetFillBrushLocal(); /// Sets the IXpsOMBrush interface pointer to a local, unshared fill brush. /// @@ -3725,7 +3728,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomglyphs-setfillbrushlocal HRESULT // SetFillBrushLocal( IXpsOMBrush *fillBrush ); - void SetFillBrushLocal([In] IXpsOMBrush fillBrush); + void SetFillBrushLocal([In] IXpsOMBrush? fillBrush); /// /// Gets the lookup key of the IXpsOMBrush interface that is stored in a resource dictionary and will be used as the fill brush. @@ -3757,7 +3760,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomglyphs-getfillbrushlookup HRESULT // GetFillBrushLookup( LPWSTR *key ); [return: MarshalAs(UnmanagedType.LPWStr)] - string GetFillBrushLookup(); + string? GetFillBrushLookup(); /// Sets the lookup key name of a shared fill brush. /// @@ -3802,7 +3805,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomglyphs-setfillbrushlookup HRESULT // SetFillBrushLookup( LPCWSTR key ); - void SetFillBrushLookup([In, MarshalAs(UnmanagedType.LPWStr)] string key); + void SetFillBrushLookup([In, MarshalAs(UnmanagedType.LPWStr)] string? key); /// Gets a pointer to the IXpsOMGlyphsEditor interface that will be used to edit the glyphs in the object. /// A pointer to the IXpsOMGlyphsEditor interface. @@ -3837,13 +3840,13 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomglyphseditor-getunicodestring // HRESULT GetUnicodeString( LPWSTR *unicodeString ); [return: MarshalAs(UnmanagedType.LPWStr)] - string 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. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomglyphseditor-setunicodestring // HRESULT SetUnicodeString( LPCWSTR unicodeString ); - void SetUnicodeString([In, MarshalAs(UnmanagedType.LPWStr)] string unicodeString); + void SetUnicodeString([In, MarshalAs(UnmanagedType.LPWStr)] string? unicodeString); /// Gets the number of glyph indices. /// The glyph index count. @@ -3882,7 +3885,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomglyphseditor-setglyphindices // HRESULT SetGlyphIndices( UINT32 indexCount, const XPS_GLYPH_INDEX *glyphIndices ); - void SetGlyphIndices([In] uint indexCount, [In] XPS_GLYPH_INDEX[] glyphIndices); + void SetGlyphIndices([In] uint indexCount, [In] XPS_GLYPH_INDEX[]? glyphIndices); /// Gets the number of glyph mappings. /// The number of glyph mappings. @@ -3918,7 +3921,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomglyphseditor-setglyphmappings // HRESULT SetGlyphMappings( UINT32 glyphMappingCount, const XPS_GLYPH_MAPPING *glyphMappings ); - void SetGlyphMappings([In] uint glyphMappingCount, [In] XPS_GLYPH_MAPPING[] glyphMappings); + void SetGlyphMappings([In] uint glyphMappingCount, [In] XPS_GLYPH_MAPPING[]? glyphMappings); /// Gets the number of prohibited caret stops. /// The number of prohibited caret stops. @@ -3955,7 +3958,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomglyphseditor-getprohibitedcaretstops // HRESULT GetProhibitedCaretStops( UINT32 *count, UINT32 *prohibitedCaretStops ); - void GetProhibitedCaretStops(ref uint count, [In, Out] uint[] prohibitedCaretStops); + void GetProhibitedCaretStops(ref uint count, [In, Out] uint[]? prohibitedCaretStops); /// Sets an array of prohibited caret stop locations. /// @@ -3973,7 +3976,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomglyphseditor-setprohibitedcaretstops // HRESULT SetProhibitedCaretStops( UINT32 count, const UINT32 *prohibitedCaretStops ); - void SetProhibitedCaretStops([In] uint count, [In] uint[] prohibitedCaretStops); + void SetProhibitedCaretStops([In] uint count, [In] uint[]? prohibitedCaretStops); /// Gets the bidirectional text level of the parent IXpsOMGlyphs interface. /// @@ -4066,7 +4069,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomglyphseditor-getdevicefontname // HRESULT GetDeviceFontName( LPWSTR *deviceFontName ); [return: MarshalAs(UnmanagedType.LPWStr)] - string GetDeviceFontName(); + string? GetDeviceFontName(); /// Sets the name of the device font. /// @@ -4078,7 +4081,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomglyphseditor-setdevicefontname // HRESULT SetDeviceFontName( LPCWSTR deviceFontName ); - void SetDeviceFontName([In, MarshalAs(UnmanagedType.LPWStr)] string deviceFontName); + void SetDeviceFontName([In, MarshalAs(UnmanagedType.LPWStr)] string? deviceFontName); } /// @@ -4215,7 +4218,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgradientbrush-gettransform HRESULT // GetTransform( IXpsOMMatrixTransform **transform ); - IXpsOMMatrixTransform GetTransform(); + IXpsOMMatrixTransform? GetTransform(); /// /// Gets a pointer to the IXpsOMMatrixTransform interface that contains the local, unshared, resolved matrix transform for the brush. @@ -4251,7 +4254,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgradientbrush-gettransformlocal // HRESULT GetTransformLocal( IXpsOMMatrixTransform **transform ); - IXpsOMMatrixTransform GetTransformLocal(); + IXpsOMMatrixTransform? GetTransformLocal(); /// /// Sets the IXpsOMMatrixTransform interface pointer to a local, unshared matrix transform that is to be used for the brush. @@ -4301,7 +4304,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgradientbrush-settransformlocal // HRESULT SetTransformLocal( IXpsOMMatrixTransform *transform ); - void SetTransformLocal([In] IXpsOMMatrixTransform transform); + void SetTransformLocal([In] IXpsOMMatrixTransform? transform); /// /// Gets the name of the lookup key of the shared matrix transform interface that is to be used for the brush. @@ -4347,7 +4350,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgradientbrush-gettransformlookup // HRESULT GetTransformLookup( LPWSTR *key ); [return: MarshalAs(UnmanagedType.LPWStr)] - string GetTransformLookup(); + string? GetTransformLookup(); /// /// Sets the name of the lookup key of a shared matrix transform that is to be used for the brush. @@ -4395,7 +4398,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgradientbrush-settransformlookup // HRESULT SetTransformLookup( LPCWSTR key ); - void SetTransformLookup([In, MarshalAs(UnmanagedType.LPWStr)] string key); + void SetTransformLookup([In, MarshalAs(UnmanagedType.LPWStr)] string? key); /// Gets the XPS_SPREAD_METHOD value, which describes how the area outside of the gradient region will be rendered. /// @@ -4481,7 +4484,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgradientstop-getowner HRESULT // GetOwner( IXpsOMGradientBrush **owner ); - IXpsOMGradientBrush GetOwner(); + IXpsOMGradientBrush? GetOwner(); /// Gets the offset value of the gradient stop. /// The offset value of the gradient stop, expressed as a fraction of the gradient path. @@ -4511,7 +4514,7 @@ public static partial class XpsObjectModel /// A color profile is only returned when the color type of color is XPS_COLOR_TYPE_CONTEXT. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgradientstop-getcolor HRESULT // GetColor( XPS_COLOR *color, IXpsOMColorProfileResource **colorProfile ); - IXpsOMColorProfileResource GetColor(out XPS_COLOR color); + IXpsOMColorProfileResource? GetColor(out XPS_COLOR color); /// Sets the color value and color profile of the gradient stop. /// @@ -4532,7 +4535,7 @@ public static partial class XpsObjectModel /// A color profile is only required when the color type of color is XPS_COLOR_TYPE_CONTEXT. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgradientstop-setcolor HRESULT // SetColor( const XPS_COLOR *color, IXpsOMColorProfileResource *colorProfile ); - void SetColor(in XPS_COLOR color, [In] IXpsOMColorProfileResource colorProfile); + void SetColor(in XPS_COLOR color, [In] IXpsOMColorProfileResource? colorProfile); /// Makes a deep copy of the IXpsOMGradientStop interface. /// A pointer to the copy of the interface. @@ -4706,7 +4709,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomtilebrush-gettransform HRESULT // GetTransform( IXpsOMMatrixTransform **transform ); - new IXpsOMMatrixTransform GetTransform(); + new IXpsOMMatrixTransform? GetTransform(); /// /// Gets a pointer to the IXpsOMMatrixTransform interface that contains the local, unshared resolved matrix transform for the brush. @@ -4741,7 +4744,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomtilebrush-gettransformlocal HRESULT // GetTransformLocal( IXpsOMMatrixTransform **transform ); - new IXpsOMMatrixTransform GetTransformLocal(); + new IXpsOMMatrixTransform? GetTransformLocal(); /// Sets the IXpsOMMatrixTransform interface pointer to a local, unshared matrix transform. /// @@ -4789,7 +4792,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomtilebrush-settransformlocal HRESULT // SetTransformLocal( IXpsOMMatrixTransform *transform ); - new void SetTransformLocal([In] IXpsOMMatrixTransform transform); + new void SetTransformLocal([In] IXpsOMMatrixTransform? transform); /// /// Gets the lookup key that identifies the IXpsOMMatrixTransform interface in a resource dictionary that contains the resolved @@ -4829,7 +4832,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomtilebrush-gettransformlookup // HRESULT GetTransformLookup( LPWSTR *key ); [return: MarshalAs(UnmanagedType.LPWStr)] - new string 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 @@ -4881,7 +4884,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomtilebrush-settransformlookup // HRESULT SetTransformLookup( LPCWSTR key ); - new void SetTransformLookup([In, MarshalAs(UnmanagedType.LPWStr)] string key); + new void SetTransformLookup([In, MarshalAs(UnmanagedType.LPWStr)] string? key); /// Gets the portion of the source image to be used by the tile. /// The XPS_RECT structure that describes the area of the source content to be used by the tile. @@ -4988,7 +4991,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomimagebrush-getimageresource HRESULT // GetImageResource( IXpsOMImageResource **imageResource ); - IXpsOMImageResource GetImageResource(); + IXpsOMImageResource? GetImageResource(); /// /// Sets a pointer to the IXpsOMImageResource interface that contains the image resource to be used as the source for the brush. @@ -4999,7 +5002,7 @@ public static partial class XpsObjectModel /// The image resource must be of type JPEG, PNG, TIFF 6.0, or HD Photo. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomimagebrush-setimageresource HRESULT // SetImageResource( IXpsOMImageResource *imageResource ); - void SetImageResource([In] IXpsOMImageResource imageResource); + void SetImageResource([In] IXpsOMImageResource? imageResource); /// /// Gets a pointer to the IXpsOMColorProfileResource interface, which contains the color profile resource that is associated @@ -5015,7 +5018,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomimagebrush-getcolorprofileresource // HRESULT GetColorProfileResource( IXpsOMColorProfileResource **colorProfileResource ); - IXpsOMColorProfileResource GetColorProfileResource(); + IXpsOMColorProfileResource? GetColorProfileResource(); /// /// Sets a pointer to the IXpsOMColorProfileResource interface, which contains the color profile resource that is associated @@ -5027,7 +5030,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomimagebrush-setcolorprofileresource // HRESULT SetColorProfileResource( IXpsOMColorProfileResource *colorProfileResource ); - void SetColorProfileResource([In] IXpsOMColorProfileResource colorProfileResource); + void SetColorProfileResource([In] IXpsOMColorProfileResource? colorProfileResource); /// Makes a deep copy of the interface. /// A pointer to the copy of the interface. @@ -5052,7 +5055,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompart-getpartname HRESULT // GetPartName( IOpcPartUri **partUri ); [MethodImpl(MethodImplOptions.InternalCall)] - new IOpcPartUri GetPartName(); + new IOpcPartUri? GetPartName(); /// Sets the name that will be used when the part is serialized. /// @@ -5065,7 +5068,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompart-setpartname HRESULT // SetPartName( IOpcPartUri *partUri ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetPartName([In] IOpcPartUri partUri); + new void SetPartName([In] IOpcPartUri? partUri); /// Gets a new, read-only copy of the stream that is associated with this resource. /// A new, read-only copy of the stream that is associated with this resource. @@ -5160,4 +5163,38 @@ public static partial class XpsObjectModel /// A non-negative value that represents the object's size in the vertical (y) dimension. public float height; } + + /// Wrapper for all IXpsXXXCollection interfaces. This class is used to wrap the collection interfaces. + /// The element type. + public class XpsList : VirtualList + { + /// Initializes a new instance of the class. + /// The collection. + public XpsList(object collection) : base(new Impl(collection)) + { + } + + private class Impl : IVirtualListMethods + { + private readonly object collection; + + public Impl(object collection) => this.collection = collection; + + bool IVirtualReadOnlyListMethods.TryGet(int index, [NotNullWhen(true)] out T? value) + { + value = collection.InvokeMethod("GetAt", (uint)index); + return value is not null; + } + + void IVirtualListMethods.SetItemAt(int index, T value) => collection.InvokeMethod("SetAt", (uint)index, value); + + int IVirtualReadOnlyListMethods.GetItemCount() => (int)collection.InvokeMethod("GetCount"); + + void IVirtualListMethods.AddItem(T item) => collection.InvokeMethod("Append", item); + + void IVirtualListMethods.InsertItemAt(int index, T item) => collection.InvokeMethod("InsertAt", (uint)index, item); + + void IVirtualListMethods.RemoveItemAt(int index) => collection.InvokeMethod("RemoveAt", (uint)index); + } + } } \ No newline at end of file diff --git a/PInvoke/Printing/XpsObjectModel2.cs b/PInvoke/Printing/XpsObjectModel2.cs index 40325eef..42924f53 100644 --- a/PInvoke/Printing/XpsObjectModel2.cs +++ b/PInvoke/Printing/XpsObjectModel2.cs @@ -98,7 +98,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomimageresourcecollection-getbypartname // HRESULT GetByPartName( IOpcPartUri *partName, IXpsOMImageResource **part ); [MethodImpl(MethodImplOptions.InternalCall)] - IXpsOMImageResource GetByPartName([In] IOpcPartUri partName); + IXpsOMImageResource? GetByPartName([In] IOpcPartUri partName); } /// Specifies a linear gradient, which is the color gradient along a vector. @@ -214,7 +214,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgradientbrush-gettransform HRESULT // GetTransform( IXpsOMMatrixTransform **transform ); - new IXpsOMMatrixTransform GetTransform(); + new IXpsOMMatrixTransform? GetTransform(); /// /// Gets a pointer to the IXpsOMMatrixTransform interface that contains the local, unshared, resolved matrix transform for the brush. @@ -250,7 +250,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgradientbrush-gettransformlocal // HRESULT GetTransformLocal( IXpsOMMatrixTransform **transform ); - new IXpsOMMatrixTransform GetTransformLocal(); + new IXpsOMMatrixTransform? GetTransformLocal(); /// /// Sets the IXpsOMMatrixTransform interface pointer to a local, unshared matrix transform that is to be used for the brush. @@ -300,7 +300,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgradientbrush-settransformlocal // HRESULT SetTransformLocal( IXpsOMMatrixTransform *transform ); - new void SetTransformLocal([In] IXpsOMMatrixTransform transform); + new void SetTransformLocal([In] IXpsOMMatrixTransform? transform); /// /// Gets the name of the lookup key of the shared matrix transform interface that is to be used for the brush. @@ -346,7 +346,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgradientbrush-gettransformlookup // HRESULT GetTransformLookup( LPWSTR *key ); [return: MarshalAs(UnmanagedType.LPWStr)] - new string GetTransformLookup(); + new string? GetTransformLookup(); /// /// Sets the name of the lookup key of a shared matrix transform that is to be used for the brush. @@ -394,7 +394,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgradientbrush-settransformlookup // HRESULT SetTransformLookup( LPCWSTR key ); - new void SetTransformLookup([In, MarshalAs(UnmanagedType.LPWStr)] string key); + new void SetTransformLookup([In, MarshalAs(UnmanagedType.LPWStr)] string? key); /// Gets the XPS_SPREAD_METHOD value, which describes how the area outside of the gradient region will be rendered. /// @@ -531,7 +531,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomnamecollection-getat HRESULT GetAt( // UINT32 index, LPWSTR *name ); [return: MarshalAs(UnmanagedType.LPWStr)] - string GetAt([In] uint index); + string? GetAt([In] uint index); } /// Describes a non-text visual item. @@ -586,7 +586,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-gettransform HRESULT // GetTransform( IXpsOMMatrixTransform **matrixTransform ); [MethodImpl(MethodImplOptions.InternalCall)] - new IXpsOMMatrixTransform GetTransform(); + new IXpsOMMatrixTransform? GetTransform(); /// /// Gets a pointer to the IXpsOMMatrixTransform interface that contains the local, unshared, resolved matrix transform for the visual. @@ -619,7 +619,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-gettransformlocal HRESULT // GetTransformLocal( IXpsOMMatrixTransform **matrixTransform ); [MethodImpl(MethodImplOptions.InternalCall)] - new IXpsOMMatrixTransform GetTransformLocal(); + new IXpsOMMatrixTransform? GetTransformLocal(); /// Sets the local, unshared matrix transform. /// @@ -664,7 +664,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-settransformlocal HRESULT // SetTransformLocal( IXpsOMMatrixTransform *matrixTransform ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetTransformLocal([In] IXpsOMMatrixTransform matrixTransform); + new void SetTransformLocal([In] IXpsOMMatrixTransform? matrixTransform); /// /// Gets the lookup key name of the IXpsOMMatrixTransform interface in a resource dictionary that contains the resolved matrix @@ -699,7 +699,7 @@ public static partial class XpsObjectModel // GetTransformLookup( LPWSTR *key ); [MethodImpl(MethodImplOptions.InternalCall)] [return: MarshalAs(UnmanagedType.LPWStr)] - new string 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. @@ -742,7 +742,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-settransformlookup HRESULT // SetTransformLookup( LPCWSTR key ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetTransformLookup([In, MarshalAs(UnmanagedType.LPWStr)] string key); + new void SetTransformLookup([In, MarshalAs(UnmanagedType.LPWStr)] string? key); /// /// Gets a pointer to the IXpsOMGeometry interface that contains the resolved geometry of the visual's clipping region. @@ -778,7 +778,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getclipgeometry HRESULT // GetClipGeometry( IXpsOMGeometry **clipGeometry ); [MethodImpl(MethodImplOptions.InternalCall)] - new IXpsOMGeometry GetClipGeometry(); + new IXpsOMGeometry? GetClipGeometry(); /// /// Gets a pointer to the IXpsOMGeometry interface that contains the local, unshared geometry of the visual's clipping region. @@ -810,7 +810,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getclipgeometrylocal HRESULT // GetClipGeometryLocal( IXpsOMGeometry **clipGeometry ); [MethodImpl(MethodImplOptions.InternalCall)] - new IXpsOMGeometry GetClipGeometryLocal(); + new IXpsOMGeometry? GetClipGeometryLocal(); /// Sets the local, unshared clipping region for the visual. /// @@ -856,7 +856,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-setclipgeometrylocal HRESULT // SetClipGeometryLocal( IXpsOMGeometry *clipGeometry ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetClipGeometryLocal([In] IXpsOMGeometry clipGeometry); + new void SetClipGeometryLocal([In] IXpsOMGeometry? clipGeometry); /// /// Gets the lookup key for the IXpsOMGeometry interface in a resource dictionary that contains the visual's clipping region. @@ -889,7 +889,7 @@ public static partial class XpsObjectModel // HRESULT GetClipGeometryLookup( LPWSTR *key ); [MethodImpl(MethodImplOptions.InternalCall)] [return: MarshalAs(UnmanagedType.LPWStr)] - new string GetClipGeometryLookup(); + new string? GetClipGeometryLookup(); /// Sets the lookup key name of a shared clip geometry in a resource dictionary. /// @@ -934,7 +934,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-setclipgeometrylookup // HRESULT SetClipGeometryLookup( LPCWSTR key ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetClipGeometryLookup([In, MarshalAs(UnmanagedType.LPWStr)] string key); + new void SetClipGeometryLookup([In, MarshalAs(UnmanagedType.LPWStr)] string? key); /// Gets the opacity value of this visual. /// The opacity value. @@ -988,7 +988,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getopacitymaskbrush HRESULT // GetOpacityMaskBrush( IXpsOMBrush **opacityMaskBrush ); [MethodImpl(MethodImplOptions.InternalCall)] - new IXpsOMBrush GetOpacityMaskBrush(); + new IXpsOMBrush? GetOpacityMaskBrush(); /// Gets the local, unshared opacity mask brush for the visual. /// @@ -1018,7 +1018,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getopacitymaskbrushlocal // HRESULT GetOpacityMaskBrushLocal( IXpsOMBrush **opacityMaskBrush ); [MethodImpl(MethodImplOptions.InternalCall)] - new IXpsOMBrush GetOpacityMaskBrushLocal(); + new IXpsOMBrush? GetOpacityMaskBrushLocal(); /// Sets the IXpsOMBrush interface pointer as the local, unshared opacity mask brush. /// @@ -1064,7 +1064,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-setopacitymaskbrushlocal // HRESULT SetOpacityMaskBrushLocal( IXpsOMBrush *opacityMaskBrush ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetOpacityMaskBrushLocal([In] IXpsOMBrush opacityMaskBrush); + new void SetOpacityMaskBrushLocal([In] IXpsOMBrush? opacityMaskBrush); /// Gets the name of the lookup key of the shared opacity mask brush in a resource dictionary. /// @@ -1095,7 +1095,7 @@ public static partial class XpsObjectModel // HRESULT GetOpacityMaskBrushLookup( LPWSTR *key ); [MethodImpl(MethodImplOptions.InternalCall)] [return: MarshalAs(UnmanagedType.LPWStr)] - new string GetOpacityMaskBrushLookup(); + new string? GetOpacityMaskBrushLookup(); /// Sets the lookup key name of a shared opacity mask brush in a resource dictionary. /// @@ -1140,7 +1140,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-setopacitymaskbrushlookup // HRESULT SetOpacityMaskBrushLookup( LPCWSTR key ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetOpacityMaskBrushLookup([In, MarshalAs(UnmanagedType.LPWStr)] string key); + new void SetOpacityMaskBrushLookup([In, MarshalAs(UnmanagedType.LPWStr)] string? key); /// Gets the Name property of the visual. /// The Name property string. If the Name property has not been set, a NULL pointer is returned. @@ -1148,7 +1148,7 @@ public static partial class XpsObjectModel // LPWSTR *name ); [MethodImpl(MethodImplOptions.InternalCall)] [return: MarshalAs(UnmanagedType.LPWStr)] - new string GetName(); + new string? GetName(); /// Sets the Name property of the visual. /// The name of the visual. A NULL pointer clears the Name property. @@ -1161,7 +1161,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-setname HRESULT SetName( // LPCWSTR name ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetName([In, MarshalAs(UnmanagedType.LPWStr)] string name); + new void SetName([In, MarshalAs(UnmanagedType.LPWStr)] string? name); /// Gets a value that indicates whether the visual is the target of a hyperlink. /// @@ -1219,7 +1219,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-gethyperlinknavigateuri // HRESULT GetHyperlinkNavigateUri( IUri **hyperlinkUri ); [MethodImpl(MethodImplOptions.InternalCall)] - new IUri GetHyperlinkNavigateUri(); + new IUri? GetHyperlinkNavigateUri(); /// Sets the destination URI of the visual's hyperlink. /// The IUri interface that contains the destination URI of the visual's hyperlink. @@ -1244,7 +1244,7 @@ public static partial class XpsObjectModel // GetLanguage( LPWSTR *language ); [MethodImpl(MethodImplOptions.InternalCall)] [return: MarshalAs(UnmanagedType.LPWStr)] - new string GetLanguage(); + new string? GetLanguage(); /// Sets the Language property of the visual. /// @@ -1257,7 +1257,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-setlanguage HRESULT // SetLanguage( LPCWSTR language ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetLanguage([In, MarshalAs(UnmanagedType.LPWStr)] string language); + new void SetLanguage([In, MarshalAs(UnmanagedType.LPWStr)] string? language); /// Gets a pointer to the path's IXpsOMGeometry interface, which describes the resolved fill area for this path. /// @@ -1289,7 +1289,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompath-getgeometry HRESULT // GetGeometry( IXpsOMGeometry **geometry ); - IXpsOMGeometry GetGeometry(); + IXpsOMGeometry? GetGeometry(); /// Gets the local, unshared geometry of the resolved fill area for this path. /// @@ -1318,7 +1318,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompath-getgeometrylocal HRESULT // GetGeometryLocal( IXpsOMGeometry **geometry ); - IXpsOMGeometry GetGeometryLocal(); + IXpsOMGeometry? GetGeometryLocal(); /// /// Sets the pointer to the local, unshared IXpsOMGeometry interface that contains the geometry of the resolved fill area to be @@ -1365,7 +1365,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompath-setgeometrylocal HRESULT // SetGeometryLocal( IXpsOMGeometry *geometry ); - void SetGeometryLocal([In] IXpsOMGeometry geometry); + void SetGeometryLocal([In] IXpsOMGeometry? geometry); /// /// Gets the lookup key of a shared geometry object that is stored in a resource dictionary and that describes the resolved fill @@ -1398,7 +1398,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompath-getgeometrylookup HRESULT // GetGeometryLookup( LPWSTR *lookup ); [return: MarshalAs(UnmanagedType.LPWStr)] - string GetGeometryLookup(); + string? GetGeometryLookup(); /// /// Sets the lookup key name of a shared geometry in a resource dictionary. @@ -1441,7 +1441,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompath-setgeometrylookup HRESULT // SetGeometryLookup( LPCWSTR lookup ); - void SetGeometryLookup([In, MarshalAs(UnmanagedType.LPWStr)] string lookup); + void SetGeometryLookup([In, MarshalAs(UnmanagedType.LPWStr)] string? lookup); /// /// Gets the short textual description of the object's contents. This description is used by accessibility clients to describe @@ -1459,7 +1459,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompath-getaccessibilityshortdescription // HRESULT GetAccessibilityShortDescription( LPWSTR *shortDescription ); [return: MarshalAs(UnmanagedType.LPWStr)] - string GetAccessibilityShortDescription(); + string? GetAccessibilityShortDescription(); /// /// Sets the short textual description of the object's contents. This description is used by accessibility clients to describe @@ -1490,7 +1490,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompath-getaccessibilitylongdescription // HRESULT GetAccessibilityLongDescription( LPWSTR *longDescription ); [return: MarshalAs(UnmanagedType.LPWStr)] - string GetAccessibilityLongDescription(); + string? GetAccessibilityLongDescription(); /// /// Sets the long (detailed) textual description of the object's contents. This description is used by accessibility clients to @@ -1590,7 +1590,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompath-getstrokebrush HRESULT // GetStrokeBrush( IXpsOMBrush **brush ); - IXpsOMBrush GetStrokeBrush(); + IXpsOMBrush? GetStrokeBrush(); /// Gets a pointer to the local, unshared IXpsOMBrush interface that contains the stroke brush for the path. /// @@ -1619,7 +1619,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompath-getstrokebrushlocal HRESULT // GetStrokeBrushLocal( IXpsOMBrush **brush ); - IXpsOMBrush GetStrokeBrushLocal(); + IXpsOMBrush? GetStrokeBrushLocal(); /// Sets a pointer to a local, unshared IXpsOMBrush interface to be used as a stroke brush. /// A pointer to a local, unshared IXpsOMBrush interface to be used as a stroke brush. @@ -1660,7 +1660,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompath-setstrokebrushlocal HRESULT // SetStrokeBrushLocal( IXpsOMBrush *brush ); - void SetStrokeBrushLocal([In] IXpsOMBrush brush); + void SetStrokeBrushLocal([In] IXpsOMBrush? brush); /// /// Gets the lookup key of the brush that is stored in a resource dictionary and is to be used as the stroke brush for the path. @@ -1692,7 +1692,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompath-getstrokebrushlookup HRESULT // GetStrokeBrushLookup( LPWSTR *lookup ); [return: MarshalAs(UnmanagedType.LPWStr)] - string 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. @@ -1734,7 +1734,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompath-setstrokebrushlookup HRESULT // SetStrokeBrushLookup( LPCWSTR lookup ); - void SetStrokeBrushLookup([In, MarshalAs(UnmanagedType.LPWStr)] string lookup); + void SetStrokeBrushLookup([In, MarshalAs(UnmanagedType.LPWStr)] string? lookup); /// /// Gets a pointer to the IXpsOMDashCollection interface that contains the XPS_DASH structures that define the dash pattern of @@ -1905,7 +1905,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompath-getfillbrush HRESULT // GetFillBrush( IXpsOMBrush **brush ); - IXpsOMBrush GetFillBrush(); + IXpsOMBrush? GetFillBrush(); /// Gets a pointer to the local, unshared IXpsOMBrush interface that contains the fill brush for the path. /// @@ -1935,7 +1935,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompath-getfillbrushlocal HRESULT // GetFillBrushLocal( IXpsOMBrush **brush ); - IXpsOMBrush GetFillBrushLocal(); + IXpsOMBrush? GetFillBrushLocal(); /// Sets the pointer to the local, unshared IXpsOMBrush interface to be used as the fill brush. /// A pointer to the local, unshared IXpsOMBrush interface to be used as the fill brush. @@ -1976,7 +1976,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompath-setfillbrushlocal HRESULT // SetFillBrushLocal( IXpsOMBrush *brush ); - void SetFillBrushLocal([In] IXpsOMBrush brush); + void SetFillBrushLocal([In] IXpsOMBrush? brush); /// /// Gets the lookup key of the brush that is stored in a resource dictionary and used as the fill brush for the path. @@ -2008,7 +2008,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompath-getfillbrushlookup HRESULT // GetFillBrushLookup( LPWSTR *lookup ); [return: MarshalAs(UnmanagedType.LPWStr)] - string 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. @@ -2048,7 +2048,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompath-setfillbrushlookup HRESULT // SetFillBrushLookup( LPCWSTR lookup ); - void SetFillBrushLookup([In, MarshalAs(UnmanagedType.LPWStr)] string lookup); + void SetFillBrushLookup([In, MarshalAs(UnmanagedType.LPWStr)] string? lookup); /// Makes a deep copy of the interface. /// A pointer to the copy of the interface. @@ -2071,7 +2071,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompart-getpartname HRESULT // GetPartName( IOpcPartUri **partUri ); [MethodImpl(MethodImplOptions.InternalCall)] - new IOpcPartUri GetPartName(); + new IOpcPartUri? GetPartName(); /// Sets the name that will be used when the part is serialized. /// @@ -2084,7 +2084,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompart-setpartname HRESULT // SetPartName( IOpcPartUri *partUri ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetPartName([In] IOpcPartUri partUri); + new void SetPartName([In] IOpcPartUri? partUri); /// Gets a new, read-only copy of the stream that is associated with this resource. /// A new, read-only copy of the stream that is associated with this resource. @@ -2228,7 +2228,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgradientbrush-gettransform HRESULT // GetTransform( IXpsOMMatrixTransform **transform ); - new IXpsOMMatrixTransform GetTransform(); + new IXpsOMMatrixTransform? GetTransform(); /// /// Gets a pointer to the IXpsOMMatrixTransform interface that contains the local, unshared, resolved matrix transform for the brush. @@ -2264,7 +2264,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgradientbrush-gettransformlocal // HRESULT GetTransformLocal( IXpsOMMatrixTransform **transform ); - new IXpsOMMatrixTransform GetTransformLocal(); + new IXpsOMMatrixTransform? GetTransformLocal(); /// /// Sets the IXpsOMMatrixTransform interface pointer to a local, unshared matrix transform that is to be used for the brush. @@ -2314,7 +2314,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgradientbrush-settransformlocal // HRESULT SetTransformLocal( IXpsOMMatrixTransform *transform ); - new void SetTransformLocal([In] IXpsOMMatrixTransform transform); + new void SetTransformLocal([In] IXpsOMMatrixTransform? transform); /// /// Gets the name of the lookup key of the shared matrix transform interface that is to be used for the brush. @@ -2360,7 +2360,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgradientbrush-gettransformlookup // HRESULT GetTransformLookup( LPWSTR *key ); [return: MarshalAs(UnmanagedType.LPWStr)] - new string GetTransformLookup(); + new string? GetTransformLookup(); /// /// Sets the name of the lookup key of a shared matrix transform that is to be used for the brush. @@ -2408,7 +2408,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomgradientbrush-settransformlookup // HRESULT SetTransformLookup( LPCWSTR key ); - new void SetTransformLookup([In, MarshalAs(UnmanagedType.LPWStr)] string key); + new void SetTransformLookup([In, MarshalAs(UnmanagedType.LPWStr)] string? key); /// Gets the XPS_SPREAD_METHOD value, which describes how the area outside of the gradient region will be rendered. /// @@ -2587,7 +2587,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompart-getpartname HRESULT // GetPartName( IOpcPartUri **partUri ); [MethodImpl(MethodImplOptions.InternalCall)] - new IOpcPartUri GetPartName(); + new IOpcPartUri? GetPartName(); /// Sets the name that will be used when the part is serialized. /// @@ -2600,7 +2600,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompart-setpartname HRESULT // SetPartName( IOpcPartUri *partUri ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetPartName([In] IOpcPartUri partUri); + new void SetPartName([In] IOpcPartUri? partUri); /// Gets a pointer to the IXpsOMDictionary interface of the remote dictionary that is associated with this resource. /// A pointer to the IXpsOMDictionary interface of the dictionary that is associated with this resource. @@ -2711,7 +2711,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomremotedictionaryresourcecollection-getbypartname // HRESULT GetByPartName( IOpcPartUri *partName, IXpsOMRemoteDictionaryResource **remoteDictionaryResource ); - IXpsOMRemoteDictionaryResource GetByPartName([In] IOpcPartUri partName); + IXpsOMRemoteDictionaryResource? GetByPartName([In] IOpcPartUri partName); } /// Used as the base interface for the resource interfaces of the XPS object model. @@ -2728,7 +2728,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompart-getpartname HRESULT // GetPartName( IOpcPartUri **partUri ); [MethodImpl(MethodImplOptions.InternalCall)] - new IOpcPartUri GetPartName(); + new IOpcPartUri? GetPartName(); /// Sets the name that will be used when the part is serialized. /// @@ -2741,7 +2741,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompart-setpartname HRESULT // SetPartName( IOpcPartUri *partUri ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetPartName([In] IOpcPartUri partUri); + new void SetPartName([In] IOpcPartUri? partUri); } /// The base interface for sharable interfaces. @@ -2778,7 +2778,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompart-getpartname HRESULT // GetPartName( IOpcPartUri **partUri ); [MethodImpl(MethodImplOptions.InternalCall)] - new IOpcPartUri GetPartName(); + new IOpcPartUri? GetPartName(); /// Sets the name that will be used when the part is serialized. /// @@ -2791,7 +2791,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompart-setpartname HRESULT // SetPartName( IOpcPartUri *partUri ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetPartName([In] IOpcPartUri partUri); + new void SetPartName([In] IOpcPartUri? partUri); /// Gets a pointer to the IXpsOMDocument interface that contains the resource. /// @@ -2801,7 +2801,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomsignatureblockresource-getowner // HRESULT GetOwner( IXpsOMDocument **owner ); [MethodImpl(MethodImplOptions.InternalCall)] - IXpsOMDocument GetOwner(); + IXpsOMDocument? GetOwner(); /// Gets a new, read-only copy of the stream that is associated with this resource. /// A new, read-only copy of the stream that is associated with this resource. @@ -2931,7 +2931,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomsignatureblockresourcecollection-getbypartname // HRESULT GetByPartName( IOpcPartUri *partName, IXpsOMSignatureBlockResource **signatureBlockResource ); - IXpsOMSignatureBlockResource GetByPartName([In] IOpcPartUri partName); + IXpsOMSignatureBlockResource? GetByPartName([In] IOpcPartUri partName); } /// A single-color brush. @@ -2985,7 +2985,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomsolidcolorbrush-getcolor HRESULT // GetColor( XPS_COLOR *color, IXpsOMColorProfileResource **colorProfile ); - IXpsOMColorProfileResource GetColor(out XPS_COLOR color); + IXpsOMColorProfileResource? GetColor(out XPS_COLOR color); /// Sets the color value and color profile of the brush. /// @@ -3005,7 +3005,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomsolidcolorbrush-setcolor HRESULT // SetColor( const XPS_COLOR *color, IXpsOMColorProfileResource *colorProfile ); - void SetColor(in XPS_COLOR color, [In] IXpsOMColorProfileResource colorProfile); + void SetColor(in XPS_COLOR color, [In] IXpsOMColorProfileResource? colorProfile); /// Makes a deep copy of the interface. /// A pointer to the copy of the interface. @@ -3037,7 +3037,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompart-getpartname HRESULT // GetPartName( IOpcPartUri **partUri ); [MethodImpl(MethodImplOptions.InternalCall)] - new IOpcPartUri GetPartName(); + new IOpcPartUri? GetPartName(); /// Sets the name that will be used when the part is serialized. /// @@ -3050,7 +3050,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsompart-setpartname HRESULT // SetPartName( IOpcPartUri *partUri ); [MethodImpl(MethodImplOptions.InternalCall)] - new void SetPartName([In] IOpcPartUri partUri); + new void SetPartName([In] IOpcPartUri? partUri); /// Gets a pointer to the IXpsOMPage interface that contains this resource. /// @@ -3060,7 +3060,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomstoryfragmentsresource-getowner // HRESULT GetOwner( IXpsOMPageReference **owner ); [MethodImpl(MethodImplOptions.InternalCall)] - IXpsOMPageReference GetOwner(); + IXpsOMPageReference? GetOwner(); /// Gets a new, read-only copy of the stream that is associated with this resource. /// A new, read-only copy of the stream that is associated with this resource. @@ -3231,7 +3231,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomtilebrush-gettransform HRESULT // GetTransform( IXpsOMMatrixTransform **transform ); - IXpsOMMatrixTransform GetTransform(); + IXpsOMMatrixTransform? GetTransform(); /// /// Gets a pointer to the IXpsOMMatrixTransform interface that contains the local, unshared resolved matrix transform for the brush. @@ -3266,7 +3266,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomtilebrush-gettransformlocal HRESULT // GetTransformLocal( IXpsOMMatrixTransform **transform ); - IXpsOMMatrixTransform GetTransformLocal(); + IXpsOMMatrixTransform? GetTransformLocal(); /// Sets the IXpsOMMatrixTransform interface pointer to a local, unshared matrix transform. /// @@ -3314,7 +3314,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomtilebrush-settransformlocal HRESULT // SetTransformLocal( IXpsOMMatrixTransform *transform ); - void SetTransformLocal([In] IXpsOMMatrixTransform transform); + void SetTransformLocal([In] IXpsOMMatrixTransform? transform); /// /// Gets the lookup key that identifies the IXpsOMMatrixTransform interface in a resource dictionary that contains the resolved @@ -3354,7 +3354,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomtilebrush-gettransformlookup // HRESULT GetTransformLookup( LPWSTR *key ); [return: MarshalAs(UnmanagedType.LPWStr)] - string 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 @@ -3406,7 +3406,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomtilebrush-settransformlookup // HRESULT SetTransformLookup( LPCWSTR key ); - void SetTransformLookup([In, MarshalAs(UnmanagedType.LPWStr)] string key); + void SetTransformLookup([In, MarshalAs(UnmanagedType.LPWStr)] string? key); /// Gets the portion of the source image to be used by the tile. /// The XPS_RECT structure that describes the area of the source content to be used by the tile. @@ -3553,7 +3553,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-gettransform HRESULT // GetTransform( IXpsOMMatrixTransform **matrixTransform ); [MethodImpl(MethodImplOptions.InternalCall)] - IXpsOMMatrixTransform GetTransform(); + IXpsOMMatrixTransform? GetTransform(); /// /// Gets a pointer to the IXpsOMMatrixTransform interface that contains the local, unshared, resolved matrix transform for the visual. @@ -3586,7 +3586,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-gettransformlocal HRESULT // GetTransformLocal( IXpsOMMatrixTransform **matrixTransform ); [MethodImpl(MethodImplOptions.InternalCall)] - IXpsOMMatrixTransform GetTransformLocal(); + IXpsOMMatrixTransform? GetTransformLocal(); /// Sets the local, unshared matrix transform. /// @@ -3631,7 +3631,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-settransformlocal HRESULT // SetTransformLocal( IXpsOMMatrixTransform *matrixTransform ); [MethodImpl(MethodImplOptions.InternalCall)] - void SetTransformLocal([In] IXpsOMMatrixTransform matrixTransform); + void SetTransformLocal([In] IXpsOMMatrixTransform? matrixTransform); /// /// Gets the lookup key name of the IXpsOMMatrixTransform interface in a resource dictionary that contains the resolved matrix @@ -3666,7 +3666,7 @@ public static partial class XpsObjectModel // GetTransformLookup( LPWSTR *key ); [MethodImpl(MethodImplOptions.InternalCall)] [return: MarshalAs(UnmanagedType.LPWStr)] - string 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. @@ -3709,7 +3709,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-settransformlookup HRESULT // SetTransformLookup( LPCWSTR key ); [MethodImpl(MethodImplOptions.InternalCall)] - void SetTransformLookup([In, MarshalAs(UnmanagedType.LPWStr)] string key); + void SetTransformLookup([In, MarshalAs(UnmanagedType.LPWStr)] string? key); /// /// Gets a pointer to the IXpsOMGeometry interface that contains the resolved geometry of the visual's clipping region. @@ -3745,7 +3745,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getclipgeometry HRESULT // GetClipGeometry( IXpsOMGeometry **clipGeometry ); [MethodImpl(MethodImplOptions.InternalCall)] - IXpsOMGeometry GetClipGeometry(); + IXpsOMGeometry? GetClipGeometry(); /// /// Gets a pointer to the IXpsOMGeometry interface that contains the local, unshared geometry of the visual's clipping region. @@ -3777,7 +3777,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getclipgeometrylocal HRESULT // GetClipGeometryLocal( IXpsOMGeometry **clipGeometry ); [MethodImpl(MethodImplOptions.InternalCall)] - IXpsOMGeometry GetClipGeometryLocal(); + IXpsOMGeometry? GetClipGeometryLocal(); /// Sets the local, unshared clipping region for the visual. /// @@ -3823,7 +3823,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-setclipgeometrylocal HRESULT // SetClipGeometryLocal( IXpsOMGeometry *clipGeometry ); [MethodImpl(MethodImplOptions.InternalCall)] - void SetClipGeometryLocal([In] IXpsOMGeometry clipGeometry); + void SetClipGeometryLocal([In] IXpsOMGeometry? clipGeometry); /// /// Gets the lookup key for the IXpsOMGeometry interface in a resource dictionary that contains the visual's clipping region. @@ -3856,7 +3856,7 @@ public static partial class XpsObjectModel // HRESULT GetClipGeometryLookup( LPWSTR *key ); [MethodImpl(MethodImplOptions.InternalCall)] [return: MarshalAs(UnmanagedType.LPWStr)] - string GetClipGeometryLookup(); + string? GetClipGeometryLookup(); /// Sets the lookup key name of a shared clip geometry in a resource dictionary. /// @@ -3901,7 +3901,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-setclipgeometrylookup // HRESULT SetClipGeometryLookup( LPCWSTR key ); [MethodImpl(MethodImplOptions.InternalCall)] - void SetClipGeometryLookup([In, MarshalAs(UnmanagedType.LPWStr)] string key); + void SetClipGeometryLookup([In, MarshalAs(UnmanagedType.LPWStr)] string? key); /// Gets the opacity value of this visual. /// The opacity value. @@ -3955,7 +3955,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getopacitymaskbrush HRESULT // GetOpacityMaskBrush( IXpsOMBrush **opacityMaskBrush ); [MethodImpl(MethodImplOptions.InternalCall)] - IXpsOMBrush GetOpacityMaskBrush(); + IXpsOMBrush? GetOpacityMaskBrush(); /// Gets the local, unshared opacity mask brush for the visual. /// @@ -3985,7 +3985,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-getopacitymaskbrushlocal // HRESULT GetOpacityMaskBrushLocal( IXpsOMBrush **opacityMaskBrush ); [MethodImpl(MethodImplOptions.InternalCall)] - IXpsOMBrush GetOpacityMaskBrushLocal(); + IXpsOMBrush? GetOpacityMaskBrushLocal(); /// Sets the IXpsOMBrush interface pointer as the local, unshared opacity mask brush. /// @@ -4031,7 +4031,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-setopacitymaskbrushlocal // HRESULT SetOpacityMaskBrushLocal( IXpsOMBrush *opacityMaskBrush ); [MethodImpl(MethodImplOptions.InternalCall)] - void SetOpacityMaskBrushLocal([In] IXpsOMBrush opacityMaskBrush); + void SetOpacityMaskBrushLocal([In] IXpsOMBrush? opacityMaskBrush); /// Gets the name of the lookup key of the shared opacity mask brush in a resource dictionary. /// @@ -4062,7 +4062,7 @@ public static partial class XpsObjectModel // HRESULT GetOpacityMaskBrushLookup( LPWSTR *key ); [MethodImpl(MethodImplOptions.InternalCall)] [return: MarshalAs(UnmanagedType.LPWStr)] - string GetOpacityMaskBrushLookup(); + string? GetOpacityMaskBrushLookup(); /// Sets the lookup key name of a shared opacity mask brush in a resource dictionary. /// @@ -4107,7 +4107,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-setopacitymaskbrushlookup // HRESULT SetOpacityMaskBrushLookup( LPCWSTR key ); [MethodImpl(MethodImplOptions.InternalCall)] - void SetOpacityMaskBrushLookup([In, MarshalAs(UnmanagedType.LPWStr)] string key); + void SetOpacityMaskBrushLookup([In, MarshalAs(UnmanagedType.LPWStr)] string? key); /// Gets the Name property of the visual. /// The Name property string. If the Name property has not been set, a NULL pointer is returned. @@ -4115,7 +4115,7 @@ public static partial class XpsObjectModel // LPWSTR *name ); [MethodImpl(MethodImplOptions.InternalCall)] [return: MarshalAs(UnmanagedType.LPWStr)] - string GetName(); + string? GetName(); /// Sets the Name property of the visual. /// The name of the visual. A NULL pointer clears the Name property. @@ -4128,7 +4128,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-setname HRESULT SetName( // LPCWSTR name ); [MethodImpl(MethodImplOptions.InternalCall)] - void SetName([In, MarshalAs(UnmanagedType.LPWStr)] string name); + void SetName([In, MarshalAs(UnmanagedType.LPWStr)] string? name); /// Gets a value that indicates whether the visual is the target of a hyperlink. /// @@ -4186,7 +4186,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-gethyperlinknavigateuri // HRESULT GetHyperlinkNavigateUri( IUri **hyperlinkUri ); [MethodImpl(MethodImplOptions.InternalCall)] - IUri GetHyperlinkNavigateUri(); + IUri? GetHyperlinkNavigateUri(); /// Sets the destination URI of the visual's hyperlink. /// The IUri interface that contains the destination URI of the visual's hyperlink. @@ -4211,7 +4211,7 @@ public static partial class XpsObjectModel // GetLanguage( LPWSTR *language ); [MethodImpl(MethodImplOptions.InternalCall)] [return: MarshalAs(UnmanagedType.LPWStr)] - string GetLanguage(); + string? GetLanguage(); /// Sets the Language property of the visual. /// @@ -4224,7 +4224,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisual-setlanguage HRESULT // SetLanguage( LPCWSTR language ); [MethodImpl(MethodImplOptions.InternalCall)] - void SetLanguage([In, MarshalAs(UnmanagedType.LPWStr)] string language); + void SetLanguage([In, MarshalAs(UnmanagedType.LPWStr)] string? language); } /// A brush that uses a visual element as a source. @@ -4305,7 +4305,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomtilebrush-gettransform HRESULT // GetTransform( IXpsOMMatrixTransform **transform ); - new IXpsOMMatrixTransform GetTransform(); + new IXpsOMMatrixTransform? GetTransform(); /// /// Gets a pointer to the IXpsOMMatrixTransform interface that contains the local, unshared resolved matrix transform for the brush. @@ -4340,7 +4340,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomtilebrush-gettransformlocal HRESULT // GetTransformLocal( IXpsOMMatrixTransform **transform ); - new IXpsOMMatrixTransform GetTransformLocal(); + new IXpsOMMatrixTransform? GetTransformLocal(); /// Sets the IXpsOMMatrixTransform interface pointer to a local, unshared matrix transform. /// @@ -4388,7 +4388,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomtilebrush-settransformlocal HRESULT // SetTransformLocal( IXpsOMMatrixTransform *transform ); - new void SetTransformLocal([In] IXpsOMMatrixTransform transform); + new void SetTransformLocal([In] IXpsOMMatrixTransform? transform); /// /// Gets the lookup key that identifies the IXpsOMMatrixTransform interface in a resource dictionary that contains the resolved @@ -4428,7 +4428,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomtilebrush-gettransformlookup // HRESULT GetTransformLookup( LPWSTR *key ); [return: MarshalAs(UnmanagedType.LPWStr)] - new string 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 @@ -4480,7 +4480,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomtilebrush-settransformlookup // HRESULT SetTransformLookup( LPCWSTR key ); - new void SetTransformLookup([In, MarshalAs(UnmanagedType.LPWStr)] string key); + new void SetTransformLookup([In, MarshalAs(UnmanagedType.LPWStr)] string? key); /// Gets the portion of the source image to be used by the tile. /// The XPS_RECT structure that describes the area of the source content to be used by the tile. @@ -4611,7 +4611,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisualbrush-getvisual HRESULT // GetVisual( IXpsOMVisual **visual ); - IXpsOMVisual GetVisual(); + IXpsOMVisual? GetVisual(); /// Gets a pointer to the interface of the local, unshared visual used as the source for the brush. /// @@ -4644,7 +4644,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisualbrush-getvisuallocal HRESULT // GetVisualLocal( IXpsOMVisual **visual ); - IXpsOMVisual GetVisualLocal(); + IXpsOMVisual? GetVisualLocal(); /// Sets the interface pointer of the local, unshared visual used as the source for the brush. /// @@ -4687,7 +4687,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisualbrush-setvisuallocal HRESULT // SetVisualLocal( IXpsOMVisual *visual ); - void SetVisualLocal([In] IXpsOMVisual visual); + void SetVisualLocal([In] IXpsOMVisual? visual); /// /// Gets the lookup key name of a visual in a resource dictionary; the visual is to be used as the source for the brush. @@ -4719,7 +4719,7 @@ public static partial class XpsObjectModel // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisualbrush-getvisuallookup HRESULT // GetVisualLookup( LPWSTR *lookup ); [return: MarshalAs(UnmanagedType.LPWStr)] - string 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. @@ -4762,7 +4762,7 @@ public static partial class XpsObjectModel /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomvisualbrush-setvisuallookup HRESULT // SetVisualLookup( LPCWSTR lookup ); - void SetVisualLookup([In, MarshalAs(UnmanagedType.LPWStr)] string lookup); + void SetVisualLookup([In, MarshalAs(UnmanagedType.LPWStr)] string? lookup); /// Makes a deep copy of the interface. /// A pointer to the copy of the interface. diff --git a/PInvoke/Printing/XpsPrint.cs b/PInvoke/Printing/XpsPrint.cs index cf4957b8..184b2026 100644 --- a/PInvoke/Printing/XpsPrint.cs +++ b/PInvoke/Printing/XpsPrint.cs @@ -313,7 +313,7 @@ public static partial class XpsPrint [DllImport(Lib.XpsPrint, SetLastError = false, ExactSpelling = true)] [PInvokeData("xpsprint.h", MSDNShortId = "d982ae2e-c68f-4197-b419-22a63e61db8a")] public static extern HRESULT StartXpsPrintJob([MarshalAs(UnmanagedType.LPWStr)] string printerName, [Optional, MarshalAs(UnmanagedType.LPWStr)] string? jobName, - [Optional, MarshalAs(UnmanagedType.LPWStr)] string? outputFileName, [Optional] IntPtr progressEvent, [Optional] IntPtr completionEvent, [Optional] byte[]? printablePagesOn, + [Optional, MarshalAs(UnmanagedType.LPWStr)] string? outputFileName, [Optional] HEVENT progressEvent, [Optional] HEVENT completionEvent, [Optional] byte[]? printablePagesOn, uint printablePagesOnCount, out IXpsPrintJob xpsPrintJob, out IXpsPrintJobStream documentStream, out IXpsPrintJobStream printTicketStream); /// @@ -439,7 +439,7 @@ public static partial class XpsPrint [DllImport(Lib.XpsPrint, SetLastError = false, ExactSpelling = true)] [PInvokeData("xpsprint.h", MSDNShortId = "91D0BA4D-60A6-43F8-8BD3-9183DC6CD50D")] public static extern HRESULT StartXpsPrintJob1([MarshalAs(UnmanagedType.LPWStr)] string printerName, [Optional, MarshalAs(UnmanagedType.LPWStr)] string? jobName, - [Optional, MarshalAs(UnmanagedType.LPWStr)] string? outputFileName, [Optional] IntPtr progressEvent, [Optional] IntPtr completionEvent, + [Optional, MarshalAs(UnmanagedType.LPWStr)] string? outputFileName, [Optional] HEVENT progressEvent, [Optional] HEVENT completionEvent, out IXpsPrintJob xpsPrintJob, out IntPtr printContentReceiver); /// diff --git a/UnitTests/PInvoke/Printing/Printing.csproj b/UnitTests/PInvoke/Printing/Printing.csproj index e91a453f..4bf02c2d 100644 --- a/UnitTests/PInvoke/Printing/Printing.csproj +++ b/UnitTests/PInvoke/Printing/Printing.csproj @@ -2,6 +2,9 @@ UnitTest.PInvoke.Printing + + + diff --git a/UnitTests/PInvoke/Printing/PrintingTests.cs b/UnitTests/PInvoke/Printing/PrintingTests.cs index bebd34f4..3f854fba 100644 --- a/UnitTests/PInvoke/Printing/PrintingTests.cs +++ b/UnitTests/PInvoke/Printing/PrintingTests.cs @@ -11,13 +11,24 @@ namespace Vanara.PInvoke.Tests; [TestFixture] public class PrintingTests { - private const string connPtrName = "Foobar"; + private string connPtrName = ""; + private (string un, string pw, string sv) creds = ("", "", ""); private const string defKey = "PrinterDriverData"; private static readonly string defaultPrinterName = new System.Drawing.Printing.PrinterSettings().PrinterName; +#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. private SafeHPRINTER hprnt; +#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. [OneTimeSetUp] - public void _Setup() => Assert.That(OpenPrinter(defaultPrinterName, out hprnt), ResultIs.Successful); + public void _Setup() + { + Assert.That(OpenPrinter(defaultPrinterName, out hprnt, new() { DesiredAccess = (uint)AccessRights.PRINTER_ACCESS_USE, pDatatype = "RAW", pDevMode = new DEVMODE() { dmDeviceName = defaultPrinterName } }), ResultIs.Successful); + var auth = (object[])TestCaseSources.GetAuthCasesFromFile(true, true)[0]; + connPtrName = string.Concat(auth[5], '\\', auth[9]); + if (!connPtrName.StartsWith('\\')) + connPtrName = @"\\" + connPtrName; + creds = ((string)auth[6], (string)auth[7], (string)auth[5]); + } [OneTimeTearDown] public void _TearDown() => hprnt?.Dispose(); @@ -79,10 +90,10 @@ public class PrintingTests pPrintProcessor = pi.pPrintProcessor, Attributes = PRINTER_ATTRIBUTE.PRINTER_ATTRIBUTE_LOCAL }; - var p2 = new SafeHPRINTER(default, false); + SafeHPRINTER p2 = new(default, false); + Assert.That(p2 = AddPrinter(null, 2, pi2), ResultIs.ValidHandle); try { - Assert.That(p2 = AddPrinter(null, 2, pi2), ResultIs.ValidHandle); GetSet("Test", 123, 123U); GetSet("Test", 123L, 123UL); GetSet("Test", "123"); @@ -102,9 +113,9 @@ public class PrintingTests Assert.That(DeletePrinter(p2), ResultIs.Successful); } - void GetSet(string vn, object v, object r = null, REG_VALUE_TYPE t = REG_VALUE_TYPE.REG_NONE) + void GetSet(string vn, object v, object? r = null, REG_VALUE_TYPE t = REG_VALUE_TYPE.REG_NONE) { - if (r is null) r = v; + r ??= v; Assert.That(SetPrinterData(p2, vn, v, t), ResultIs.Successful); Assert.That(GetPrinterData(p2, vn), v.GetType().IsArray ? (IResolveConstraint)Is.EquivalentTo((IEnumerable)r) : Is.EqualTo(r)); Assert.That(DeletePrinterData(p2, vn), ResultIs.Successful); @@ -248,20 +259,17 @@ public class PrintingTests [Test] public void EnumPrintersTest() { - PRINTER_INFO_1[] res1; - Assert.That(res1 = EnumPrinters().ToArray(), Is.Not.Empty); - TestContext.WriteLine(string.Join(",", res1.Select(v => v.pName))); PRINTER_INFO_2[] res2; Assert.That(res2 = EnumPrinters().ToArray(), Is.Not.Empty); - TestContext.WriteLine(string.Join(",", res2.Select(v => v.Status))); + res2.WriteValues(); + PRINTER_INFO_1[] res1; + Assert.That(res1 = EnumPrinters().ToArray(), Is.Not.Empty); //PRINTER_INFO_3[] res3; //Assert.That(res3 = EnumPrinters().ToArray(), Is.Not.Empty); PRINTER_INFO_4[] res4; Assert.That(res4 = EnumPrinters().ToArray(), Is.Not.Empty); - TestContext.WriteLine(string.Join(",", res4.Select(v => v.Attributes))); PRINTER_INFO_5[] res5; Assert.That(res5 = EnumPrinters().ToArray(), Is.Not.Empty); - TestContext.WriteLine(string.Join(",", res5.Select(v => v.pPortName))); //PRINTER_INFO_6[] res6; //Assert.That(res6 = EnumPrinters().ToArray(), Is.Not.Empty); //PRINTER_INFO_7[] res7; @@ -381,14 +389,15 @@ public class PrintingTests Assert.That(AddJob(hprnt, out var path, out var id), ResultIs.Successful); try { - System.IO.File.WriteAllText(path, "Test page."); + System.IO.File.WriteAllText(path!, "Test page."); JOB_INFO_2 ji2 = default; Assert.That(() => ji2 = GetJob(hprnt, id), Throws.Nothing); Assert.That(ji2.JobId, Is.EqualTo(id)); + Assert.NotNull(ji2.pDatatype); TestHelper.WriteValues(ji2); - var jobInfo = new JOB_INFO_1 { JobId = id, Priority = JOB_PRIORITY.MAX_PRIORITY, Status = ji2.Status, pDatatype = ji2.pDatatype }; + var jobInfo = new JOB_INFO_1 { JobId = id, Priority = JOB_PRIORITY.MAX_PRIORITY, Status = ji2.Status, pDatatype = ji2.pDatatype! }; Assert.That(SetJob(hprnt, id, jobInfo), ResultIs.Successful); Assert.That(ScheduleJob(hprnt, id), ResultIs.Successful); @@ -432,7 +441,7 @@ public class PrintingTests var bytes = new byte[] { 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 }; Kernel32.WriteFile(hspf, bytes, (uint)bytes.Length, out _); Assert.That(CommitSpoolData(hprnt, hspf, (uint)bytes.Length), ResultIs.Successful); - Assert.That(() => hspf.Dispose(), Throws.Nothing); + Assert.That(hspf.Dispose, Throws.Nothing); } [Test] @@ -474,7 +483,8 @@ public class PrintingTests if (FindNextPrinterChangeNotification(hChange, out var chg, default, out var ppi) && !ppi.IsInvalid) { PRINTER_NOTIFY_INFO pi = ppi; - log.Add($"{chg}: {string.Join(",", pi.aData?.Select(d => d.Field))}"); + if (pi.aData is not null) + log.Add($"{chg}: {string.Join(",", pi.aData.Select(d => d.Field))}"); } } }