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.

145 lines
3.1 KiB

  1. /*++
  2. Copyright (c) 1994 - 1995 Microsoft Corporation
  3. Module Name:
  4. Win9x.c
  5. Abstract:
  6. Test pre-migration of Win95 to NT
  7. Author:
  8. MuhuntS
  9. Revision History:
  10. 01-17-97
  11. --*/
  12. #define NOMINMAX
  13. #include <nt.h>
  14. #include <ntrtl.h>
  15. #include <nturtl.h>
  16. #include <windows.h>
  17. #include <stdio.h>
  18. #include <setupapi.h>
  19. #include <plugin.h>
  20. P_QUERY_VERSION QueryVersion;
  21. P_INITIALIZE_9X Initialize9x;
  22. P_MIGRATE_SYSTEM_9X MigrateSystem9x;
  23. P_INITIALIZE_NT InitializeNT;
  24. P_MIGRATE_SYSTEM_NT MigrateSystemNT;
  25. WCHAR szSrcDir[MAX_PATH], szWrkDir[MAX_PATH];
  26. int __cdecl
  27. main (argc, argv)
  28. int argc;
  29. char *argv[];
  30. {
  31. PVENDORINFO pVI;
  32. HMODULE hModule;
  33. HANDLE hAlive = NULL;
  34. DWORD dwLastError;
  35. LPSTR p1, p2, p3, p4, p5;
  36. LONG x;
  37. UINT v;
  38. INT c;
  39. p1 = p2 = p3 = p4 = p5 = NULL;
  40. if ( argc < 3 ) {
  41. printf("Usage: %s <working-dir> <source-dir>\n", argv[0]);
  42. return 0;
  43. }
  44. hModule = LoadLibraryA("migrate.dll");
  45. if ( !hModule ) {
  46. printf("%s: LoadLibrary failed with %d\n", argv[0], GetLastError());
  47. goto Cleanup;
  48. }
  49. //
  50. // Nt only?
  51. //
  52. if ( argc == 4 && argv[3][0] == '+' )
  53. goto DoNT;
  54. (FARPROC) QueryVersion = GetProcAddress(hModule, "QueryVersion");
  55. (FARPROC) Initialize9x = GetProcAddress(hModule, "Initialize9x");
  56. (FARPROC) MigrateSystem9x = GetProcAddress(hModule, "MigrateSystem9x");
  57. if ( !QueryVersion || !Initialize9x || !MigrateSystem9x )
  58. goto Cleanup;
  59. x = QueryVersion(&p1, (LPUINT)&p2, (LPINT*)&p3, &p4, (PVENDORINFO*)&pVI);
  60. printf("QueryVersion returned %d\n", x);
  61. x = Initialize9x(argv[1], argv[2], 0);
  62. printf("Initialize9x returned %d\n", x);
  63. x = MigrateSystem9x(0, NULL, 0);
  64. printf("MigrateSystem9x returned %d\n", x);
  65. FreeLibrary(hModule);
  66. //
  67. // Win95 only?
  68. //
  69. if ( argc == 4 && argv[3][0] == '-' )
  70. goto Cleanup;
  71. hModule = LoadLibraryA("migrate.dll");
  72. if ( !hModule ) {
  73. printf("%s: LoadLibrary II failed with %d\n", argv[0], GetLastError());
  74. goto Cleanup;
  75. }
  76. DoNT:
  77. MultiByteToWideChar(CP_ACP,
  78. MB_PRECOMPOSED,
  79. argv[1],
  80. -1,
  81. szWrkDir,
  82. MAX_PATH);
  83. MultiByteToWideChar(CP_ACP,
  84. MB_PRECOMPOSED,
  85. argv[2],
  86. -1,
  87. szSrcDir,
  88. MAX_PATH);
  89. InitializeNT = (P_INITIALIZE_NT)GetProcAddress(hModule, "InitializeNT");
  90. MigrateSystemNT = (P_MIGRATE_SYSTEM_NT)GetProcAddress(hModule, "MigrateSystemNT");
  91. if ( !InitializeNT || !MigrateSystemNT )
  92. goto Cleanup;
  93. hAlive = CreateEventA(NULL, FALSE, FALSE, "MigDllAlive");
  94. if ( ERROR_SUCCESS == InitializeNT(szWrkDir, szSrcDir, 0) )
  95. MigrateSystemNT(INVALID_HANDLE_VALUE, 0);
  96. FreeLibrary(hModule);
  97. Cleanup:
  98. if ( hModule )
  99. FreeLibrary(hModule);
  100. if ( hAlive )
  101. CloseHandle(hAlive);
  102. return 0;
  103. }