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.

89 lines
2.3 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. This module tests the NT side of my migration DLL.
  4. Assumptions:
  5. * There's no work to do migrating users. That's all done by fax setup.
  6. * The migration DLL doesn't need the unattend file.
  7. * awdvstub.exe is in the same directory.
  8. Author:
  9. Brian Dewey (t-briand) 1997-7-25
  10. --*/
  11. #include <windows.h>
  12. #include <stdio.h>
  13. #include <stdlib.h>
  14. #include <tchar.h>
  15. #include <setupapi.h>
  16. #include "migrate.h"
  17. // ------------------------------------------------------------
  18. // Prototypes
  19. void SystemError(DWORD dwSysErrorCode);
  20. // ------------------------------------------------------------
  21. // main
  22. int _cdecl
  23. main()
  24. {
  25. LPVOID Reserved = NULL;
  26. HINF hUnattend; // Handle to the unattend file.
  27. UINT iLineNo; // Will hold the number of an offending line.
  28. DWORD dwSysError; // Error code...
  29. LONG lError; // Returned error code.
  30. TCHAR szFileName[] = TEXT("f:\\nt\\private\\awd2tiff\\bin\\i386\\unattend.txt");
  31. fprintf(stderr, "Windows NT Sample Migration Tool.\n");
  32. fprintf(stderr, "Copyright (c) 1997 Microsoft Corporation.\n\n");
  33. if(InitializeNT(L"dump", L"dump", Reserved) != ERROR_SUCCESS) {
  34. fprintf(stderr, "NTMigrate:Migration DLL initialization failed, exiting...\n");
  35. exit(1);
  36. } else {
  37. fprintf(stderr, "NT side of migration DLL successfully initialized.\n");
  38. }
  39. // TODO: migrate the system.
  40. MigrateSystemNT(NULL, NULL);
  41. return 0;
  42. }
  43. // ------------------------------------------------------------
  44. // Auxiliary functions
  45. // SystemError
  46. //
  47. // Displays a system error message on stderr.
  48. //
  49. // Parameters:
  50. // dwSysErrorCode The system error code returned by GetLastError().
  51. //
  52. // Returns:
  53. // Nothing.
  54. //
  55. // Side effects:
  56. // Prints the error message on stderr.
  57. //
  58. // Author:
  59. // Brian Dewey (t-briand) 1997-7-25
  60. void
  61. SystemError(DWORD dwSysErrorCode)
  62. {
  63. TCHAR szErrorMsg[MAX_PATH]; // Holds our message.
  64. fprintf(stderr, "In SystemError(): Error code = %x.\n", dwSysErrorCode);
  65. FormatMessage(
  66. FORMAT_MESSAGE_FROM_SYSTEM, // We're given a system error code.
  67. NULL, // No string.
  68. dwSysErrorCode, // The error code.
  69. 0, // Default language.
  70. szErrorMsg, // The error message.
  71. sizeof(szErrorMsg), // Size of our buffer.
  72. NULL // No arguments.
  73. );
  74. _ftprintf(stderr, szErrorMsg);
  75. }