Update of /cvsroot/wix/wix/src/votive/sdk_vs2008/common/source/csharp/project/misc In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv19110/src/votive/sdk_vs2008/common/source/csharp/project/misc Added Files: connectionpointcontainer.cs externdll.cs nativemethods.cs safenativemethods.cs unsafenativemethods.cs Log Message: AaronSte: Creating separate Votive and Sconce DLLs for VS 2005 and VS 2008. Adding the VS 2008 SDK source code that is needed to build the VS 2008 Votive and Sconce dlls. HeathS: SFBUG:1789825 - CreationTimeUTC documents wrong format SFFEATURE:1768845 - Patch element should support MinorUpdateTargetRTM attribute SFFEATURE:1735295 - Patch build should add PATCHNEW* properties to patch transform Added support for ignorables to CompareUnit in WixUnit HeathS: SFBUG:1768842 - PatchProperty does not allow Company RobMen: Ensure RegistryKey element never ends up as KeyPath because MSI SDK says it isn't allowed. RobMen: Component guid generation. RobMen: SFBUG:1795309 - respect the rollback flag for the last SQL string like all the other strings. RobMen: SFBUG:1787888 - correctly handle certificates that are in Components that are conditioned out. RobMen: SFBUG:1675194 - loop through all server bindings when searching for a match. --- NEW FILE: safenativemethods.cs --- /*************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. This code is licensed under the Visual Studio SDK license terms. THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. ***************************************************************************/ namespace Microsoft.VisualStudio { using System.Runtime.InteropServices; using System; using System.Drawing; using System.Security.Permissions; using System.Collections; using System.IO; using System.Text; // We sacrifice performance for security as this is a serious fxcop bug. // [System.Security.SuppressUnmanagedCodeSecurityAttribute()] internal static class SafeNativeMethods { [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)] internal static extern bool InvalidateRect(IntPtr hWnd, ref NativeMethods.RECT rect, bool erase); [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)] internal static extern bool InvalidateRect(IntPtr hWnd, [MarshalAs(UnmanagedType.Interface)] object rect, bool erase); [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)] internal extern static bool IsChild(IntPtr parent, IntPtr child); [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)] internal static extern bool IsWindowVisible(IntPtr hWnd); [DllImport(ExternDll.Kernel32, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)] internal static extern int GetCurrentThreadId(); [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)] internal static extern int MapWindowPoints(IntPtr hWndFrom, IntPtr hWndTo, [In, Out] ref NativeMethods.RECT rect, int cPoints); [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)] internal static extern int MapWindowPoints(IntPtr hWndFrom, IntPtr hWndTo, [In, Out] ref NativeMethods.POINT pt, int cPoints); [DllImport(ExternDll.User32, CharSet=System.Runtime.InteropServices.CharSet.Auto)] internal static extern int RegisterWindowMessage(string msg); [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)] internal static extern bool GetWindowRect(IntPtr hWnd, [In, Out] ref NativeMethods.RECT rect); [DllImport(ExternDll.User32, CharSet=System.Runtime.InteropServices.CharSet.Auto)] internal static extern int DrawText(IntPtr hDC, string lpszString, int nCount, ref NativeMethods.RECT lpRect, int nFormat); [DllImport(ExternDll.User32, CharSet=System.Runtime.InteropServices.CharSet.Auto)] internal static extern bool OffsetRect([In, Out] ref NativeMethods.RECT lpRect, int dx, int dy); [DllImport(ExternDll.Gdi32, SetLastError=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)] internal static extern int GetTextExtentPoint32(IntPtr hDC, string str, int len, [In, Out] ref NativeMethods.POINT ptSize); [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=CharSet.Auto)] internal static extern IntPtr SelectObject(IntPtr hdc, IntPtr gdiObj); [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=CharSet.Auto)] internal static extern void DeleteObject(IntPtr gdiObj); [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=CharSet.Auto)] internal static extern IntPtr CreateSolidBrush(int crColor); [DllImport(ExternDll.Gdi32, SetLastError=true, CharSet=CharSet.Auto)] internal static extern IntPtr CreateFontIndirect([In, Out, MarshalAs(UnmanagedType.AsAny)] ref object lf); [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=CharSet.Auto)] internal static extern int SetTextColor(IntPtr hdc, int crColor); [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=CharSet.Auto)] internal static extern int SetBkMode(IntPtr hdc, int nBkMode); [DllImport(ExternDll.Oleaut32, PreserveSig = false)] internal static extern void VariantInit(IntPtr pObject); [DllImport(ExternDll.Oleaut32, PreserveSig = false)] internal static extern void VariantClear(IntPtr pObject); } } --- NEW FILE: externdll.cs --- /*************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. This code is licensed under the Visual Studio SDK license terms. THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. ***************************************************************************/ namespace System { internal static class ExternDll { #if FEATURE_PAL #if !PLATFORM_UNIX internal const String DLLPREFIX = ""; internal const String DLLSUFFIX = ".dll"; #else // !PLATFORM_UNIX #if __APPLE__ internal const String DLLPREFIX = "lib"; internal const String DLLSUFFIX = ".dylib"; #elif _AIX internal const String DLLPREFIX = "lib"; internal const String DLLSUFFIX = ".a"; #elif __hppa__ || IA64 internal const String DLLPREFIX = "lib"; internal const String DLLSUFFIX = ".sl"; #else internal const String DLLPREFIX = "lib"; internal const String DLLSUFFIX = ".so"; #endif #endif // !PLATFORM_UNIX public const string Kernel32 = DLLPREFIX + "rotor_pal" + DLLSUFFIX; public const string User32 = DLLPREFIX + "rotor_pal" + DLLSUFFIX; public const string Mscoree = DLLPREFIX + "sscoree" + DLLSUFFIX; #else public const string Activeds = "activeds.dll"; public const string Advapi32 = "advapi32.dll"; public const string Comctl32 = "comctl32.dll"; public const string Comdlg32 = "comdlg32.dll"; public const string Gdi32 = "gdi32.dll"; public const string Gdiplus = "gdiplus.dll"; public const string Hhctrl = "hhctrl.ocx"; public const string Imm32 = "imm32.dll"; public const string Kernel32 = "kernel32.dll"; public const string Loadperf = "Loadperf.dll"; public const string Mscoree = "mscoree.dll"; public const string Mscorwks = "mscorwks.dll"; public const string Msi = "msi.dll"; public const string Mqrt = "mqrt.dll"; public const string Ntdll = "ntdll.dll"; public const string Ole32 = "ole32.dll"; public const string Oleacc = "oleacc.dll"; public const string Oleaut32 = "oleaut32.dll"; public const string Olepro32 = "olepro32.dll"; public const string PerfCounter = "perfcounter.dll"; public const string Powrprof = "Powrprof.dll"; public const string Psapi = "psapi.dll"; public const string Shell32 = "shell32.dll"; public const string Shfolder = "shfolder.dll"; public const string User32 = "user32.dll"; public const string Uxtheme = "uxtheme.dll"; public const string WinMM = "winmm.dll"; public const string Winspool = "winspool.drv"; public const string Wtsapi32 = "wtsapi32.dll"; public const string Version = "version.dll"; public const string Vsassert = "vsassert.dll"; public const string Shlwapi = "shlwapi.dll"; public const string Crypt32 = "crypt32.dll"; // system.data specific internal const string Odbc32 = "odbc32.dll"; internal const string SNI = "System.Data.dll"; // system.data.oracleclient specific internal const string OciDll = "oci.dll"; internal const string OraMtsDll = "oramts.dll"; #endif //!FEATURE_PAL } } --- NEW FILE: unsafenativemethods.cs --- /*************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. This code is licensed under the Visual Studio SDK license terms. THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. ***************************************************************************/ namespace Microsoft.VisualStudio { using System.Runtime.InteropServices; using System; using System.Security.Permissions; using System.Collections; using System.IO; using System.Text; using System.Diagnostics.CodeAnalysis; // We sacrifice performance for security as this is a serious fxcop bug. // [System.Security.SuppressUnmanagedCodeSecurityAttribute()] internal static class UnsafeNativeMethods { // APIS [DllImport(ExternDll.Kernel32, CharSet=CharSet.Auto, SetLastError=true)] internal static extern int GetFileAttributes(String name); [DllImport(ExternDll.Kernel32, CharSet = CharSet.Auto)] public static extern void GetTempFileName(string tempDirName, string prefixName, int unique, StringBuilder sb); [DllImport(ExternDll.Kernel32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)] public static extern bool CloseHandle(HandleRef handle); [DllImport(ExternDll.User32, SetLastError = true, CharSet = CharSet.Auto)] public static extern bool LoadString(HandleRef hInstance, int uID, StringBuilder lpBuffer, int nBufferMax); //GetWindowLong won't work correctly for 64-bit: we should use GetWindowLongPtr instead. On //32-bit, GetWindowLongPtr is just #defined as GetWindowLong. GetWindowLong really should //take/return int instead of IntPtr/HandleRef, but since we're running this only for 32-bit //it'll be OK. public static IntPtr GetWindowLong(IntPtr hWnd, int nIndex) { if (IntPtr.Size == 4) { return GetWindowLong32(hWnd, nIndex); } return GetWindowLongPtr64(hWnd, nIndex); } [DllImport(ExternDll.User32, CharSet = CharSet.Auto, EntryPoint = "GetWindowLong")] public static extern IntPtr GetWindowLong32(IntPtr hWnd, int nIndex); [SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist")] [DllImport(ExternDll.User32, CharSet = CharSet.Auto, EntryPoint = "GetWindowLongPtr")] public static extern IntPtr GetWindowLongPtr64(IntPtr hWnd, int nIndex); [DllImport(ExternDll.User32, CharSet = CharSet.Auto)] internal static extern bool PostMessage(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam); [DllImport(ExternDll.User32, CharSet = CharSet.Auto)] internal static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam); [DllImport(ExternDll.User32, CharSet = System.Runtime.InteropServices.CharSet.Auto)] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable")] public static extern IntPtr SendMessage(IntPtr hwnd, int msg, bool wparam, int lparam); [DllImport(ExternDll.User32, CharSet = CharSet.Auto)] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable")] public static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, string lParam); [DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Auto)] internal static extern IntPtr SetParent(IntPtr hWnd, IntPtr hWndParent); //SetWindowLong won't work correctly for 64-bit: we should use SetWindowLongPtr instead. On //32-bit, SetWindowLongPtr is just #defined as SetWindowLong. SetWindowLong really should //take/return int instead of IntPtr/HandleRef, but since we're running this only for 32-bit //it'll be OK. public static IntPtr SetWindowLong(IntPtr hWnd, int nIndex, IntPtr dwNewLong) { if (IntPtr.Size == 4) { return SetWindowLongPtr32(hWnd, nIndex, dwNewLong); } return SetWindowLongPtr64(hWnd, nIndex, dwNewLong); } [SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable")] [DllImport(ExternDll.User32, CharSet = CharSet.Auto, EntryPoint = "SetWindowLong")] public static extern IntPtr SetWindowLongPtr32(IntPtr hWnd, int nIndex, IntPtr dwNewLong); [SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist")] [DllImport(ExternDll.User32, CharSet = CharSet.Auto, EntryPoint = "SetWindowLongPtr")] public static extern IntPtr SetWindowLongPtr64(IntPtr hWnd, int nIndex, IntPtr dwNewLong); public static IntPtr SetWindowLong(IntPtr hWnd, short nIndex, IntPtr dwNewLong) { if (IntPtr.Size == 4) { return SetWindowLongPtr32(hWnd, nIndex, dwNewLong); } return SetWindowLongPtr64(hWnd, (int)nIndex, dwNewLong); } [SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable")] [DllImport(ExternDll.User32, CharSet = CharSet.Auto, EntryPoint = "SetWindowLong")] public static extern IntPtr SetWindowLongPtr32(IntPtr hWnd, short nIndex, IntPtr dwNewLong); [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)] internal static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, int flags); [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)] internal static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); /// IDataObject stuff [DllImport(ExternDll.Kernel32, ExactSpelling=true, CharSet=CharSet.Auto)] internal static extern IntPtr GlobalAlloc(int uFlags, int dwBytes); [DllImport(ExternDll.Kernel32, ExactSpelling=true, CharSet=CharSet.Auto)] internal static extern IntPtr GlobalReAlloc(HandleRef handle, int bytes, int flags); [DllImport(ExternDll.Kernel32, ExactSpelling=true, CharSet=CharSet.Auto)] internal static extern IntPtr GlobalLock(HandleRef handle); [DllImport(ExternDll.Kernel32, ExactSpelling=true, CharSet=CharSet.Auto)] internal static extern bool GlobalUnlock(HandleRef handle); [DllImport(ExternDll.Kernel32, ExactSpelling=true, CharSet=CharSet.Auto)] internal static extern IntPtr GlobalFree(HandleRef handle); [DllImport(ExternDll.Kernel32, ExactSpelling=true, CharSet=CharSet.Auto)] internal static extern int GlobalSize(HandleRef handle); // Beats me why this isn't in the Marshal class. [DllImport(ExternDll.Kernel32, EntryPoint = "GlobalLock", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] internal static extern IntPtr GlobalLock(IntPtr h); [DllImport(ExternDll.Kernel32, EntryPoint = "GlobalUnlock", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] internal static extern bool GlobalUnLock(IntPtr h); [DllImport(ExternDll.Kernel32, EntryPoint = "GlobalSize", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] internal static extern int GlobalSize(IntPtr h); [DllImport(ExternDll.Kernel32, ExactSpelling=true, EntryPoint="RtlMoveMemory", CharSet=CharSet.Unicode)] internal static extern void CopyMemoryW(IntPtr pdst, string psrc, int cb); [DllImport(ExternDll.Kernel32, ExactSpelling=true, EntryPoint="RtlMoveMemory", CharSet=CharSet.Unicode)] internal static extern void CopyMemoryW(IntPtr pdst, char[] psrc, int cb); [DllImport(ExternDll.Kernel32, ExactSpelling=true, EntryPoint="RtlMoveMemory", CharSet=CharSet.Unicode)] internal static extern void CopyMemoryW(StringBuilder pdst, HandleRef psrc, int cb); [DllImport(ExternDll.Kernel32, ExactSpelling=true, EntryPoint="RtlMoveMemory", CharSet=CharSet.Unicode)] internal static extern void CopyMemoryW(char[] pdst, HandleRef psrc, int cb); [DllImport(ExternDll.Kernel32, ExactSpelling=true, EntryPoint="RtlMoveMemory")] internal static extern void CopyMemory(IntPtr pdst, byte[] psrc, int cb); [DllImport(ExternDll.Kernel32, ExactSpelling=true, EntryPoint="RtlMoveMemory")] internal static extern void CopyMemory(byte[] pdst, HandleRef psrc, int cb); [DllImport(ExternDll.Kernel32, ExactSpelling=true, EntryPoint="RtlMoveMemory")] internal static extern void CopyMemory(IntPtr pdst, HandleRef psrc, int cb); [DllImport(ExternDll.Kernel32, ExactSpelling=true, EntryPoint="RtlMoveMemory")] internal static extern void CopyMemory(IntPtr pdst, string psrc, int cb); [DllImport(ExternDll.Kernel32, ExactSpelling=true, CharSet=CharSet.Unicode)] internal static extern int WideCharToMultiByte(int codePage, int flags, [MarshalAs(UnmanagedType.LPWStr)]string wideStr, int chars, [In,Out] ref byte[] pOutBytes, int bufferBytes, IntPtr defaultChar, IntPtr pDefaultUsed); [DllImport(ExternDll.Ole32, ExactSpelling = true, CharSet = CharSet.Unicode)] internal static extern int OleSetClipboard(Microsoft.VisualStudio.OLE.Interop.IDataObject dataObject); [DllImport(ExternDll.Ole32, ExactSpelling = true, CharSet = CharSet.Unicode)] internal static extern int OleGetClipboard(out Microsoft.VisualStudio.OLE.Interop.IDataObject dataObject); [DllImport(ExternDll.Ole32, ExactSpelling = true, CharSet = CharSet.Unicode)] internal static extern int OleFlushClipboard(); [DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Unicode)] internal static extern int OpenClipboard(IntPtr newOwner); [DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Unicode)] internal static extern int EmptyClipboard(); [DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Unicode)] internal static extern int CloseClipboard(); [DllImport(ExternDll.Comctl32, CharSet = CharSet.Auto)] internal static extern int ImageList_GetImageCount(HandleRef himl); [DllImport(ExternDll.Comctl32, CharSet = CharSet.Auto)] internal static extern bool ImageList_Draw(HandleRef himl, int i, HandleRef hdcDst, int x, int y, int fStyle); [DllImport(ExternDll.Shell32, EntryPoint = "DragQueryFileW", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] internal static extern uint DragQueryFile(IntPtr hDrop, uint iFile, char[] lpszFile, uint cch); [DllImport(ExternDll.User32, EntryPoint = "RegisterClipboardFormatW", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] internal static extern ushort RegisterClipboardFormat(string format); [DllImport(ExternDll.Shell32, EntryPoint = "SHGetSpecialFolderLocation")] internal static extern int SHGetSpecialFolderLocation(IntPtr hwnd, int csidl, [Out, MarshalAs(UnmanagedType.LPArray)] IntPtr[] ppidl); //SHSTDAPI SHGetSpecialFolderLocation(HWND hwnd, int csidl, LPITEMIDLIST *ppidl); [DllImport(ExternDll.Shell32, EntryPoint = "SHGetPathFromIDList", CharSet = System.Runtime.InteropServices.CharSet.Auto)] internal static extern bool SHGetPathFromIDList(IntPtr pidl, IntPtr pszPath); //SHSTDAPI_(BOOL) SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath); ///////////// UNUSED #if false [DllImport(ExternDll.Oleaut32, PreserveSig=false)] internal static extern UCOMITypeLib LoadRegTypeLib(ref Guid clsid, int majorVersion, int minorVersion, int lcid); #endif } } --- NEW FILE: connectionpointcontainer.cs --- /*************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. This code is licensed under the Visual Studio SDK license terms. THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. ***************************************************************************/ using System; using System.Collections.Generic; using Microsoft.VisualStudio.OLE.Interop; using System.Runtime.InteropServices; namespace Microsoft.VisualStudio.Package { /// <summary> /// Class used to identify a source of events of type SinkType. /// </summary> [ComVisible(false)] internal interface IEventSource<SinkType> where SinkType : class { void OnSinkAdded(SinkType sink); void OnSinkRemoved(SinkType sink); } [ComVisible(true)] public class ConnectionPointContainer : IConnectionPointContainer { private Dictionary<Guid, IConnectionPoint> connectionPoints; internal ConnectionPointContainer() { connectionPoints = new Dictionary<Guid, IConnectionPoint>(); } internal void AddEventSource<SinkType>(IEventSource<SinkType> source) where SinkType : class { if (null == source) { throw new ArgumentNullException("source"); } if (connectionPoints.ContainsKey(typeof(SinkType).GUID)) { throw new ArgumentException(); } connectionPoints.Add(typeof(SinkType).GUID, new ConnectionPoint<SinkType>(this, source)); } #region IConnectionPointContainer Members void IConnectionPointContainer.EnumConnectionPoints(out IEnumConnectionPoints ppEnum) { throw new Exception("The method or operation is not implemented."); } void IConnectionPointContainer.FindConnectionPoint(ref Guid riid, out IConnectionPoint ppCP) { ppCP = connectionPoints[riid]; } #endregion } internal class ConnectionPoint<SinkType> : IConnectionPoint where SinkType : class { Dictionary<uint, SinkType> sinks; private uint nextCookie; private ConnectionPointContainer container; private IEventSource<SinkType> source; internal ConnectionPoint(ConnectionPointContainer container, IEventSource<SinkType> source) { if (null == container) { throw new ArgumentNullException("container"); } if (null == source) { throw new ArgumentNullException("source"); } this.container = container; this.source = source; sinks = new Dictionary<uint, SinkType>(); nextCookie = 1; } #region IConnectionPoint Members public void Advise(object pUnkSink, out uint pdwCookie) { SinkType sink = pUnkSink as SinkType; if (null == sink) { Marshal.ThrowExceptionForHR(VSConstants.E_NOINTERFACE); } sinks.Add(nextCookie, sink); pdwCookie = nextCookie; source.OnSinkAdded(sink); nextCookie += 1; } public void EnumConnections(out IEnumConnections ppEnum) { throw new Exception("The method or operation is not implemented."); } public void GetConnectionInterface(out Guid pIID) { pIID = typeof(SinkType).GUID; } public void GetConnectionPointContainer(out IConnectionPointContainer ppCPC) { ppCPC = this.container; } public void Unadvise(uint dwCookie) { // This will throw if the cookie is not in the list. SinkType sink = sinks[dwCookie]; sinks.Remove(dwCookie); source.OnSinkRemoved(sink); } #endregion } } --- NEW FILE: nativemethods.cs --- /*************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. This code is licensed under the Visual Studio SDK license terms. THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. ***************************************************************************/ namespace Microsoft.VisualStudio { using Microsoft.VisualStudio.OLE.Interop; using Microsoft.VisualStudio.TextManager.Interop; using System.Runtime.InteropServices; using System; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; [...1645 lines suppressed...] /// <summary> /// Defines the values that are not supported by the System.Environment.SpecialFolder enumeration /// </summary> [ComVisible(true)] public enum ExtendedSpecialFolder { /// <summary> /// Identical to CSIDL_COMMON_STARTUP /// </summary> CommonStartup = 0x0018, /// <summary> /// Identical to CSIDL_WINDOWS /// </summary> Windows = 0x0024, } } } |