Moved code around

pull/60/head
David Hall 2019-05-24 14:42:29 -06:00
parent c11860bf0c
commit be34118b68
2 changed files with 1521 additions and 313 deletions

View File

@ -746,319 +746,6 @@ namespace Vanara.PInvoke
[PInvokeData("objbase.h", MSDNShortId = "65d9cf7d-cc8a-4199-9a4a-7fd67ef8872d")]
public static extern HRESULT GetRunningObjectTable([Optional] uint reserved, out IRunningObjectTable pprot);
/// <summary>
/// The StgCreateStorageEx function creates a new storage object using a provided implementation for the IStorage or
/// IPropertySetStorage interfaces. To open an existing file, use the StgOpenStorageEx function instead.
/// <para>
/// Applications written for Windows 2000, Windows Server 2003 and Windows XP must use StgCreateStorageEx rather than
/// StgCreateDocfile to take advantage of the enhanced Windows 2000 and Windows XP Structured Storage features.
/// </para>
/// </summary>
/// <param name="pwcsName">
/// A pointer to the path of the file to create. It is passed uninterpreted to the file system. This can be a relative name or NULL.
/// If NULL, a temporary file is allocated with a unique name. If non-NULL, the string size must not exceed MAX_PATH characters.
/// <para>Windows 2000: Unlike the CreateFile function, you cannot exceed the MAX_PATH limit by using the "\\?\" prefix.</para>
/// </param>
/// <param name="grfMode">
/// A value that specifies the access mode to use when opening the new storage object. For more information, see STGM Constants. If
/// the caller specifies transacted mode together with STGM_CREATE or STGM_CONVERT, the overwrite or conversion takes place when the
/// commit operation is called for the root storage. If IStorage::Commit is not called for the root storage object, previous contents
/// of the file will be restored. STGM_CREATE and STGM_CONVERT cannot be combined with the STGM_NOSNAPSHOT flag, because a snapshot
/// copy is required when a file is overwritten or converted in the transacted mode.
/// </param>
/// <param name="stgfmt">A value that specifies the storage file format. For more information, see the STGFMT enumeration.</param>
/// <param name="grfAttrs">
/// A value that depends on the value of the stgfmt parameter.
/// <list type="table">
/// <listheader>
/// <term>Parameter Values</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term>STGFMT_DOCFILE</term>
/// <description>
/// 0, or FILE_FLAG_NO_BUFFERING.For more information, see CreateFile.If the sector size of the file, specified in pStgOptions, is
/// not an integer multiple of the underlying disk's physical sector size, this operation will fail.
/// </description>
/// </item>
/// <item>
/// <term>All other values of stgfmt</term>
/// <description>Must be 0.</description>
/// </item>
/// </list>
/// </param>
/// <param name="pStgOptions">
/// The pStgOptions parameter is valid only if the stgfmt parameter is set to STGFMT_DOCFILE. If the stgfmt parameter is set to
/// STGFMT_DOCFILE, pStgOptions points to the STGOPTIONS structure, which specifies features of the storage object, such as the
/// sector size. This parameter may be NULL, which creates a storage object with a default sector size of 512 bytes. If non-NULL, the
/// ulSectorSize member must be set to either 512 or 4096. If set to 4096, STGM_SIMPLE may not be specified in the grfMode parameter.
/// The usVersion member must be set before calling StgCreateStorageEx. For more information, see STGOPTIONS.
/// </param>
/// <param name="pSecurityDescriptor">
/// Enables the ACLs to be set when the file is created. If not NULL, needs to be a pointer to the SECURITY_ATTRIBUTES structure. See
/// CreateFile for information on how to set ACLs on files.
/// <para>Windows Server 2003, Windows 2000 Server, Windows XP and Windows 2000 Professional: Value must be NULL.</para>
/// </param>
/// <param name="riid">
/// A value that specifies the interface identifier (IID) of the interface pointer to return. This IID may be for the IStorage
/// interface or the IPropertySetStorage interface.
/// </param>
/// <param name="ppObjectOpen">
/// A pointer to an interface pointer variable that receives a pointer for an interface on the new storage object; contains NULL if
/// operation failed.
/// </param>
/// <returns>
/// This function can also return any file system errors or system errors wrapped in an HRESULT. For more information, see Error
/// Handling Strategies and Handling Unknown Errors.
/// </returns>
[DllImport(Lib.Ole32, ExactSpelling = true, SetLastError = false)]
[PInvokeData("Objbase.h", MSDNShortId = "aa380328")]
public static extern HRESULT StgCreateStorageEx([MarshalAs(UnmanagedType.LPWStr)] string pwcsName, STGM grfMode,
STGFMT stgfmt, FileFlagsAndAttributes grfAttrs, [In] IntPtr pStgOptions, PSECURITY_DESCRIPTOR pSecurityDescriptor, in Guid riid,
[MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 6)] out object ppObjectOpen);
/// <summary>
/// The StgCreateStorageEx function creates a new storage object using a provided implementation for the IStorage or
/// IPropertySetStorage interfaces. To open an existing file, use the StgOpenStorageEx function instead.
/// <para>
/// Applications written for Windows 2000, Windows Server 2003 and Windows XP must use StgCreateStorageEx rather than
/// StgCreateDocfile to take advantage of the enhanced Windows 2000 and Windows XP Structured Storage features.
/// </para>
/// </summary>
/// <param name="pwcsName">
/// A pointer to the path of the file to create. It is passed uninterpreted to the file system. This can be a relative name or NULL.
/// If NULL, a temporary file is allocated with a unique name. If non-NULL, the string size must not exceed MAX_PATH characters.
/// <para>Windows 2000: Unlike the CreateFile function, you cannot exceed the MAX_PATH limit by using the "\\?\" prefix.</para>
/// </param>
/// <param name="grfMode">
/// A value that specifies the access mode to use when opening the new storage object. For more information, see STGM Constants. If
/// the caller specifies transacted mode together with STGM_CREATE or STGM_CONVERT, the overwrite or conversion takes place when the
/// commit operation is called for the root storage. If IStorage::Commit is not called for the root storage object, previous contents
/// of the file will be restored. STGM_CREATE and STGM_CONVERT cannot be combined with the STGM_NOSNAPSHOT flag, because a snapshot
/// copy is required when a file is overwritten or converted in the transacted mode.
/// </param>
/// <param name="stgfmt">A value that specifies the storage file format. For more information, see the STGFMT enumeration.</param>
/// <param name="grfAttrs">
/// A value that depends on the value of the stgfmt parameter.
/// <list type="table">
/// <listheader>
/// <term>Parameter Values</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term>STGFMT_DOCFILE</term>
/// <description>
/// 0, or FILE_FLAG_NO_BUFFERING.For more information, see CreateFile.If the sector size of the file, specified in pStgOptions, is
/// not an integer multiple of the underlying disk's physical sector size, this operation will fail.
/// </description>
/// </item>
/// <item>
/// <term>All other values of stgfmt</term>
/// <description>Must be 0.</description>
/// </item>
/// </list>
/// </param>
/// <param name="pStgOptions">
/// The pStgOptions parameter is valid only if the stgfmt parameter is set to STGFMT_DOCFILE. If the stgfmt parameter is set to
/// STGFMT_DOCFILE, pStgOptions points to the STGOPTIONS structure, which specifies features of the storage object, such as the
/// sector size. This parameter may be NULL, which creates a storage object with a default sector size of 512 bytes. If non-NULL, the
/// ulSectorSize member must be set to either 512 or 4096. If set to 4096, STGM_SIMPLE may not be specified in the grfMode parameter.
/// The usVersion member must be set before calling StgCreateStorageEx. For more information, see STGOPTIONS.
/// </param>
/// <param name="pSecurityDescriptor">
/// Enables the ACLs to be set when the file is created. If not NULL, needs to be a pointer to the SECURITY_ATTRIBUTES structure. See
/// CreateFile for information on how to set ACLs on files.
/// <para>Windows Server 2003, Windows 2000 Server, Windows XP and Windows 2000 Professional: Value must be NULL.</para>
/// </param>
/// <param name="riid">
/// A value that specifies the interface identifier (IID) of the interface pointer to return. This IID may be for the IStorage
/// interface or the IPropertySetStorage interface.
/// </param>
/// <param name="ppObjectOpen">
/// A pointer to an interface pointer variable that receives a pointer for an interface on the new storage object; contains NULL if
/// operation failed.
/// </param>
/// <returns>
/// This function can also return any file system errors or system errors wrapped in an HRESULT. For more information, see Error
/// Handling Strategies and Handling Unknown Errors.
/// </returns>
[DllImport(Lib.Ole32, ExactSpelling = true, SetLastError = false)]
[PInvokeData("Objbase.h", MSDNShortId = "aa380328")]
public static extern HRESULT StgCreateStorageEx([MarshalAs(UnmanagedType.LPWStr)] string pwcsName, STGM grfMode,
STGFMT stgfmt, FileFlagsAndAttributes grfAttrs, in STGOPTIONS pStgOptions, PSECURITY_DESCRIPTOR pSecurityDescriptor, in Guid riid,
[MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 6)] out object ppObjectOpen);
/// <summary>The StgIsStorageFile function indicates whether a particular disk file contains a storage object.</summary>
/// <param name="pwcsName">
/// Pointer to the null-terminated Unicode string name of the disk file to be examined. The pwcsName parameter is passed
/// uninterpreted to the underlying file system.
/// </param>
/// <returns>
/// <list>
/// <item>
/// <term>S_OK</term>
/// <description>Indicates that the file contains a storage object.</description>
/// </item>
/// <item>
/// <term>S_FALSE</term>
/// <description>Indicates that the file does not contain a storage object.</description>
/// </item>
/// <item>
/// <term>STG_E_FILENOTFOUND</term>
/// <description>Indicates that the file was not found.</description>
/// </item>
/// </list>
/// <para>
/// StgIsStorageFile function can also return any file system errors or system errors wrapped in an HRESULT. See Error Handling
/// Strategies and Handling Unknown Errors
/// </para>
/// </returns>
[DllImport(Lib.Ole32, ExactSpelling = true, SetLastError = false)]
[PInvokeData("Objbase.h", MSDNShortId = "aa380334")]
public static extern HRESULT StgIsStorageFile([MarshalAs(UnmanagedType.LPWStr)] string pwcsName);
/// <summary>
/// The StgOpenStorage function opens an existing root storage object in the file system. Use this function to open compound files.
/// Do not use it to open directories, files, or summary catalogs. Nested storage objects can only be opened using their parent
/// IStorage::OpenStorage method. <note type="note">Applications should use the new function, StgOpenStorageEx, instead of
/// StgOpenStorage, to take advantage of the enhanced and Windows Structured Storage features. This function, StgOpenStorage, still
/// exists for compatibility with applications running on Windows 2000.</note>
/// </summary>
/// <param name="pwcsName">
/// A pointer to the path of the null-terminated Unicode string file that contains the storage object to open. This parameter is
/// ignored if the pstgPriority parameter is not NULL.
/// </param>
/// <param name="pstgPriority">
/// A pointer to the IStorage interface that should be NULL. If not NULL, this parameter is used as described below in the Remarks
/// section. After StgOpenStorage returns, the storage object specified in pStgPriority may have been released and should no longer
/// be used.
/// </param>
/// <param name="grfMode">Specifies the access mode to use to open the storage object.</param>
/// <param name="snbExclude">
/// If not NULL, pointer to a block of elements in the storage to be excluded as the storage object is opened. The exclusion occurs
/// regardless of whether a snapshot copy happens on the open. Can be NULL.
/// </param>
/// <param name="reserved">Indicates reserved for future use; must be zero.</param>
/// <param name="ppstgOpen">A pointer to a IStorage* pointer variable that receives the interface pointer to the opened storage.</param>
/// <returns>
/// The StgOpenStorage function can also return any file system errors or system errors wrapped in an HRESULT. For more information,
/// see Error Handling Strategies and Handling Unknown Errors.
/// </returns>
[DllImport(Lib.Ole32, ExactSpelling = true, SetLastError = false)]
[PInvokeData("Objbase.h", MSDNShortId = "aa380341")]
public static extern HRESULT StgOpenStorage([MarshalAs(UnmanagedType.LPWStr)] string pwcsName,
IStorage pstgPriority, STGM grfMode, [In] SNB snbExclude, [Optional] uint reserved, out IStorage ppstgOpen);
/// <summary>STGs the open storage ex.</summary>
/// <param name="pwcsName">
/// A pointer to the path of the null-terminated Unicode string file that contains the storage object. This string size cannot exceed
/// MAX_PATH characters.
/// <para>
/// Windows Server 2003 and Windows XP/2000: Unlike the CreateFile function, the MAX_PATH limit cannot be exceeded by using the
/// "\\?\" prefix.
/// </para>
/// </param>
/// <param name="grfMode">
/// A value that specifies the access mode to open the new storage object. For more information, see STGM Constants. If the caller
/// specifies transacted mode together with STGM_CREATE or STGM_CONVERT, the overwrite or conversion occurs when the commit operation
/// is called for the root storage. If IStorage::Commit is not called for the root storage object, previous contents of the file will
/// be restored. STGM_CREATE and STGM_CONVERT cannot be combined with the STGM_NOSNAPSHOT flag, because a snapshot copy is required
/// when a file is overwritten or converted in transacted mode.
/// <para>
/// If the storage object is opened in direct mode(STGM_DIRECT) with access to either STGM_WRITE or STGM_READWRITE, the sharing mode
/// must be STGM_SHARE_EXCLUSIVE unless the STGM_DIRECT_SWMR mode is specified.For more information, see the Remarks section.If the
/// storage object is opened in direct mode with access to STGM_READ, the sharing mode must be either STGM_SHARE_EXCLUSIVE or
/// STGM_SHARE_DENY_WRITE, unless STGM_PRIORITY or STGM_DIRECT_SWMR is specified.For more information, see the Remarks section.
/// </para>
/// <para>
/// The mode in which a file is opened can affect implementation performance.For more information, see Compound File Implementation Limits.
/// </para>
/// </param>
/// <param name="stgfmt">A value that specifies the storage file format. For more information, see the STGFMT enumeration.</param>
/// <param name="grfAttrs">
/// A value that depends upon the value of the stgfmt parameter. STGFMT_DOCFILE must be zero (0) or FILE_FLAG_NO_BUFFERING. For more
/// information about this value, see CreateFile. If the sector size of the file, specified in pStgOptions, is not an integer
/// multiple of the physical sector size of the underlying disk, then this operation will fail. All other values of stgfmt must be zero.
/// </param>
/// <param name="pStgOptions">
/// A pointer to an STGOPTIONS structure that contains data about the storage object opened. The pStgOptions parameter is valid only
/// if the stgfmt parameter is set to STGFMT_DOCFILE. The usVersion member must be set before calling StgOpenStorageEx. For more
/// information, see the STGOPTIONS structure.
/// </param>
/// <param name="reserved2">Reserved; must be zero.</param>
/// <param name="riid">
/// A value that specifies the GUID of the interface pointer to return. Can also be the header-specified value for IID_IStorage to
/// obtain the IStorage interface or for IID_IPropertySetStorage to obtain the IPropertySetStorage interface.
/// </param>
/// <param name="ppObjectOpen">
/// The address of an interface pointer variable that receives a pointer for an interface on the storage object opened; contains NULL
/// if operation failed.
/// </param>
/// <returns>
/// This function can also return any file system errors or system errors wrapped in an HRESULT. For more information, see Error
/// Handling Strategies and Handling Unknown Errors.
/// </returns>
[DllImport(Lib.Ole32, ExactSpelling = true, SetLastError = false)]
[PInvokeData("Objbase.h", MSDNShortId = "aa380342")]
public static extern HRESULT StgOpenStorageEx([MarshalAs(UnmanagedType.LPWStr)] string pwcsName, STGM grfMode, STGFMT stgfmt,
FileFlagsAndAttributes grfAttrs, ref STGOPTIONS pStgOptions, [Optional] IntPtr reserved2, in Guid riid,
[MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 6)] out object ppObjectOpen);
/// <summary>STGs the open storage ex.</summary>
/// <param name="pwcsName">
/// A pointer to the path of the null-terminated Unicode string file that contains the storage object. This string size cannot exceed
/// MAX_PATH characters.
/// <para>
/// Windows Server 2003 and Windows XP/2000: Unlike the CreateFile function, the MAX_PATH limit cannot be exceeded by using the
/// "\\?\" prefix.
/// </para>
/// </param>
/// <param name="grfMode">
/// A value that specifies the access mode to open the new storage object. For more information, see STGM Constants. If the caller
/// specifies transacted mode together with STGM_CREATE or STGM_CONVERT, the overwrite or conversion occurs when the commit operation
/// is called for the root storage. If IStorage::Commit is not called for the root storage object, previous contents of the file will
/// be restored. STGM_CREATE and STGM_CONVERT cannot be combined with the STGM_NOSNAPSHOT flag, because a snapshot copy is required
/// when a file is overwritten or converted in transacted mode.
/// <para>
/// If the storage object is opened in direct mode(STGM_DIRECT) with access to either STGM_WRITE or STGM_READWRITE, the sharing mode
/// must be STGM_SHARE_EXCLUSIVE unless the STGM_DIRECT_SWMR mode is specified.For more information, see the Remarks section.If the
/// storage object is opened in direct mode with access to STGM_READ, the sharing mode must be either STGM_SHARE_EXCLUSIVE or
/// STGM_SHARE_DENY_WRITE, unless STGM_PRIORITY or STGM_DIRECT_SWMR is specified.For more information, see the Remarks section.
/// </para>
/// <para>
/// The mode in which a file is opened can affect implementation performance.For more information, see Compound File Implementation Limits.
/// </para>
/// </param>
/// <param name="stgfmt">A value that specifies the storage file format. For more information, see the STGFMT enumeration.</param>
/// <param name="grfAttrs">
/// A value that depends upon the value of the stgfmt parameter. STGFMT_DOCFILE must be zero (0) or FILE_FLAG_NO_BUFFERING. For more
/// information about this value, see CreateFile. If the sector size of the file, specified in pStgOptions, is not an integer
/// multiple of the physical sector size of the underlying disk, then this operation will fail. All other values of stgfmt must be zero.
/// </param>
/// <param name="pStgOptions">
/// A pointer to an STGOPTIONS structure that contains data about the storage object opened. The pStgOptions parameter is valid only
/// if the stgfmt parameter is set to STGFMT_DOCFILE. The usVersion member must be set before calling StgOpenStorageEx. For more
/// information, see the STGOPTIONS structure.
/// </param>
/// <param name="reserved2">Reserved; must be zero.</param>
/// <param name="riid">
/// A value that specifies the GUID of the interface pointer to return. Can also be the header-specified value for IID_IStorage to
/// obtain the IStorage interface or for IID_IPropertySetStorage to obtain the IPropertySetStorage interface.
/// </param>
/// <param name="ppObjectOpen">
/// The address of an interface pointer variable that receives a pointer for an interface on the storage object opened; contains NULL
/// if operation failed.
/// </param>
/// <returns>
/// This function can also return any file system errors or system errors wrapped in an HRESULT. For more information, see Error
/// Handling Strategies and Handling Unknown Errors.
/// </returns>
[DllImport(Lib.Ole32, ExactSpelling = true, SetLastError = false)]
[PInvokeData("Objbase.h", MSDNShortId = "aa380342")]
public static extern HRESULT StgOpenStorageEx([MarshalAs(UnmanagedType.LPWStr)] string pwcsName, STGM grfMode, STGFMT stgfmt,
FileFlagsAndAttributes grfAttrs, [Optional] IntPtr pStgOptions, [Optional] IntPtr reserved2, in Guid riid,
[MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 6)] out object ppObjectOpen);
/// <summary>Provides a CO_MTA_USAGE_COOKIE.</summary>
[StructLayout(LayoutKind.Sequential)]
public struct CO_MTA_USAGE_COOKIE : IHandle

File diff suppressed because it is too large Load Diff