mirror of https://github.com/dahall/Vanara.git
Updated FILETIME* references to PFILETIME
parent
5304fa5888
commit
bf20f2d216
|
@ -6221,59 +6221,7 @@ public static partial class Kernel32
|
|||
[DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)]
|
||||
[PInvokeData("FileAPI.h", MSDNShortId = "ms724933")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool SetFileTime([In] HFILE hFile, in FILETIME lpCreationTime, in FILETIME lpLastAccessTime, in FILETIME lpLastWriteTime);
|
||||
|
||||
/// <summary>
|
||||
/// <para>Sets the date and time that the specified file or directory was created, last accessed, or last modified.</para>
|
||||
/// </summary>
|
||||
/// <param name="hFile">
|
||||
/// <para>
|
||||
/// A handle to the file or directory. The handle must have been created using the <c>CreateFile</c> function with the
|
||||
/// <c>FILE_WRITE_ATTRIBUTES</c> access right. For more information, see File Security and Access Rights.
|
||||
/// </para>
|
||||
/// </param>
|
||||
/// <param name="lpCreationTime">
|
||||
/// <para>
|
||||
/// A pointer to a <c>FILETIME</c> structure that contains the new creation date and time for the file or directory. If the
|
||||
/// application does not need to change this information, set this parameter either to <c>NULL</c> or to a pointer to a
|
||||
/// <c>FILETIME</c> structure that has both the <c>dwLowDateTime</c> and <c>dwHighDateTime</c> members set to 0.
|
||||
/// </para>
|
||||
/// </param>
|
||||
/// <param name="lpLastAccessTime">
|
||||
/// <para>
|
||||
/// A pointer to a <c>FILETIME</c> structure that contains the new last access date and time for the file or directory. The last
|
||||
/// access time includes the last time the file or directory was written to, read from, or (in the case of executable files) run. If
|
||||
/// the application does not need to change this information, set this parameter either to <c>NULL</c> or to a pointer to a
|
||||
/// <c>FILETIME</c> structure that has both the <c>dwLowDateTime</c> and <c>dwHighDateTime</c> members set to 0.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// To prevent file operations using the given handle from modifying the last access time, call <c>SetFileTime</c> immediately after
|
||||
/// opening the file handle and pass a <c>FILETIME</c> structure that has both the <c>dwLowDateTime</c> and <c>dwHighDateTime</c>
|
||||
/// members set to 0xFFFFFFFF.
|
||||
/// </para>
|
||||
/// </param>
|
||||
/// <param name="lpLastWriteTime">
|
||||
/// <para>
|
||||
/// A pointer to a <c>FILETIME</c> structure that contains the new last modified date and time for the file or directory. If the
|
||||
/// application does not need to change this information, set this parameter either to <c>NULL</c> or to a pointer to a
|
||||
/// <c>FILETIME</c> structure that has both the <c>dwLowDateTime</c> and <c>dwHighDateTime</c> members set to 0.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// To prevent file operations using the given handle from modifying the last access time, call <c>SetFileTime</c> immediately after
|
||||
/// opening the file handle and pass a <c>FILETIME</c> structure that has both the <c>dwLowDateTime</c> and <c>dwHighDateTime</c>
|
||||
/// members set to 0xFFFFFFFF.
|
||||
/// </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 <c>GetLastError</c>.</para>
|
||||
/// </returns>
|
||||
// BOOL WINAPI SetFileTime( _In_ HANDLE hFile, _In_opt_ const FILETIME *lpCreationTime, _In_opt_ const FILETIME *lpLastAccessTime,
|
||||
// _In_opt_ const FILETIME *lpLastWriteTime);
|
||||
[DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)]
|
||||
[PInvokeData("FileAPI.h", MSDNShortId = "ms724933")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern unsafe bool SetFileTime([In] HFILE hFile, [In, Optional] FILETIME* lpCreationTime, [In, Optional] FILETIME* lpLastAccessTime, [In, Optional] FILETIME* lpLastWriteTime);
|
||||
public static extern unsafe bool SetFileTime([In] HFILE hFile, [In, Optional] PFILETIME lpCreationTime, [In, Optional] PFILETIME lpLastAccessTime, [In, Optional] PFILETIME lpLastWriteTime);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the valid data length of the specified file. This function is useful in very limited scenarios. For more information, see
|
||||
|
|
|
@ -1519,35 +1519,7 @@ public static partial class Ole32
|
|||
// const FILETIME *pctime, const FILETIME *patime, const FILETIME *pmtime );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("coml2api.h", MSDNShortId = "5ade3e7a-a22a-458f-b463-1680893edc15")]
|
||||
public static extern HRESULT StgSetTimes([In, MarshalAs(UnmanagedType.LPWStr)] string lpszName, in FILETIME pctime, in FILETIME patime, in FILETIME pmtime);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>StgSetTimes</c> function sets the creation, access, and modification times of the indicated file, if supported by the
|
||||
/// underlying file system.
|
||||
/// </summary>
|
||||
/// <param name="lpszName">Pointer to the name of the file to be changed.</param>
|
||||
/// <param name="pctime">Pointer to the new value for the creation time.</param>
|
||||
/// <param name="patime">Pointer to the new value for the access time.</param>
|
||||
/// <param name="pmtime">Pointer to the new value for the modification time.</param>
|
||||
/// <returns>
|
||||
/// The <c>StgSetTimes</c> function can also return any file system errors or system errors wrapped in an <c>HRESULT</c>. See Error
|
||||
/// Handling Strategies and Handling Unknown Errors.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// The <c>StgSetTimes</c> function sets the time values for the specified file. Each of the time value parameters can be
|
||||
/// <c>NULL</c>, indicating that no modification should occur.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// It is possible that one or more of these time values are not supported by the underlying file system. This function sets the
|
||||
/// times that can be set and ignores the rest.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/api/coml2api/nf-coml2api-stgsettimes HRESULT StgSetTimes( const WCHAR *lpszName,
|
||||
// const FILETIME *pctime, const FILETIME *patime, const FILETIME *pmtime );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("coml2api.h", MSDNShortId = "5ade3e7a-a22a-458f-b463-1680893edc15")]
|
||||
public static extern HRESULT StgSetTimes([In, MarshalAs(UnmanagedType.LPWStr)] string lpszName, [Optional] IntPtr pctime, [Optional] IntPtr patime, [Optional] IntPtr pmtime);
|
||||
public static extern HRESULT StgSetTimes([In, MarshalAs(UnmanagedType.LPWStr)] string lpszName, [Optional] PFILETIME pctime, [Optional] PFILETIME patime, [Optional] PFILETIME pmtime);
|
||||
|
||||
/// <summary>The <c>WriteClassStg</c> function stores the specified class identifier (CLSID) in a storage object.</summary>
|
||||
/// <param name="pStg">IStorage pointer to the storage object that gets a new CLSID.</param>
|
||||
|
|
|
@ -140,11 +140,7 @@ public class PFILETIME : IEquatable<PFILETIME>, IEquatable<FILETIME>, IEquatable
|
|||
/// <param name="p">The pointer to FILETIME instance.</param>
|
||||
/// <returns>The result of the conversion.</returns>
|
||||
/// <exception cref="ArgumentException">Pointer must be to a FILETIME structure.</exception>
|
||||
public static unsafe explicit operator PFILETIME?(FILETIME* p)
|
||||
{
|
||||
if (p is null) return null;
|
||||
return new(*p);
|
||||
}
|
||||
public static unsafe implicit operator PFILETIME?(FILETIME* p) => p is null ? null : new(*p);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public int CompareTo(FILETIME other) => ft.CompareTo(other);
|
||||
|
|
Loading…
Reference in New Issue