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.

248 lines
7.4 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. groups.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 "faxocm.h"
  13. #pragma hdrstop
  14. GROUP_ITEMS GroupItems[] =
  15. {
  16. { {IDS_FAXGROUP, TEXT("") },
  17. {IDS_FAXQUEUE_ITEM, TEXT("") },
  18. {IDS_FAXQUEUE_EXE, TEXT("") },
  19. {IDS_FAXQUEUE_ICON, TEXT("") },
  20. {IDS_FAXQUEUE_WORKINGDIRECTORY, TEXT("") },
  21. USE_COMMON_GROUP | USE_SERVER_NAME,
  22. 0,
  23. SW_NORMAL,
  24. 0,
  25. {IDS_FAXQUEUE_INFOTIP, TEXT("") }
  26. },
  27. { {IDS_FAXGROUP, TEXT("") },
  28. {IDS_FAXFOLDER_ITEM, TEXT("") },
  29. {IDS_FAXFOLDER_EXE, TEXT("") },
  30. {IDS_FAXFOLDER_ICON, TEXT("") },
  31. {IDS_FAXFOLDER_WORKINGDIRECTORY, TEXT("") },
  32. USE_COMMON_GROUP | USE_SERVER_NAME |USE_SHELL_PATH | USE_SUBDIR,
  33. 4,
  34. SW_NORMAL,
  35. 0,
  36. {IDS_FAXFOLDER_INFOTIP, TEXT("") }
  37. },
  38. #if 0
  39. { {IDS_FAXGROUP, TEXT("") },
  40. {IDS_CPE_ITEM, TEXT("") },
  41. {IDS_CPE_EXE, TEXT("") },
  42. {IDS_CPE_ICON, TEXT("") },
  43. {IDS_CPE_WORKINGDIRECTORY, TEXT("") },
  44. USE_COMMON_GROUP,
  45. 0,
  46. SW_NORMAL,
  47. 0,
  48. {IDS_CPE_INFOTIP, TEXT("") }
  49. },
  50. #endif
  51. { {IDS_FAXGROUP, TEXT("") },
  52. {IDS_FAXSEND_ITEM, TEXT("") },
  53. {IDS_FAXSEND_EXE, TEXT("") },
  54. {IDS_FAXSEND_ICON, TEXT("") },
  55. {IDS_FAXSEND_WORKINGDIRECTORY, TEXT("") },
  56. USE_COMMON_GROUP,
  57. 0,
  58. SW_NORMAL,
  59. 0,
  60. {IDS_FAXSEND_INFOTIP, TEXT("") }
  61. },
  62. { {IDS_FAXGROUP, TEXT("") },
  63. {IDS_FAXADMIN_ITEM, TEXT("") },
  64. {IDS_FAXADMIN_EXE, TEXT("") },
  65. {IDS_FAXADMIN_ICON, TEXT("") },
  66. {IDS_FAXADMIN_WORKINGDIRECTORY, TEXT("") },
  67. USE_COMMON_GROUP,
  68. 5,
  69. SW_NORMAL,
  70. 0,
  71. {IDS_FAXADMIN_INFOTIP, TEXT("") }
  72. },
  73. #if 0
  74. { {IDS_FAXGROUP, TEXT("") },
  75. {IDS_FAXVIEWER_ITEM, TEXT("") },
  76. {IDS_FAXVIEWER_EXE, TEXT("") },
  77. {IDS_FAXVIEWER_ICON, TEXT("") },
  78. {IDS_FAXVIEWER_WORKINGDIRECTORY, TEXT("") },
  79. USE_COMMON_GROUP,
  80. 0,
  81. SW_NORMAL,
  82. 0,
  83. {IDS_FAXVIEWER_INFOTIP, TEXT("") }
  84. },
  85. #endif
  86. { {IDS_FAXGROUP, TEXT("") },
  87. {IDS_FAXHELP_ITEM, TEXT("") },
  88. {IDS_FAXHELP_EXE, TEXT("") },
  89. {IDS_FAXHELP_ICON, TEXT("") },
  90. {IDS_FAXHELP_WORKINGDIRECTORY, TEXT("") },
  91. USE_COMMON_GROUP,
  92. 0,
  93. SW_NORMAL,
  94. 0,
  95. {IDS_FAXHELP_INFOTIP, TEXT("") }
  96. }
  97. #if 0
  98. { {IDS_FAXGROUP, TEXT("") },
  99. {IDS_FAXPRINTER_ITEM, TEXT("") },
  100. {IDS_FAXPRINTER_EXE, TEXT("") },
  101. {IDS_FAXPRINTER_ICON, TEXT("") },
  102. {IDS_FAXPRINTER_WORKINGDIRECTORY, TEXT("") },
  103. USE_COMMON_GROUP,
  104. 59,
  105. SW_NORMAL,
  106. 0,
  107. {IDS_FAXPRINTER_INFOTIP, TEXT("") }
  108. }
  109. #endif
  110. };
  111. #define MAX_GROUP_ITEMS (sizeof(GroupItems)/sizeof(GroupItems[0]))
  112. VOID
  113. DeleteNt4Group(
  114. VOID
  115. )
  116. {
  117. WCHAR Name[100];
  118. MyLoadString(hInstance, IDS_NT4FAX_GROUP, Name, sizeof(Name) / sizeof(WCHAR), GetSystemDefaultUILanguage() );
  119. DeleteGroup( Name, USE_COMMON_GROUP );
  120. }
  121. VOID
  122. DeleteGroupItems(
  123. VOID
  124. )
  125. {
  126. DWORD i;
  127. for (i=0; i<MAX_GROUP_ITEMS; i++) {
  128. MyLoadString(hInstance,GroupItems[i].GroupName.ResourceID,GroupItems[i].GroupName.Name,64, GetSystemDefaultUILanguage());
  129. MyLoadString(hInstance,GroupItems[i].Description.ResourceID,GroupItems[i].Description.Name,64, GetSystemDefaultUILanguage());
  130. DeleteLinkFile(
  131. CSIDL_COMMON_PROGRAMS,
  132. GroupItems[i].GroupName.Name,
  133. GroupItems[i].Description.Name,
  134. FALSE
  135. );
  136. }
  137. DeleteGroup( GroupItems[0].GroupName.Name, GroupItems[0].Flags & USE_COMMON_GROUP );
  138. }
  139. VOID
  140. CreateGroupItems(
  141. LPTSTR ServerName
  142. )
  143. {
  144. DWORD i;
  145. WCHAR CommandLine[MAX_PATH*2];
  146. WCHAR IconPath[MAX_PATH*2];
  147. WCHAR WorkingDirectory[MAX_PATH*2];
  148. PGROUP_ITEMS Groups;
  149. DWORD GroupCount;
  150. WCHAR ShellPath[MAX_PATH];
  151. WCHAR FaxPrinterName[MAX_PATH];
  152. if (Upgrade) {
  153. DeleteGroupItems();
  154. }
  155. Groups = GroupItems;
  156. GroupCount = MAX_GROUP_ITEMS;
  157. for (i=0; i<GroupCount; i++) {
  158. MyLoadString(hInstance,Groups[i].GroupName.ResourceID,Groups[i].GroupName.Name,64, GetSystemDefaultUILanguage());
  159. MyLoadString(hInstance,Groups[i].Description.ResourceID,Groups[i].Description.Name,64, GetSystemDefaultUILanguage());
  160. if (Groups[i].CommandLine.ResourceID == IDS_FAXPRINTER_EXE) {
  161. MyLoadString(hInstance,IDS_DEFAULT_PRINTER_NAME,FaxPrinterName,MAX_PATH, GetSystemDefaultUILanguage());
  162. swprintf(
  163. Groups[i].CommandLine.Name,
  164. L"rundll32 printui.dll,PrintUIEntry %s /q /if /b \"%s\" /f \"%%SystemRoot%%\\inf\\ntprint.inf\" /r \"MSFAX:\" /m \"%s\" /l \"%%SystemRoot%%\\system32\"",
  165. IsProductSuite() ? L"/Z" : L"/z",
  166. FaxPrinterName,
  167. FAX_DRIVER_NAME
  168. );
  169. }
  170. else {
  171. MyLoadString(hInstance,Groups[i].CommandLine.ResourceID,Groups[i].CommandLine.Name,MAX_PATH, GetSystemDefaultUILanguage());
  172. }
  173. MyLoadString(hInstance,Groups[i].IconPath.ResourceID,Groups[i].IconPath.Name,MAX_PATH, GetSystemDefaultUILanguage());
  174. MyLoadString(hInstance,Groups[i].WorkingDirectory.ResourceID,Groups[i].WorkingDirectory.Name,MAX_PATH, GetSystemDefaultUILanguage());
  175. MyLoadString(hInstance,Groups[i].InfoTip.ResourceID,Groups[i].InfoTip.Name,MAX_PATH, GetSystemDefaultUILanguage());
  176. CreateGroup( Groups[i].GroupName.Name, Groups[i].Flags & USE_COMMON_GROUP );
  177. if ((Groups[i].Flags & USE_SHELL_PATH) && MyGetSpecialPath( CSIDL_COMMON_DOCUMENTS, ShellPath)) {
  178. wsprintf(CommandLine,Groups[i].CommandLine.Name,ShellPath);
  179. wsprintf(WorkingDirectory,Groups[i].WorkingDirectory.Name,ShellPath);
  180. } else {
  181. ExpandEnvironmentStrings( Groups[i].CommandLine.Name, CommandLine, sizeof(CommandLine)/sizeof(WCHAR) );
  182. ExpandEnvironmentStrings( Groups[i].WorkingDirectory.Name, WorkingDirectory, sizeof(WorkingDirectory)/sizeof(WCHAR) );
  183. }
  184. ExpandEnvironmentStrings( Groups[i].IconPath.Name, IconPath, sizeof(IconPath)/sizeof(WCHAR) );
  185. if ((Groups[i].Flags & USE_SERVER_NAME) && ServerName) {
  186. wcscat( CommandLine, L" " );
  187. wcscat( CommandLine, ServerName );
  188. }
  189. CreateLinkFile(
  190. CSIDL_COMMON_PROGRAMS,
  191. Groups[i].GroupName.Name,
  192. Groups[i].Description.Name,
  193. CommandLine,
  194. IconPath,
  195. Groups[i].IconIndex,
  196. (Groups[i].Flags & USE_SUBDIR) ? TEXT("") : WorkingDirectory,
  197. Groups[i].HotKey,
  198. Groups[i].ShowCmd,
  199. Groups[i].InfoTip.Name
  200. );
  201. }
  202. }