Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4. "syscall"
  5. "unsafe"
  6. )
  7.  
  8. var (
  9. user32, _ = syscall.LoadLibrary("user32.dll")
  10. messageBox, _ = syscall.GetProcAddress(user32, "MessageBoxW")
  11. )
  12.  
  13. const (
  14. MB_UINTPTR = 0x00000013
  15. MB_TITLE = "Virus Alert !"
  16. // Couldn't find a way to easily make this a multi-line "statement"
  17. MB_TEXT = "Hi, I am an Albanian virus but because of poor technology in my country unfortunately I am not able to harm your computer. Please be so kind to delete one of your important files yourself and then forward me to other users. Many thanks for your cooperation! Best regards,Albanian virus"
  18. )
  19.  
  20.  
  21. func MessageBox(caption, text string, style uintptr) (result int) {
  22. var nargs uintptr = 4
  23. ret, _, callErr := syscall.Syscall9(uintptr(messageBox),
  24. nargs,
  25. 0,
  26. uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(text))),
  27. uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(caption))),
  28. style,
  29. 0,
  30. 0,
  31. 0,
  32. 0,
  33. 0)
  34. if callErr != 0 {
  35. // Do something ?
  36. }
  37. result = int(ret)
  38. return
  39. }
  40.  
  41. func main() {
  42. defer syscall.FreeLibrary(user32)
  43.  
  44. MessageBox(MB_TITLE, MB_TEXT, MB_UINTPTR)
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement