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.

272 lines
6.8 KiB

  1. /*++
  2. winntmig.c
  3. Copyright (c) 2001 Microsoft Corporation
  4. This module implements an NT migration DLL.
  5. Author:
  6. Jonathan Barner, Dec. 2001
  7. --*/
  8. #include "winntmig.h"
  9. #include <faxutil.h>
  10. #include "cvernum.h"
  11. #include "faxsetup.h"
  12. #include "setuputil.h"
  13. //
  14. // Globals
  15. //
  16. VENDORINFO g_VendorInfo = {FAX_VER_COMPANYNAME_STR, NULL, NULL, NULL};
  17. MIGRATIONINFOW g_MigInfoW = {
  18. sizeof(MIGRATIONINFOW), // SIZE_T Size;
  19. _T(FAX_VER_PRODUCTNAME_STR), // PCWSTR StaticProductIdentifier;
  20. BUILD, // UINT DllVersion;
  21. NULL, // PINT CodePageArray;
  22. OS_WINDOWS2000, // SOURCEOS_WINNT, // UINT SourceOs;
  23. OS_WINDOWSWHISTLER, // SOURCEOS_WINNT, // UINT TargetOs;
  24. NULL, // PCWSTR* NeededFileList;
  25. &g_VendorInfo // PVENDORINFO VendorInfo;
  26. };
  27. LONG
  28. CALLBACK
  29. QueryMigrationInfoW(
  30. OUT PMIGRATIONINFOW *ppMigrationInfo
  31. )
  32. /*++
  33. Routine description:
  34. Provide winnt32 migration information
  35. Author:
  36. Jonathan Barner, Dec. 2001
  37. Arguments:
  38. ppMigrationInfo [out] - Pointer to the structure to return
  39. Return Value:
  40. ERROR_SUCCESS, ERROR_NOT_INSTALLED, or Win32 error code
  41. --*/
  42. {
  43. DEBUG_FUNCTION_NAME(_T("QueryMigrationInfoW"));
  44. if (!ppMigrationInfo)
  45. {
  46. DebugPrintEx(DEBUG_ERR, _T("ppMigrationInfo == NULL"));
  47. return ERROR_INVALID_PARAMETER;
  48. }
  49. *ppMigrationInfo = &g_MigInfoW;
  50. return ERROR_SUCCESS;
  51. }
  52. LONG
  53. CALLBACK
  54. InitializeSrcW(
  55. IN PCWSTR WorkingDirectory,
  56. IN PCWSTR SourceDirectories,
  57. IN PCWSTR MediaDirectory,
  58. PVOID Reserved
  59. )
  60. /*++
  61. Routine description:
  62. Initialize migration DLL. Currently, does nothing.
  63. Author:
  64. Jonathan Barner, Dec. 2001
  65. Arguments:
  66. WorkingDirectory [in] - Win32 path to the directory that DLL can use to store temporary data.
  67. SourceDirectories [in] - Win32 path to the Destination Windows OS installation files
  68. MediaDirectory [in] - Win32 path to the original media directory
  69. Reserved [tbd] - reserved for future use
  70. Return Value:
  71. ERROR_SUCCESS, ERROR_NOT_INSTALLED, or Win32 error code
  72. --*/
  73. {
  74. DEBUG_FUNCTION_NAME(_T("InitializeSrcW"));
  75. return ERROR_SUCCESS;
  76. }
  77. LONG
  78. CALLBACK
  79. InitializeDstW(
  80. IN PCWSTR WorkingDirectory,
  81. IN PCWSTR SourceDirectories,
  82. PVOID Reserved
  83. )
  84. /*++
  85. Routine description:
  86. This function is called during Destination Windows OS GUI Mode Setup,
  87. right before the upgrade is ready to start. Currently, does nothing.
  88. Author:
  89. Jonathan Barner, Dec. 2001
  90. Arguments:
  91. WorkingDirectory [in] - Win32 path of Setup-supplied working directory available for temporary file storage.
  92. SourceDirectories [in] - Win32 path of Destination Windows distribution source directory.
  93. Reserved [tbd]- Reserved for future use
  94. Return Value:
  95. ERROR_SUCCESS or Win32 error code.
  96. --*/
  97. {
  98. DEBUG_FUNCTION_NAME(_T("InitializeDst"));
  99. return ERROR_SUCCESS;
  100. }
  101. LONG
  102. CALLBACK
  103. GatherUserSettingsW(
  104. IN PCWSTR AnswerFile,
  105. IN HKEY UserRegKey,
  106. IN PCWSTR UserName,
  107. PVOID Reserved
  108. )
  109. /*++
  110. Routine description:
  111. Perform per-user pre-setup tasks, currently nothing.
  112. Author:
  113. Jonathan Barner, Dec. 2001
  114. Arguments:
  115. AnswerFile [in] - Win32 path to the unattended file
  116. UserRegKey [in] - Registry handle to the private registry settings for the current user
  117. UserName [in] - user name of the current user
  118. Reserved [tbd] - reserved for future use
  119. Return Value:
  120. ERROR_SUCCESS, ERROR_NOT_INSTALLED, ERROR_CANCELED or Win32 error code
  121. --*/
  122. {
  123. DEBUG_FUNCTION_NAME(_T("GatherUserSettingsW"));
  124. return ERROR_SUCCESS;
  125. }
  126. LONG
  127. CALLBACK
  128. GatherSystemSettingsW(
  129. IN PCWSTR AnswerFile,
  130. PVOID Reserved
  131. )
  132. /*++
  133. Routine description:
  134. Checks whether BOS fax server is installed. If so, saves its registry in HKLM/sw/ms/SharedFaxBackup
  135. Author:
  136. Jonathan Barner, Dec. 2001
  137. Arguments:
  138. AnswerFile [in] - Win32 path to the unattended answer file.
  139. Reserved [tbd] - reserved for future use
  140. Return Value:
  141. ERROR_SUCCESS, ERROR_NOT_INSTALLED or Win32 error code.
  142. --*/
  143. {
  144. DWORD dwRes = ERROR_SUCCESS;
  145. DWORD dwFaxInstalled = FXSTATE_NONE;
  146. DEBUG_FUNCTION_NAME(_T("GatherSystemSettingsW"));
  147. dwRes = CheckInstalledFax(FXSTATE_SBS5_SERVER, &dwFaxInstalled);
  148. if (dwRes != ERROR_SUCCESS)
  149. {
  150. DebugPrintEx(DEBUG_ERR, _T("CheckInstalledFax() failed, ec=%d"), dwRes);
  151. return dwRes;
  152. }
  153. if (dwFaxInstalled == FXSTATE_NONE)
  154. {
  155. DebugPrintEx(DEBUG_MSG, _T("SBS 5.0 Server is not installed, nothing to do"));
  156. return ERROR_NOT_INSTALLED;
  157. }
  158. dwRes = CopyRegistrySubkeys(REGKEY_SBS2000_FAX_BACKUP, REGKEY_SBS2000_FAX,TRUE);
  159. if (dwRes != ERROR_SUCCESS)
  160. {
  161. DebugPrintEx(DEBUG_MSG, _T("CopyRegistrySubkeys failed, ec=%d"), dwRes);
  162. return dwRes;
  163. }
  164. return ERROR_SUCCESS;
  165. }
  166. LONG
  167. CALLBACK
  168. ApplyUserSettingsW(
  169. IN HINF UnattendInfHandle,
  170. IN HKEY UserRegHandle,
  171. IN PCWSTR UserName,
  172. IN PCWSTR UserDomain,
  173. IN PCWSTR FixedUserName,
  174. PVOID Reserved
  175. )
  176. /*++
  177. Routine description:
  178. This function is called near the end of Destination Windows OS Setup.
  179. It migrates user-specific data. Currently, does nothing.
  180. Author:
  181. Jonathan Barner, Dec. 2001
  182. Arguments:
  183. UnattendInfHandle [in] - Handle to the INF answer file being used for the Upgrade process
  184. UserRegHandle [in] - Handle to the private registry settings of the User specified in the UserName
  185. UserName [in] - Name of the User who is in process
  186. UserDomain [in] - User's Domain
  187. FixedUserName [in] - Fixed User's Name
  188. Reserved [tbd] - reserved for future use
  189. Return Value:
  190. ERROR_SUCCESS or Win32 error code.
  191. --*/
  192. {
  193. DEBUG_FUNCTION_NAME(_T("ApplyUserSettings"));
  194. return ERROR_SUCCESS;
  195. }
  196. LONG
  197. CALLBACK
  198. ApplySystemSettingsW(
  199. IN HINF UnattendInfHandle,
  200. PVOID Reserved
  201. )
  202. /*++
  203. Routine description:
  204. This function is called near the end of Destination Windows OS Setup.
  205. It migrates system-wide settings of fax. Currently, does nothing.
  206. Author:
  207. Jonathan Barner, Dec. 2001
  208. Arguments:
  209. UnattendInfHandle [in] - valid INF handle to the Answer File
  210. Reserved [tbd] - reserved for future use
  211. Return Value:
  212. ERROR_SUCCESS or Win32 error code.
  213. --*/
  214. {
  215. DEBUG_FUNCTION_NAME(_T("ApplySystemSettings"));
  216. return ERROR_SUCCESS;
  217. }