Example #1
0
        public static SafeLocalFree LocalAlloc(int cb)
        {
            SafeLocalFree result = UnsafeCommonNativeMethods.LocalAlloc(LMEM_FIXED, (UIntPtr)cb);

            if (result.IsInvalid)
            {
                result.SetHandleAsInvalid();
                throw new OutOfMemoryException();
            }
            return(result);
        }
        public static SafeLocalFree LocalAlloc(int cb)
        {
            SafeLocalFree free = UnsafeNclNativeMethods.SafeNetHandles.LocalAlloc(0, (UIntPtr)cb);

            if (free.IsInvalid)
            {
                free.SetHandleAsInvalid();
                throw new OutOfMemoryException();
            }
            return(free);
        }