31 lines
831 B
C#
31 lines
831 B
C#
using System.Diagnostics;
|
|
using System.Runtime.InteropServices;
|
|
using System.Text;
|
|
|
|
namespace IPClab2;
|
|
|
|
internal class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
var secretBytes = Encoding.UTF8.GetBytes("Super secret data\0");
|
|
GCHandle handle = GCHandle.Alloc(secretBytes, GCHandleType.Pinned);
|
|
|
|
try
|
|
{
|
|
IntPtr memAddress = handle.AddrOfPinnedObject();
|
|
int currentPid = Process.GetCurrentProcess().Id;
|
|
Console.WriteLine("oh yep hi");
|
|
Console.WriteLine(currentPid);
|
|
Console.WriteLine($"0x{memAddress.ToInt64():X}");
|
|
Console.ReadLine();
|
|
Console.WriteLine(Encoding.UTF8.GetString(secretBytes));
|
|
Console.ReadLine();
|
|
}
|
|
finally
|
|
{
|
|
handle.Free();
|
|
}
|
|
}
|
|
}
|