mirror of https://github.com/dahall/Vanara.git
Added new Win10 functions
parent
dd876ef071
commit
f6b7c3892d
|
@ -1599,6 +1599,51 @@ namespace Vanara.PInvoke
|
||||||
[return: MarshalAs(UnmanagedType.Bool)]
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
public static extern bool GetSystemTimeAdjustment(out uint lpTimeAdjustment, out uint lpTimeIncrement, [MarshalAs(UnmanagedType.Bool)] out bool lpTimeAdjustmentDisabled);
|
public static extern bool GetSystemTimeAdjustment(out uint lpTimeAdjustment, out uint lpTimeIncrement, [MarshalAs(UnmanagedType.Bool)] out bool lpTimeAdjustmentDisabled);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>
|
||||||
|
/// Determines whether the system is applying periodic, programmed time adjustments to its time-of-day clock, and obtains the value
|
||||||
|
/// and period of any such adjustments.
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="lpTimeAdjustment">
|
||||||
|
/// <para>Returns the adjusted clock update frequency.</para>
|
||||||
|
/// </param>
|
||||||
|
/// <param name="lpTimeIncrement">
|
||||||
|
/// <para>Returns the clock update frequency.</para>
|
||||||
|
/// </param>
|
||||||
|
/// <param name="lpTimeAdjustmentDisabled">
|
||||||
|
/// <para>Returns an indicator which specifies whether the time adjustment is enabled.</para>
|
||||||
|
/// <para>
|
||||||
|
/// A value of <c>TRUE</c> indicates that periodic adjustment is disabled. In this case, the system may attempt to keep the
|
||||||
|
/// time-of-day clock in sync using its own internal mechanisms. This may cause time-of-day to periodically jump to the "correct time."
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// A value of <c>FALSE</c> indicates that periodic, programmed time adjustment is being used to serialize time-of-day, and the
|
||||||
|
/// system will not interfere or attempt to synchronize time-of-day on its own.
|
||||||
|
/// </para>
|
||||||
|
/// </param>
|
||||||
|
/// <returns>
|
||||||
|
/// <para>If the function succeeds, the return value is nonzero.</para>
|
||||||
|
/// <para>If the function fails, the return value is zero. To get extended error information, call GetLastError.</para>
|
||||||
|
/// </returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// <para>
|
||||||
|
/// This function is used in algorithms that synchronize the time-of-day with another time source, using a programmed clock
|
||||||
|
/// adjustment. To do this, the system computes the adjusted clock update frequency, and then this function allows the caller to
|
||||||
|
/// obtain that value.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// <c>Note</c> For a complete code sample on how to enable system-time privileges, adjust the system clock, and display clock
|
||||||
|
/// values, see SetSystemTimeAdjustmentPrecise.
|
||||||
|
/// </para>
|
||||||
|
/// </remarks>
|
||||||
|
// https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimeadjustmentprecise
|
||||||
|
// BOOL GetSystemTimeAdjustmentPrecise( PDWORD64 lpTimeAdjustment, PDWORD64 lpTimeIncrement, PBOOL lpTimeAdjustmentDisabled );
|
||||||
|
[DllImport(Lib.Api, SetLastError = true, ExactSpelling = true)]
|
||||||
|
[PInvokeData("sysinfoapi.h", MSDNShortId = "95EEE23D-01D8-49E1-BA64-49C07E8B1619")]
|
||||||
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
|
public static extern bool GetSystemTimeAdjustmentPrecise(out ulong lpTimeAdjustment, out ulong lpTimeIncrement, [MarshalAs(UnmanagedType.Bool)] out bool lpTimeAdjustmentDisabled);
|
||||||
|
|
||||||
/// <summary>Retrieves the current system date and time. The information is in Coordinated Universal Time (UTC) format.</summary>
|
/// <summary>Retrieves the current system date and time. The information is in Coordinated Universal Time (UTC) format.</summary>
|
||||||
/// <param name="lpSystemTimeAsFileTime">
|
/// <param name="lpSystemTimeAsFileTime">
|
||||||
/// A pointer to a <c>FILETIME</c> structure to receive the current system date and time in UTC format.
|
/// A pointer to a <c>FILETIME</c> structure to receive the current system date and time in UTC format.
|
||||||
|
|
|
@ -638,6 +638,49 @@ namespace Vanara.PInvoke
|
||||||
[return: MarshalAs(UnmanagedType.Bool)]
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
public static extern bool GetCommModemStatus([In] HFILE hFile, out COMM_MODEM_STATUS lpModemStat);
|
public static extern bool GetCommModemStatus([In] HFILE hFile, out COMM_MODEM_STATUS lpModemStat);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Gets an array that contains the well-formed COM ports.</para>
|
||||||
|
/// <para>
|
||||||
|
/// This function obtains the COM port numbers from the <c>HKLM\Hardware\DeviceMap\SERIALCOMM</c> registry key and then writes them
|
||||||
|
/// to a caller-supplied array. If the array is too small, the function gets the necessary size.
|
||||||
|
/// </para>
|
||||||
|
/// <para><c>Note</c> If new entries are added to the registry key, the necessary size can change between API calls.</para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="lpPortNumbers">
|
||||||
|
/// <para>An array for the port numbers.</para>
|
||||||
|
/// </param>
|
||||||
|
/// <param name="uPortNumbersCount">
|
||||||
|
/// <para>The length of the array in the lpPortNumbers parameter.</para>
|
||||||
|
/// </param>
|
||||||
|
/// <param name="puPortNumbersFound">
|
||||||
|
/// <para>The number of port numbers written to the lpPortNumbers or the length of the array required for the port numbers.</para>
|
||||||
|
/// </param>
|
||||||
|
/// <returns>
|
||||||
|
/// <list type="table">
|
||||||
|
/// <listheader>
|
||||||
|
/// <term>Return code</term>
|
||||||
|
/// <term>Description</term>
|
||||||
|
/// </listheader>
|
||||||
|
/// <item>
|
||||||
|
/// <term>ERROR_SUCCESS</term>
|
||||||
|
/// <term>The call succeeded. The lpPortNumbers array was large enough for the result.</term>
|
||||||
|
/// </item>
|
||||||
|
/// <item>
|
||||||
|
/// <term>ERROR_MORE_DATA</term>
|
||||||
|
/// <term>The lpPortNumbers array was too small to contain all available port numbers.</term>
|
||||||
|
/// </item>
|
||||||
|
/// <item>
|
||||||
|
/// <term>ERROR_FILE_NOT_FOUND</term>
|
||||||
|
/// <term>There are no comm ports available.</term>
|
||||||
|
/// </item>
|
||||||
|
/// </list>
|
||||||
|
/// </returns>
|
||||||
|
// https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-getcommports
|
||||||
|
// ULONG GetCommPorts( PULONG lpPortNumbers, ULONG uPortNumbersCount, PULONG puPortNumbersFound );
|
||||||
|
[DllImport(Lib.KernelBase, SetLastError = false, ExactSpelling = true)]
|
||||||
|
[PInvokeData("winbase.h", MSDNShortId = "8E57FB62-D7A0-4B47-942B-E33E0B7A37B1", MinClient = PInvokeClient.Windows10)]
|
||||||
|
public static extern Win32Error GetCommPorts([In, Out] uint[] lpPortNumbers, uint uPortNumbersCount, out uint puPortNumbersFound);
|
||||||
|
|
||||||
/// <summary>Retrieves information about the communications properties for a specified communications device.</summary>
|
/// <summary>Retrieves information about the communications properties for a specified communications device.</summary>
|
||||||
/// <param name="hFile">A handle to the communications device. The <c>CreateFile</c> function returns this handle.</param>
|
/// <param name="hFile">A handle to the communications device. The <c>CreateFile</c> function returns this handle.</param>
|
||||||
/// <param name="lpCommProp">
|
/// <param name="lpCommProp">
|
||||||
|
|
Loading…
Reference in New Issue