Leaked source code of windows server 2003
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.

67 lines
1.2 KiB

  1. /*
  2. * basic client for sumserve remote checksum server
  3. *
  4. *
  5. * sends the program exit command to the server named on the cmd line
  6. */
  7. #include <windows.h>
  8. #include <stdio.h>
  9. #include <string.h>
  10. #include <sumserve.h>
  11. #include "ssclient.h"
  12. extern int __argc;
  13. extern char ** __argv;
  14. /* program entry point
  15. *
  16. */
  17. int PASCAL
  18. WinMain (HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpszCmdParam,
  19. int nCmdShow)
  20. {
  21. HANDLE hpipe;
  22. /* we expect one arg: the server name */
  23. if (__argc != 2) {
  24. printf("usage: sendquit <servername>");
  25. return(1);
  26. }
  27. hpipe = ss_connect(__argv[1]);
  28. if (hpipe == INVALID_HANDLE_VALUE) {
  29. printf("cannot connect to %s", __argv[1]);
  30. return(2);
  31. }
  32. ss_sendrequest(hpipe, SSREQ_EXIT, NULL, strlen(__argv[1])+1);
  33. CloseHandle(hpipe);
  34. return(0);
  35. }
  36. /* error output functions - called by the ssclient library functions
  37. *
  38. * defined here so the library can be called from cmdline and windows
  39. * programs.
  40. *
  41. */
  42. BOOL
  43. Trace_Error(LPSTR str, BOOL fCancel)
  44. {
  45. printf("%s\n", str);
  46. return(TRUE);
  47. }
  48. /*
  49. * status update (eg retrying...)
  50. */
  51. void
  52. Trace_Status(LPSTR str)
  53. {
  54. printf("%s\n", str);
  55. }