consolinst.c 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. /** BEGIN COPYRIGHT BLOCK
  2. * This Program is free software; you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation; version 2 of the License.
  5. *
  6. * This Program is distributed in the hope that it will be useful, but WITHOUT
  7. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  8. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  9. *
  10. * You should have received a copy of the GNU General Public License along with
  11. * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
  12. * Place, Suite 330, Boston, MA 02111-1307 USA.
  13. *
  14. * In addition, as a special exception, Red Hat, Inc. gives You the additional
  15. * right to link the code of this Program with code not covered under the GNU
  16. * General Public License ("Non-GPL Code") and to distribute linked combinations
  17. * including the two, subject to the limitations in this paragraph. Non-GPL Code
  18. * permitted under this exception must only link to the code of this Program
  19. * through those well defined interfaces identified in the file named EXCEPTION
  20. * found in the source code files (the "Approved Interfaces"). The files of
  21. * Non-GPL Code may instantiate templates or use macros or inline functions from
  22. * the Approved Interfaces without causing the resulting work to be covered by
  23. * the GNU General Public License. Only Red Hat, Inc. may make changes or
  24. * additions to the list of Approved Interfaces. You must obey the GNU General
  25. * Public License in all respects for all of the Program code and other code used
  26. * in conjunction with the Program except the Non-GPL Code covered by this
  27. * exception. If you modify this file, you may extend this exception to your
  28. * version of the file, but you are not obligated to do so. If you do not wish to
  29. * provide this exception without modification, you must delete this exception
  30. * statement from your version and license this file solely under the GPL without
  31. * exception.
  32. *
  33. *
  34. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  35. * Copyright (C) 2005 Red Hat, Inc.
  36. * All rights reserved.
  37. * END COPYRIGHT BLOCK **/
  38. //////////////////////////////////////////////////////////////////////////////
  39. // CONSOLINST.c - Fedora Directory Server Installation Plug-In
  40. //
  41. //
  42. #include <windows.h>
  43. #include <commctrl.h>
  44. #include <nssetup.h>
  45. #include <time.h>
  46. #include <sys/types.h>
  47. #include <sys/stat.h>
  48. #include <stdio.h>
  49. #include <process.h>
  50. #include <memory.h>
  51. #include <regstr.h>
  52. #include <ldap.h>
  53. #include "resource.h"
  54. #include "consolinst.h"
  55. #define NUM_PROP_PAGES 1
  56. #define INDEX_FIRST_PAGE 0
  57. #define INDEX_LAST_PAGE 0
  58. static MODULEINFO mi = {
  59. NULL, // m_hModule
  60. NULL, // m_hwndParent
  61. NS_WIZERROR, // m_nResult
  62. };
  63. //////////////////////////////////////////////////////////////////////////////
  64. // _DialogProcs
  65. //
  66. // The dialog procedure for a single property page. You will need to create
  67. // one of these for each property page used in the property sheet. This
  68. // procedure processes dialog messages sent to your property page by Windows.
  69. // See the Windows SDK documentation for more information about this function.
  70. //
  71. //////////////////////////////////////////////////////////////////////////////
  72. // TMPL_PreInstall
  73. //
  74. // This function is called by the installation framework before asking the
  75. // user any questions. Here you should determine if all of the requisites
  76. // for installing this component are being met. If this operation succeeds
  77. // return TRUE, otherwise display an error message and return FALSE to abort
  78. // installation.
  79. //
  80. BOOL __declspec(dllexport)
  81. CONSOLINST_PreInstall(LPCSTR lpszInstallPath)
  82. {
  83. // TODO: Add code to check for pre-installation requirements.
  84. return TRUE;
  85. }
  86. //////////////////////////////////////////////////////////////////////////////
  87. // CONSOLINST_AskOptions
  88. //
  89. // This function is called by the installation framework to query the user for
  90. // information about your component. Here you should ask all of the questions
  91. // required to install your component as a series of wizard property sheets.
  92. //
  93. INT __declspec(dllexport)
  94. CONSOLINST_AskOptions(HWND hwndParent, INT nDirection)
  95. {
  96. PROPSHEETPAGE psp[NUM_PROP_PAGES];
  97. UINT uStartPage;
  98. INT nNumPages;
  99. // TODO: Initialize a property page for each dialog template/resource
  100. // required to query the user for options related to your server
  101. // installation. Don't forget to increment the count of pages contained
  102. // in NUM_PROP_PAGES at the top of this file.
  103. if( SILENTMODE == MODE)
  104. {
  105. mi.m_nResult = NS_WIZNEXT;
  106. }else{
  107. if(EXPRESSMODE == MODE)
  108. {
  109. }else if( (NORMALMODE == MODE) || (CUSTOMMODE == MODE) ){
  110. /* ask for server settings, SuitespotID and Unrestricted User */
  111. }
  112. /* add additional pages for custom mode */
  113. if( (CUSTOMMODE == MODE) )
  114. {
  115. }
  116. // Must initialize the result to an error code before calling WizardDialog
  117. mi.m_nResult = NS_WIZERROR;
  118. // Set the first page to display based on the direction we are travelling
  119. uStartPage = (nDirection == NS_WIZBACK) ? INDEX_LAST_PAGE : INDEX_FIRST_PAGE;
  120. // Call WizardDialog to display the set of property pages
  121. if (WizardDialog(mi.m_hModule, hwndParent, psp, nNumPages, uStartPage) < 0)
  122. {
  123. mi.m_nResult = NS_WIZERROR;
  124. }
  125. }
  126. return mi.m_nResult;
  127. }
  128. //////////////////////////////////////////////////////////////////////////////
  129. // CONSOLINST_GetSummary
  130. //
  131. // This function is called by the installation framework after all questions,
  132. // for all components, have been asked. Here you should provide a detailed
  133. // summary explaining all of the choices selected by the user.
  134. //
  135. // IMPORTANT NOTE: Each line MUST end in a carriage return/line feed
  136. // combination ("\r\n") as this string is placed in an edit control. Edit
  137. // controls do not properly handle single "\n" end-of-line characters.
  138. //
  139. VOID __declspec(dllexport)
  140. CONSOLINST_GetSummary(LPSTR lpszSummary)
  141. {
  142. // TODO: Add code to fill in the summary information entered by the user
  143. char *psz = lpszSummary;
  144. *psz = '\0';
  145. }
  146. //////////////////////////////////////////////////////////////////////////////
  147. // CONSOLINST_WriteGlobalCache
  148. //
  149. // This function is called by the installation framework when the user clicks
  150. // Next at the summary screen. Here you should write all information entered
  151. // by the user into the installation cache for use during silent installation.
  152. // Data written to this section of the file may be interpreted by the
  153. // framework. If this operation succeeds return TRUE, otherwise display an
  154. // error message and return FALSE to indicate an error.
  155. //
  156. BOOL __declspec(dllexport)
  157. CONSOLINST_WriteGlobalCache(LPCSTR lpszCacheFileName, LPCSTR lpszSectionName)
  158. {
  159. // TODO: Add code to write data to the cache file (INI format) under the
  160. // specified section name.
  161. return TRUE;
  162. }
  163. //////////////////////////////////////////////////////////////////////////////
  164. // CONSOLINST_WriteLocalCache
  165. //
  166. // This function is called by the installation framework when the user clicks
  167. // Next at the summary screen. Here you should write all information entered
  168. // by the user into the installation cache for use during silent installation.
  169. // Data written to this file is not interpreted by the framework, and may
  170. // consist of any values that you will need to perform the installation (not
  171. // just values entered by the user). If this operation succeeds return TRUE,
  172. // otherwise display an error message and return FALSE to indicate an error.
  173. //
  174. BOOL __declspec(dllexport)
  175. CONSOLINST_WriteLocalCache(LPCSTR lpszCacheFileName, LPCSTR lpszSectionName)
  176. {
  177. // TODO: Add code to write data to the cache file (INI format) under the
  178. // specified section name.
  179. return TRUE;
  180. }
  181. //////////////////////////////////////////////////////////////////////////////
  182. // CONSOLINST_ReadGlobalCache
  183. //
  184. // This function is called by the installation framework during silent install
  185. // to initialize your data from the cache file you created above. Here you
  186. // should read any information stored in the installation cache's global
  187. // section that you need. If this operation succeeds return TRUE, otherwise
  188. // display an error message and return FALSE to indicate an error.
  189. //
  190. BOOL __declspec(dllexport)
  191. CONSOLINST_ReadGlobalCache(LPCSTR lpszCacheFileName, LPCSTR lpszSectionName)
  192. {
  193. return TRUE;
  194. }
  195. //////////////////////////////////////////////////////////////////////////////
  196. // CONSOLINST_ReadLocalCache
  197. //
  198. // This function is called by the installation framework during silent install
  199. // to intialize your data from the local section of the cache created above.
  200. // Here you should read any information stored in the installation cache's
  201. // local section that you need. If this operation succeeds return TRUE,
  202. // otherwise display an error message and return FALSE to indicate an error.
  203. //
  204. BOOL __declspec(dllexport)
  205. CONSOLINST_ReadLocalCache(LPCSTR lpszCacheFileName, LPCSTR lpszSectionName)
  206. {
  207. // TODO: Add code to read data from the cache file (INI format) under the
  208. // specified section name.
  209. return TRUE;
  210. }
  211. //////////////////////////////////////////////////////////////////////////////
  212. // CONSOLINST_Install
  213. //
  214. // The framework calls this function to perform installation. Here you should
  215. // define the file sets that are required to place your files on the
  216. // destination disk. You should not however perform the extraction, as the
  217. // calling level will do that once the file sets for all products have been
  218. // defined. This ensures that the progress indicator shows the results for
  219. // the entire range of user selections as a whole. If the function
  220. // successfully defines the file set return TRUE, otherwise return FALSE to
  221. // indicate an error.
  222. //
  223. BOOL __declspec(dllexport)
  224. CONSOLINST_Install(VOID)
  225. {
  226. HFILESET hfs;
  227. UINT uFlags;
  228. CHAR szSavedPath[MAX_PATH];
  229. CHAR szDirName[MAX_PATH];
  230. BOOL bResult = FALSE;
  231. hfs = FileSetCreate(CON_ID_DIR);
  232. if (hfs == INVALID_FILESET_HANDLE)
  233. return FALSE;
  234. uFlags = FS_UPDATE_VERSION | FS_SHAREDFILE;
  235. FileSetAddArchive(hfs, CON_JAR, "*.*", CON_MESSAGE,
  236. uFlags);
  237. FileSetClose(hfs);
  238. return TRUE;
  239. }
  240. //////////////////////////////////////////////////////////////////////////////
  241. // CONSOLINST_PostInstall
  242. //
  243. // The framework calls this function to perform post-installation
  244. // configuration. Here you should set values in any product configuration
  245. // files, install services, add registry keys, start servers, and anything
  246. // else that can only be done once the binaries are layed down on the disk.
  247. // If the function succeeds return TRUE, otherwise return FALSE to indicate
  248. // an error.
  249. //
  250. BOOL __declspec(dllexport)
  251. CONSOLINST_PostInstall(VOID)
  252. {
  253. // TODO: Add code to perform configuration.
  254. BOOL bRC = TRUE;
  255. return bRC;
  256. }
  257. //////////////////////////////////////////////////////////////////////////////
  258. // PreUninst
  259. //
  260. //
  261. // Do things before uninstalling like turn off the server
  262. //
  263. //
  264. //
  265. //
  266. BOOL __declspec(dllexport)
  267. CONSOLINST_PreUnInstall(LPCSTR pszServerRoot)
  268. {
  269. BOOL bRC = TRUE;
  270. return bRC;
  271. }
  272. //////////////////////////////////////////////////////////////////////////////
  273. // PostUninst
  274. //
  275. //
  276. // Clean up registry keys etc
  277. //
  278. //
  279. //
  280. //
  281. BOOL __declspec(dllexport)
  282. CONSOLINST_PostUnInstall(LPCSTR pszServerRoot)
  283. {
  284. BOOL bRC = TRUE;
  285. return bRC;
  286. }