Skip to content

Commit ffb276b

Browse files
author
dahall
committed
Added Kernel32.WIN32_STREAM_ID_HEADER as work-around to challenges with BackupRead (#516)
1 parent 2937986 commit ffb276b

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

PInvoke/Kernel32/WinBase.Backup.cs

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,4 +1882,94 @@ public struct WIN32_STREAM_ID
18821882
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1)]
18831883
public string cStreamName;
18841884
}
1885+
1886+
/// <summary>The <c>WIN32_STREAM_ID</c> structure contains stream data.</summary>
1887+
// https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-win32_stream_id typedef struct _WIN32_STREAM_ID { DWORD
1888+
// dwStreamId; DWORD dwStreamAttributes; LARGE_INTEGER Size; DWORD dwStreamNameSize; WCHAR cStreamName[ANYSIZE_ARRAY]; } WIN32_STREAM_ID, *LPWIN32_STREAM_ID;
1889+
[PInvokeData("winbase.h", MSDNShortId = "NS:winbase._WIN32_STREAM_ID")]
1890+
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode, Size = 20, Pack = 4)]
1891+
public struct WIN32_STREAM_ID_HEADER
1892+
{
1893+
/// <summary>
1894+
/// <para>Type of data. This member can be one of the following values.</para>
1895+
/// <list type="table">
1896+
/// <listheader>
1897+
/// <description>Value</description>
1898+
/// <description>Meaning</description>
1899+
/// </listheader>
1900+
/// <item>
1901+
/// <description><c>BACKUP_ALTERNATE_DATA</c> 0x00000004</description>
1902+
/// <description>Alternative data streams. This corresponds to the NTFS $DATA stream type on a named data stream.</description>
1903+
/// </item>
1904+
/// <item>
1905+
/// <description><c>BACKUP_DATA</c> 0x00000001</description>
1906+
/// <description>Standard data. This corresponds to the NTFS $DATA stream type on the default (unnamed) data stream.</description>
1907+
/// </item>
1908+
/// <item>
1909+
/// <description><c>BACKUP_EA_DATA</c> 0x00000002</description>
1910+
/// <description>Extended attribute data. This corresponds to the NTFS $EA stream type.</description>
1911+
/// </item>
1912+
/// <item>
1913+
/// <description><c>BACKUP_LINK</c> 0x00000005</description>
1914+
/// <description>Hard link information. This corresponds to the NTFS $FILE_NAME stream type.</description>
1915+
/// </item>
1916+
/// <item>
1917+
/// <description><c>BACKUP_OBJECT_ID</c> 0x00000007</description>
1918+
/// <description>Objects identifiers. This corresponds to the NTFS $OBJECT_ID stream type.</description>
1919+
/// </item>
1920+
/// <item>
1921+
/// <description><c>BACKUP_PROPERTY_DATA</c> 0x00000006</description>
1922+
/// <description>Property data.</description>
1923+
/// </item>
1924+
/// <item>
1925+
/// <description><c>BACKUP_REPARSE_DATA</c> 0x00000008</description>
1926+
/// <description>Reparse points. This corresponds to the NTFS $REPARSE_POINT stream type.</description>
1927+
/// </item>
1928+
/// <item>
1929+
/// <description><c>BACKUP_SECURITY_DATA</c> 0x00000003</description>
1930+
/// <description>Security descriptor data.</description>
1931+
/// </item>
1932+
/// <item>
1933+
/// <description><c>BACKUP_SPARSE_BLOCK</c> 0x00000009</description>
1934+
/// <description>Sparse file. This corresponds to the NTFS $DATA stream type for a sparse file.</description>
1935+
/// </item>
1936+
/// <item>
1937+
/// <description><c>BACKUP_TXFS_DATA</c> 0x0000000A</description>
1938+
/// <description>
1939+
/// Transactional NTFS (TxF) data stream. This corresponds to the NTFS $TXF_DATA stream type. <c>Windows Server 2003 and
1940+
/// Windows XP:  </c> This value is not supported.
1941+
/// </description>
1942+
/// </item>
1943+
/// </list>
1944+
/// </summary>
1945+
public BACKUP_STREAM_ID dwStreamId;
1946+
1947+
/// <summary>
1948+
/// <para>Attributes of data to facilitate cross-operating system transfer. This member can be one or more of the following values.</para>
1949+
/// <list type="table">
1950+
/// <listheader>
1951+
/// <description>Value</description>
1952+
/// <description>Meaning</description>
1953+
/// </listheader>
1954+
/// <item>
1955+
/// <description><c>STREAM_MODIFIED_WHEN_READ</c></description>
1956+
/// <description>
1957+
/// Attribute set if the stream contains data that is modified when read. Allows the backup application to know that verification of
1958+
/// data will fail.
1959+
/// </description>
1960+
/// </item>
1961+
/// <item>
1962+
/// <description><c>STREAM_CONTAINS_SECURITY</c></description>
1963+
/// <description>Stream contains security data (general attributes). Allows the stream to be ignored on cross-operations restore.</description>
1964+
/// </item>
1965+
/// </list>
1966+
/// </summary>
1967+
public BACKUP_STREAM_ATTR dwStreamAttributes;
1968+
1969+
/// <summary>Size of data, in bytes.</summary>
1970+
public long Size;
1971+
1972+
/// <summary>Length of the name of the alternative data stream, in bytes.</summary>
1973+
public uint dwStreamNameSize;
1974+
}
18851975
}

0 commit comments

Comments
 (0)