Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(811)

Side by Side Diff: experimental/visual_studio_plugin/src/NaClVsx.Package/NaClVsx.Package_IntegrationTestProject/IntegrationTest Library/NativeMethods.cs

Issue 10928195: First round of dead file removal (Closed) Base URL: https://github.com/samclegg/nativeclient-sdk.git@master
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /***************************************************************************
2
3 Copyright (c) Microsoft Corporation. All rights reserved.
4 This code is licensed under the Visual Studio SDK license terms.
5 THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
6 ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
7 IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
8 PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
9
10 ***************************************************************************/
11
12 namespace Microsoft.VsSDK.IntegrationTestLibrary
13 {
14 using System;
15 using System.Collections.Generic;
16 using System.Text;
17 using System.Runtime.InteropServices;
18 using System.Threading;
19 using Microsoft.VisualStudio.Shell.Interop;
20
21 /// <summary>
22 /// Defines pinvoked utility methods and internal VS Constants
23 /// </summary>
24 internal static class NativeMethods
25 {
26 internal delegate bool CallBack(IntPtr hwnd, IntPtr lParam);
27
28 // Declare two overloaded SendMessage functions
29 [DllImport("user32.dll")]
30 internal static extern UInt32 SendMessage(IntPtr hWnd, UInt32 Msg,
31 UInt32 wParam, IntPtr lParam);
32
33 [DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSe t.Auto)]
34 internal static extern bool PeekMessage([In, Out] ref Microsoft.VisualSt udio.OLE.Interop.MSG msg, HandleRef hwnd, int msgMin, int msgMax, int remove);
35
36 [DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSe t.Auto)]
37 internal static extern bool TranslateMessage([In, Out] ref Microsoft.Vis ualStudio.OLE.Interop.MSG msg);
38
39 [DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSe t.Auto)]
40 internal static extern int DispatchMessage([In] ref Microsoft.VisualStud io.OLE.Interop.MSG msg);
41
42 [DllImport("user32.dll", ExactSpelling = true, CharSet = CharSet.Auto)]
43 internal static extern int MsgWaitForMultipleObjects(int nCount, int pHa ndles, bool fWaitAll, int dwMilliseconds, int dwWakeMask);
44
45 [DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSe t.Auto)]
46 internal static extern bool AttachThreadInput(uint idAttach, uint idAtta chTo, bool attach);
47
48 [DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSe t.Auto)]
49 internal static extern uint GetWindowThreadProcessId(IntPtr hWnd, out ui nt lpdwProcessId);
50
51 [DllImport("kernel32.dll", CharSet = System.Runtime.InteropServices.Char Set.Auto)]
52 internal static extern uint GetCurrentThreadId();
53
54 [DllImport("user32")]
55 internal static extern int EnumChildWindows(IntPtr hwnd, CallBack x, Int Ptr y);
56
57 [DllImport("user32")]
58 internal static extern bool IsWindowVisible(IntPtr hDlg);
59
60 [DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSe t.Auto)]
61 internal static extern IntPtr SetFocus(IntPtr hWnd);
62
63 [DllImport("user32")]
64 internal static extern int GetClassName(IntPtr hWnd,
65 StringBuilder className,
66 int stringLength);
67 [DllImport("user32")]
68 internal static extern int GetWindowText(IntPtr hWnd, StringBuilder clas sName, int stringLength);
69
70
71 [DllImport("user32")]
72 internal static extern bool EndDialog(IntPtr hDlg, int result);
73
74 [DllImport("Kernel32")]
75 internal static extern long GetLastError();
76
77 internal const int QS_KEY = 0x0001,
78 QS_MOUSEMOVE = 0x0002,
79 QS_MOUSEBUTTON = 0x0004,
80 QS_POSTMESSAGE = 0x0008,
81 QS_TIMER = 0x0010,
82 QS_PAINT = 0x0020,
83 QS_SENDMESSAGE = 0x0040,
84 QS_HOTKEY = 0x0080,
85 QS_ALLPOSTMESSAGE = 0x0100,
86 QS_MOUSE = QS_MOUSEMOVE | QS_MOUSEBUTTON,
87 QS_INPUT = QS_MOUSE | QS_KEY,
88 QS_ALLEVENTS = QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS _PAINT | QS_HOTKEY,
89 QS_ALLINPUT = QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS_ PAINT | QS_HOTKEY | QS_SENDMESSAGE;
90
91 internal const int Facility_Win32 = 7;
92
93 internal const int WM_CLOSE = 0x0010;
94
95 internal const int
96 S_FALSE = 0x00000001,
97 S_OK = 0x00000000,
98
99 IDOK = 1,
100 IDCANCEL = 2,
101 IDABORT = 3,
102 IDRETRY = 4,
103 IDIGNORE = 5,
104 IDYES = 6,
105 IDNO = 7,
106 IDCLOSE = 8,
107 IDHELP = 9,
108 IDTRYAGAIN = 10,
109 IDCONTINUE = 11;
110
111 internal static long HResultFromWin32(long error)
112 {
113 if (error <= 0)
114 {
115 return error;
116 }
117
118 return ((error & 0x0000FFFF) | (Facility_Win32 << 16) | 0x80000000);
119 }
120
121 /// <devdoc>
122 /// Please use this "approved" method to compare file names.
123 /// </devdoc>
124 public static bool IsSamePath(string file1, string file2)
125 {
126 if (file1 == null || file1.Length == 0)
127 {
128 return (file2 == null || file2.Length == 0);
129 }
130
131 Uri uri1 = null;
132 Uri uri2 = null;
133
134 try
135 {
136 if (!Uri.TryCreate(file1, UriKind.Absolute, out uri1) || !Uri.Tr yCreate(file2, UriKind.Absolute, out uri2))
137 {
138 return false;
139 }
140
141 if (uri1 != null && uri1.IsFile && uri2 != null && uri2.IsFile)
142 {
143 return 0 == String.Compare(uri1.LocalPath, uri2.LocalPath, S tringComparison.OrdinalIgnoreCase);
144 }
145
146 return file1 == file2;
147 }
148 catch (UriFormatException e)
149 {
150 System.Diagnostics.Trace.WriteLine("Exception " + e.Message);
151 }
152
153 return false;
154 }
155
156 }
157 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698