Microsoft.VisualStudio.Project.UnsafeNativeMethods.GlobalUnlock C# (CSharp) Method

GlobalUnlock() private method

private GlobalUnlock ( SafeGlobalAllocHandle h ) : bool
h SafeGlobalAllocHandle
return bool
        internal static extern bool GlobalUnlock(SafeGlobalAllocHandle h);

Usage Example

Esempio n. 1
0
        public static SafeGlobalAllocHandle CopyHGlobal(SafeGlobalAllocHandle data)
        {
            IntPtr  src  = UnsafeNativeMethods.GlobalLock(data);
            UIntPtr size = UnsafeNativeMethods.GlobalSize(data);
            SafeGlobalAllocHandle ptr = UnsafeNativeMethods.GlobalAlloc(0, size);
            IntPtr buffer             = UnsafeNativeMethods.GlobalLock(ptr);

            try
            {
                UnsafeNativeMethods.MoveMemory(buffer, src, size);
            }
            finally
            {
                if (buffer != IntPtr.Zero)
                {
                    UnsafeNativeMethods.GlobalUnlock(ptr);
                }

                if (src != IntPtr.Zero)
                {
                    UnsafeNativeMethods.GlobalUnlock(data);
                }
            }

            return(ptr);
        }
All Usage Examples Of Microsoft.VisualStudio.Project.UnsafeNativeMethods::GlobalUnlock