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.

202 lines
6.8 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. client.c
  5. Abstract:
  6. This file implements the file copy code.
  7. Environment:
  8. WIN32 User Mode
  9. Author:
  10. Wesley Witt (wesw) 17-Feb-1996
  11. --*/
  12. #include "wizard.h"
  13. #pragma hdrstop
  14. FILE_QUEUE_INFO ClientFileQueue[] =
  15. {
  16. //-----------------------------------------------------------------------------------------------------------------------------------------------------
  17. // Section Name Dest Dir INF Dir Id Dest Dir Id Platforms Copy Flags
  18. //-----------------------------------------------------------------------------------------------------------------------------------------------------
  19. { TEXT("ClientSystemFiles"), NULL, DIRID_SYSTEM, DIRID_SYSTEM, PLATFORM_NONE, SP_COPY_NEWER },
  20. { TEXT("HelpFilesCommon"), NULL, DIRID_HELP, DIRID_HELP, PLATFORM_NONE, SP_COPY_NEWER },
  21. { TEXT("HelpFilesClient"), NULL, DIRID_HELP, DIRID_HELP, PLATFORM_NONE, SP_COPY_NEWER },
  22. { TEXT("ServerPrinterFiles"), NULL, PRINTER_DRIVER_DIR, DIRID_SPOOLDRIVERS, PLATFORM_NONE, SP_COPY_NEWER },
  23. { TEXT("ClientCoverPageFiles"), COVERPAGE_DIR, COVERPAGE_CLIENT_DIR, DIRID_SYSTEM, PLATFORM_NONE, SP_COPY_NEWER },
  24. { TEXT("OutlookConfigFile"), OUTLOOKCONFIG_DIR, OUTLOOK_ECF_DIR, DIRID_WINDOWS, PLATFORM_NONE, SP_COPY_NEWER }
  25. };
  26. #define CountClientFileQueue (sizeof(ClientFileQueue)/sizeof(FILE_QUEUE_INFO))
  27. FILE_QUEUE_INFO PointPrintFileQueue[] =
  28. {
  29. //--------------------------------------------------------------------------------------------------------------------------------------
  30. // Section Name Dest Dir INF Dir Id Dest Dir Id Platforms Copy Flags
  31. //--------------------------------------------------------------------------------------------------------------------------------------
  32. { TEXT("ClientSystemFiles"), FAXCLIENTS_DIR, DIRID_SYSTEM, DIRID_SPOOLDRIVERS, PLATFORM_USE_MACHINE, SP_COPY_NEWER },
  33. { TEXT("HelpFilesCommon"), NULL, DIRID_HELP, DIRID_HELP, PLATFORM_NONE, SP_COPY_NEWER },
  34. { TEXT("HelpFilesClient"), NULL, DIRID_HELP, DIRID_HELP, PLATFORM_NONE, SP_COPY_NEWER },
  35. { TEXT("ServerPrinterFiles"), NULL, PRINTER_DRIVER_DIR, DIRID_SPOOLDRIVERS, PLATFORM_NONE, SP_COPY_NEWER },
  36. { TEXT("ClientCoverPageFiles"), COVERPAGE_DIR, COVERPAGE_CLIENT_DIR, DIRID_SYSTEM, PLATFORM_NONE, SP_COPY_NEWER },
  37. { TEXT("OutlookConfigFile"), OUTLOOKCONFIG_DIR, OUTLOOK_ECF_DIR, DIRID_WINDOWS, PLATFORM_NONE, SP_COPY_NEWER }
  38. };
  39. #define CountPointPrintFileQueue (sizeof(PointPrintFileQueue)/sizeof(FILE_QUEUE_INFO))
  40. DWORD
  41. ClientFileCopyThread(
  42. HWND hwnd
  43. )
  44. {
  45. HINF FaxSetupInf;
  46. HSPFILEQ *FileQueue;
  47. PVOID QueueContext;
  48. DWORD ErrorCode = 0;
  49. if (InstallMode & INSTALL_NEW) {
  50. SendMessage( hwnd, WM_MY_PROGRESS, 0xff, 30 );
  51. }
  52. if (!InitializeFileQueue( hwnd, &FaxSetupInf, &FileQueue, &QueueContext, SourceDirectory )) {
  53. ErrorCode = IDS_COULD_NOT_COPY_FILES;
  54. goto error_exit;
  55. }
  56. if (!ProcessFileQueue( FaxSetupInf, FileQueue, QueueContext, SourceDirectory,
  57. ClientFileQueue, CountClientFileQueue, InstallQueueCallback, SETUP_ACTION_COPY )) {
  58. ErrorCode = IDS_COULD_NOT_COPY_FILES;
  59. goto error_exit;
  60. }
  61. if (!CloseFileQueue( FileQueue, QueueContext )) {
  62. ErrorCode = IDS_COULD_NOT_COPY_FILES;
  63. goto error_exit;
  64. }
  65. if (InstallMode & INSTALL_NEW) {
  66. SetProgress( hwnd, IDS_SETTING_REGISTRY );
  67. if (!SetClientRegistryData()) {
  68. PopUpMsg( hwnd, IDS_COULD_SET_REG_DATA, TRUE, 0 );
  69. PropSheet_PressButton( GetParent(hwnd), PSBTN_CANCEL );
  70. SetWindowLong( hwnd, DWL_MSGRESULT, -1 );
  71. OkToCancel = TRUE;
  72. return TRUE;
  73. }
  74. SetProgress( hwnd, IDS_CREATING_FAXPRT );
  75. SetInstalledFlag( TRUE );
  76. SetInstallType( FAX_INSTALL_NETWORK_CLIENT );
  77. SetUnInstallInfo();
  78. ErrorCode = CreateClientFaxPrinter( hwnd, WizData.PrinterName );
  79. if (ErrorCode != ERROR_SUCCESS) {
  80. SetInstalledFlag( FALSE );
  81. ErrorCode = (ErrorCode == ERROR_ACCESS_DENIED) ?
  82. IDS_PERMISSION_CREATE_PRINTER : IDS_COULD_NOT_CREATE_PRINTER;
  83. goto error_exit;
  84. }
  85. SetProgress( hwnd, IDS_CREATING_GROUPS );
  86. CreateGroupItems( FALSE, NULL );
  87. InstallHelpFiles();
  88. }
  89. //
  90. // do the exchange stuff
  91. //
  92. DoExchangeInstall( hwnd );
  93. SetWindowLong( hwnd, DWL_MSGRESULT, 0 );
  94. PropSheet_PressButton( GetParent(hwnd), PSBTN_NEXT );
  95. return TRUE;
  96. error_exit:
  97. InstallThreadError = ErrorCode;
  98. PopUpMsg( hwnd, ErrorCode, TRUE, 0 );
  99. OkToCancel = TRUE;
  100. PropSheet_PressButton( GetParent(hwnd), PSBTN_CANCEL );
  101. SetWindowLong( hwnd, DWL_MSGRESULT, -1 );
  102. return FALSE;
  103. }
  104. DWORD
  105. PointPrintFileCopyThread(
  106. HWND hwnd
  107. )
  108. {
  109. HINF FaxSetupInf;
  110. HSPFILEQ *FileQueue;
  111. PVOID QueueContext;
  112. DWORD ErrorCode = 0;
  113. SendMessage( hwnd, WM_MY_PROGRESS, 0xff, 20 );
  114. if (!InitializeFileQueue( hwnd, &FaxSetupInf, &FileQueue, &QueueContext, SourceDirectory )) {
  115. ErrorCode = IDS_COULD_NOT_COPY_FILES;
  116. goto error_exit;
  117. }
  118. if (!ProcessFileQueue( FaxSetupInf, FileQueue, QueueContext, SourceDirectory,
  119. PointPrintFileQueue, CountPointPrintFileQueue, InstallQueueCallback, SETUP_ACTION_COPY )) {
  120. ErrorCode = IDS_COULD_NOT_COPY_FILES;
  121. goto error_exit;
  122. }
  123. if (!CloseFileQueue( FileQueue, QueueContext )) {
  124. ErrorCode = IDS_COULD_NOT_COPY_FILES;
  125. goto error_exit;
  126. }
  127. SetProgress( hwnd, IDS_SETTING_REGISTRY );
  128. if (!SetClientRegistryData()) {
  129. PopUpMsg( hwnd, IDS_COULD_SET_REG_DATA, TRUE, 0 );
  130. PropSheet_PressButton( GetParent(hwnd), PSBTN_CANCEL );
  131. SetWindowLong( hwnd, DWL_MSGRESULT, -1 );
  132. OkToCancel = TRUE;
  133. return TRUE;
  134. }
  135. SetProgress( hwnd, IDS_CREATING_GROUPS );
  136. CreateGroupItems( FALSE, ClientSetupServerName );
  137. SetWindowLong( hwnd, DWL_MSGRESULT, 0 );
  138. PropSheet_PressButton( GetParent(hwnd), PSBTN_FINISH );
  139. return TRUE;
  140. error_exit:
  141. InstallThreadError = ErrorCode;
  142. PopUpMsg( hwnd, ErrorCode, TRUE, 0 );
  143. OkToCancel = TRUE;
  144. PropSheet_PressButton( GetParent(hwnd), PSBTN_CANCEL );
  145. SetWindowLong( hwnd, DWL_MSGRESULT, -1 );
  146. return FALSE;
  147. }