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.

172 lines
2.7 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. nttool.c
  5. Abstract:
  6. Implements a stub tool that is designed to run with NT-side
  7. upgrade code.
  8. Author:
  9. <full name> (<alias>) <date>
  10. Revision History:
  11. <alias> <date> <comments>
  12. --*/
  13. #include "pch.h"
  14. BOOL
  15. ProcessIniFileMapping (
  16. IN BOOL UserMode
  17. );
  18. BOOL
  19. ConvertIniFiles (
  20. VOID
  21. );
  22. BOOL
  23. Init (
  24. VOID
  25. )
  26. {
  27. HINSTANCE hInstance;
  28. DWORD dwReason;
  29. PVOID lpReserved;
  30. //
  31. // Simulate DllMain
  32. //
  33. hInstance = GetModuleHandle (NULL);
  34. dwReason = DLL_PROCESS_ATTACH;
  35. lpReserved = NULL;
  36. //
  37. // Initialize DLL globals
  38. //
  39. if (!FirstInitRoutine (hInstance)) {
  40. return FALSE;
  41. }
  42. //
  43. // Initialize all libraries
  44. //
  45. if (!InitLibs (hInstance, dwReason, lpReserved)) {
  46. return FALSE;
  47. }
  48. //
  49. // Final initialization
  50. //
  51. if (!FinalInitRoutine ()) {
  52. return FALSE;
  53. }
  54. return TRUE;
  55. }
  56. VOID
  57. Terminate (
  58. VOID
  59. )
  60. {
  61. HINSTANCE hInstance;
  62. DWORD dwReason;
  63. PVOID lpReserved;
  64. //
  65. // Simulate DllMain
  66. //
  67. hInstance = GetModuleHandle (NULL);
  68. dwReason = DLL_PROCESS_DETACH;
  69. lpReserved = NULL;
  70. //
  71. // Call the cleanup routine that requires library APIs
  72. //
  73. FirstCleanupRoutine();
  74. //
  75. // Clean up all libraries
  76. //
  77. TerminateLibs (hInstance, dwReason, lpReserved);
  78. //
  79. // Do any remaining clean up
  80. //
  81. FinalCleanupRoutine();
  82. }
  83. INT
  84. __cdecl
  85. wmain (
  86. INT argc,
  87. WCHAR *argv[]
  88. )
  89. {
  90. LONG rc;
  91. if (!Init()) {
  92. wprintf (L"Unable to initialize!\n");
  93. return 255;
  94. }
  95. g_UserMigInf = InfOpenInfFile (TEXT("d:\\i386\\usermig.inf"));
  96. //
  97. // Initialize Win95Reg
  98. //
  99. rc = Win95RegInit (TEXT("c:\\windows\\setup\\defhives"), TRUE);
  100. if (rc != ERROR_SUCCESS) {
  101. SetLastError (rc);
  102. LOG ((LOG_ERROR, "Init Processor: Win95RegInit failed, check your temp files in c:\\windows\\setup"));
  103. return FALSE;
  104. }
  105. if (!MemDbLoad (TEXT("c:\\windows\\setup\\ntsetup.dat"))) {
  106. LOG ((LOG_ERROR, "Init Processor: MemDbLoad failed, check your temp files in c:\\windows\\setup"));
  107. return FALSE;
  108. }
  109. g_DomainUserName = TEXT("NTDEV\\marcw");
  110. g_Win9xUserName = TEXT("marcw");
  111. g_FixedUserName = TEXT("marcw");
  112. g_hKeyRootNT = HKEY_CURRENT_USER;
  113. g_hKeyRoot95 = HKEY_CURRENT_USER;
  114. SetRegRoot (g_hKeyRoot95);
  115. ConvertIniFiles();
  116. ProcessIniFileMapping (TRUE);
  117. Terminate();
  118. return 0;
  119. }