support for .NET framework 3.5
Still have bugs
This commit is contained in:
1 parent
5878039e21
commit
7d6b491f25
704 files changed
+48273
-33
No files matched your search
@@ -0,0 +1,15 @@
|
||||
namespace Microsoft.Windows.Shell
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
public abstract class JumpItem
|
||||
{
|
||||
internal JumpItem()
|
||||
{
|
||||
}
|
||||
|
||||
public string CustomCategory { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Microsoft.Windows.Shell
|
||||
{
|
||||
using System;
|
||||
|
||||
public enum JumpItemRejectionReason
|
||||
{
|
||||
None,
|
||||
InvalidItem,
|
||||
NoRegisteredHandler,
|
||||
RemovedByUser
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
namespace Microsoft.Windows.Shell
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
public sealed class JumpItemsRejectedEventArgs : EventArgs
|
||||
{
|
||||
public JumpItemsRejectedEventArgs() : this(null, null)
|
||||
{
|
||||
}
|
||||
|
||||
public JumpItemsRejectedEventArgs(IList<JumpItem> rejectedItems, IList<JumpItemRejectionReason> reasons)
|
||||
{
|
||||
if ((((rejectedItems == null) && (reasons != null)) || ((reasons == null) && (rejectedItems != null))) || (((rejectedItems != null) && (reasons != null)) && (rejectedItems.Count != reasons.Count)))
|
||||
{
|
||||
throw new ArgumentException("The counts of rejected items doesn't match the count of reasons.");
|
||||
}
|
||||
if (rejectedItems != null)
|
||||
{
|
||||
this.RejectedItems = new List<JumpItem>(rejectedItems).AsReadOnly();
|
||||
this.RejectionReasons = new List<JumpItemRejectionReason>(reasons).AsReadOnly();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.RejectedItems = new List<JumpItem>().AsReadOnly();
|
||||
this.RejectionReasons = new List<JumpItemRejectionReason>().AsReadOnly();
|
||||
}
|
||||
}
|
||||
|
||||
public IList<JumpItem> RejectedItems { get; private set; }
|
||||
|
||||
public IList<JumpItemRejectionReason> RejectionReasons { get; private set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
namespace Microsoft.Windows.Shell
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
public sealed class JumpItemsRemovedEventArgs : EventArgs
|
||||
{
|
||||
public JumpItemsRemovedEventArgs() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public JumpItemsRemovedEventArgs(IList<JumpItem> removedItems)
|
||||
{
|
||||
if (removedItems != null)
|
||||
{
|
||||
this.RemovedItems = new List<JumpItem>(removedItems).AsReadOnly();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.RemovedItems = new List<JumpItem>().AsReadOnly();
|
||||
}
|
||||
}
|
||||
|
||||
public IList<JumpItem> RemovedItems { get; private set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,731 @@
|
||||
namespace Microsoft.Windows.Shell
|
||||
{
|
||||
using Standard;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Markup;
|
||||
|
||||
[ContentProperty("JumpItems")]
|
||||
public sealed class JumpList : ISupportInitialize
|
||||
{
|
||||
private Application _application;
|
||||
private static readonly string _FullName = Standard.NativeMethods.GetModuleFileName(IntPtr.Zero);
|
||||
private bool? _initializing;
|
||||
private List<JumpItem> _jumpItems;
|
||||
private static readonly Dictionary<Application, JumpList> s_applicationMap = new Dictionary<Application, JumpList>();
|
||||
private static readonly object s_lock = new object();
|
||||
|
||||
public event EventHandler<JumpItemsRejectedEventArgs> JumpItemsRejected;
|
||||
|
||||
public event EventHandler<JumpItemsRemovedEventArgs> JumpItemsRemovedByUser;
|
||||
|
||||
public JumpList() : this(null, false, false)
|
||||
{
|
||||
this._initializing = null;
|
||||
}
|
||||
|
||||
public JumpList(IEnumerable<JumpItem> items, bool showFrequent, bool showRecent)
|
||||
{
|
||||
if (items != null)
|
||||
{
|
||||
this._jumpItems = new List<JumpItem>(items);
|
||||
}
|
||||
else
|
||||
{
|
||||
this._jumpItems = new List<JumpItem>();
|
||||
}
|
||||
this.ShowFrequentCategory = showFrequent;
|
||||
this.ShowRecentCategory = showRecent;
|
||||
this._initializing = false;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId="Standard.Verify.IsApartmentState(System.Threading.ApartmentState,System.String)"), SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes"), SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId="JumpLists")]
|
||||
private void _ApplyList()
|
||||
{
|
||||
Standard.Verify.IsApartmentState(ApartmentState.STA, "JumpLists can only be effected on STA threads.");
|
||||
if (!Standard.Utility.IsOSWindows7OrNewer)
|
||||
{
|
||||
this.RejectEverything();
|
||||
}
|
||||
else
|
||||
{
|
||||
List<JumpItem> list;
|
||||
List<_RejectedJumpItemPair> list2;
|
||||
List<_ShellObjectPair> list3;
|
||||
try
|
||||
{
|
||||
this._BuildShellLists(out list, out list2, out list3);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
this.RejectEverything();
|
||||
return;
|
||||
}
|
||||
this._jumpItems = list;
|
||||
EventHandler<JumpItemsRejectedEventArgs> jumpItemsRejected = this.JumpItemsRejected;
|
||||
EventHandler<JumpItemsRemovedEventArgs> jumpItemsRemovedByUser = this.JumpItemsRemovedByUser;
|
||||
if ((list2.Count > 0) && (jumpItemsRejected != null))
|
||||
{
|
||||
List<JumpItem> rejectedItems = new List<JumpItem>(list2.Count);
|
||||
List<JumpItemRejectionReason> reasons = new List<JumpItemRejectionReason>(list2.Count);
|
||||
foreach (_RejectedJumpItemPair pair in list2)
|
||||
{
|
||||
rejectedItems.Add(pair.JumpItem);
|
||||
reasons.Add(pair.Reason);
|
||||
}
|
||||
jumpItemsRejected(this, new JumpItemsRejectedEventArgs(rejectedItems, reasons));
|
||||
}
|
||||
if ((list3.Count > 0) && (jumpItemsRemovedByUser != null))
|
||||
{
|
||||
List<JumpItem> removedItems = new List<JumpItem>(list3.Count);
|
||||
foreach (_ShellObjectPair pair2 in list3)
|
||||
{
|
||||
if (pair2.JumpItem != null)
|
||||
{
|
||||
removedItems.Add(pair2.JumpItem);
|
||||
}
|
||||
}
|
||||
if (removedItems.Count > 0)
|
||||
{
|
||||
jumpItemsRemovedByUser(this, new JumpItemsRemovedEventArgs(removedItems));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void _BuildShellLists(out List<JumpItem> successList, out List<_RejectedJumpItemPair> rejectedList, out List<_ShellObjectPair> removedList)
|
||||
{
|
||||
List<List<_ShellObjectPair>> list = null;
|
||||
removedList = null;
|
||||
Standard.ICustomDestinationList cdl = Standard.CLSID.CoCreateInstance<Standard.ICustomDestinationList>("77f10cf0-3db5-4966-b520-b7c54fd35ed6");
|
||||
try
|
||||
{
|
||||
uint num;
|
||||
string str = _RuntimeId;
|
||||
if (!string.IsNullOrEmpty(str))
|
||||
{
|
||||
cdl.SetAppID(str);
|
||||
}
|
||||
Guid riid = new Guid("92CA9DCD-5622-4bba-A805-5E9F541BD8C9");
|
||||
Standard.IObjectArray shellObjects = (Standard.IObjectArray) cdl.BeginList(out num, ref riid);
|
||||
removedList = GenerateJumpItems(shellObjects);
|
||||
successList = new List<JumpItem>(this.JumpItems.Count);
|
||||
rejectedList = new List<_RejectedJumpItemPair>(this.JumpItems.Count);
|
||||
list = new List<List<_ShellObjectPair>> {
|
||||
new List<_ShellObjectPair>()
|
||||
};
|
||||
foreach (JumpItem item in this.JumpItems)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
_RejectedJumpItemPair pair = new _RejectedJumpItemPair {
|
||||
JumpItem = item,
|
||||
Reason = JumpItemRejectionReason.InvalidItem
|
||||
};
|
||||
rejectedList.Add(pair);
|
||||
}
|
||||
else
|
||||
{
|
||||
object shellObject = null;
|
||||
try
|
||||
{
|
||||
shellObject = GetShellObjectForJumpItem(item);
|
||||
if (shellObject == null)
|
||||
{
|
||||
_RejectedJumpItemPair pair2 = new _RejectedJumpItemPair {
|
||||
Reason = JumpItemRejectionReason.InvalidItem,
|
||||
JumpItem = item
|
||||
};
|
||||
rejectedList.Add(pair2);
|
||||
}
|
||||
else if (ListContainsShellObject(removedList, shellObject))
|
||||
{
|
||||
_RejectedJumpItemPair pair3 = new _RejectedJumpItemPair {
|
||||
Reason = JumpItemRejectionReason.RemovedByUser,
|
||||
JumpItem = item
|
||||
};
|
||||
rejectedList.Add(pair3);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ShellObjectPair pair4 = new _ShellObjectPair {
|
||||
JumpItem = item,
|
||||
ShellObject = shellObject
|
||||
};
|
||||
if (string.IsNullOrEmpty(item.CustomCategory))
|
||||
{
|
||||
list[0].Add(pair4);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag = false;
|
||||
foreach (List<_ShellObjectPair> list3 in list)
|
||||
{
|
||||
if ((list3.Count > 0) && (list3[0].JumpItem.CustomCategory == item.CustomCategory))
|
||||
{
|
||||
list3.Add(pair4);
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag)
|
||||
{
|
||||
list.Add(new List<_ShellObjectPair> { pair4 });
|
||||
}
|
||||
}
|
||||
shellObject = null;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
Standard.Utility.SafeRelease<object>(ref shellObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
list.Reverse();
|
||||
if (this.ShowFrequentCategory)
|
||||
{
|
||||
cdl.AppendKnownCategory(Standard.KDC.FREQUENT);
|
||||
}
|
||||
if (this.ShowRecentCategory)
|
||||
{
|
||||
cdl.AppendKnownCategory(Standard.KDC.RECENT);
|
||||
}
|
||||
foreach (List<_ShellObjectPair> list5 in list)
|
||||
{
|
||||
if (list5.Count > 0)
|
||||
{
|
||||
string customCategory = list5[0].JumpItem.CustomCategory;
|
||||
AddCategory(cdl, customCategory, list5, successList, rejectedList);
|
||||
}
|
||||
}
|
||||
cdl.CommitList();
|
||||
successList.Reverse();
|
||||
}
|
||||
finally
|
||||
{
|
||||
Standard.Utility.SafeRelease<Standard.ICustomDestinationList>(ref cdl);
|
||||
if (list != null)
|
||||
{
|
||||
foreach (List<_ShellObjectPair> list7 in list)
|
||||
{
|
||||
_ShellObjectPair.ReleaseShellObjects(list7);
|
||||
}
|
||||
}
|
||||
_ShellObjectPair.ReleaseShellObjects(removedList);
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddCategory(Standard.ICustomDestinationList cdl, string category, List<_ShellObjectPair> jumpItems, List<JumpItem> successList, List<_RejectedJumpItemPair> rejectionList)
|
||||
{
|
||||
AddCategory(cdl, category, jumpItems, successList, rejectionList, true);
|
||||
}
|
||||
|
||||
private static void AddCategory(Standard.ICustomDestinationList cdl, string category, List<_ShellObjectPair> jumpItems, List<JumpItem> successList, List<_RejectedJumpItemPair> rejectionList, bool isHeterogenous)
|
||||
{
|
||||
Standard.HRESULT hresult;
|
||||
Standard.IObjectCollection poa = (Standard.IObjectCollection) Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("2d3468c1-36a7-43b6-ac24-d3f02fd9607a")));
|
||||
foreach (_ShellObjectPair pair in jumpItems)
|
||||
{
|
||||
poa.AddObject(pair.ShellObject);
|
||||
}
|
||||
if (string.IsNullOrEmpty(category))
|
||||
{
|
||||
hresult = cdl.AddUserTasks(poa);
|
||||
}
|
||||
else
|
||||
{
|
||||
hresult = cdl.AppendCategory(category, poa);
|
||||
}
|
||||
if (hresult.Succeeded)
|
||||
{
|
||||
int count = jumpItems.Count;
|
||||
while (--count >= 0)
|
||||
{
|
||||
successList.Add(jumpItems[count].JumpItem);
|
||||
}
|
||||
}
|
||||
else if (isHeterogenous && (hresult == Standard.HRESULT.DESTS_E_NO_MATCHING_ASSOC_HANDLER))
|
||||
{
|
||||
Standard.Utility.SafeRelease<Standard.IObjectCollection>(ref poa);
|
||||
List<_ShellObjectPair> list = new List<_ShellObjectPair>();
|
||||
foreach (_ShellObjectPair pair2 in jumpItems)
|
||||
{
|
||||
if (pair2.JumpItem is JumpPath)
|
||||
{
|
||||
_RejectedJumpItemPair item = new _RejectedJumpItemPair {
|
||||
JumpItem = pair2.JumpItem,
|
||||
Reason = JumpItemRejectionReason.NoRegisteredHandler
|
||||
};
|
||||
rejectionList.Add(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
list.Add(pair2);
|
||||
}
|
||||
}
|
||||
if (list.Count > 0)
|
||||
{
|
||||
AddCategory(cdl, category, list, successList, rejectionList, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (_ShellObjectPair pair4 in jumpItems)
|
||||
{
|
||||
_RejectedJumpItemPair pair5 = new _RejectedJumpItemPair {
|
||||
JumpItem = pair4.JumpItem,
|
||||
Reason = JumpItemRejectionReason.InvalidItem
|
||||
};
|
||||
rejectionList.Add(pair5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId="0")]
|
||||
public static void AddToRecentCategory(JumpPath jumpPath)
|
||||
{
|
||||
Standard.Verify.IsNotNull<JumpPath>(jumpPath, "jumpPath");
|
||||
AddToRecentCategory(jumpPath.Path);
|
||||
}
|
||||
|
||||
public static void AddToRecentCategory(JumpTask jumpTask)
|
||||
{
|
||||
Standard.Verify.IsNotNull<JumpTask>(jumpTask, "jumpTask");
|
||||
if (Standard.Utility.IsOSWindows7OrNewer)
|
||||
{
|
||||
Standard.IShellLinkW shellLink = CreateLinkFromJumpTask(jumpTask, false);
|
||||
try
|
||||
{
|
||||
if (shellLink != null)
|
||||
{
|
||||
Standard.NativeMethods.SHAddToRecentDocs(shellLink);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
Standard.Utility.SafeRelease<Standard.IShellLinkW>(ref shellLink);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddToRecentCategory(string itemPath)
|
||||
{
|
||||
Standard.Verify.FileExists(itemPath, "itemPath");
|
||||
itemPath = Path.GetFullPath(itemPath);
|
||||
Standard.NativeMethods.SHAddToRecentDocs(itemPath);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId="JumpList"), SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId="EndInit")]
|
||||
public void Apply()
|
||||
{
|
||||
if (this._initializing == true)
|
||||
{
|
||||
throw new InvalidOperationException("The JumpList can't be applied until EndInit has been called.");
|
||||
}
|
||||
this._initializing = false;
|
||||
this._ApplyList();
|
||||
}
|
||||
|
||||
private void ApplyFromApplication()
|
||||
{
|
||||
if ((this._initializing != true) && !this._IsUnmodified)
|
||||
{
|
||||
this._initializing = false;
|
||||
}
|
||||
if ((this._application == Application.Current) && (this._initializing == false))
|
||||
{
|
||||
this._ApplyList();
|
||||
}
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId="BeginInit")]
|
||||
public void BeginInit()
|
||||
{
|
||||
if (!this._IsUnmodified)
|
||||
{
|
||||
throw new InvalidOperationException("Calls to BeginInit cannot be nested.");
|
||||
}
|
||||
this._initializing = true;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
|
||||
private static Standard.IShellItem2 CreateItemFromJumpPath(JumpPath jumpPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
return GetShellItemForPath(Path.GetFullPath(jumpPath.Path));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
|
||||
private static Standard.IShellLinkW CreateLinkFromJumpTask(JumpTask jumpTask, bool allowSeparators)
|
||||
{
|
||||
Standard.IShellLinkW kw3;
|
||||
if (string.IsNullOrEmpty(jumpTask.Title) && (!allowSeparators || !string.IsNullOrEmpty(jumpTask.CustomCategory)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Standard.IShellLinkW comObject = (Standard.IShellLinkW) Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("00021401-0000-0000-C000-000000000046")));
|
||||
try
|
||||
{
|
||||
string pszFile = _FullName;
|
||||
if (!string.IsNullOrEmpty(jumpTask.ApplicationPath))
|
||||
{
|
||||
pszFile = jumpTask.ApplicationPath;
|
||||
}
|
||||
comObject.SetPath(pszFile);
|
||||
if (!string.IsNullOrEmpty(jumpTask.WorkingDirectory))
|
||||
{
|
||||
comObject.SetWorkingDirectory(jumpTask.WorkingDirectory);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(jumpTask.Arguments))
|
||||
{
|
||||
comObject.SetArguments(jumpTask.Arguments);
|
||||
}
|
||||
if (jumpTask.IconResourceIndex != -1)
|
||||
{
|
||||
string pszIconPath = _FullName;
|
||||
if (!string.IsNullOrEmpty(jumpTask.IconResourcePath))
|
||||
{
|
||||
if (jumpTask.IconResourcePath.Length >= 260L)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
pszIconPath = jumpTask.IconResourcePath;
|
||||
}
|
||||
comObject.SetIconLocation(pszIconPath, jumpTask.IconResourceIndex);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(jumpTask.Description))
|
||||
{
|
||||
comObject.SetDescription(jumpTask.Description);
|
||||
}
|
||||
Standard.IPropertyStore store = (Standard.IPropertyStore) comObject;
|
||||
using (PROPVARIANT propvariant = new PROPVARIANT())
|
||||
{
|
||||
Standard.PKEY title = new Standard.PKEY();
|
||||
if (!string.IsNullOrEmpty(jumpTask.Title))
|
||||
{
|
||||
propvariant.SetValue(jumpTask.Title);
|
||||
title = Standard.PKEY.Title;
|
||||
}
|
||||
else
|
||||
{
|
||||
propvariant.SetValue(true);
|
||||
title = Standard.PKEY.AppUserModel_IsDestListSeparator;
|
||||
}
|
||||
store.SetValue(ref title, propvariant);
|
||||
}
|
||||
store.Commit();
|
||||
Standard.IShellLinkW kw2 = comObject;
|
||||
comObject = null;
|
||||
kw3 = kw2;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
kw3 = null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Standard.Utility.SafeRelease<Standard.IShellLinkW>(ref comObject);
|
||||
}
|
||||
return kw3;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId="EndInit"), SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId="BeginInit")]
|
||||
public void EndInit()
|
||||
{
|
||||
if (this._initializing != true)
|
||||
{
|
||||
throw new NotSupportedException("Can't call EndInit without first calling BeginInit.");
|
||||
}
|
||||
this._initializing = false;
|
||||
this.ApplyFromApplication();
|
||||
}
|
||||
|
||||
private static List<_ShellObjectPair> GenerateJumpItems(Standard.IObjectArray shellObjects)
|
||||
{
|
||||
List<_ShellObjectPair> list = new List<_ShellObjectPair>();
|
||||
Guid riid = new Guid("00000000-0000-0000-C000-000000000046");
|
||||
uint count = shellObjects.GetCount();
|
||||
for (uint i = 0; i < count; i++)
|
||||
{
|
||||
object at = shellObjects.GetAt(i, ref riid);
|
||||
JumpItem jumpItemForShellObject = null;
|
||||
try
|
||||
{
|
||||
jumpItemForShellObject = GetJumpItemForShellObject(at);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
if ((exception is NullReferenceException) || (exception is SEHException))
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
_ShellObjectPair pair = new _ShellObjectPair {
|
||||
ShellObject = at,
|
||||
JumpItem = jumpItemForShellObject
|
||||
};
|
||||
list.Add(pair);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static JumpItem GetJumpItemForShellObject(object shellObject)
|
||||
{
|
||||
int num;
|
||||
Standard.IShellItem2 item = shellObject as Standard.IShellItem2;
|
||||
Standard.IShellLinkW kw = shellObject as Standard.IShellLinkW;
|
||||
if (item != null)
|
||||
{
|
||||
return new JumpPath { Path = item.GetDisplayName(unchecked((Standard.SIGDN) (-2147319808))) };
|
||||
}
|
||||
if (kw == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
StringBuilder pszFile = new StringBuilder(260);
|
||||
kw.GetPath(pszFile, pszFile.Capacity, null, Standard.SLGP.RAWPATH);
|
||||
StringBuilder pszArgs = new StringBuilder(0x400);
|
||||
kw.GetArguments(pszArgs, pszArgs.Capacity);
|
||||
StringBuilder builder3 = new StringBuilder(0x400);
|
||||
kw.GetDescription(builder3, builder3.Capacity);
|
||||
StringBuilder pszIconPath = new StringBuilder(260);
|
||||
kw.GetIconLocation(pszIconPath, pszIconPath.Capacity, out num);
|
||||
StringBuilder pszDir = new StringBuilder(260);
|
||||
kw.GetWorkingDirectory(pszDir, pszDir.Capacity);
|
||||
JumpTask task = new JumpTask {
|
||||
ApplicationPath = pszFile.ToString(),
|
||||
Arguments = pszArgs.ToString(),
|
||||
Description = builder3.ToString(),
|
||||
IconResourceIndex = num,
|
||||
IconResourcePath = pszIconPath.ToString(),
|
||||
WorkingDirectory = pszDir.ToString()
|
||||
};
|
||||
using (PROPVARIANT propvariant = new PROPVARIANT())
|
||||
{
|
||||
Standard.IPropertyStore store = (Standard.IPropertyStore) kw;
|
||||
Standard.PKEY title = Standard.PKEY.Title;
|
||||
store.GetValue(ref title, propvariant);
|
||||
task.Title = propvariant.GetValue() ?? "";
|
||||
}
|
||||
return task;
|
||||
}
|
||||
|
||||
public static JumpList GetJumpList(Application application)
|
||||
{
|
||||
JumpList list;
|
||||
Standard.Verify.IsNotNull<Application>(application, "application");
|
||||
s_applicationMap.TryGetValue(application, out list);
|
||||
return list;
|
||||
}
|
||||
|
||||
private static Standard.IShellItem2 GetShellItemForPath(string path)
|
||||
{
|
||||
object obj2;
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Guid riid = new Guid("7e9fb0d3-919f-4307-ab2e-9b1860310c93");
|
||||
Standard.HRESULT hresult = Standard.NativeMethods.SHCreateItemFromParsingName(path, null, ref riid, out obj2);
|
||||
if ((hresult == ((Standard.HRESULT) Standard.Win32Error.ERROR_FILE_NOT_FOUND)) || (hresult == ((Standard.HRESULT) Standard.Win32Error.ERROR_PATH_NOT_FOUND)))
|
||||
{
|
||||
hresult = Standard.HRESULT.S_OK;
|
||||
obj2 = null;
|
||||
}
|
||||
hresult.ThrowIfFailed();
|
||||
return (Standard.IShellItem2) obj2;
|
||||
}
|
||||
|
||||
private static object GetShellObjectForJumpItem(JumpItem jumpItem)
|
||||
{
|
||||
JumpPath jumpPath = jumpItem as JumpPath;
|
||||
JumpTask jumpTask = jumpItem as JumpTask;
|
||||
if (jumpPath != null)
|
||||
{
|
||||
return CreateItemFromJumpPath(jumpPath);
|
||||
}
|
||||
if (jumpTask != null)
|
||||
{
|
||||
return CreateLinkFromJumpTask(jumpTask, true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static bool ListContainsShellObject(List<_ShellObjectPair> removedList, object shellObject)
|
||||
{
|
||||
if (removedList.Count != 0)
|
||||
{
|
||||
Standard.IShellItem item = shellObject as Standard.IShellItem;
|
||||
if (item != null)
|
||||
{
|
||||
foreach (_ShellObjectPair pair in removedList)
|
||||
{
|
||||
Standard.IShellItem psi = pair.ShellObject as Standard.IShellItem;
|
||||
if ((psi != null) && (item.Compare(psi, Standard.SICHINT.CANONICAL | Standard.SICHINT.TEST_FILESYSPATH_IF_NOT_EQUAL) == 0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
Standard.IShellLinkW shellLink = shellObject as Standard.IShellLinkW;
|
||||
if (shellLink != null)
|
||||
{
|
||||
foreach (_ShellObjectPair pair2 in removedList)
|
||||
{
|
||||
Standard.IShellLinkW kw2 = pair2.ShellObject as Standard.IShellLinkW;
|
||||
if (kw2 != null)
|
||||
{
|
||||
string str = ShellLinkToString(kw2);
|
||||
string str2 = ShellLinkToString(shellLink);
|
||||
if (str == str2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void RejectEverything()
|
||||
{
|
||||
EventHandler<JumpItemsRejectedEventArgs> jumpItemsRejected = this.JumpItemsRejected;
|
||||
if (jumpItemsRejected == null)
|
||||
{
|
||||
this._jumpItems.Clear();
|
||||
}
|
||||
else if (this._jumpItems.Count > 0)
|
||||
{
|
||||
List<JumpItemRejectionReason> reasons = new List<JumpItemRejectionReason>(this.JumpItems.Count);
|
||||
for (int i = 0; i < this.JumpItems.Count; i++)
|
||||
{
|
||||
reasons.Add(JumpItemRejectionReason.InvalidItem);
|
||||
}
|
||||
JumpItemsRejectedEventArgs e = new JumpItemsRejectedEventArgs(this.JumpItems, reasons);
|
||||
this._jumpItems.Clear();
|
||||
jumpItemsRejected(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetJumpList(Application application, JumpList value)
|
||||
{
|
||||
Standard.Verify.IsNotNull<Application>(application, "application");
|
||||
lock (s_lock)
|
||||
{
|
||||
JumpList list;
|
||||
if (s_applicationMap.TryGetValue(application, out list) && (list != null))
|
||||
{
|
||||
list._application = null;
|
||||
}
|
||||
s_applicationMap[application] = value;
|
||||
if (value != null)
|
||||
{
|
||||
value._application = application;
|
||||
}
|
||||
}
|
||||
if (value != null)
|
||||
{
|
||||
value.ApplyFromApplication();
|
||||
}
|
||||
}
|
||||
|
||||
private static string ShellLinkToString(Standard.IShellLinkW shellLink)
|
||||
{
|
||||
StringBuilder pszFile = new StringBuilder(260);
|
||||
shellLink.GetPath(pszFile, pszFile.Capacity, null, Standard.SLGP.RAWPATH);
|
||||
string str = null;
|
||||
using (PROPVARIANT propvariant = new PROPVARIANT())
|
||||
{
|
||||
Standard.IPropertyStore store = (Standard.IPropertyStore) shellLink;
|
||||
Standard.PKEY title = Standard.PKEY.Title;
|
||||
store.GetValue(ref title, propvariant);
|
||||
str = propvariant.GetValue() ?? "";
|
||||
}
|
||||
StringBuilder pszArgs = new StringBuilder(0x400);
|
||||
shellLink.GetArguments(pszArgs, pszArgs.Capacity);
|
||||
return (pszFile.ToString().ToUpperInvariant() + str.ToUpperInvariant() + pszArgs.ToString());
|
||||
}
|
||||
|
||||
private bool _IsUnmodified
|
||||
{
|
||||
get
|
||||
{
|
||||
return (((!this._initializing.HasValue && (this.JumpItems.Count == 0)) && !this.ShowRecentCategory) && !this.ShowFrequentCategory);
|
||||
}
|
||||
}
|
||||
|
||||
private static string _RuntimeId
|
||||
{
|
||||
get
|
||||
{
|
||||
string str;
|
||||
Standard.HRESULT currentProcessExplicitAppUserModelID = Standard.NativeMethods.GetCurrentProcessExplicitAppUserModelID(out str);
|
||||
if (currentProcessExplicitAppUserModelID == Standard.HRESULT.E_FAIL)
|
||||
{
|
||||
currentProcessExplicitAppUserModelID = Standard.HRESULT.S_OK;
|
||||
str = null;
|
||||
}
|
||||
currentProcessExplicitAppUserModelID.ThrowIfFailed();
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists")]
|
||||
public List<JumpItem> JumpItems
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._jumpItems;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowFrequentCategory { get; set; }
|
||||
|
||||
public bool ShowRecentCategory { get; set; }
|
||||
|
||||
private class _RejectedJumpItemPair
|
||||
{
|
||||
public Microsoft.Windows.Shell.JumpItem JumpItem { get; set; }
|
||||
|
||||
public JumpItemRejectionReason Reason { get; set; }
|
||||
}
|
||||
|
||||
private class _ShellObjectPair
|
||||
{
|
||||
public static void ReleaseShellObjects(List<JumpList._ShellObjectPair> list)
|
||||
{
|
||||
if (list != null)
|
||||
{
|
||||
foreach (JumpList._ShellObjectPair pair in list)
|
||||
{
|
||||
object shellObject = pair.ShellObject;
|
||||
pair.ShellObject = null;
|
||||
Standard.Utility.SafeRelease<object>(ref shellObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Microsoft.Windows.Shell.JumpItem JumpItem { get; set; }
|
||||
|
||||
public object ShellObject { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Microsoft.Windows.Shell
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
public class JumpPath : JumpItem
|
||||
{
|
||||
public string Path { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace Microsoft.Windows.Shell
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
public class JumpTask : JumpItem
|
||||
{
|
||||
public string ApplicationPath { get; set; }
|
||||
|
||||
public string Arguments { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
|
||||
public int IconResourceIndex { get; set; }
|
||||
|
||||
public string IconResourcePath { get; set; }
|
||||
|
||||
public string Title { get; set; }
|
||||
|
||||
public string WorkingDirectory { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum AC : byte
|
||||
{
|
||||
SRC_ALPHA = 1,
|
||||
SRC_OVER = 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum APPDOCLISTTYPE
|
||||
{
|
||||
ADLT_RECENT,
|
||||
ADLT_FREQUENT
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,232 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
|
||||
internal static class Assert
|
||||
{
|
||||
private static void _Break()
|
||||
{
|
||||
Debugger.Break();
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void AreEqual<T>(T expected, T actual)
|
||||
{
|
||||
if (expected == null)
|
||||
{
|
||||
if ((actual != null) && !actual.Equals(expected))
|
||||
{
|
||||
_Break();
|
||||
}
|
||||
}
|
||||
else if (!expected.Equals(actual))
|
||||
{
|
||||
_Break();
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void AreNotEqual<T>(T notExpected, T actual)
|
||||
{
|
||||
if (notExpected == null)
|
||||
{
|
||||
if ((actual == null) || actual.Equals(notExpected))
|
||||
{
|
||||
_Break();
|
||||
}
|
||||
}
|
||||
else if (notExpected.Equals(actual))
|
||||
{
|
||||
_Break();
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void BoundedDoubleInc(double lowerBoundInclusive, double value, double upperBoundInclusive)
|
||||
{
|
||||
if ((value < lowerBoundInclusive) || (value > upperBoundInclusive))
|
||||
{
|
||||
_Break();
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void BoundedInteger(int lowerBoundInclusive, int value, int upperBoundExclusive)
|
||||
{
|
||||
if ((value < lowerBoundInclusive) || (value >= upperBoundExclusive))
|
||||
{
|
||||
_Break();
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("Use Assert.AreEqual instead of Assert.Equals", false), Conditional("DEBUG")]
|
||||
public static void Equals<T>(T expected, T actual)
|
||||
{
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void Evaluate(EvaluateFunction argument)
|
||||
{
|
||||
argument();
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void Fail()
|
||||
{
|
||||
_Break();
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void Fail(string message)
|
||||
{
|
||||
_Break();
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void Implies(bool condition, ImplicationFunction result)
|
||||
{
|
||||
if (condition && !result())
|
||||
{
|
||||
_Break();
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void Implies(bool condition, bool result)
|
||||
{
|
||||
if (condition && !result)
|
||||
{
|
||||
_Break();
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void IsApartmentState(ApartmentState expectedState)
|
||||
{
|
||||
if (Thread.CurrentThread.GetApartmentState() != expectedState)
|
||||
{
|
||||
_Break();
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void IsDefault<T>(T value) where T: struct
|
||||
{
|
||||
value.Equals(default(T));
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void IsFalse(bool condition)
|
||||
{
|
||||
if (condition)
|
||||
{
|
||||
_Break();
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void IsFalse(bool condition, string message)
|
||||
{
|
||||
if (condition)
|
||||
{
|
||||
_Break();
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void IsNeitherNullNorEmpty(string value)
|
||||
{
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void IsNeitherNullNorWhitespace(string value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
_Break();
|
||||
}
|
||||
if (value.Trim().Length == 0)
|
||||
{
|
||||
_Break();
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void IsNotDefault<T>(T value) where T: struct
|
||||
{
|
||||
value.Equals(default(T));
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void IsNotNull<T>(T value) where T: class
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
_Break();
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void IsNotOnMainThread()
|
||||
{
|
||||
if (Application.Current.Dispatcher.CheckAccess())
|
||||
{
|
||||
_Break();
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void IsNull<T>(T item) where T: class
|
||||
{
|
||||
if (item != null)
|
||||
{
|
||||
_Break();
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void IsTrue(bool condition)
|
||||
{
|
||||
if (!condition)
|
||||
{
|
||||
_Break();
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void IsTrue(bool condition, string message)
|
||||
{
|
||||
if (!condition)
|
||||
{
|
||||
_Break();
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void NullableIsNotNull<T>(T? value) where T: struct
|
||||
{
|
||||
if (!value.HasValue)
|
||||
{
|
||||
_Break();
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void NullableIsNull<T>(T? value) where T: struct
|
||||
{
|
||||
if (value.HasValue)
|
||||
{
|
||||
_Break();
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void EvaluateFunction();
|
||||
|
||||
public delegate bool ImplicationFunction();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum BI
|
||||
{
|
||||
RGB
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct BITMAPINFO
|
||||
{
|
||||
public Standard.BITMAPINFOHEADER bmiHeader;
|
||||
public Standard.RGBQUAD bmiColors;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack=2)]
|
||||
internal struct BITMAPINFOHEADER
|
||||
{
|
||||
public int biSize;
|
||||
public int biWidth;
|
||||
public int biHeight;
|
||||
public short biPlanes;
|
||||
public short biBitCount;
|
||||
public Standard.BI biCompression;
|
||||
public int biSizeImage;
|
||||
public int biXPelsPerMeter;
|
||||
public int biYPelsPerMeter;
|
||||
public int biClrUsed;
|
||||
public int biClrImportant;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct BLENDFUNCTION
|
||||
{
|
||||
public Standard.AC BlendOp;
|
||||
public byte BlendFlags;
|
||||
public byte SourceConstantAlpha;
|
||||
public Standard.AC AlphaFormat;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct CHANGEFILTERSTRUCT
|
||||
{
|
||||
public uint cbSize;
|
||||
public Standard.MSGFLTINFO ExtStatus;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal static class CLSID
|
||||
{
|
||||
public const string ApplicationDestinations = "86c14003-4d6b-4ef3-a7b4-0506663b2e68";
|
||||
public const string ApplicationDocumentLists = "86bec222-30f2-47e0-9f25-60d11cd75c28";
|
||||
public const string DestinationList = "77f10cf0-3db5-4966-b520-b7c54fd35ed6";
|
||||
public const string EnumerableObjectCollection = "2d3468c1-36a7-43b6-ac24-d3f02fd9607a";
|
||||
public const string ShellLink = "00021401-0000-0000-C000-000000000046";
|
||||
public const string TaskbarList = "56FDF344-FD6D-11d0-958A-006097C9A090";
|
||||
|
||||
public static T CoCreateInstance<T>(string clsid)
|
||||
{
|
||||
return (T) Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid(clsid)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
|
||||
internal struct CREATESTRUCT
|
||||
{
|
||||
public IntPtr lpCreateParams;
|
||||
public IntPtr hInstance;
|
||||
public IntPtr hMenu;
|
||||
public IntPtr hwndParent;
|
||||
public int cy;
|
||||
public int cx;
|
||||
public int y;
|
||||
public int x;
|
||||
public Standard.WS style;
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
public string lpszName;
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
public string lpszClass;
|
||||
public Standard.WS_EX dwExStyle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
[Flags]
|
||||
internal enum CS : uint
|
||||
{
|
||||
BYTEALIGNCLIENT = 0x1000,
|
||||
BYTEALIGNWINDOW = 0x2000,
|
||||
CLASSDC = 0x40,
|
||||
DBLCLKS = 8,
|
||||
DROPSHADOW = 0x20000,
|
||||
GLOBALCLASS = 0x4000,
|
||||
HREDRAW = 2,
|
||||
IME = 0x10000,
|
||||
NOCLOSE = 0x200,
|
||||
OWNDC = 0x20,
|
||||
PARENTDC = 0x80,
|
||||
SAVEBITS = 0x800,
|
||||
VREDRAW = 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum CombineRgnResult
|
||||
{
|
||||
ERROR,
|
||||
NULLREGION,
|
||||
SIMPLEREGION,
|
||||
COMPLEXREGION
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum DOGIF
|
||||
{
|
||||
DEFAULT = 0,
|
||||
NO_HDROP = 2,
|
||||
NO_URL = 4,
|
||||
ONLY_IF_ONE = 8,
|
||||
TRAVERSE_LINK = 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum DWMFLIP3D
|
||||
{
|
||||
DEFAULT,
|
||||
EXCLUDEBELOW,
|
||||
EXCLUDEABOVE
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum DWMNCRP
|
||||
{
|
||||
USEWINDOWSTYLE,
|
||||
DISABLED,
|
||||
ENABLED
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum DWMWA
|
||||
{
|
||||
ALLOW_NCPAINT = 4,
|
||||
CAPTION_BUTTON_BOUNDS = 5,
|
||||
DISALLOW_PEEK = 11,
|
||||
EXCLUDED_FROM_PEEK = 12,
|
||||
EXTENDED_FRAME_BOUNDS = 9,
|
||||
FLIP3D_POLICY = 8,
|
||||
FORCE_ICONIC_REPRESENTATION = 7,
|
||||
HAS_ICONIC_BITMAP = 10,
|
||||
NCRENDERING_ENABLED = 1,
|
||||
NCRENDERING_POLICY = 2,
|
||||
NONCLIENT_RTL_LAYOUT = 6,
|
||||
TRANSITIONS_FORCEDISABLED = 3
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum DWM_SIT
|
||||
{
|
||||
None,
|
||||
DISPLAYFRAME
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack=1)]
|
||||
internal struct DWM_TIMING_INFO
|
||||
{
|
||||
public int cbSize;
|
||||
public Standard.UNSIGNED_RATIO rateRefresh;
|
||||
public ulong qpcRefreshPeriod;
|
||||
public Standard.UNSIGNED_RATIO rateCompose;
|
||||
public ulong qpcVBlank;
|
||||
public ulong cRefresh;
|
||||
public uint cDXRefresh;
|
||||
public ulong qpcCompose;
|
||||
public ulong cFrame;
|
||||
public uint cDXPresent;
|
||||
public ulong cRefreshFrame;
|
||||
public ulong cFrameSubmitted;
|
||||
public uint cDXPresentSubmitted;
|
||||
public ulong cFrameConfirmed;
|
||||
public uint cDXPresentConfirmed;
|
||||
public ulong cRefreshConfirmed;
|
||||
public uint cDXRefreshConfirmed;
|
||||
public ulong cFramesLate;
|
||||
public uint cFramesOutstanding;
|
||||
public ulong cFrameDisplayed;
|
||||
public ulong qpcFrameDisplayed;
|
||||
public ulong cRefreshFrameDisplayed;
|
||||
public ulong cFrameComplete;
|
||||
public ulong qpcFrameComplete;
|
||||
public ulong cFramePending;
|
||||
public ulong qpcFramePending;
|
||||
public ulong cFramesDisplayed;
|
||||
public ulong cFramesComplete;
|
||||
public ulong cFramesPending;
|
||||
public ulong cFramesAvailable;
|
||||
public ulong cFramesDropped;
|
||||
public ulong cFramesMissed;
|
||||
public ulong cRefreshNextDisplayed;
|
||||
public ulong cRefreshNextPresented;
|
||||
public ulong cRefreshesDisplayed;
|
||||
public ulong cRefreshesPresented;
|
||||
public ulong cRefreshStarted;
|
||||
public ulong cPixelsReceived;
|
||||
public ulong cPixelsDrawn;
|
||||
public ulong cBuffersEmpty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum DeviceCap
|
||||
{
|
||||
BITSPIXEL = 12,
|
||||
LOGPIXELSX = 0x58,
|
||||
LOGPIXELSY = 90,
|
||||
PLANES = 14
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
internal static class DoubleUtilities
|
||||
{
|
||||
private const double Epsilon = 1.53E-06;
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static bool AreClose(double value1, double value2)
|
||||
{
|
||||
if (value1 == value2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
double num = value1 - value2;
|
||||
return ((num < 1.53E-06) && (num > -1.53E-06));
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static bool GreaterThan(double value1, double value2)
|
||||
{
|
||||
return ((value1 > value2) && !AreClose(value1, value2));
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static bool GreaterThanOrClose(double value1, double value2)
|
||||
{
|
||||
if (value1 <= value2)
|
||||
{
|
||||
return AreClose(value1, value2);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static bool IsFinite(double value)
|
||||
{
|
||||
return (!double.IsNaN(value) && !double.IsInfinity(value));
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static bool IsValidSize(double value)
|
||||
{
|
||||
return (IsFinite(value) && GreaterThanOrClose(value, 0.0));
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static bool LessThan(double value1, double value2)
|
||||
{
|
||||
return ((value1 < value2) && !AreClose(value1, value2));
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static bool LessThanOrClose(double value1, double value2)
|
||||
{
|
||||
if (value1 >= value2)
|
||||
{
|
||||
return AreClose(value1, value2);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
internal static class DpiHelper
|
||||
{
|
||||
private static Matrix _transformToDevice;
|
||||
private static Matrix _transformToDip;
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline")]
|
||||
static DpiHelper()
|
||||
{
|
||||
using (Standard.SafeDC edc = Standard.SafeDC.GetDesktop())
|
||||
{
|
||||
int deviceCaps = Standard.NativeMethods.GetDeviceCaps(edc, Standard.DeviceCap.LOGPIXELSX);
|
||||
int num2 = Standard.NativeMethods.GetDeviceCaps(edc, Standard.DeviceCap.LOGPIXELSY);
|
||||
_transformToDip = Matrix.Identity;
|
||||
_transformToDip.Scale(96.0 / ((double) deviceCaps), 96.0 / ((double) num2));
|
||||
_transformToDevice = Matrix.Identity;
|
||||
_transformToDevice.Scale(((double) deviceCaps) / 96.0, ((double) num2) / 96.0);
|
||||
}
|
||||
}
|
||||
|
||||
public static Point DevicePixelsToLogical(Point devicePoint)
|
||||
{
|
||||
return _transformToDip.Transform(devicePoint);
|
||||
}
|
||||
|
||||
public static Rect DeviceRectToLogical(Rect deviceRectangle)
|
||||
{
|
||||
Point point = DevicePixelsToLogical(new Point(deviceRectangle.Left, deviceRectangle.Top));
|
||||
return new Rect(point, DevicePixelsToLogical(new Point(deviceRectangle.Right, deviceRectangle.Bottom)));
|
||||
}
|
||||
|
||||
public static Size DeviceSizeToLogical(Size deviceSize)
|
||||
{
|
||||
Point point = DevicePixelsToLogical(new Point(deviceSize.Width, deviceSize.Height));
|
||||
return new Size(point.X, point.Y);
|
||||
}
|
||||
|
||||
public static Point LogicalPixelsToDevice(Point logicalPoint)
|
||||
{
|
||||
return _transformToDevice.Transform(logicalPoint);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static Rect LogicalRectToDevice(Rect logicalRectangle)
|
||||
{
|
||||
Point point = LogicalPixelsToDevice(new Point(logicalRectangle.Left, logicalRectangle.Top));
|
||||
return new Rect(point, LogicalPixelsToDevice(new Point(logicalRectangle.Right, logicalRectangle.Bottom)));
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static Size LogicalSizeToDevice(Size logicalSize)
|
||||
{
|
||||
Point point = LogicalPixelsToDevice(new Point(logicalSize.Width, logicalSize.Height));
|
||||
return new Size { Width = point.X, Height = point.Y };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
[Flags]
|
||||
internal enum ErrorModes
|
||||
{
|
||||
Default = 0,
|
||||
FailCriticalErrors = 1,
|
||||
NoAlignmentFaultExcept = 4,
|
||||
NoGpFaultErrorBox = 2,
|
||||
NoOpenFileErrorBox = 0x8000
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum FO
|
||||
{
|
||||
COPY = 2,
|
||||
DELETE = 3,
|
||||
MOVE = 1,
|
||||
RENAME = 4
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum FOF : ushort
|
||||
{
|
||||
ALLOWUNDO = 0x40,
|
||||
CONFIRMMOUSE = 2,
|
||||
FILESONLY = 0x80,
|
||||
MULTIDESTFILES = 1,
|
||||
NO_CONNECTED_ELEMENTS = 0x2000,
|
||||
NOCONFIRMATION = 0x10,
|
||||
NOCONFIRMMKDIR = 0x200,
|
||||
NOCOPYSECURITYATTRIBS = 0x800,
|
||||
NOERRORUI = 0x400,
|
||||
NORECURSEREPARSE = 0x8000,
|
||||
NORECURSION = 0x1000,
|
||||
RENAMEONCOLLISION = 8,
|
||||
SILENT = 4,
|
||||
SIMPLEPROGRESS = 0x100,
|
||||
WANTMAPPINGHANDLE = 0x20,
|
||||
WANTNUKEWARNING = 0x4000
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum Facility
|
||||
{
|
||||
Control = 10,
|
||||
Dispatch = 2,
|
||||
Ese = 0xe5e,
|
||||
Itf = 4,
|
||||
Null = 0,
|
||||
Rpc = 1,
|
||||
Storage = 3,
|
||||
Win32 = 7,
|
||||
WinCodec = 0x898,
|
||||
Windows = 8
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum GCLP
|
||||
{
|
||||
HBRBACKGROUND = -10
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum GPS
|
||||
{
|
||||
BESTEFFORT = 0x40,
|
||||
DEFAULT = 0,
|
||||
DELAYCREATION = 0x20,
|
||||
FASTPROPERTIESONLY = 8,
|
||||
HANDLERPROPERTIESONLY = 1,
|
||||
MASK_VALID = 0xff,
|
||||
NO_OPLOCK = 0x80,
|
||||
OPENSLOWITEM = 0x10,
|
||||
READWRITE = 2,
|
||||
TEMPORARY = 4
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum GWL
|
||||
{
|
||||
EXSTYLE = -20,
|
||||
HINSTANCE = -6,
|
||||
HWNDPARENT = -8,
|
||||
ID = -12,
|
||||
STYLE = -16,
|
||||
USERDATA = -21,
|
||||
WNDPROC = -4
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
[Flags]
|
||||
internal enum HCF
|
||||
{
|
||||
AVAILABLE = 2,
|
||||
CONFIRMHOTKEY = 8,
|
||||
HIGHCONTRASTON = 1,
|
||||
HOTKEYACTIVE = 4,
|
||||
HOTKEYAVAILABLE = 0x40,
|
||||
HOTKEYSOUND = 0x10,
|
||||
INDICATOR = 0x20
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct HIGHCONTRAST
|
||||
{
|
||||
public int cbSize;
|
||||
public Standard.HCF dwFlags;
|
||||
public IntPtr lpszDefaultScheme;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,236 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
internal struct HRESULT
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
private readonly uint _value;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
public static readonly Standard.HRESULT COR_E_OBJECTDISPOSED;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
public static readonly Standard.HRESULT DESTS_E_NO_MATCHING_ASSOC_HANDLER;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
public static readonly Standard.HRESULT DESTS_E_NORECDOCS;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
public static readonly Standard.HRESULT DESTS_E_NOTALLCLEARED;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
public static readonly Standard.HRESULT E_ABORT;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
public static readonly Standard.HRESULT E_ACCESSDENIED;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
public static readonly Standard.HRESULT E_FAIL;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
public static readonly Standard.HRESULT E_INVALIDARG;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
public static readonly Standard.HRESULT E_NOINTERFACE;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
public static readonly Standard.HRESULT E_NOTIMPL;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
public static readonly Standard.HRESULT E_OUTOFMEMORY;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
public static readonly Standard.HRESULT E_PENDING;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
public static readonly Standard.HRESULT E_POINTER;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
public static readonly Standard.HRESULT E_UNEXPECTED;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
public static readonly Standard.HRESULT INTSAFE_E_ARITHMETIC_OVERFLOW;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
public static readonly Standard.HRESULT REGDB_E_CLASSNOTREG;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
public static readonly Standard.HRESULT S_FALSE;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
public static readonly Standard.HRESULT S_OK;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
public static readonly Standard.HRESULT STG_E_INVALIDFUNCTION;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
public static readonly Standard.HRESULT WC_E_GREATERTHAN;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
public static readonly Standard.HRESULT WC_E_SYNTAX;
|
||||
|
||||
static HRESULT()
|
||||
{
|
||||
S_OK = new Standard.HRESULT(0);
|
||||
S_FALSE = new Standard.HRESULT(1);
|
||||
E_PENDING = new Standard.HRESULT(0x8000000a);
|
||||
E_NOTIMPL = new Standard.HRESULT(0x80004001);
|
||||
E_NOINTERFACE = new Standard.HRESULT(0x80004002);
|
||||
E_POINTER = new Standard.HRESULT(0x80004003);
|
||||
E_ABORT = new Standard.HRESULT(0x80004004);
|
||||
E_FAIL = new Standard.HRESULT(0x80004005);
|
||||
E_UNEXPECTED = new Standard.HRESULT(0x8000ffff);
|
||||
STG_E_INVALIDFUNCTION = new Standard.HRESULT(0x80030001);
|
||||
REGDB_E_CLASSNOTREG = new Standard.HRESULT(0x80040154);
|
||||
DESTS_E_NO_MATCHING_ASSOC_HANDLER = new Standard.HRESULT(0x80040f03);
|
||||
DESTS_E_NORECDOCS = new Standard.HRESULT(0x80040f04);
|
||||
DESTS_E_NOTALLCLEARED = new Standard.HRESULT(0x80040f05);
|
||||
E_ACCESSDENIED = new Standard.HRESULT(0x80070005);
|
||||
E_OUTOFMEMORY = new Standard.HRESULT(0x8007000e);
|
||||
E_INVALIDARG = new Standard.HRESULT(0x80070057);
|
||||
INTSAFE_E_ARITHMETIC_OVERFLOW = new Standard.HRESULT(0x80070216);
|
||||
COR_E_OBJECTDISPOSED = new Standard.HRESULT(0x80131622);
|
||||
WC_E_GREATERTHAN = new Standard.HRESULT(0xc00cee23);
|
||||
WC_E_SYNTAX = new Standard.HRESULT(0xc00cee2d);
|
||||
}
|
||||
|
||||
public HRESULT(uint i)
|
||||
{
|
||||
this._value = i;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
return (((Standard.HRESULT) obj)._value == this._value);
|
||||
}
|
||||
catch (InvalidCastException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetCode(int error)
|
||||
{
|
||||
return (error & 0xffff);
|
||||
}
|
||||
|
||||
public static Standard.Facility GetFacility(int errorCode)
|
||||
{
|
||||
return (((Standard.Facility) (errorCode >> 0x10)) & ((Standard.Facility) 0x1fff));
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return this._value.GetHashCode();
|
||||
}
|
||||
|
||||
public static Standard.HRESULT Make(bool severe, Standard.Facility facility, int code)
|
||||
{
|
||||
return new Standard.HRESULT((uint) (((severe ? -2147483648 : 0) | (((int) facility) << 0x10)) | code));
|
||||
}
|
||||
|
||||
public static bool operator ==(Standard.HRESULT hrLeft, Standard.HRESULT hrRight)
|
||||
{
|
||||
return (hrLeft._value == hrRight._value);
|
||||
}
|
||||
|
||||
public static bool operator !=(Standard.HRESULT hrLeft, Standard.HRESULT hrRight)
|
||||
{
|
||||
return !(hrLeft == hrRight);
|
||||
}
|
||||
|
||||
public void ThrowIfFailed()
|
||||
{
|
||||
this.ThrowIfFailed(null);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes", Justification="Only recreating Exceptions that were already raised."), SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")]
|
||||
public void ThrowIfFailed(string message)
|
||||
{
|
||||
if (this.Failed)
|
||||
{
|
||||
if (string.IsNullOrEmpty(message))
|
||||
{
|
||||
message = this.ToString();
|
||||
}
|
||||
Exception exceptionForHR = Marshal.GetExceptionForHR((int) this._value, new IntPtr(-1));
|
||||
if (exceptionForHR.GetType() == typeof(COMException))
|
||||
{
|
||||
if (this.Facility == Standard.Facility.Win32)
|
||||
{
|
||||
exceptionForHR = new Win32Exception(this.Code, message);
|
||||
}
|
||||
else
|
||||
{
|
||||
exceptionForHR = new COMException(message, (int) this._value);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ConstructorInfo constructor = exceptionForHR.GetType().GetConstructor(new Type[] { typeof(string) });
|
||||
if (null != constructor)
|
||||
{
|
||||
exceptionForHR = constructor.Invoke(new object[] { message }) as Exception;
|
||||
}
|
||||
}
|
||||
throw exceptionForHR;
|
||||
}
|
||||
}
|
||||
|
||||
public static void ThrowLastError()
|
||||
{
|
||||
((Standard.HRESULT) Standard.Win32Error.GetLastError()).ThrowIfFailed();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
foreach (FieldInfo info in typeof(Standard.HRESULT).GetFields(BindingFlags.Public | BindingFlags.Static))
|
||||
{
|
||||
if (info.FieldType == typeof(Standard.HRESULT))
|
||||
{
|
||||
Standard.HRESULT hresult = (Standard.HRESULT) info.GetValue(null);
|
||||
if (hresult == this)
|
||||
{
|
||||
return info.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.Facility == Standard.Facility.Win32)
|
||||
{
|
||||
foreach (FieldInfo info2 in typeof(Standard.Win32Error).GetFields(BindingFlags.Public | BindingFlags.Static))
|
||||
{
|
||||
if (info2.FieldType == typeof(Standard.Win32Error))
|
||||
{
|
||||
Standard.Win32Error error = (Standard.Win32Error) info2.GetValue(null);
|
||||
if (((Standard.HRESULT) error) == this)
|
||||
{
|
||||
return ("HRESULT_FROM_WIN32(" + info2.Name + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return string.Format(CultureInfo.InvariantCulture, "0x{0:X8}", new object[] { this._value });
|
||||
}
|
||||
|
||||
public int Code
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetCode((int) this._value);
|
||||
}
|
||||
}
|
||||
|
||||
public Standard.Facility Facility
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetFacility((int) this._value);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Failed
|
||||
{
|
||||
get
|
||||
{
|
||||
return (this._value < 0);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Succeeded
|
||||
{
|
||||
get
|
||||
{
|
||||
return (this._value >= 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum HT
|
||||
{
|
||||
BORDER = 0x12,
|
||||
BOTTOM = 15,
|
||||
BOTTOMLEFT = 0x10,
|
||||
BOTTOMRIGHT = 0x11,
|
||||
CAPTION = 2,
|
||||
CLIENT = 1,
|
||||
CLOSE = 20,
|
||||
ERROR = -2,
|
||||
GROWBOX = 4,
|
||||
HELP = 0x15,
|
||||
HSCROLL = 6,
|
||||
LEFT = 10,
|
||||
MAXBUTTON = 9,
|
||||
MENU = 5,
|
||||
MINBUTTON = 8,
|
||||
NOWHERE = 0,
|
||||
OBJECT = 0x13,
|
||||
REDUCE = 8,
|
||||
RIGHT = 11,
|
||||
SIZE = 4,
|
||||
SIZEFIRST = 10,
|
||||
SIZELAST = 0x11,
|
||||
SYSMENU = 3,
|
||||
TOP = 12,
|
||||
TOPLEFT = 13,
|
||||
TOPRIGHT = 14,
|
||||
TRANSPARENT = -1,
|
||||
VSCROLL = 7,
|
||||
ZOOM = 9
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[ComImport, Guid("12337d35-94c6-48a0-bce7-6a9c69d4d600"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
internal interface IApplicationDestinations
|
||||
{
|
||||
void SetAppID([In, MarshalAs(UnmanagedType.LPWStr)] string pszAppID);
|
||||
void RemoveDestination([MarshalAs(UnmanagedType.IUnknown)] object punk);
|
||||
void RemoveAllDestinations();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[ComImport, Guid("3c594f9f-9f30-47a1-979a-c9e83d3d0a06"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
internal interface IApplicationDocumentLists
|
||||
{
|
||||
void SetAppID([MarshalAs(UnmanagedType.LPWStr)] string pszAppID);
|
||||
[return: MarshalAs(UnmanagedType.IUnknown)]
|
||||
object GetList([In] Standard.APPDOCLISTTYPE listtype, [In] uint cItemsDesired, [In] ref Guid riid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[ComImport, Guid("6332debf-87b5-4670-90c0-5e57b408a49e"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
internal interface ICustomDestinationList
|
||||
{
|
||||
void SetAppID([In, MarshalAs(UnmanagedType.LPWStr)] string pszAppID);
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
object BeginList(out uint pcMaxSlots, [In] ref Guid riid);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT AppendCategory([MarshalAs(UnmanagedType.LPWStr)] string pszCategory, Standard.IObjectArray poa);
|
||||
void AppendKnownCategory(Standard.KDC category);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT AddUserTasks(Standard.IObjectArray poa);
|
||||
void CommitList();
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
object GetRemovedDestinations([In] ref Guid riid);
|
||||
void DeleteList([MarshalAs(UnmanagedType.LPWStr)] string pszAppID);
|
||||
void AbortList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[ComImport, Guid("000214F2-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
internal interface IEnumIDList
|
||||
{
|
||||
[PreserveSig]
|
||||
Standard.HRESULT Next(uint celt, out IntPtr rgelt, out int pceltFetched);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT Skip(uint celt);
|
||||
void Reset();
|
||||
void Clone([MarshalAs(UnmanagedType.Interface)] out Standard.IEnumIDList ppenum);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[ComImport, Guid("2c1c7e2e-2d0e-4059-831e-1e6f82335c2e"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
internal interface IEnumObjects
|
||||
{
|
||||
void Next(uint celt, [In] ref Guid riid, [Out, MarshalAs(UnmanagedType.LPArray, ArraySubType=UnmanagedType.IUnknown, SizeParamIndex=0)] object[] rgelt, out uint pceltFetched);
|
||||
void Skip(uint celt);
|
||||
void Reset();
|
||||
Standard.IEnumObjects Clone();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal static class IID
|
||||
{
|
||||
public const string ApplicationDestinations = "12337d35-94c6-48a0-bce7-6a9c69d4d600";
|
||||
public const string ApplicationDocumentLists = "3c594f9f-9f30-47a1-979a-c9e83d3d0a06";
|
||||
public const string CustomDestinationList = "6332debf-87b5-4670-90c0-5e57b408a49e";
|
||||
public const string EnumIdList = "000214F2-0000-0000-C000-000000000046";
|
||||
public const string EnumObjects = "2c1c7e2e-2d0e-4059-831e-1e6f82335c2e";
|
||||
public const string HtmlDocument2 = "332C4425-26CB-11D0-B483-00C04FD90119";
|
||||
public const string ModalWindow = "b4db1657-70d7-485e-8e3e-6fcb5a5c1802";
|
||||
public const string ObjectArray = "92CA9DCD-5622-4bba-A805-5E9F541BD8C9";
|
||||
public const string ObjectCollection = "5632b1a4-e38a-400a-928a-d4cd63230295";
|
||||
public const string ObjectWithAppUserModelId = "36db0196-9665-46d1-9ba7-d3709eecf9ed";
|
||||
public const string ObjectWithProgId = "71e806fb-8dee-46fc-bf8c-7748a8a1ae13";
|
||||
public const string PropertyNotifySink = "9BFBBC02-EFF1-101A-84ED-00AA00341D07";
|
||||
public const string PropertyStore = "886d8eeb-8cf2-4446-8d02-cdba1dbdcf99";
|
||||
public const string ServiceProvider = "6d5140c1-7436-11ce-8034-00aa006009fa";
|
||||
public const string ShellFolder = "000214E6-0000-0000-C000-000000000046";
|
||||
public const string ShellItem = "43826d1e-e718-42ee-bc55-a1e261c37bfe";
|
||||
public const string ShellItem2 = "7e9fb0d3-919f-4307-ab2e-9b1860310c93";
|
||||
public const string ShellItemArray = "B63EA76D-1F85-456F-A19C-48159EFA858B";
|
||||
public const string ShellLink = "000214F9-0000-0000-C000-000000000046";
|
||||
public const string TaskbarList = "56FDF342-FD6D-11d0-958A-006097C9A090";
|
||||
public const string TaskbarList2 = "602D4995-B13A-429b-A66E-1935E44F4317";
|
||||
public const string TaskbarList3 = "ea1afb91-9e28-4b86-90e9-9e9f8a5eefaf";
|
||||
public const string TaskbarList4 = "c43dc798-95d1-4bea-9030-bb99e2983a1a";
|
||||
public const string Unknown = "00000000-0000-0000-C000-000000000046";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct INPUT
|
||||
{
|
||||
public uint type;
|
||||
public Standard.MOUSEINPUT mi;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum INPUT_TYPE : uint
|
||||
{
|
||||
MOUSE = 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("92CA9DCD-5622-4bba-A805-5E9F541BD8C9")]
|
||||
internal interface IObjectArray
|
||||
{
|
||||
uint GetCount();
|
||||
[return: MarshalAs(UnmanagedType.IUnknown)]
|
||||
object GetAt([In] uint uiIndex, [In] ref Guid riid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("92CA9DCD-5622-4bba-A805-5E9F541BD8C9")]
|
||||
internal interface IObjectCollection : Standard.IObjectArray
|
||||
{
|
||||
uint GetCount();
|
||||
[return: MarshalAs(UnmanagedType.IUnknown)]
|
||||
object GetAt([In] uint uiIndex, [In] ref Guid riid);
|
||||
void AddObject([MarshalAs(UnmanagedType.IUnknown)] object punk);
|
||||
void AddFromArray(Standard.IObjectArray poaSource);
|
||||
void RemoveObjectAt(uint uiIndex);
|
||||
void Clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[ComImport, Guid("36db0196-9665-46d1-9ba7-d3709eecf9ed"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
internal interface IObjectWithAppUserModelId
|
||||
{
|
||||
void SetAppID([MarshalAs(UnmanagedType.LPWStr)] string pszAppID);
|
||||
[return: MarshalAs(UnmanagedType.LPWStr)]
|
||||
string GetAppID();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[ComImport, Guid("71e806fb-8dee-46fc-bf8c-7748a8a1ae13"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
internal interface IObjectWithProgId
|
||||
{
|
||||
void SetProgID([MarshalAs(UnmanagedType.LPWStr)] string pszProgID);
|
||||
[return: MarshalAs(UnmanagedType.LPWStr)]
|
||||
string GetProgID();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[ComImport, Guid("886d8eeb-8cf2-4446-8d02-cdba1dbdcf99"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
internal interface IPropertyStore
|
||||
{
|
||||
uint GetCount();
|
||||
Standard.PKEY GetAt(uint iProp);
|
||||
void GetValue([In] ref Standard.PKEY pkey, [In, Out] PROPVARIANT pv);
|
||||
void SetValue([In] ref Standard.PKEY pkey, PROPVARIANT pv);
|
||||
void Commit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
|
||||
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("000214E6-0000-0000-C000-000000000046")]
|
||||
internal interface IShellFolder
|
||||
{
|
||||
void ParseDisplayName([In] IntPtr hwnd, [In] IBindCtx pbc, [In, MarshalAs(UnmanagedType.LPWStr)] string pszDisplayName, [In, Out] ref int pchEaten, out IntPtr ppidl, [In, Out] ref uint pdwAttributes);
|
||||
Standard.IEnumIDList EnumObjects([In] IntPtr hwnd, [In] Standard.SHCONTF grfFlags);
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
object BindToObject([In] IntPtr pidl, [In] IBindCtx pbc, [In] ref Guid riid);
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
object BindToStorage([In] IntPtr pidl, [In] IBindCtx pbc, [In] ref Guid riid);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT CompareIDs([In] IntPtr lParam, [In] IntPtr pidl1, [In] IntPtr pidl2);
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
object CreateViewObject([In] IntPtr hwndOwner, [In] ref Guid riid);
|
||||
void GetAttributesOf([In] uint cidl, [In] IntPtr apidl, [In, Out] ref Standard.SFGAO rgfInOut);
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
object GetUIObjectOf([In] IntPtr hwndOwner, [In] uint cidl, [In, MarshalAs(UnmanagedType.LPArray, ArraySubType=UnmanagedType.SysInt, SizeParamIndex=2)] IntPtr apidl, [In] ref Guid riid, [In, Out] ref uint rgfReserved);
|
||||
void GetDisplayNameOf([In] IntPtr pidl, [In] Standard.SHGDN uFlags, out IntPtr pName);
|
||||
void SetNameOf([In] IntPtr hwnd, [In] IntPtr pidl, [In, MarshalAs(UnmanagedType.LPWStr)] string pszName, [In] Standard.SHGDN uFlags, out IntPtr ppidlOut);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
|
||||
[ComImport, Guid("43826d1e-e718-42ee-bc55-a1e261c37bfe"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
internal interface IShellItem
|
||||
{
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
object BindToHandler(IBindCtx pbc, [In] ref Guid bhid, [In] ref Guid riid);
|
||||
Standard.IShellItem GetParent();
|
||||
[return: MarshalAs(UnmanagedType.LPWStr)]
|
||||
string GetDisplayName(Standard.SIGDN sigdnName);
|
||||
Standard.SFGAO GetAttributes(Standard.SFGAO sfgaoMask);
|
||||
int Compare(Standard.IShellItem psi, Standard.SICHINT hint);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
|
||||
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("7e9fb0d3-919f-4307-ab2e-9b1860310c93")]
|
||||
internal interface IShellItem2 : Standard.IShellItem
|
||||
{
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
object BindToHandler([In] IBindCtx pbc, [In] ref Guid bhid, [In] ref Guid riid);
|
||||
Standard.IShellItem GetParent();
|
||||
[return: MarshalAs(UnmanagedType.LPWStr)]
|
||||
string GetDisplayName(Standard.SIGDN sigdnName);
|
||||
Standard.SFGAO GetAttributes(Standard.SFGAO sfgaoMask);
|
||||
int Compare(Standard.IShellItem psi, Standard.SICHINT hint);
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
object GetPropertyStore(Standard.GPS flags, [In] ref Guid riid);
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
object GetPropertyStoreWithCreateObject(Standard.GPS flags, [MarshalAs(UnmanagedType.IUnknown)] object punkCreateObject, [In] ref Guid riid);
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
object GetPropertyStoreForKeys(IntPtr rgKeys, uint cKeys, Standard.GPS flags, [In] ref Guid riid);
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
object GetPropertyDescriptionList(IntPtr keyType, [In] ref Guid riid);
|
||||
void Update(IBindCtx pbc);
|
||||
PROPVARIANT GetProperty(IntPtr key);
|
||||
Guid GetCLSID(IntPtr key);
|
||||
System.Runtime.InteropServices.ComTypes.FILETIME GetFileTime(IntPtr key);
|
||||
int GetInt32(IntPtr key);
|
||||
[return: MarshalAs(UnmanagedType.LPWStr)]
|
||||
string GetString(IntPtr key);
|
||||
uint GetUInt32(IntPtr key);
|
||||
ulong GetUInt64(IntPtr key);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
void GetBool(IntPtr key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
|
||||
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("B63EA76D-1F85-456F-A19C-48159EFA858B")]
|
||||
internal interface IShellItemArray
|
||||
{
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
object BindToHandler(IBindCtx pbc, [In] ref Guid rbhid, [In] ref Guid riid);
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
object GetPropertyStore(int flags, [In] ref Guid riid);
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
object GetPropertyDescriptionList([In] ref Standard.PKEY keyType, [In] ref Guid riid);
|
||||
uint GetAttributes(Standard.SIATTRIBFLAGS dwAttribFlags, uint sfgaoMask);
|
||||
uint GetCount();
|
||||
Standard.IShellItem GetItemAt(uint dwIndex);
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
object EnumItems();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
[ComImport, Guid("000214F9-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
internal interface IShellLinkW
|
||||
{
|
||||
void GetPath([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFile, int cchMaxPath, [In, Out] Standard.WIN32_FIND_DATAW pfd, Standard.SLGP fFlags);
|
||||
void GetIDList(out IntPtr ppidl);
|
||||
void SetIDList(IntPtr pidl);
|
||||
void GetDescription([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFile, int cchMaxName);
|
||||
void SetDescription([MarshalAs(UnmanagedType.LPWStr)] string pszName);
|
||||
void GetWorkingDirectory([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszDir, int cchMaxPath);
|
||||
void SetWorkingDirectory([MarshalAs(UnmanagedType.LPWStr)] string pszDir);
|
||||
void GetArguments([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszArgs, int cchMaxPath);
|
||||
void SetArguments([MarshalAs(UnmanagedType.LPWStr)] string pszArgs);
|
||||
short GetHotKey();
|
||||
void SetHotKey(short wHotKey);
|
||||
uint GetShowCmd();
|
||||
void SetShowCmd(uint iShowCmd);
|
||||
void GetIconLocation([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszIconPath, int cchIconPath, out int piIcon);
|
||||
void SetIconLocation([MarshalAs(UnmanagedType.LPWStr)] string pszIconPath, int iIcon);
|
||||
void SetRelativePath([MarshalAs(UnmanagedType.LPWStr)] string pszPathRel, uint dwReserved);
|
||||
void Resolve(IntPtr hwnd, uint fFlags);
|
||||
void SetPath([MarshalAs(UnmanagedType.LPWStr)] string pszFile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[ComImport, Guid("56FDF342-FD6D-11d0-958A-006097C9A090"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
internal interface ITaskbarList
|
||||
{
|
||||
void HrInit();
|
||||
void AddTab(IntPtr hwnd);
|
||||
void DeleteTab(IntPtr hwnd);
|
||||
void ActivateTab(IntPtr hwnd);
|
||||
void SetActiveAlt(IntPtr hwnd);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[ComImport, Guid("602D4995-B13A-429b-A66E-1935E44F4317"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
internal interface ITaskbarList2 : Standard.ITaskbarList
|
||||
{
|
||||
void HrInit();
|
||||
void AddTab(IntPtr hwnd);
|
||||
void DeleteTab(IntPtr hwnd);
|
||||
void ActivateTab(IntPtr hwnd);
|
||||
void SetActiveAlt(IntPtr hwnd);
|
||||
void MarkFullscreenWindow(IntPtr hwnd, [MarshalAs(UnmanagedType.Bool)] bool fFullscreen);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[ComImport, Guid("ea1afb91-9e28-4b86-90e9-9e9f8a5eefaf"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
internal interface ITaskbarList3 : Standard.ITaskbarList2, Standard.ITaskbarList
|
||||
{
|
||||
void HrInit();
|
||||
void AddTab(IntPtr hwnd);
|
||||
void DeleteTab(IntPtr hwnd);
|
||||
void ActivateTab(IntPtr hwnd);
|
||||
void SetActiveAlt(IntPtr hwnd);
|
||||
void MarkFullscreenWindow(IntPtr hwnd, [MarshalAs(UnmanagedType.Bool)] bool fFullscreen);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT SetProgressValue(IntPtr hwnd, ulong ullCompleted, ulong ullTotal);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT SetProgressState(IntPtr hwnd, Standard.TBPF tbpFlags);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT RegisterTab(IntPtr hwndTab, IntPtr hwndMDI);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT UnregisterTab(IntPtr hwndTab);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT SetTabOrder(IntPtr hwndTab, IntPtr hwndInsertBefore);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT SetTabActive(IntPtr hwndTab, IntPtr hwndMDI, uint dwReserved);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT ThumbBarAddButtons(IntPtr hwnd, uint cButtons, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex=1)] Standard.THUMBBUTTON[] pButtons);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT ThumbBarUpdateButtons(IntPtr hwnd, uint cButtons, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex=1)] Standard.THUMBBUTTON[] pButtons);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT ThumbBarSetImageList(IntPtr hwnd, [MarshalAs(UnmanagedType.IUnknown)] object himl);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT SetOverlayIcon(IntPtr hwnd, IntPtr hIcon, [MarshalAs(UnmanagedType.LPWStr)] string pszDescription);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT SetThumbnailTooltip(IntPtr hwnd, [MarshalAs(UnmanagedType.LPWStr)] string pszTip);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT SetThumbnailClip(IntPtr hwnd, Standard.RefRECT prcClip);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("ea1afb91-9e28-4b86-90e9-9e9f8a5eefaf")]
|
||||
internal interface ITaskbarList4 : Standard.ITaskbarList3, Standard.ITaskbarList2, Standard.ITaskbarList
|
||||
{
|
||||
void HrInit();
|
||||
void AddTab(IntPtr hwnd);
|
||||
void DeleteTab(IntPtr hwnd);
|
||||
void ActivateTab(IntPtr hwnd);
|
||||
void SetActiveAlt(IntPtr hwnd);
|
||||
void MarkFullscreenWindow(IntPtr hwnd, [MarshalAs(UnmanagedType.Bool)] bool fFullscreen);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT SetProgressValue(IntPtr hwnd, ulong ullCompleted, ulong ullTotal);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT SetProgressState(IntPtr hwnd, Standard.TBPF tbpFlags);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT RegisterTab(IntPtr hwndTab, IntPtr hwndMDI);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT UnregisterTab(IntPtr hwndTab);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT SetTabOrder(IntPtr hwndTab, IntPtr hwndInsertBefore);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT SetTabActive(IntPtr hwndTab, IntPtr hwndMDI, uint dwReserved);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT ThumbBarAddButtons(IntPtr hwnd, uint cButtons, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex=1)] Standard.THUMBBUTTON[] pButtons);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT ThumbBarUpdateButtons(IntPtr hwnd, uint cButtons, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex=1)] Standard.THUMBBUTTON[] pButtons);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT ThumbBarSetImageList(IntPtr hwnd, [MarshalAs(UnmanagedType.IUnknown)] object himl);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT SetOverlayIcon(IntPtr hwnd, IntPtr hIcon, [MarshalAs(UnmanagedType.LPWStr)] string pszDescription);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT SetThumbnailTooltip(IntPtr hwnd, [MarshalAs(UnmanagedType.LPWStr)] string pszTip);
|
||||
[PreserveSig]
|
||||
Standard.HRESULT SetThumbnailClip(IntPtr hwnd, Standard.RefRECT prcClip);
|
||||
void SetTabProperties(IntPtr hwndTab, Standard.STPF stpFlags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum KDC
|
||||
{
|
||||
FREQUENT = 1,
|
||||
RECENT = 2
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
|
||||
internal struct LOGFONT
|
||||
{
|
||||
public int lfHeight;
|
||||
public int lfWidth;
|
||||
public int lfEscapement;
|
||||
public int lfOrientation;
|
||||
public int lfWeight;
|
||||
public byte lfItalic;
|
||||
public byte lfUnderline;
|
||||
public byte lfStrikeOut;
|
||||
public byte lfCharSet;
|
||||
public byte lfOutPrecision;
|
||||
public byte lfClipPrecision;
|
||||
public byte lfQuality;
|
||||
public byte lfPitchAndFamily;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=0x20)]
|
||||
public string lfFaceName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct MARGINS
|
||||
{
|
||||
public int cxLeftWidth;
|
||||
public int cxRightWidth;
|
||||
public int cyTopHeight;
|
||||
public int cyBottomHeight;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
[Flags]
|
||||
internal enum MF : uint
|
||||
{
|
||||
BYCOMMAND = 0,
|
||||
DISABLED = 2,
|
||||
DOES_NOT_EXIST = 0xffffffff,
|
||||
ENABLED = 0,
|
||||
GRAYED = 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct MINMAXINFO
|
||||
{
|
||||
public Standard.POINT ptReserved;
|
||||
public Standard.POINT ptMaxSize;
|
||||
public Standard.POINT ptMaxPosition;
|
||||
public Standard.POINT ptMinTrackSize;
|
||||
public Standard.POINT ptMaxTrackSize;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal class MONITORINFO
|
||||
{
|
||||
public int cbSize = Marshal.SizeOf(typeof(Standard.MONITORINFO));
|
||||
public Standard.RECT rcMonitor;
|
||||
public Standard.RECT rcWork;
|
||||
public int dwFlags;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum MOUSEEVENTF
|
||||
{
|
||||
LEFTDOWN = 2,
|
||||
LEFTUP = 4
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct MOUSEINPUT
|
||||
{
|
||||
public int dx;
|
||||
public int dy;
|
||||
public int mouseData;
|
||||
public int dwFlags;
|
||||
public int time;
|
||||
public IntPtr dwExtraInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum MSGFLT
|
||||
{
|
||||
RESET,
|
||||
ALLOW,
|
||||
DISALLOW
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum MSGFLTINFO
|
||||
{
|
||||
NONE,
|
||||
ALREADYALLOWED_FORWND,
|
||||
ALREADYDISALLOWED_FORWND,
|
||||
ALLOWED_HIGHER
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
|
||||
internal sealed class ManagedIStream : IStream, IDisposable
|
||||
{
|
||||
private Stream _source;
|
||||
private const int LOCK_EXCLUSIVE = 2;
|
||||
private const int STGM_READWRITE = 2;
|
||||
private const int STGTY_STREAM = 2;
|
||||
|
||||
public ManagedIStream(Stream source)
|
||||
{
|
||||
Standard.Verify.IsNotNull<Stream>(source, "source");
|
||||
this._source = source;
|
||||
}
|
||||
|
||||
private void _Validate()
|
||||
{
|
||||
if (this._source == null)
|
||||
{
|
||||
throw new ObjectDisposedException("this");
|
||||
}
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId="Standard.HRESULT.ThrowIfFailed(System.String)"), Obsolete("The method is not implemented", true)]
|
||||
public void Clone(out IStream ppstm)
|
||||
{
|
||||
ppstm = null;
|
||||
Standard.HRESULT.STG_E_INVALIDFUNCTION.ThrowIfFailed("The method is not implemented.");
|
||||
}
|
||||
|
||||
public void Commit(int grfCommitFlags)
|
||||
{
|
||||
this._Validate();
|
||||
this._source.Flush();
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands"), SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId="0")]
|
||||
public void CopyTo(IStream pstm, long cb, IntPtr pcbRead, IntPtr pcbWritten)
|
||||
{
|
||||
Standard.Verify.IsNotNull<IStream>(pstm, "pstm");
|
||||
this._Validate();
|
||||
byte[] buffer = new byte[0x1000];
|
||||
long val = 0L;
|
||||
while (val < cb)
|
||||
{
|
||||
int num2 = this._source.Read(buffer, 0, buffer.Length);
|
||||
if (num2 == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
pstm.Write(buffer, num2, IntPtr.Zero);
|
||||
val += num2;
|
||||
}
|
||||
if (IntPtr.Zero != pcbRead)
|
||||
{
|
||||
Marshal.WriteInt64(pcbRead, val);
|
||||
}
|
||||
if (IntPtr.Zero != pcbWritten)
|
||||
{
|
||||
Marshal.WriteInt64(pcbWritten, val);
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
this._source = null;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId="Standard.HRESULT.ThrowIfFailed(System.String)"), Obsolete("The method is not implemented", true)]
|
||||
public void LockRegion(long libOffset, long cb, int dwLockType)
|
||||
{
|
||||
Standard.HRESULT.STG_E_INVALIDFUNCTION.ThrowIfFailed("The method is not implemented.");
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")]
|
||||
public void Read(byte[] pv, int cb, IntPtr pcbRead)
|
||||
{
|
||||
this._Validate();
|
||||
int val = this._source.Read(pv, 0, cb);
|
||||
if (IntPtr.Zero != pcbRead)
|
||||
{
|
||||
Marshal.WriteInt32(pcbRead, val);
|
||||
}
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId="Standard.HRESULT.ThrowIfFailed(System.String)"), Obsolete("The method is not implemented", true)]
|
||||
public void Revert()
|
||||
{
|
||||
Standard.HRESULT.STG_E_INVALIDFUNCTION.ThrowIfFailed("The method is not implemented.");
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")]
|
||||
public void Seek(long dlibMove, int dwOrigin, IntPtr plibNewPosition)
|
||||
{
|
||||
this._Validate();
|
||||
long val = this._source.Seek(dlibMove, (SeekOrigin) dwOrigin);
|
||||
if (IntPtr.Zero != plibNewPosition)
|
||||
{
|
||||
Marshal.WriteInt64(plibNewPosition, val);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetSize(long libNewSize)
|
||||
{
|
||||
this._Validate();
|
||||
this._source.SetLength(libNewSize);
|
||||
}
|
||||
|
||||
public void Stat(out System.Runtime.InteropServices.ComTypes.STATSTG pstatstg, int grfStatFlag)
|
||||
{
|
||||
pstatstg = new System.Runtime.InteropServices.ComTypes.STATSTG();
|
||||
this._Validate();
|
||||
pstatstg.type = 2;
|
||||
pstatstg.cbSize = this._source.Length;
|
||||
pstatstg.grfMode = 2;
|
||||
pstatstg.grfLocksSupported = 2;
|
||||
}
|
||||
|
||||
[Obsolete("The method is not implemented", true), SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId="Standard.HRESULT.ThrowIfFailed(System.String)")]
|
||||
public void UnlockRegion(long libOffset, long cb, int dwLockType)
|
||||
{
|
||||
Standard.HRESULT.STG_E_INVALIDFUNCTION.ThrowIfFailed("The method is not implemented.");
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")]
|
||||
public void Write(byte[] pv, int cb, IntPtr pcbWritten)
|
||||
{
|
||||
this._Validate();
|
||||
this._source.Write(pv, 0, cb);
|
||||
if (IntPtr.Zero != pcbWritten)
|
||||
{
|
||||
Marshal.WriteInt32(pcbWritten, cb);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
internal delegate IntPtr MessageHandler(Standard.WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
|
||||
internal sealed class MessageWindow : DispatcherObject, IDisposable
|
||||
{
|
||||
private string _className;
|
||||
private bool _isDisposed;
|
||||
private Standard.WndProc _wndProcCallback;
|
||||
private static readonly Dictionary<IntPtr, Standard.MessageWindow> s_windowLookup = new Dictionary<IntPtr, Standard.MessageWindow>();
|
||||
private static readonly Standard.WndProc s_WndProc = new Standard.WndProc(Standard.MessageWindow._WndProc);
|
||||
|
||||
[SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")]
|
||||
public MessageWindow(Standard.CS classStyle, Standard.WS style, Standard.WS_EX exStyle, Rect location, string name, Standard.WndProc callback)
|
||||
{
|
||||
this._wndProcCallback = callback;
|
||||
this._className = "MessageWindowClass+" + Guid.NewGuid().ToString();
|
||||
Standard.WNDCLASSEX lpwcx = new Standard.WNDCLASSEX {
|
||||
cbSize = Marshal.SizeOf(typeof(Standard.WNDCLASSEX)),
|
||||
style = classStyle,
|
||||
lpfnWndProc = s_WndProc,
|
||||
hInstance = Standard.NativeMethods.GetModuleHandle(null),
|
||||
hbrBackground = Standard.NativeMethods.GetStockObject(Standard.StockObject.NULL_BRUSH),
|
||||
lpszMenuName = "",
|
||||
lpszClassName = this._className
|
||||
};
|
||||
Standard.NativeMethods.RegisterClassEx(ref lpwcx);
|
||||
GCHandle handle = new GCHandle();
|
||||
try
|
||||
{
|
||||
handle = GCHandle.Alloc(this);
|
||||
IntPtr lpParam = (IntPtr) handle;
|
||||
this.Handle = Standard.NativeMethods.CreateWindowEx(exStyle, this._className, name, style, (int) location.X, (int) location.Y, (int) location.Width, (int) location.Height, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, lpParam);
|
||||
}
|
||||
finally
|
||||
{
|
||||
handle.Free();
|
||||
}
|
||||
}
|
||||
|
||||
private static object _DestroyWindow(IntPtr hwnd, string className)
|
||||
{
|
||||
Standard.Utility.SafeDestroyWindow(ref hwnd);
|
||||
Standard.NativeMethods.UnregisterClass(className, Standard.NativeMethods.GetModuleHandle(null));
|
||||
return null;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId="disposing")]
|
||||
private void _Dispose(bool disposing, bool isHwndBeingDestroyed)
|
||||
{
|
||||
DispatcherOperationCallback method = null;
|
||||
DispatcherOperationCallback callback2 = null;
|
||||
IntPtr hwnd;
|
||||
string className;
|
||||
if (!this._isDisposed)
|
||||
{
|
||||
this._isDisposed = true;
|
||||
hwnd = this.Handle;
|
||||
className = this._className;
|
||||
if (isHwndBeingDestroyed)
|
||||
{
|
||||
if (method == null)
|
||||
{
|
||||
method = arg => _DestroyWindow(IntPtr.Zero, className);
|
||||
}
|
||||
base.Dispatcher.BeginInvoke(DispatcherPriority.Normal, method);
|
||||
}
|
||||
else if (this.Handle != IntPtr.Zero)
|
||||
{
|
||||
if (base.CheckAccess())
|
||||
{
|
||||
_DestroyWindow(hwnd, className);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (callback2 == null)
|
||||
{
|
||||
callback2 = arg => _DestroyWindow(hwnd, className);
|
||||
}
|
||||
base.Dispatcher.BeginInvoke(DispatcherPriority.Normal, callback2);
|
||||
}
|
||||
}
|
||||
s_windowLookup.Remove(hwnd);
|
||||
this._className = null;
|
||||
this.Handle = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Usage", "CA1816:CallGCSuppressFinalizeCorrectly")]
|
||||
private static IntPtr _WndProc(IntPtr hwnd, Standard.WM msg, IntPtr wParam, IntPtr lParam)
|
||||
{
|
||||
IntPtr zero = IntPtr.Zero;
|
||||
Standard.MessageWindow target = null;
|
||||
if (msg == Standard.WM.CREATE)
|
||||
{
|
||||
Standard.CREATESTRUCT createstruct = (Standard.CREATESTRUCT) Marshal.PtrToStructure(lParam, typeof(Standard.CREATESTRUCT));
|
||||
target = (Standard.MessageWindow) GCHandle.FromIntPtr(createstruct.lpCreateParams).Target;
|
||||
s_windowLookup.Add(hwnd, target);
|
||||
}
|
||||
else if (!s_windowLookup.TryGetValue(hwnd, out target))
|
||||
{
|
||||
return Standard.NativeMethods.DefWindowProc(hwnd, msg, wParam, lParam);
|
||||
}
|
||||
Standard.WndProc proc = target._wndProcCallback;
|
||||
if (proc != null)
|
||||
{
|
||||
zero = proc(hwnd, msg, wParam, lParam);
|
||||
}
|
||||
else
|
||||
{
|
||||
zero = Standard.NativeMethods.DefWindowProc(hwnd, msg, wParam, lParam);
|
||||
}
|
||||
if (msg == Standard.WM.NCDESTROY)
|
||||
{
|
||||
target._Dispose(true, true);
|
||||
GC.SuppressFinalize(target);
|
||||
}
|
||||
return zero;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
this._Dispose(true, false);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
~MessageWindow()
|
||||
{
|
||||
this._Dispose(false, false);
|
||||
}
|
||||
|
||||
public IntPtr Handle { get; private set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
[Flags]
|
||||
internal enum NIF : uint
|
||||
{
|
||||
GUID = 0x20,
|
||||
ICON = 2,
|
||||
INFO = 0x10,
|
||||
MESSAGE = 1,
|
||||
REALTIME = 0x40,
|
||||
SHOWTIP = 0x80,
|
||||
STATE = 8,
|
||||
TIP = 4,
|
||||
VISTA_MASK = 0xfb,
|
||||
XP_MASK = 0x3b
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum NIIF
|
||||
{
|
||||
ERROR = 3,
|
||||
INFO = 1,
|
||||
LARGE_ICON = 0x20,
|
||||
NIIF_RESPECT_QUIET_TIME = 0x80,
|
||||
NONE = 0,
|
||||
NOSOUND = 0x10,
|
||||
USER = 4,
|
||||
WARNING = 2,
|
||||
XP_ICON_MASK = 15
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum NIM : uint
|
||||
{
|
||||
ADD = 0,
|
||||
DELETE = 2,
|
||||
MODIFY = 1,
|
||||
SETFOCUS = 3,
|
||||
SETVERSION = 4
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct NONCLIENTMETRICS
|
||||
{
|
||||
public int cbSize;
|
||||
public int iBorderWidth;
|
||||
public int iScrollWidth;
|
||||
public int iScrollHeight;
|
||||
public int iCaptionWidth;
|
||||
public int iCaptionHeight;
|
||||
public Standard.LOGFONT lfCaptionFont;
|
||||
public int iSmCaptionWidth;
|
||||
public int iSmCaptionHeight;
|
||||
public Standard.LOGFONT lfSmCaptionFont;
|
||||
public int iMenuWidth;
|
||||
public int iMenuHeight;
|
||||
public Standard.LOGFONT lfMenuFont;
|
||||
public Standard.LOGFONT lfStatusFont;
|
||||
public Standard.LOGFONT lfMessageFont;
|
||||
public int iPaddedBorderWidth;
|
||||
[SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")]
|
||||
public static Standard.NONCLIENTMETRICS VistaMetricsStruct
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Standard.NONCLIENTMETRICS { cbSize = Marshal.SizeOf(typeof(Standard.NONCLIENTMETRICS)) };
|
||||
}
|
||||
}
|
||||
[SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")]
|
||||
public static Standard.NONCLIENTMETRICS XPMetricsStruct
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Standard.NONCLIENTMETRICS { cbSize = Marshal.SizeOf(typeof(Standard.NONCLIENTMETRICS)) - 4 };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential), SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
|
||||
internal class NOTIFYICONDATA
|
||||
{
|
||||
public int cbSize;
|
||||
public IntPtr hWnd;
|
||||
public int uID;
|
||||
public Standard.NIF uFlags;
|
||||
public int uCallbackMessage;
|
||||
public IntPtr hIcon;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst=0x80)]
|
||||
public char[] szTip = new char[0x80];
|
||||
public uint dwState;
|
||||
public uint dwStateMask;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst=0x100)]
|
||||
public char[] szInfo = new char[0x100];
|
||||
public uint uVersion;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst=0x40)]
|
||||
public char[] szInfoTitle = new char[0x40];
|
||||
public uint dwInfoFlags;
|
||||
public Guid guidItem;
|
||||
private IntPtr hBalloonIcon;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,732 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.ConstrainedExecution;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using System.Text;
|
||||
|
||||
internal static class NativeMethods
|
||||
{
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="AdjustWindowRectEx", SetLastError=true)]
|
||||
private static extern bool _AdjustWindowRectEx(ref Standard.RECT lpRect, Standard.WS dwStyle, [MarshalAs(UnmanagedType.Bool)] bool bMenu, Standard.WS_EX dwExStyle);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="ChangeWindowMessageFilter", SetLastError=true)]
|
||||
private static extern bool _ChangeWindowMessageFilter(Standard.WM message, Standard.MSGFLT dwFlag);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="ChangeWindowMessageFilterEx", SetLastError=true)]
|
||||
private static extern bool _ChangeWindowMessageFilterEx(IntPtr hwnd, Standard.WM message, Standard.MSGFLT action, [In, Out, Optional] ref Standard.CHANGEFILTERSTRUCT pChangeFilterStruct);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("shell32.dll", EntryPoint="CommandLineToArgvW", CharSet=CharSet.Unicode)]
|
||||
private static extern IntPtr _CommandLineToArgvW([MarshalAs(UnmanagedType.LPWStr)] string cmdLine, out int numArgs);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("gdi32.dll", EntryPoint="CreateDIBSection", SetLastError=true)]
|
||||
private static extern Standard.SafeHBITMAP _CreateDIBSection(Standard.SafeDC hdc, [In] ref Standard.BITMAPINFO bitmapInfo, int iUsage, out IntPtr ppvBits, IntPtr hSection, int dwOffset);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("gdi32.dll", EntryPoint="CreateDIBSection", SetLastError=true)]
|
||||
private static extern Standard.SafeHBITMAP _CreateDIBSectionIntPtr(IntPtr hdc, [In] ref Standard.BITMAPINFO bitmapInfo, int iUsage, out IntPtr ppvBits, IntPtr hSection, int dwOffset);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("gdi32.dll", EntryPoint="CreateRectRgn", SetLastError=true)]
|
||||
private static extern IntPtr _CreateRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("gdi32.dll", EntryPoint="CreateRectRgnIndirect", SetLastError=true)]
|
||||
private static extern IntPtr _CreateRectRgnIndirect([In] ref Standard.RECT lprc);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("gdi32.dll", EntryPoint="CreateRoundRectRgn", SetLastError=true)]
|
||||
private static extern IntPtr _CreateRoundRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect, int nWidthEllipse, int nHeightEllipse);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="CreateWindowExW", CharSet=CharSet.Unicode, SetLastError=true)]
|
||||
private static extern IntPtr _CreateWindowEx(Standard.WS_EX dwExStyle, [MarshalAs(UnmanagedType.LPWStr)] string lpClassName, [MarshalAs(UnmanagedType.LPWStr)] string lpWindowName, Standard.WS dwStyle, int x, int y, int nWidth, int nHeight, IntPtr hWndParent, IntPtr hMenu, IntPtr hInstance, IntPtr lpParam);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="DrawMenuBar", SetLastError=true)]
|
||||
private static extern bool _DrawMenuBar(IntPtr hWnd);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("dwmapi.dll", EntryPoint="DwmGetColorizationColor")]
|
||||
private static extern Standard.HRESULT _DwmGetColorizationColor(out uint pcrColorization, [MarshalAs(UnmanagedType.Bool)] out bool pfOpaqueBlend);
|
||||
[DllImport("dwmapi.dll", EntryPoint="DwmGetCompositionTimingInfo")]
|
||||
private static extern Standard.HRESULT _DwmGetCompositionTimingInfo(IntPtr hwnd, ref Standard.DWM_TIMING_INFO pTimingInfo);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("dwmapi.dll", EntryPoint="DwmIsCompositionEnabled", PreserveSig=false)]
|
||||
private static extern bool _DwmIsCompositionEnabled();
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("dwmapi.dll", EntryPoint="DwmSetWindowAttribute")]
|
||||
private static extern void _DwmSetWindowAttribute(IntPtr hwnd, Standard.DWMWA dwAttribute, ref int pvAttribute, int cbAttribute);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="EnableMenuItem")]
|
||||
private static extern int _EnableMenuItem(IntPtr hMenu, Standard.SC uIDEnableItem, Standard.MF uEnable);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="GetClientRect", SetLastError=true)]
|
||||
private static extern bool _GetClientRect(IntPtr hwnd, out Standard.RECT lpRect);
|
||||
[DllImport("uxtheme.dll", EntryPoint="GetCurrentThemeName", CharSet=CharSet.Unicode)]
|
||||
private static extern Standard.HRESULT _GetCurrentThemeName(StringBuilder pszThemeFileName, int dwMaxNameChars, StringBuilder pszColorBuff, int cchMaxColorChars, StringBuilder pszSizeBuff, int cchMaxSizeChars);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("kernel32.dll", EntryPoint="GetModuleFileName", CharSet=CharSet.Unicode, SetLastError=true)]
|
||||
private static extern int _GetModuleFileName(IntPtr hModule, StringBuilder lpFilename, int nSize);
|
||||
[DllImport("kernel32.dll", EntryPoint="GetModuleHandleW", CharSet=CharSet.Unicode, SetLastError=true)]
|
||||
private static extern IntPtr _GetModuleHandle([MarshalAs(UnmanagedType.LPWStr)] string lpModuleName);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="GetMonitorInfo", SetLastError=true)]
|
||||
private static extern bool _GetMonitorInfo(IntPtr hMonitor, [In, Out] Standard.MONITORINFO lpmi);
|
||||
[DllImport("gdi32.dll", EntryPoint="GetStockObject", SetLastError=true)]
|
||||
private static extern IntPtr _GetStockObject(Standard.StockObject fnObject);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="GetWindowRect", SetLastError=true)]
|
||||
private static extern bool _GetWindowRect(IntPtr hWnd, out Standard.RECT lpRect);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("kernel32.dll", EntryPoint="LocalFree", SetLastError=true)]
|
||||
private static extern IntPtr _LocalFree(IntPtr hMem);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="PostMessage", SetLastError=true)]
|
||||
private static extern bool _PostMessage(IntPtr hWnd, Standard.WM Msg, IntPtr wParam, IntPtr lParam);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="RegisterClassExW", SetLastError=true)]
|
||||
private static extern short _RegisterClassEx([In] ref Standard.WNDCLASSEX lpwcx);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="RegisterWindowMessage", CharSet=CharSet.Unicode, SetLastError=true)]
|
||||
private static extern uint _RegisterWindowMessage([MarshalAs(UnmanagedType.LPWStr)] string lpString);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="RemoveMenu", SetLastError=true)]
|
||||
private static extern bool _RemoveMenu(IntPtr hMenu, uint uPosition, uint uFlags);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("gdi32.dll", EntryPoint="SelectObject", SetLastError=true)]
|
||||
private static extern IntPtr _SelectObject(Standard.SafeDC hdc, IntPtr hgdiobj);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("gdi32.dll", EntryPoint="SelectObject", SetLastError=true)]
|
||||
private static extern IntPtr _SelectObjectSafeHBITMAP(Standard.SafeDC hdc, Standard.SafeHBITMAP hgdiobj);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="SetActiveWindow", SetLastError=true)]
|
||||
private static extern IntPtr _SetActiveWindow(IntPtr hWnd);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("kernel32.dll", EntryPoint="SetProcessWorkingSetSize", SetLastError=true)]
|
||||
private static extern bool _SetProcessWorkingSetSize(IntPtr hProcess, IntPtr dwMinimiumWorkingSetSize, IntPtr dwMaximumWorkingSetSize);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="SetWindowPos", SetLastError=true)]
|
||||
private static extern bool _SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, Standard.SWP uFlags);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="SetWindowRgn", SetLastError=true)]
|
||||
private static extern int _SetWindowRgn(IntPtr hWnd, IntPtr hRgn, [MarshalAs(UnmanagedType.Bool)] bool bRedraw);
|
||||
[DllImport("shell32.dll", EntryPoint="SHAddToRecentDocs")]
|
||||
private static extern void _SHAddToRecentDocs_ShellLink(Standard.SHARD uFlags, Standard.IShellLinkW pv);
|
||||
[DllImport("shell32.dll", EntryPoint="SHAddToRecentDocs")]
|
||||
private static extern void _SHAddToRecentDocs_String(Standard.SHARD uFlags, [MarshalAs(UnmanagedType.LPWStr)] string pv);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="SystemParametersInfoW", CharSet=CharSet.Unicode, SetLastError=true)]
|
||||
private static extern bool _SystemParametersInfo_HIGHCONTRAST(Standard.SPI uiAction, int uiParam, [In, Out] ref Standard.HIGHCONTRAST pvParam, Standard.SPIF fWinIni);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="SystemParametersInfoW", CharSet=CharSet.Unicode, SetLastError=true)]
|
||||
private static extern bool _SystemParametersInfo_NONCLIENTMETRICS(Standard.SPI uiAction, int uiParam, [In, Out] ref Standard.NONCLIENTMETRICS pvParam, Standard.SPIF fWinIni);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="SystemParametersInfoW", SetLastError=true)]
|
||||
private static extern bool _SystemParametersInfo_String(Standard.SPI uiAction, int uiParam, [MarshalAs(UnmanagedType.LPWStr)] string pvParam, Standard.SPIF fWinIni);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="UnregisterClass", SetLastError=true)]
|
||||
private static extern bool _UnregisterClassAtom(IntPtr lpClassName, IntPtr hInstance);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="UnregisterClass", CharSet=CharSet.Unicode, SetLastError=true)]
|
||||
private static extern bool _UnregisterClassName(string lpClassName, IntPtr hInstance);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="UpdateLayeredWindow", SetLastError=true)]
|
||||
private static extern bool _UpdateLayeredWindow(IntPtr hwnd, Standard.SafeDC hdcDst, [In] ref Standard.POINT pptDst, [In] ref Standard.SIZE psize, Standard.SafeDC hdcSrc, [In] ref Standard.POINT pptSrc, int crKey, ref Standard.BLENDFUNCTION pblend, Standard.ULW dwFlags);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="UpdateLayeredWindow", SetLastError=true)]
|
||||
private static extern bool _UpdateLayeredWindowIntPtr(IntPtr hwnd, IntPtr hdcDst, IntPtr pptDst, IntPtr psize, IntPtr hdcSrc, IntPtr pptSrc, int crKey, ref Standard.BLENDFUNCTION pblend, Standard.ULW dwFlags);
|
||||
public static Standard.RECT AdjustWindowRectEx(Standard.RECT lpRect, Standard.WS dwStyle, bool bMenu, Standard.WS_EX dwExStyle)
|
||||
{
|
||||
if (!_AdjustWindowRectEx(ref lpRect, dwStyle, bMenu, dwExStyle))
|
||||
{
|
||||
Standard.HRESULT.ThrowLastError();
|
||||
}
|
||||
return lpRect;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static Standard.HRESULT ChangeWindowMessageFilterEx(IntPtr hwnd, Standard.WM message, Standard.MSGFLT action, out Standard.MSGFLTINFO filterInfo)
|
||||
{
|
||||
filterInfo = Standard.MSGFLTINFO.NONE;
|
||||
if (!Standard.Utility.IsOSVistaOrNewer)
|
||||
{
|
||||
return Standard.HRESULT.S_FALSE;
|
||||
}
|
||||
if (!Standard.Utility.IsOSWindows7OrNewer)
|
||||
{
|
||||
if (!_ChangeWindowMessageFilter(message, action))
|
||||
{
|
||||
return (Standard.HRESULT) Standard.Win32Error.GetLastError();
|
||||
}
|
||||
return Standard.HRESULT.S_OK;
|
||||
}
|
||||
Standard.CHANGEFILTERSTRUCT pChangeFilterStruct = new Standard.CHANGEFILTERSTRUCT {
|
||||
cbSize = (uint) Marshal.SizeOf(typeof(Standard.CHANGEFILTERSTRUCT))
|
||||
};
|
||||
if (!_ChangeWindowMessageFilterEx(hwnd, message, action, ref pChangeFilterStruct))
|
||||
{
|
||||
return (Standard.HRESULT) Standard.Win32Error.GetLastError();
|
||||
}
|
||||
filterInfo = pChangeFilterStruct.ExtStatus;
|
||||
return Standard.HRESULT.S_OK;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("gdi32.dll")]
|
||||
public static extern Standard.CombineRgnResult CombineRgn(IntPtr hrgnDest, IntPtr hrgnSrc1, IntPtr hrgnSrc2, Standard.RGN fnCombineMode);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static string[] CommandLineToArgvW(string cmdLine)
|
||||
{
|
||||
string[] strArray2;
|
||||
IntPtr zero = IntPtr.Zero;
|
||||
try
|
||||
{
|
||||
int numArgs = 0;
|
||||
zero = _CommandLineToArgvW(cmdLine, out numArgs);
|
||||
if (zero == IntPtr.Zero)
|
||||
{
|
||||
throw new Win32Exception();
|
||||
}
|
||||
string[] strArray = new string[numArgs];
|
||||
for (int i = 0; i < numArgs; i++)
|
||||
{
|
||||
IntPtr ptr = Marshal.ReadIntPtr(zero, i * Marshal.SizeOf(typeof(IntPtr)));
|
||||
strArray[i] = Marshal.PtrToStringUni(ptr);
|
||||
}
|
||||
strArray2 = strArray;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_LocalFree(zero);
|
||||
}
|
||||
return strArray2;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static Standard.SafeHBITMAP CreateDIBSection(Standard.SafeDC hdc, ref Standard.BITMAPINFO bitmapInfo, out IntPtr ppvBits, IntPtr hSection, int dwOffset)
|
||||
{
|
||||
Standard.SafeHBITMAP ehbitmap = null;
|
||||
if (hdc == null)
|
||||
{
|
||||
ehbitmap = _CreateDIBSectionIntPtr(IntPtr.Zero, ref bitmapInfo, 0, out ppvBits, hSection, dwOffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
ehbitmap = _CreateDIBSection(hdc, ref bitmapInfo, 0, out ppvBits, hSection, dwOffset);
|
||||
}
|
||||
if (ehbitmap.IsInvalid)
|
||||
{
|
||||
Standard.HRESULT.ThrowLastError();
|
||||
}
|
||||
return ehbitmap;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static IntPtr CreateRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect)
|
||||
{
|
||||
IntPtr ptr = _CreateRectRgn(nLeftRect, nTopRect, nRightRect, nBottomRect);
|
||||
if (IntPtr.Zero == ptr)
|
||||
{
|
||||
throw new Win32Exception();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static IntPtr CreateRectRgnIndirect(Standard.RECT lprc)
|
||||
{
|
||||
IntPtr ptr = _CreateRectRgnIndirect(ref lprc);
|
||||
if (IntPtr.Zero == ptr)
|
||||
{
|
||||
throw new Win32Exception();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static IntPtr CreateRoundRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect, int nWidthEllipse, int nHeightEllipse)
|
||||
{
|
||||
IntPtr ptr = _CreateRoundRectRgn(nLeftRect, nTopRect, nRightRect, nBottomRect, nWidthEllipse, nHeightEllipse);
|
||||
if (IntPtr.Zero == ptr)
|
||||
{
|
||||
throw new Win32Exception();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("gdi32.dll")]
|
||||
public static extern IntPtr CreateSolidBrush(int crColor);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static IntPtr CreateWindowEx(Standard.WS_EX dwExStyle, string lpClassName, string lpWindowName, Standard.WS dwStyle, int x, int y, int nWidth, int nHeight, IntPtr hWndParent, IntPtr hMenu, IntPtr hInstance, IntPtr lpParam)
|
||||
{
|
||||
IntPtr ptr = _CreateWindowEx(dwExStyle, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
|
||||
if (IntPtr.Zero == ptr)
|
||||
{
|
||||
Standard.HRESULT.ThrowLastError();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="DefWindowProcW", CharSet=CharSet.Unicode)]
|
||||
public static extern IntPtr DefWindowProc(IntPtr hWnd, Standard.WM Msg, IntPtr wParam, IntPtr lParam);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("gdi32.dll")]
|
||||
public static extern bool DeleteObject(IntPtr hObject);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll")]
|
||||
public static extern bool DestroyIcon(IntPtr handle);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", SetLastError=true)]
|
||||
public static extern bool DestroyWindow(IntPtr hwnd);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static void DrawMenuBar(IntPtr hWnd)
|
||||
{
|
||||
if (!_DrawMenuBar(hWnd))
|
||||
{
|
||||
throw new Win32Exception();
|
||||
}
|
||||
}
|
||||
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("dwmapi.dll")]
|
||||
public static extern bool DwmDefWindowProc(IntPtr hwnd, Standard.WM msg, IntPtr wParam, IntPtr lParam, out IntPtr plResult);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("dwmapi.dll", PreserveSig=false)]
|
||||
public static extern void DwmExtendFrameIntoClientArea(IntPtr hwnd, ref Standard.MARGINS pMarInset);
|
||||
public static bool DwmGetColorizationColor(out uint pcrColorization, out bool pfOpaqueBlend)
|
||||
{
|
||||
if ((Standard.Utility.IsOSVistaOrNewer && IsThemeActive()) && _DwmGetColorizationColor(out pcrColorization, out pfOpaqueBlend).Succeeded)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
pcrColorization = 0xff000000;
|
||||
pfOpaqueBlend = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Standard.DWM_TIMING_INFO? DwmGetCompositionTimingInfo(IntPtr hwnd)
|
||||
{
|
||||
if (!Standard.Utility.IsOSVistaOrNewer)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Standard.DWM_TIMING_INFO pTimingInfo = new Standard.DWM_TIMING_INFO {
|
||||
cbSize = Marshal.SizeOf(typeof(Standard.DWM_TIMING_INFO))
|
||||
};
|
||||
Standard.HRESULT hresult = _DwmGetCompositionTimingInfo(hwnd, ref pTimingInfo);
|
||||
if (hresult == Standard.HRESULT.E_PENDING)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
hresult.ThrowIfFailed();
|
||||
return new Standard.DWM_TIMING_INFO?(pTimingInfo);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("dwmapi.dll", PreserveSig=false)]
|
||||
public static extern void DwmInvalidateIconicBitmaps(IntPtr hwnd);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static bool DwmIsCompositionEnabled()
|
||||
{
|
||||
if (!Standard.Utility.IsOSVistaOrNewer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return _DwmIsCompositionEnabled();
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("dwmapi.dll", PreserveSig=false)]
|
||||
public static extern void DwmSetIconicLivePreviewBitmap(IntPtr hwnd, IntPtr hbmp, Standard.RefPOINT pptClient, Standard.DWM_SIT dwSITFlags);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("dwmapi.dll", PreserveSig=false)]
|
||||
public static extern void DwmSetIconicThumbnail(IntPtr hwnd, IntPtr hbmp, Standard.DWM_SIT dwSITFlags);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static void DwmSetWindowAttributeDisallowPeek(IntPtr hwnd, bool disallowPeek)
|
||||
{
|
||||
int pvAttribute = disallowPeek ? 1 : 0;
|
||||
_DwmSetWindowAttribute(hwnd, Standard.DWMWA.DISALLOW_PEEK, ref pvAttribute, 4);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static void DwmSetWindowAttributeFlip3DPolicy(IntPtr hwnd, Standard.DWMFLIP3D flip3dPolicy)
|
||||
{
|
||||
int pvAttribute = (int) flip3dPolicy;
|
||||
_DwmSetWindowAttribute(hwnd, Standard.DWMWA.FLIP3D_POLICY, ref pvAttribute, 4);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static Standard.MF EnableMenuItem(IntPtr hMenu, Standard.SC uIDEnableItem, Standard.MF uEnable)
|
||||
{
|
||||
return (Standard.MF) _EnableMenuItem(hMenu, uIDEnableItem, uEnable);
|
||||
}
|
||||
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success), SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("kernel32.dll")]
|
||||
public static extern bool FindClose(IntPtr handle);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("kernel32.dll", CharSet=CharSet.Unicode, SetLastError=true)]
|
||||
public static extern Standard.SafeFindHandle FindFirstFileW(string lpFileName, [In, Out, MarshalAs(UnmanagedType.LPStruct)] Standard.WIN32_FIND_DATAW lpFindFileData);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("kernel32.dll", SetLastError=true)]
|
||||
public static extern bool FindNextFileW(Standard.SafeFindHandle hndFindFile, [In, Out, MarshalAs(UnmanagedType.LPStruct)] Standard.WIN32_FIND_DATAW lpFindFileData);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("gdiplus.dll")]
|
||||
public static extern Standard.Status GdipCreateBitmapFromStream(IStream stream, out IntPtr bitmap);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("gdiplus.dll")]
|
||||
public static extern Standard.Status GdipCreateHBITMAPFromBitmap(IntPtr bitmap, out IntPtr hbmReturn, int background);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("gdiplus.dll")]
|
||||
public static extern Standard.Status GdipCreateHICONFromBitmap(IntPtr bitmap, out IntPtr hbmReturn);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("gdiplus.dll")]
|
||||
public static extern Standard.Status GdipDisposeImage(IntPtr image);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("gdiplus.dll")]
|
||||
public static extern Standard.Status GdipImageForceValidation(IntPtr image);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("gdiplus.dll")]
|
||||
public static extern Standard.Status GdiplusShutdown(IntPtr token);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("gdiplus.dll")]
|
||||
public static extern Standard.Status GdiplusStartup(out IntPtr token, Standard.StartupInput input, out Standard.StartupOutput output);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static Standard.RECT GetClientRect(IntPtr hwnd)
|
||||
{
|
||||
Standard.RECT rect;
|
||||
if (!_GetClientRect(hwnd, out rect))
|
||||
{
|
||||
Standard.HRESULT.ThrowLastError();
|
||||
}
|
||||
return rect;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("shell32.dll")]
|
||||
public static extern Standard.HRESULT GetCurrentProcessExplicitAppUserModelID([MarshalAs(UnmanagedType.LPWStr)] out string AppID);
|
||||
public static void GetCurrentThemeName(out string themeFileName, out string color, out string size)
|
||||
{
|
||||
StringBuilder pszThemeFileName = new StringBuilder(260);
|
||||
StringBuilder pszColorBuff = new StringBuilder(260);
|
||||
StringBuilder pszSizeBuff = new StringBuilder(260);
|
||||
_GetCurrentThemeName(pszThemeFileName, pszThemeFileName.Capacity, pszColorBuff, pszColorBuff.Capacity, pszSizeBuff, pszSizeBuff.Capacity).ThrowIfFailed();
|
||||
themeFileName = pszThemeFileName.ToString();
|
||||
color = pszColorBuff.ToString();
|
||||
size = pszSizeBuff.ToString();
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), Obsolete("Use SafeDC.GetDC instead.", true)]
|
||||
public static void GetDC()
|
||||
{
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("gdi32.dll")]
|
||||
public static extern int GetDeviceCaps(Standard.SafeDC hdc, Standard.DeviceCap nIndex);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static string GetModuleFileName(IntPtr hModule)
|
||||
{
|
||||
int num;
|
||||
StringBuilder lpFilename = new StringBuilder(260);
|
||||
Label_000B:
|
||||
num = _GetModuleFileName(hModule, lpFilename, lpFilename.Capacity);
|
||||
if (num == 0)
|
||||
{
|
||||
Standard.HRESULT.ThrowLastError();
|
||||
}
|
||||
if (num == lpFilename.Capacity)
|
||||
{
|
||||
lpFilename.EnsureCapacity(lpFilename.Capacity * 2);
|
||||
goto Label_000B;
|
||||
}
|
||||
return lpFilename.ToString();
|
||||
}
|
||||
|
||||
public static IntPtr GetModuleHandle(string lpModuleName)
|
||||
{
|
||||
IntPtr ptr = _GetModuleHandle(lpModuleName);
|
||||
if (ptr == IntPtr.Zero)
|
||||
{
|
||||
Standard.HRESULT.ThrowLastError();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static Standard.MONITORINFO GetMonitorInfo(IntPtr hMonitor)
|
||||
{
|
||||
Standard.MONITORINFO lpmi = new Standard.MONITORINFO();
|
||||
if (!_GetMonitorInfo(hMonitor, lpmi))
|
||||
{
|
||||
throw new Win32Exception();
|
||||
}
|
||||
return lpmi;
|
||||
}
|
||||
|
||||
public static IntPtr GetStockObject(Standard.StockObject fnObject)
|
||||
{
|
||||
return _GetStockObject(fnObject);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll")]
|
||||
public static extern IntPtr GetSystemMenu(IntPtr hWnd, [MarshalAs(UnmanagedType.Bool)] bool bRevert);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll")]
|
||||
public static extern int GetSystemMetrics(Standard.SM nIndex);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static IntPtr GetWindowLongPtr(IntPtr hwnd, Standard.GWL nIndex)
|
||||
{
|
||||
IntPtr zero = IntPtr.Zero;
|
||||
if (8 == IntPtr.Size)
|
||||
{
|
||||
zero = GetWindowLongPtr64(hwnd, nIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
zero = new IntPtr(GetWindowLongPtr32(hwnd, nIndex));
|
||||
}
|
||||
if (IntPtr.Zero == zero)
|
||||
{
|
||||
throw new Win32Exception();
|
||||
}
|
||||
return zero;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist"), SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="GetWindowLong", SetLastError=true)]
|
||||
private static extern int GetWindowLongPtr32(IntPtr hWnd, Standard.GWL nIndex);
|
||||
[SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist"), SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="GetWindowLongPtr", SetLastError=true)]
|
||||
private static extern IntPtr GetWindowLongPtr64(IntPtr hWnd, Standard.GWL nIndex);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static Standard.WINDOWPLACEMENT GetWindowPlacement(IntPtr hwnd)
|
||||
{
|
||||
Standard.WINDOWPLACEMENT lpwndpl = new Standard.WINDOWPLACEMENT();
|
||||
if (!GetWindowPlacement(hwnd, lpwndpl))
|
||||
{
|
||||
throw new Win32Exception();
|
||||
}
|
||||
return lpwndpl;
|
||||
}
|
||||
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", SetLastError=true)]
|
||||
private static extern bool GetWindowPlacement(IntPtr hwnd, Standard.WINDOWPLACEMENT lpwndpl);
|
||||
public static Standard.RECT GetWindowRect(IntPtr hwnd)
|
||||
{
|
||||
Standard.RECT rect;
|
||||
if (!_GetWindowRect(hwnd, out rect))
|
||||
{
|
||||
Standard.HRESULT.ThrowLastError();
|
||||
}
|
||||
return rect;
|
||||
}
|
||||
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[DllImport("uxtheme.dll")]
|
||||
public static extern bool IsThemeActive();
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll")]
|
||||
public static extern bool IsWindow(IntPtr hwnd);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll")]
|
||||
public static extern bool IsWindowVisible(IntPtr hwnd);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll")]
|
||||
public static extern IntPtr MonitorFromWindow(IntPtr hwnd, uint dwFlags);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static void PostMessage(IntPtr hWnd, Standard.WM Msg, IntPtr wParam, IntPtr lParam)
|
||||
{
|
||||
if (!_PostMessage(hWnd, Msg, wParam, lParam))
|
||||
{
|
||||
throw new Win32Exception();
|
||||
}
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static short RegisterClassEx(ref Standard.WNDCLASSEX lpwcx)
|
||||
{
|
||||
short num = _RegisterClassEx(ref lpwcx);
|
||||
if (num == 0)
|
||||
{
|
||||
Standard.HRESULT.ThrowLastError();
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static Standard.WM RegisterWindowMessage(string lpString)
|
||||
{
|
||||
uint num = _RegisterWindowMessage(lpString);
|
||||
if (num == 0)
|
||||
{
|
||||
Standard.HRESULT.ThrowLastError();
|
||||
}
|
||||
return (Standard.WM) num;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static void RemoveMenu(IntPtr hMenu, Standard.SC uPosition, Standard.MF uFlags)
|
||||
{
|
||||
if (!_RemoveMenu(hMenu, (uint) uPosition, (uint) uFlags))
|
||||
{
|
||||
throw new Win32Exception();
|
||||
}
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static IntPtr SelectObject(Standard.SafeDC hdc, Standard.SafeHBITMAP hgdiobj)
|
||||
{
|
||||
IntPtr ptr = _SelectObjectSafeHBITMAP(hdc, hgdiobj);
|
||||
if (ptr == IntPtr.Zero)
|
||||
{
|
||||
Standard.HRESULT.ThrowLastError();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static IntPtr SelectObject(Standard.SafeDC hdc, IntPtr hgdiobj)
|
||||
{
|
||||
IntPtr ptr = _SelectObject(hdc, hgdiobj);
|
||||
if (ptr == IntPtr.Zero)
|
||||
{
|
||||
Standard.HRESULT.ThrowLastError();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", SetLastError=true)]
|
||||
public static extern int SendInput(int nInputs, ref Standard.INPUT pInputs, int cbSize);
|
||||
[DllImport("user32.dll", SetLastError=true)]
|
||||
public static extern IntPtr SendMessage(IntPtr hWnd, Standard.WM Msg, IntPtr wParam, IntPtr lParam);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static IntPtr SetActiveWindow(IntPtr hwnd)
|
||||
{
|
||||
Standard.Verify.IsNotDefault<IntPtr>(hwnd, "hwnd");
|
||||
IntPtr ptr = _SetActiveWindow(hwnd);
|
||||
if (ptr == IntPtr.Zero)
|
||||
{
|
||||
Standard.HRESULT.ThrowLastError();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static IntPtr SetClassLongPtr(IntPtr hwnd, Standard.GCLP nIndex, IntPtr dwNewLong)
|
||||
{
|
||||
if (8 == IntPtr.Size)
|
||||
{
|
||||
return SetClassLongPtr64(hwnd, nIndex, dwNewLong);
|
||||
}
|
||||
return new IntPtr(SetClassLongPtr32(hwnd, nIndex, dwNewLong.ToInt32()));
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist"), SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="SetClassLong", SetLastError=true)]
|
||||
private static extern int SetClassLongPtr32(IntPtr hWnd, Standard.GCLP nIndex, int dwNewLong);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist"), DllImport("user32.dll", EntryPoint="SetClassLongPtr", SetLastError=true)]
|
||||
private static extern IntPtr SetClassLongPtr64(IntPtr hWnd, Standard.GCLP nIndex, IntPtr dwNewLong);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("shell32.dll", PreserveSig=false)]
|
||||
public static extern void SetCurrentProcessExplicitAppUserModelID([MarshalAs(UnmanagedType.LPWStr)] string AppID);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("kernel32.dll", SetLastError=true)]
|
||||
public static extern Standard.ErrorModes SetErrorMode(Standard.ErrorModes newMode);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static void SetProcessWorkingSetSize(IntPtr hProcess, int dwMinimumWorkingSetSize, int dwMaximumWorkingSetSize)
|
||||
{
|
||||
if (!_SetProcessWorkingSetSize(hProcess, new IntPtr(dwMinimumWorkingSetSize), new IntPtr(dwMaximumWorkingSetSize)))
|
||||
{
|
||||
throw new Win32Exception();
|
||||
}
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static IntPtr SetWindowLongPtr(IntPtr hwnd, Standard.GWL nIndex, IntPtr dwNewLong)
|
||||
{
|
||||
if (8 == IntPtr.Size)
|
||||
{
|
||||
return SetWindowLongPtr64(hwnd, nIndex, dwNewLong);
|
||||
}
|
||||
return new IntPtr(SetWindowLongPtr32(hwnd, nIndex, dwNewLong.ToInt32()));
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist"), SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="SetWindowLong", SetLastError=true)]
|
||||
private static extern int SetWindowLongPtr32(IntPtr hWnd, Standard.GWL nIndex, int dwNewLong);
|
||||
[SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist"), SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("user32.dll", EntryPoint="SetWindowLongPtr", SetLastError=true)]
|
||||
private static extern IntPtr SetWindowLongPtr64(IntPtr hWnd, Standard.GWL nIndex, IntPtr dwNewLong);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, Standard.SWP uFlags)
|
||||
{
|
||||
if (!_SetWindowPos(hWnd, hWndInsertAfter, x, y, cx, cy, uFlags))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static void SetWindowRgn(IntPtr hWnd, IntPtr hRgn, bool bRedraw)
|
||||
{
|
||||
if (_SetWindowRgn(hWnd, hRgn, bRedraw) == 0)
|
||||
{
|
||||
throw new Win32Exception();
|
||||
}
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("uxtheme.dll", PreserveSig=false)]
|
||||
public static extern void SetWindowThemeAttribute([In] IntPtr hwnd, [In] Standard.WINDOWTHEMEATTRIBUTETYPE eAttribute, [In] ref Standard.WTA_OPTIONS pvAttribute, [In] uint cbAttribute);
|
||||
public static void SHAddToRecentDocs(Standard.IShellLinkW shellLink)
|
||||
{
|
||||
_SHAddToRecentDocs_ShellLink(Standard.SHARD.LINK, shellLink);
|
||||
}
|
||||
|
||||
public static void SHAddToRecentDocs(string path)
|
||||
{
|
||||
_SHAddToRecentDocs_String(Standard.SHARD.PATHW, path);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("shell32.dll", PreserveSig=false)]
|
||||
public static extern Standard.HRESULT SHCreateItemFromParsingName([MarshalAs(UnmanagedType.LPWStr)] string pszPath, IBindCtx pbc, [In] ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppv);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("shell32.dll")]
|
||||
public static extern bool Shell_NotifyIcon(Standard.NIM dwMessage, [In] Standard.NOTIFYICONDATA lpdata);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("shell32.dll")]
|
||||
public static extern Standard.Win32Error SHFileOperation(ref Standard.SHFILEOPSTRUCT lpFileOp);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode"), DllImport("shell32.dll", PreserveSig=false)]
|
||||
public static extern void SHGetItemFromDataObject(IDataObject pdtobj, Standard.DOGIF dwFlags, [In] ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppv);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool ShowWindow(IntPtr hwnd, Standard.SW nCmdShow);
|
||||
[SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")]
|
||||
public static Standard.HIGHCONTRAST SystemParameterInfo_GetHIGHCONTRAST()
|
||||
{
|
||||
Standard.HIGHCONTRAST pvParam = new Standard.HIGHCONTRAST {
|
||||
cbSize = Marshal.SizeOf(typeof(Standard.HIGHCONTRAST))
|
||||
};
|
||||
if (!_SystemParametersInfo_HIGHCONTRAST(Standard.SPI.GETHIGHCONTRAST, pvParam.cbSize, ref pvParam, Standard.SPIF.None))
|
||||
{
|
||||
Standard.HRESULT.ThrowLastError();
|
||||
}
|
||||
return pvParam;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static Standard.NONCLIENTMETRICS SystemParameterInfo_GetNONCLIENTMETRICS()
|
||||
{
|
||||
Standard.NONCLIENTMETRICS pvParam = Standard.Utility.IsOSVistaOrNewer ? Standard.NONCLIENTMETRICS.VistaMetricsStruct : Standard.NONCLIENTMETRICS.XPMetricsStruct;
|
||||
if (!_SystemParametersInfo_NONCLIENTMETRICS(Standard.SPI.GETNONCLIENTMETRICS, pvParam.cbSize, ref pvParam, Standard.SPIF.None))
|
||||
{
|
||||
Standard.HRESULT.ThrowLastError();
|
||||
}
|
||||
return pvParam;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static void SystemParametersInfo(Standard.SPI uiAction, int uiParam, string pvParam, Standard.SPIF fWinIni)
|
||||
{
|
||||
if (!_SystemParametersInfo_String(uiAction, uiParam, pvParam, fWinIni))
|
||||
{
|
||||
Standard.HRESULT.ThrowLastError();
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern uint TrackPopupMenuEx(IntPtr hmenu, uint fuFlags, int x, int y, IntPtr hwnd, IntPtr lptpm);
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static void UnregisterClass(short atom, IntPtr hinstance)
|
||||
{
|
||||
if (!_UnregisterClassAtom(new IntPtr(atom), hinstance))
|
||||
{
|
||||
Standard.HRESULT.ThrowLastError();
|
||||
}
|
||||
}
|
||||
|
||||
public static void UnregisterClass(string lpClassName, IntPtr hInstance)
|
||||
{
|
||||
if (!_UnregisterClassName(lpClassName, hInstance))
|
||||
{
|
||||
Standard.HRESULT.ThrowLastError();
|
||||
}
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static void UpdateLayeredWindow(IntPtr hwnd, int crKey, ref Standard.BLENDFUNCTION pblend, Standard.ULW dwFlags)
|
||||
{
|
||||
if (!_UpdateLayeredWindowIntPtr(hwnd, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, crKey, ref pblend, dwFlags))
|
||||
{
|
||||
Standard.HRESULT.ThrowLastError();
|
||||
}
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static void UpdateLayeredWindow(IntPtr hwnd, Standard.SafeDC hdcDst, ref Standard.POINT pptDst, ref Standard.SIZE psize, Standard.SafeDC hdcSrc, ref Standard.POINT pptSrc, int crKey, ref Standard.BLENDFUNCTION pblend, Standard.ULW dwFlags)
|
||||
{
|
||||
if (!_UpdateLayeredWindow(hwnd, hdcDst, ref pptDst, ref psize, hdcSrc, ref pptSrc, crKey, ref pblend, dwFlags))
|
||||
{
|
||||
Standard.HRESULT.ThrowLastError();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum OLECMDEXECOPT
|
||||
{
|
||||
DODEFAULT,
|
||||
PROMPTUSER,
|
||||
DONTPROMPTUSER,
|
||||
SHOWHELP
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum OLECMDF
|
||||
{
|
||||
DEFHIDEONCTXTMENU = 0x20,
|
||||
ENABLED = 2,
|
||||
INVISIBLE = 0x10,
|
||||
LATCHED = 4,
|
||||
NINCHED = 8,
|
||||
SUPPORTED = 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum OLECMDID
|
||||
{
|
||||
ALLOWUILESSSAVEAS = 0x2e,
|
||||
CLEARSELECTION = 0x12,
|
||||
CLOSE = 0x2d,
|
||||
COPY = 12,
|
||||
CUT = 11,
|
||||
DELETE = 0x21,
|
||||
DONTDOWNLOADCSS = 0x2f,
|
||||
ENABLE_INTERACTION = 0x24,
|
||||
FIND = 0x20,
|
||||
FOCUSVIEWCONTROLS = 0x39,
|
||||
FOCUSVIEWCONTROLSQUERY = 0x3a,
|
||||
GETPRINTTEMPLATE = 0x34,
|
||||
GETZOOMRANGE = 20,
|
||||
HIDETOOLBARS = 0x18,
|
||||
HTTPEQUIV = 0x22,
|
||||
HTTPEQUIV_DONE = 0x23,
|
||||
NEW = 2,
|
||||
ONTOOLBARACTIVATED = 0x1f,
|
||||
ONUNLOAD = 0x25,
|
||||
OPEN = 1,
|
||||
PAGEACTIONBLOCKED = 0x37,
|
||||
PAGEACTIONUIQUERY = 0x38,
|
||||
PAGESETUP = 8,
|
||||
PASTE = 13,
|
||||
PASTESPECIAL = 14,
|
||||
PREREFRESH = 0x27,
|
||||
PRINT = 6,
|
||||
PRINT2 = 0x31,
|
||||
PRINTPREVIEW = 7,
|
||||
PRINTPREVIEW2 = 50,
|
||||
PROPERTIES = 10,
|
||||
PROPERTYBAG2 = 0x26,
|
||||
REDO = 0x10,
|
||||
REFRESH = 0x16,
|
||||
SAVE = 3,
|
||||
SAVEAS = 4,
|
||||
SAVECOPYAS = 5,
|
||||
SELECTALL = 0x11,
|
||||
SETDOWNLOADSTATE = 0x1d,
|
||||
SETPRINTTEMPLATE = 0x33,
|
||||
SETPROGRESSMAX = 0x19,
|
||||
SETPROGRESSPOS = 0x1a,
|
||||
SETPROGRESSTEXT = 0x1b,
|
||||
SETTITLE = 0x1c,
|
||||
SHOWFIND = 0x2a,
|
||||
SHOWMESSAGE = 0x29,
|
||||
SHOWPAGEACTIONMENU = 0x3b,
|
||||
SHOWPAGESETUP = 0x2b,
|
||||
SHOWPRINT = 0x2c,
|
||||
SHOWSCRIPTERROR = 40,
|
||||
SPELL = 9,
|
||||
STOP = 0x17,
|
||||
STOPDOWNLOAD = 30,
|
||||
UNDO = 15,
|
||||
UPDATECOMMANDS = 0x15,
|
||||
UPDATEPAGESTATUS = 0x30,
|
||||
ZOOM = 0x13
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack=4)]
|
||||
internal struct PKEY
|
||||
{
|
||||
private readonly Guid _fmtid;
|
||||
private readonly uint _pid;
|
||||
public static readonly Standard.PKEY Title;
|
||||
public static readonly Standard.PKEY AppUserModel_ID;
|
||||
public static readonly Standard.PKEY AppUserModel_IsDestListSeparator;
|
||||
public static readonly Standard.PKEY AppUserModel_RelaunchCommand;
|
||||
public static readonly Standard.PKEY AppUserModel_RelaunchDisplayNameResource;
|
||||
public static readonly Standard.PKEY AppUserModel_RelaunchIconResource;
|
||||
public PKEY(Guid fmtid, uint pid)
|
||||
{
|
||||
this._fmtid = fmtid;
|
||||
this._pid = pid;
|
||||
}
|
||||
|
||||
static PKEY()
|
||||
{
|
||||
Title = new Standard.PKEY(new Guid("F29F85E0-4FF9-1068-AB91-08002B27B3D9"), 2);
|
||||
AppUserModel_ID = new Standard.PKEY(new Guid("9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3"), 5);
|
||||
AppUserModel_IsDestListSeparator = new Standard.PKEY(new Guid("9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3"), 6);
|
||||
AppUserModel_RelaunchCommand = new Standard.PKEY(new Guid("9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3"), 2);
|
||||
AppUserModel_RelaunchDisplayNameResource = new Standard.PKEY(new Guid("9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3"), 4);
|
||||
AppUserModel_RelaunchIconResource = new Standard.PKEY(new Guid("9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3"), 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct POINT
|
||||
{
|
||||
public int x;
|
||||
public int y;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Explicit), SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
|
||||
internal class PROPVARIANT : IDisposable
|
||||
{
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields"), FieldOffset(8)]
|
||||
private short boolVal;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields"), FieldOffset(8)]
|
||||
private byte byteVal;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields"), FieldOffset(8)]
|
||||
private long longVal;
|
||||
[SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources"), SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields"), FieldOffset(8)]
|
||||
private IntPtr pointerVal;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields"), FieldOffset(0)]
|
||||
private ushort vt;
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
NativeMethods.PropVariantClear(this);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
this.Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId="disposing")]
|
||||
private void Dispose(bool disposing)
|
||||
{
|
||||
this.Clear();
|
||||
}
|
||||
|
||||
~PROPVARIANT()
|
||||
{
|
||||
this.Dispose(false);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")]
|
||||
public string GetValue()
|
||||
{
|
||||
if (this.vt == 0x1f)
|
||||
{
|
||||
return Marshal.PtrToStringUni(this.pointerVal);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void SetValue(bool f)
|
||||
{
|
||||
this.Clear();
|
||||
this.vt = 11;
|
||||
this.boolVal = f ? ((short) (-1)) : ((short) 0);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")]
|
||||
public void SetValue(string val)
|
||||
{
|
||||
this.Clear();
|
||||
this.vt = 0x1f;
|
||||
this.pointerVal = Marshal.StringToCoTaskMemUni(val);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public VarEnum VarType
|
||||
{
|
||||
get
|
||||
{
|
||||
return (VarEnum) this.vt;
|
||||
}
|
||||
}
|
||||
|
||||
private static class NativeMethods
|
||||
{
|
||||
[DllImport("ole32.dll")]
|
||||
internal static extern Standard.HRESULT PropVariantClear(PROPVARIANT pvar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum READYSTATE
|
||||
{
|
||||
UNINITIALIZED,
|
||||
LOADING,
|
||||
LOADED,
|
||||
INTERACTIVE,
|
||||
COMPLETE
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct RECT
|
||||
{
|
||||
private int _left;
|
||||
private int _top;
|
||||
private int _right;
|
||||
private int _bottom;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public void Offset(int dx, int dy)
|
||||
{
|
||||
this._left += dx;
|
||||
this._top += dy;
|
||||
this._right += dx;
|
||||
this._bottom += dy;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public int Left
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._left;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._left = value;
|
||||
}
|
||||
}
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public int Right
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._right;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._right = value;
|
||||
}
|
||||
}
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public int Top
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._top;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._top = value;
|
||||
}
|
||||
}
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public int Bottom
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._bottom;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._bottom = value;
|
||||
}
|
||||
}
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public int Width
|
||||
{
|
||||
get
|
||||
{
|
||||
return (this._right - this._left);
|
||||
}
|
||||
}
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public int Height
|
||||
{
|
||||
get
|
||||
{
|
||||
return (this._bottom - this._top);
|
||||
}
|
||||
}
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public Standard.POINT Position
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Standard.POINT { x = this._left, y = this._top };
|
||||
}
|
||||
}
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public Standard.SIZE Size
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Standard.SIZE { cx = this.Width, cy = this.Height };
|
||||
}
|
||||
}
|
||||
public static Standard.RECT Union(Standard.RECT rect1, Standard.RECT rect2)
|
||||
{
|
||||
return new Standard.RECT { Left = Math.Min(rect1.Left, rect2.Left), Top = Math.Min(rect1.Top, rect2.Top), Right = Math.Max(rect1.Right, rect2.Right), Bottom = Math.Max(rect1.Bottom, rect2.Bottom) };
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
Standard.RECT rect = (Standard.RECT) obj;
|
||||
return ((((rect._bottom == this._bottom) && (rect._left == this._left)) && (rect._right == this._right)) && (rect._top == this._top));
|
||||
}
|
||||
catch (InvalidCastException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return (((this._left << 0x10) | Standard.Utility.LOWORD(this._right)) ^ ((this._top << 0x10) | Standard.Utility.LOWORD(this._bottom)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct RGBQUAD
|
||||
{
|
||||
public byte rgbBlue;
|
||||
public byte rgbGreen;
|
||||
public byte rgbRed;
|
||||
public byte rgbReserved;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum RGN
|
||||
{
|
||||
AND = 1,
|
||||
COPY = 5,
|
||||
DIFF = 4,
|
||||
OR = 2,
|
||||
XOR = 3
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential), SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
|
||||
internal class RefPOINT
|
||||
{
|
||||
public int x;
|
||||
public int y;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential), SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
|
||||
internal class RefRECT
|
||||
{
|
||||
private int _left;
|
||||
private int _top;
|
||||
private int _right;
|
||||
private int _bottom;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public RefRECT(int left, int top, int right, int bottom)
|
||||
{
|
||||
this._left = left;
|
||||
this._top = top;
|
||||
this._right = right;
|
||||
this._bottom = bottom;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public int Width
|
||||
{
|
||||
get
|
||||
{
|
||||
return (this._right - this._left);
|
||||
}
|
||||
}
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public int Height
|
||||
{
|
||||
get
|
||||
{
|
||||
return (this._bottom - this._top);
|
||||
}
|
||||
}
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public int Left
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._left;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._left = value;
|
||||
}
|
||||
}
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public int Right
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._right;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._right = value;
|
||||
}
|
||||
}
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public int Top
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._top;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._top = value;
|
||||
}
|
||||
}
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public int Bottom
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._bottom;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._bottom = value;
|
||||
}
|
||||
}
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public void Offset(int dx, int dy)
|
||||
{
|
||||
this._left += dx;
|
||||
this._top += dy;
|
||||
this._right += dx;
|
||||
this._bottom += dy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum SC
|
||||
{
|
||||
ARRANGE = 0xf110,
|
||||
CLOSE = 0xf060,
|
||||
CONTEXTHELP = 0xf180,
|
||||
DEFAULT = 0xf160,
|
||||
F_ISSECURE = 1,
|
||||
HOTKEY = 0xf150,
|
||||
HSCROLL = 0xf080,
|
||||
ICON = 0xf020,
|
||||
KEYMENU = 0xf100,
|
||||
MAXIMIZE = 0xf030,
|
||||
MINIMIZE = 0xf020,
|
||||
MONITORPOWER = 0xf170,
|
||||
MOUSEMENU = 0xf090,
|
||||
MOVE = 0xf010,
|
||||
NEXTWINDOW = 0xf040,
|
||||
PREVWINDOW = 0xf050,
|
||||
RESTORE = 0xf120,
|
||||
SCREENSAVE = 0xf140,
|
||||
SEPARATOR = 0xf00f,
|
||||
SIZE = 0xf000,
|
||||
TASKLIST = 0xf130,
|
||||
VSCROLL = 0xf070,
|
||||
ZOOM = 0xf030
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
[Flags]
|
||||
internal enum SFGAO : uint
|
||||
{
|
||||
BROWSABLE = 0x8000000,
|
||||
CANCOPY = 1,
|
||||
CANDELETE = 0x20,
|
||||
CANLINK = 4,
|
||||
CANMONIKER = 0x400000,
|
||||
CANMOVE = 2,
|
||||
CANRENAME = 0x10,
|
||||
CAPABILITYMASK = 0x177,
|
||||
COMPRESSED = 0x4000000,
|
||||
CONTENTSMASK = 0x80000000,
|
||||
DISPLAYATTRMASK = 0xfc000,
|
||||
DROPTARGET = 0x100,
|
||||
ENCRYPTED = 0x2000,
|
||||
FILESYSANCESTOR = 0x10000000,
|
||||
FILESYSTEM = 0x40000000,
|
||||
FOLDER = 0x20000000,
|
||||
GHOSTED = 0x8000,
|
||||
HASPROPSHEET = 0x40,
|
||||
HASSTORAGE = 0x400000,
|
||||
HASSUBFOLDER = 0x80000000,
|
||||
HIDDEN = 0x80000,
|
||||
ISSLOW = 0x4000,
|
||||
LINK = 0x10000,
|
||||
NEWCONTENT = 0x200000,
|
||||
NONENUMERATED = 0x100000,
|
||||
PKEYSFGAOMASK = 0x81044000,
|
||||
READONLY = 0x40000,
|
||||
REMOVABLE = 0x2000000,
|
||||
SHARE = 0x20000,
|
||||
STORAGE = 8,
|
||||
STORAGEANCESTOR = 0x800000,
|
||||
STORAGECAPMASK = 0x70c50008,
|
||||
STREAM = 0x400000,
|
||||
VALIDATE = 0x1000000
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum SHARD
|
||||
{
|
||||
APPIDINFO = 4,
|
||||
APPIDINFOIDLIST = 5,
|
||||
APPIDINFOLINK = 7,
|
||||
LINK = 6,
|
||||
PATHA = 2,
|
||||
PATHW = 3,
|
||||
PIDL = 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack=4), SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
|
||||
internal class SHARDAPPIDINFO
|
||||
{
|
||||
[MarshalAs(UnmanagedType.Interface)]
|
||||
private object psi;
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
private string pszAppID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack=4), SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
|
||||
internal class SHARDAPPIDINFOIDLIST
|
||||
{
|
||||
private IntPtr pidl;
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
private string pszAppID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack=4), SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
|
||||
internal class SHARDAPPIDINFOLINK
|
||||
{
|
||||
private IntPtr psl;
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
private string pszAppID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
|
||||
internal enum SHCONTF
|
||||
{
|
||||
CHECKING_FOR_CHILDREN = 0x10,
|
||||
ENABLE_ASYNC = 0x8000,
|
||||
FASTITEMS = 0x2000,
|
||||
FLATLIST = 0x4000,
|
||||
FOLDERS = 0x20,
|
||||
INCLUDEHIDDEN = 0x80,
|
||||
INIT_ON_FIRST_NEXT = 0x100,
|
||||
NAVIGATION_ENUM = 0x1000,
|
||||
NETPRINTERSRCH = 0x200,
|
||||
NONFOLDERS = 0x40,
|
||||
SHAREABLE = 0x400,
|
||||
STORAGE = 0x800
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace Standard
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode, Pack=1)]
|
||||
internal struct SHFILEOPSTRUCT
|
||||
{
|
||||
public IntPtr hwnd;
|
||||
[MarshalAs(UnmanagedType.U4)]
|
||||
public Standard.FO wFunc;
|
||||
public string pFrom;
|
||||
public string pTo;
|
||||
[MarshalAs(UnmanagedType.U2)]
|
||||
public Standard.FOF fFlags;
|
||||
[MarshalAs(UnmanagedType.Bool)]
|
||||
public int fAnyOperationsAborted;
|
||||
public IntPtr hNameMappings;
|
||||
public string lpszProgressTitle;
|
||||
}
|
||||
}
|
||||
|
||||
Loaded 100 of 704 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user