1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
|
/*
KeePass Password Safe - The Open-Source Password Manager
Copyright (C) 2003-2012 Dominik Reichl <dominik.reichl@t-online.de>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
using System;
using System.Text;
using System.Security;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Windows.Forms;
using System.Drawing;
namespace KeePass.Native
{
internal static partial class NativeMethods
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
internal struct MOUSEINPUT32_WithSkip
{
public uint __Unused0; // See INPUT32 structure
public int X;
public int Y;
public uint MouseData;
public uint Flags;
public uint Time;
public IntPtr ExtraInfo;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
internal struct KEYBDINPUT32_WithSkip
{
public uint __Unused0; // See INPUT32 structure
public ushort VirtualKeyCode;
public ushort ScanCode;
public uint Flags;
public uint Time;
public IntPtr ExtraInfo;
}
[StructLayout(LayoutKind.Explicit)]
internal struct INPUT32
{
[FieldOffset(0)]
public uint Type;
[FieldOffset(0)]
public MOUSEINPUT32_WithSkip MouseInput;
[FieldOffset(0)]
public KEYBDINPUT32_WithSkip KeyboardInput;
}
// INPUT.KI (40). vk: 8, sc: 10, fl: 12, t: 16, ex: 24
[StructLayout(LayoutKind.Explicit, Size = 40)]
internal struct SpecializedKeyboardINPUT64
{
[FieldOffset(0)]
public uint Type;
[FieldOffset(8)]
public ushort VirtualKeyCode;
[FieldOffset(10)]
public ushort ScanCode;
[FieldOffset(12)]
public uint Flags;
[FieldOffset(16)]
public uint Time;
[FieldOffset(24)]
public IntPtr ExtraInfo;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
internal struct CHARFORMAT2
{
public UInt32 cbSize;
public UInt32 dwMask;
public UInt32 dwEffects;
public Int32 yHeight;
public Int32 yOffset;
public UInt32 crTextColor;
public Byte bCharSet;
public Byte bPitchAndFamily;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string szFaceName;
public UInt16 wWeight;
public UInt16 sSpacing;
public Int32 crBackColor;
public Int32 lcid;
public UInt32 dwReserved;
public Int16 sStyle;
public Int16 wKerning;
public Byte bUnderlineType;
public Byte bAnimation;
public Byte bRevAuthor;
public Byte bReserved1;
}
[StructLayout(LayoutKind.Sequential)]
internal struct RECT
{
public Int32 Left;
public Int32 Top;
public Int32 Right;
public Int32 Bottom;
public RECT(Rectangle rect)
{
this.Left = rect.Left;
this.Top = rect.Top;
this.Right = rect.Right;
this.Bottom = rect.Bottom;
}
}
[StructLayout(LayoutKind.Sequential)]
internal struct COMBOBOXINFO
{
public Int32 cbSize;
public RECT rcItem;
public RECT rcButton;
[MarshalAs(UnmanagedType.U4)]
public ComboBoxButtonState buttonState;
public IntPtr hwndCombo;
public IntPtr hwndEdit;
public IntPtr hwndList;
}
[StructLayout(LayoutKind.Sequential)]
internal struct MARGINS
{
public Int32 Left;
public Int32 Right;
public Int32 Top;
public Int32 Bottom;
}
[StructLayout(LayoutKind.Sequential)]
internal struct COPYDATASTRUCT
{
public IntPtr dwData;
public Int32 cbData;
public IntPtr lpData;
}
[StructLayout(LayoutKind.Sequential)]
private struct SCROLLINFO
{
public uint cbSize;
public uint fMask;
public int nMin;
public int nMax;
public uint nPage;
public int nPos;
public int nTrackPos;
}
[StructLayout(LayoutKind.Sequential)]
internal struct HDITEM
{
public UInt32 mask;
public Int32 cxy;
[MarshalAs(UnmanagedType.LPTStr)]
public string pszText;
public IntPtr hbm;
public Int32 cchTextMax;
public Int32 fmt;
public IntPtr lParam;
public Int32 iImage;
public Int32 iOrder;
}
// [StructLayout(LayoutKind.Sequential)]
// internal struct NMHDR
// {
// public IntPtr hwndFrom;
// public IntPtr idFrom;
// public int code;
// }
[StructLayout(LayoutKind.Sequential)]
private struct LASTINPUTINFO
{
public uint cbSize;
public uint dwTime;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
private struct SHFILEINFO
{
public IntPtr hIcon;
public int iIcon;
public uint dwAttributes;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst =
KeePassLib.Native.NativeMethods.MAX_PATH)]
public string szDisplayName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
public string szTypeName;
}
/* // LVGROUP for Windows Vista and higher
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
private struct LVGROUP
{
public uint cbSize;
public uint mask;
// [MarshalAs(UnmanagedType.LPWStr)]
// public StringBuilder pszHeader;
public IntPtr pszHeader;
public int cchHeader;
// [MarshalAs(UnmanagedType.LPWStr)]
// public StringBuilder pszFooter;
public IntPtr pszFooter;
public int cchFooter;
public int iGroupId;
public uint stateMask;
public uint state;
public uint uAlign;
// [MarshalAs(UnmanagedType.LPWStr)]
// public StringBuilder pszSubtitle;
public IntPtr pszSubtitle;
public uint cchSubtitle;
[MarshalAs(UnmanagedType.LPWStr)]
public string pszTask;
// public StringBuilder pszTask;
// public IntPtr pszTask;
public uint cchTask;
// [MarshalAs(UnmanagedType.LPWStr)]
// public StringBuilder pszDescriptionTop;
public IntPtr pszDescriptionTop;
public uint cchDescriptionTop;
// [MarshalAs(UnmanagedType.LPWStr)]
// public StringBuilder pszDescriptionBottom;
public IntPtr pszDescriptionBottom;
public uint cchDescriptionBottom;
public int iTitleImage;
public int iExtendedImage;
public int iFirstItem;
public uint cItems;
// [MarshalAs(UnmanagedType.LPWStr)]
// public StringBuilder pszSubsetTitle;
public IntPtr pszSubsetTitle;
public uint cchSubsetTitle;
[Conditional("DEBUG")]
internal void AssertSize()
{
if(IntPtr.Size == 4)
{
Debug.Assert(Marshal.SizeOf(this) == 96);
}
else if(IntPtr.Size == 8)
{
Debug.Assert(Marshal.SizeOf(this) == 152);
}
else { Debug.Assert(false); }
}
} */
}
}
|