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.

71 lines
1.3 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation
  3. Module Name:
  4. ntsetup\hwlogexe\hwlogexe.c
  5. Abstract:
  6. Command line interface to hwlog.lib.
  7. Author:
  8. Jay Krell (JayKrell) December 13, 2001
  9. Revision History:
  10. Environment:
  11. Windows XP+ Win32 usermode console app
  12. --*/
  13. #include <stdio.h>
  14. #include "windows.h"
  15. #include "setupapi.h"
  16. #include "hwlog.h"
  17. #include "shellapi.h"
  18. #include "io.h"
  19. #define STANDALONE 1
  20. void Main(
  21. PSP_LOG_HARDWARE_IN Parameters
  22. )
  23. {
  24. #if STANDALONE == 1
  25. Parameters->LogFile = (HANDLE)_get_osfhandle(_fileno(stdout));
  26. #elif STANDALONE == 2
  27. SetupOpenLog(FALSE);
  28. Parameters->SetupLogError = SetupLogError;
  29. #endif
  30. SpLogHardware(Parameters);
  31. #if STANDALONE == 2
  32. SetupCloseLog();
  33. #endif
  34. }
  35. #ifdef UNICODE
  36. int __cdecl wmain(int argc, WCHAR** argv)
  37. {
  38. SP_LOG_HARDWARE_IN Parameters = { 0 };
  39. Parameters.MachineName = (argc > 1) ? argv[1] : NULL;
  40. Main(&Parameters);
  41. return 0;
  42. }
  43. #endif
  44. int __cdecl main(int argc, CHAR** argv)
  45. {
  46. SP_LOG_HARDWARE_IN Parameters = { 0 };
  47. #ifdef UNICODE
  48. WCHAR** argvw = NULL;
  49. argvw = CommandLineToArgvW(GetCommandLineW(), &argc);
  50. Parameters.MachineName = (argc > 1) ? argvw[1] : NULL;
  51. #else
  52. Parameters.MachineName = (argc > 1) ? argv[1] : NULL;
  53. #endif
  54. Main(&Parameters);
  55. return 0;
  56. }