internal static SafeLocalAllocHandle LocalAlloc(int cb) { SafeLocalAllocHandle localAllocHandle = Kernel32.LocalAlloc(0, (UIntPtr)((ulong)cb)); if (localAllocHandle.IsInvalid) { localAllocHandle.SetHandleAsInvalid(); throw new OutOfMemoryException(); } return(localAllocHandle); }