Imports System.Runtime.InteropServices
<DllImport("advapi32", EntryPoint:="SystemFunction040")>
Shared Function RtlEncryptMemory(Memory As IntPtr, MemoryLength As Integer, OptionFlags As Integer) As Integer
Const RTL_ENCRYPT_MEMORY_SIZE As Integer = 8
Public Shared Sub Main(args As String())
Dim pLong As IntPtr = Marshal.AllocHGlobal(8)
Marshal.WriteInt64(pLong, &H1234567890ABCDEF)
Console.WriteLine("SystemFunction040(RtlEncryptMemory) 메서드 호출 전")
Console.WriteLine("\tpLong: 0x{0:X16}", Marshal.ReadInt64(pLong))
RtlEncryptMemory(pLong, 8, 0)
Console.WriteLine("SystemFunction040(RtlEncryptMemory) 메서드 호출 후")
Console.WriteLine("\tpLong: 0x{0:X16}", Marshal.ReadInt64(pLong))
Marshal.FreeHGlobal(pLong)