You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

69 lines
1.2 KiB

  1. // Copyright 2012 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // +build windows
  5. // func servicemain(argc uint32, argv **uint16)
  6. TEXT ·servicemain(SB),7,$0
  7. MOVL argc+0(FP), AX
  8. MOVL AX, ·sArgc(SB)
  9. MOVL argv+4(FP), AX
  10. MOVL AX, ·sArgv(SB)
  11. PUSHL BP
  12. PUSHL BX
  13. PUSHL SI
  14. PUSHL DI
  15. SUBL $12, SP
  16. MOVL ·sName(SB), AX
  17. MOVL AX, (SP)
  18. MOVL $·servicectlhandler(SB), AX
  19. MOVL AX, 4(SP)
  20. MOVL $0, 8(SP)
  21. MOVL ·cRegisterServiceCtrlHandlerExW(SB), AX
  22. MOVL SP, BP
  23. CALL AX
  24. MOVL BP, SP
  25. CMPL AX, $0
  26. JE exit
  27. MOVL AX, ·ssHandle(SB)
  28. MOVL ·goWaitsH(SB), AX
  29. MOVL AX, (SP)
  30. MOVL ·cSetEvent(SB), AX
  31. MOVL SP, BP
  32. CALL AX
  33. MOVL BP, SP
  34. MOVL ·cWaitsH(SB), AX
  35. MOVL AX, (SP)
  36. MOVL $-1, AX
  37. MOVL AX, 4(SP)
  38. MOVL ·cWaitForSingleObject(SB), AX
  39. MOVL SP, BP
  40. CALL AX
  41. MOVL BP, SP
  42. exit:
  43. ADDL $12, SP
  44. POPL DI
  45. POPL SI
  46. POPL BX
  47. POPL BP
  48. MOVL 0(SP), CX
  49. ADDL $12, SP
  50. JMP CX
  51. // I do not know why, but this seems to be the only way to call
  52. // ctlHandlerProc on Windows 7.
  53. // func servicectlhandler(ctl uint32, evtype uint32, evdata uintptr, context uintptr) uintptr {
  54. TEXT ·servicectlhandler(SB),7,$0
  55. MOVL ·ctlHandlerExProc(SB), CX
  56. JMP CX