Files
mirror-processhacker/trunk/ProcessHacker.Native/Memory/LocalMemoryAlloc.cs
T
wj32 c096bdfa33 major refactoring; all Native functions are now in a separate assembly
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@1109 21ef857c-d57f-4fe0-8362-d861dc6d29cd
2009-04-21 00:39:15 +00:00

38 lines
899 B
C#

using System;
using System.Collections.Generic;
using System.Text;
using ProcessHacker.Native.Api;
namespace ProcessHacker.Native
{
/// <summary>
/// Represents a LocalAlloc() memory allocation.
/// </summary>
public class LocalMemoryAlloc : MemoryAlloc
{
public LocalMemoryAlloc(int size)
: this(size, AllocFlags.LPtr)
{ }
public LocalMemoryAlloc(int size, AllocFlags flags)
{
this.Memory = Win32.LocalAlloc(flags, size);
if (this.Memory == IntPtr.Zero)
throw new OutOfMemoryException();
base.Size = size;
}
protected override void Free()
{
Win32.LocalFree(this);
}
public override void Resize(int newSize)
{
throw new NotImplementedException();
}
}
}