Make the position of 'n files selected' label synced with the width of navigation...
[chromium-blink-merge.git] / tools / stats_viewer / win32.cs
blob18c4a8d4792e77bb15eeb4ac4f0067d8c3fb4eb0
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 using System;
6 using System.Collections.Generic;
7 using System.Runtime.InteropServices;
8 using System.Text;
10 namespace StatsViewer {
11 /// <summary>
12 /// Win32 API constants, structs, and wrappers for access via C#.
13 /// </summary>
14 class Win32 {
15 #region Constants
16 public enum MapAccess {
17 FILE_MAP_COPY = 0x0001,
18 FILE_MAP_WRITE = 0x0002,
19 FILE_MAP_READ = 0x0004,
20 FILE_MAP_ALL_ACCESS = 0x001f,
23 public const int GENERIC_READ = unchecked((int)0x80000000);
24 public const int GENERIC_WRITE = unchecked((int)0x40000000);
25 public const int OPEN_ALWAYS = 4;
26 public static readonly IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1);
27 #endregion
29 [DllImport("kernel32", SetLastError=true, CharSet=CharSet.Auto)]
30 public static extern IntPtr CreateFile (
31 String lpFileName, int dwDesiredAccess, int dwShareMode,
32 IntPtr lpSecurityAttributes, int dwCreationDisposition,
33 int dwFlagsAndAttributes, IntPtr hTemplateFile);
35 [DllImport("kernel32", SetLastError=true)]
36 public static extern IntPtr MapViewOfFile (
37 IntPtr hFileMappingObject, int dwDesiredAccess, int dwFileOffsetHigh,
38 int dwFileOffsetLow, int dwNumBytesToMap);
40 [DllImport("kernel32", SetLastError=true, CharSet=CharSet.Auto)]
41 public static extern IntPtr OpenFileMapping (
42 int dwDesiredAccess, bool bInheritHandle, String lpName);
44 [DllImport("kernel32", SetLastError=true)]
45 public static extern bool UnmapViewOfFile (IntPtr lpBaseAddress);
47 [DllImport("kernel32", SetLastError = true)]
48 public static extern bool CloseHandle(IntPtr handle);