restructure projects
This commit is contained in:
125
ShellExtensions/Interop/Common/ShellNativeStructs.cs
Normal file
125
ShellExtensions/Interop/Common/ShellNativeStructs.cs
Normal file
@ -0,0 +1,125 @@
|
||||
using System;
|
||||
|
||||
namespace ShellExtensions.Interop.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// The STGM constants are flags that indicate
|
||||
/// conditions for creating and deleting the object and access modes
|
||||
/// for the object.
|
||||
///
|
||||
/// You can combine these flags, but you can only choose one flag
|
||||
/// from each group of related flags. Typically one flag from each
|
||||
/// of the access and sharing groups must be specified for all
|
||||
/// functions and methods which use these constants.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum AccessModes
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates that, in direct mode, each change to a storage
|
||||
/// or stream element is written as it occurs.
|
||||
/// </summary>
|
||||
Direct = 0x00000000,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that, in transacted mode, changes are buffered
|
||||
/// and written only if an explicit commit operation is called.
|
||||
/// </summary>
|
||||
Transacted = 0x00010000,
|
||||
|
||||
/// <summary>
|
||||
/// Provides a faster implementation of a compound file
|
||||
/// in a limited, but frequently used, case.
|
||||
/// </summary>
|
||||
Simple = 0x08000000,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the object is read-only,
|
||||
/// meaning that modifications cannot be made.
|
||||
/// </summary>
|
||||
Read = 0x00000000,
|
||||
|
||||
/// <summary>
|
||||
/// Enables you to save changes to the object,
|
||||
/// but does not permit access to its data.
|
||||
/// </summary>
|
||||
Write = 0x00000001,
|
||||
|
||||
/// <summary>
|
||||
/// Enables access and modification of object data.
|
||||
/// </summary>
|
||||
ReadWrite = 0x00000002,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies that subsequent openings of the object are
|
||||
/// not denied read or write access.
|
||||
/// </summary>
|
||||
ShareDenyNone = 0x00000040,
|
||||
|
||||
/// <summary>
|
||||
/// Prevents others from subsequently opening the object in Read mode.
|
||||
/// </summary>
|
||||
ShareDenyRead = 0x00000030,
|
||||
|
||||
/// <summary>
|
||||
/// Prevents others from subsequently opening the object
|
||||
/// for Write or ReadWrite access.
|
||||
/// </summary>
|
||||
ShareDenyWrite = 0x00000020,
|
||||
|
||||
/// <summary>
|
||||
/// Prevents others from subsequently opening the object in any mode.
|
||||
/// </summary>
|
||||
ShareExclusive = 0x00000010,
|
||||
|
||||
/// <summary>
|
||||
/// Opens the storage object with exclusive access to the most
|
||||
/// recently committed version.
|
||||
/// </summary>
|
||||
Priority = 0x00040000,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the underlying file is to be automatically destroyed when the root
|
||||
/// storage object is released. This feature is most useful for creating temporary files.
|
||||
/// </summary>
|
||||
DeleteOnRelease = 0x04000000,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that, in transacted mode, a temporary scratch file is usually used
|
||||
/// to save modifications until the Commit method is called.
|
||||
/// Specifying NoScratch permits the unused portion of the original file
|
||||
/// to be used as work space instead of creating a new file for that purpose.
|
||||
/// </summary>
|
||||
NoScratch = 0x00100000,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that an existing storage object
|
||||
/// or stream should be removed before the new object replaces it.
|
||||
/// </summary>
|
||||
Create = 0x00001000,
|
||||
|
||||
/// <summary>
|
||||
/// Creates the new object while preserving existing data in a stream named "Contents".
|
||||
/// </summary>
|
||||
Convert = 0x00020000,
|
||||
|
||||
/// <summary>
|
||||
/// Causes the create operation to fail if an existing object with the specified name exists.
|
||||
/// </summary>
|
||||
FailIfThere = 0x00000000,
|
||||
|
||||
/// <summary>
|
||||
/// This flag is used when opening a storage object with Transacted
|
||||
/// and without ShareExclusive or ShareDenyWrite.
|
||||
/// In this case, specifying NoSnapshot prevents the system-provided
|
||||
/// implementation from creating a snapshot copy of the file.
|
||||
/// Instead, changes to the file are written to the end of the file.
|
||||
/// </summary>
|
||||
NoSnapshot = 0x00200000,
|
||||
|
||||
/// <summary>
|
||||
/// Supports direct mode for single-writer, multireader file operations.
|
||||
/// </summary>
|
||||
DirectSingleWriterMultipleReader = 0x00400000
|
||||
}
|
||||
}
|
92
ShellExtensions/Interop/HandlerNativeMethods.cs
Normal file
92
ShellExtensions/Interop/HandlerNativeMethods.cs
Normal file
@ -0,0 +1,92 @@
|
||||
using ShellExtensions.Interop.Common;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
|
||||
namespace ShellExtensions.Interop
|
||||
{
|
||||
internal static class HandlerNativeMethods
|
||||
{
|
||||
internal static readonly Guid IThumbnailProviderGuid = new Guid("e357fccd-a995-4576-b01f-234630154e96");
|
||||
|
||||
internal static readonly Guid IInitializeWithFileGuid = new Guid("b7d14566-0509-4cce-a71f-0a554233bd9b");
|
||||
internal static readonly Guid IInitializeWithStreamGuid = new Guid("b824b49d-22ac-4161-ac8a-9916e8fa3f7f");
|
||||
//internal static readonly Guid IInitializeWithItemGuid = new Guid("7f73be3f-fb79-493c-a6c7-7ee14e245841");
|
||||
|
||||
internal static readonly Guid IMarshalGuid = new Guid("00000003-0000-0000-C000-000000000046");
|
||||
}
|
||||
|
||||
#region Interfaces
|
||||
|
||||
/// <summary>
|
||||
/// ComVisible interface for native IThumbnailProvider
|
||||
/// </summary>
|
||||
[ComImport]
|
||||
[Guid("e357fccd-a995-4576-b01f-234630154e96")]
|
||||
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
interface IThumbnailProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a pointer to a bitmap to display as a thumbnail
|
||||
/// </summary>
|
||||
/// <param name="squareLength"></param>
|
||||
/// <param name="bitmapHandle"></param>
|
||||
/// <param name="bitmapType"></param>
|
||||
void GetThumbnail(uint squareLength, [Out] out IntPtr bitmapHandle, [Out] out uint bitmapType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides means by which to initialize with a file.
|
||||
/// </summary>
|
||||
[ComImport]
|
||||
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
[Guid("b7d14566-0509-4cce-a71f-0a554233bd9b")]
|
||||
interface IInitializeWithFile
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes with a file.
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
/// <param name="fileMode"></param>
|
||||
void Initialize([MarshalAs(UnmanagedType.LPWStr)] string filePath, AccessModes fileMode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides means by which to initialize with a stream.
|
||||
/// </summary>
|
||||
[ComImport]
|
||||
[Guid("b824b49d-22ac-4161-ac8a-9916e8fa3f7f")]
|
||||
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
interface IInitializeWithStream
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes with a stream.
|
||||
/// </summary>
|
||||
/// <param name="stream"></param>
|
||||
/// <param name="fileMode"></param>
|
||||
void Initialize(IStream stream, AccessModes fileMode);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
// <summary>
|
||||
/// Thumbnail Alpha Types
|
||||
/// </summary>
|
||||
public enum ThumbnailAlphaType
|
||||
{
|
||||
/// <summary>
|
||||
/// Let the system decide.
|
||||
/// </summary>
|
||||
Unknown = 0,
|
||||
|
||||
/// <summary>
|
||||
/// No transparency
|
||||
/// </summary>
|
||||
NoAlphaChannel = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Has transparency
|
||||
/// </summary>
|
||||
HasAlphaChannel = 2,
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user