Source code of Windows XP (NT5)
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.

57 lines
1.7 KiB

  1. /****************************************************************************/
  2. // winbreak.c
  3. //
  4. // Copyright (C) 1997-1999 Microsoft Corp.
  5. /****************************************************************************/
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <windows.h>
  9. #include <winsta.h>
  10. int _cdecl
  11. main (int argc, char *argv[])
  12. {
  13. int i;
  14. ULONG LogonId = 0;
  15. HANDLE hServer = NULL;
  16. BOOLEAN KernelFlag = FALSE;
  17. if ( argc == 1 || argc == 2 && !strcmp( argv[1], "-?" ) ) {
  18. printf( "winbreak: WinStation breakpoint utility\n" );
  19. printf( "USAGE: winbreak [-k] [-s server] <logonid>\n" );
  20. printf( " -k: for kernel breakpoint\n" );
  21. printf( " -s: to specify server name\n" );
  22. return( 1 );
  23. }
  24. for ( i = 1; i < argc; i++ ) {
  25. if ( !strcmp( argv[i], "-s" ) ) {
  26. if ( i+1 >= argc ) {
  27. printf( "Server name expected after -s\n" );
  28. return( 1 );
  29. }
  30. hServer = WinStationOpenServerA( argv[++i] );
  31. if ( hServer == NULL ) {
  32. printf( "Unable to open server %s\n", argv[i] );
  33. return( 1 );
  34. }
  35. } else if ( !strcmp( argv[1], "-k" ) ) {
  36. KernelFlag = TRUE;
  37. } else if ( !strcmp( argv[1], "-2" ) ) {
  38. LogonId = (ULONG)-2;
  39. } else if ( isdigit( argv[i][0] ) ) {
  40. LogonId = atoi( argv[i] );
  41. } else {
  42. printf( "winbreak: WinStation breakpoint utility\n" );
  43. printf( "USAGE: winbreak [-k] [-s server] <logonid>\n" );
  44. printf( " -k: for kernel breakpoint\n" );
  45. printf( " -s: to specify server name\n" );
  46. return( 1 );
  47. }
  48. }
  49. _WinStationBreakPoint( hServer, LogonId, KernelFlag );
  50. return( 0 );
  51. }