chgusr.c
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 6k
Category:

Windows Kernel

Development Platform:

Visual C++

  1. //
  2. //  Chgusr.C
  3. //
  4. //  Copyright (C) Citrix, 1996 All Rights Reserved.
  5. //
  6. //  History:
  7. //  scottn 11/19/96 - First pass
  8. //
  9. //  scottn 12/5/96  - Add storage of chgusr option into registry.
  10. //
  11. //  scottn 12/13/96 - Create the UNINSTALL key if necessary (upon
  12. // first install of an uninstallable)
  13. //
  14. //  scottn 12/17/96 - Remove cwait (hangs on 16-bit installs).  Now
  15. // just exec and go to next page.  Add Finish page
  16. // which will turn option back and end tracking thread.
  17. //
  18. #include "priv.h"
  19. #ifndef DOWNLEVEL_PLATFORM
  20. #ifdef WINNT
  21. #include "appwiz.h"
  22. #include "regstr.h"
  23. #include <uastrfnc.h>
  24. #include <stdio.h>
  25. #include <process.h>
  26. #include <tsappcmp.h>       // for TermsrvAppInstallMode
  27. //
  28. //  Initialize the chgusr property sheet.  Check the "install" radio control.
  29. //
  30. void ChgusrFinishInitPropSheet(HWND hDlg, LPARAM lParam)
  31. {
  32.     LPWIZDATA lpwd = InitWizSheet(hDlg, lParam, 0);
  33. }
  34. void ChgusrFinishPrevInitPropSheet(HWND hDlg, LPARAM lParam)
  35. {
  36.     LPWIZDATA lpwd = InitWizSheet(hDlg, lParam, 0);
  37. }
  38. //
  39. //  Sets the appropriate wizard buttons.
  40. //
  41. void SetChgusrFinishButtons(LPWIZDATA lpwd)
  42. {
  43.     // no BACK button so that they don't relaunch the app and
  44.     // start a new thread, etc.
  45.     int iBtns = PSWIZB_FINISH | PSWIZB_BACK;
  46.     PropSheet_SetWizButtons(GetParent(lpwd->hwnd), iBtns);
  47. }
  48. void SetChgusrFinishPrevButtons(LPWIZDATA lpwd)
  49. {
  50.     // no BACK button so that they don't relaunch the app and
  51.     // start a new thread, etc.
  52.     int iBtns = PSWIZB_NEXT;
  53.     PropSheet_SetWizButtons(GetParent(lpwd->hwnd), iBtns);
  54. }
  55. //
  56. //  NOTES: 1) This function assumes that lpwd->hwnd has already been set to
  57. //           the dialogs hwnd.
  58. //
  59. void ChgusrFinishSetActive(LPWIZDATA lpwd)
  60. {
  61.     if (lpwd->dwFlags & WDFLAG_SETUPWIZ)
  62.     {
  63.         TCHAR szInstruct[MAX_PATH];
  64.         LoadString(g_hinst, IDS_CHGUSRFINISH, szInstruct, ARRAYSIZE(szInstruct));
  65.         Static_SetText(GetDlgItem(lpwd->hwnd, IDC_SETUPMSG), szInstruct);
  66.     }
  67.     SetChgusrFinishButtons(lpwd);
  68.     PostMessage(lpwd->hwnd, WMPRIV_POKEFOCUS, 0, 0);
  69. }
  70. void ChgusrFinishPrevSetActive(LPWIZDATA lpwd)
  71. {
  72.     if (lpwd->dwFlags & WDFLAG_SETUPWIZ)
  73.     {
  74.         TCHAR szInstruct[MAX_PATH];
  75.         LoadString(g_hinst, IDS_CHGUSRFINISH_PREV, szInstruct, ARRAYSIZE(szInstruct));
  76.         Static_SetText(GetDlgItem(lpwd->hwnd, IDC_SETUPMSG), szInstruct);
  77.     }
  78.     SetChgusrFinishPrevButtons(lpwd);
  79.     PostMessage(lpwd->hwnd, WMPRIV_POKEFOCUS, 0, 0);
  80. }
  81. //
  82. //  Main dialog procedure for fourth page of setup wizard.
  83. //
  84. BOOL_PTR CALLBACK ChgusrFinishPrevDlgProc(HWND hDlg, UINT message , WPARAM wParam, LPARAM lParam)
  85. {
  86.     NMHDR FAR *lpnm;
  87.     LPPROPSHEETPAGE lpPropSheet = (LPPROPSHEETPAGE)(GetWindowLongPtr(hDlg, DWLP_USER));
  88.     LPWIZDATA lpwd;
  89.     if (lpPropSheet)
  90.     {
  91.         lpwd = (LPWIZDATA)lpPropSheet->lParam;
  92.     }
  93.     switch(message)
  94.     {
  95.         case WM_NOTIFY:
  96.             lpnm = (NMHDR FAR *)lParam;
  97.             switch(lpnm->code)
  98.             {
  99.                 case PSN_SETACTIVE:
  100.                     lpwd->hwnd = hDlg;
  101.                     ChgusrFinishPrevSetActive(lpwd);
  102.                     break;
  103.                 case PSN_WIZNEXT:
  104.                     break;
  105.                 case PSN_RESET:
  106.                     SetTermsrvAppInstallMode(lpwd->bPrevMode);
  107.                     
  108.                     CleanUpWizData(lpwd);
  109.                     break;
  110.                 default:
  111.                     return FALSE;
  112.             }
  113.             break;
  114.         case WM_INITDIALOG:
  115.             ChgusrFinishPrevInitPropSheet(hDlg, lParam);
  116.             break;
  117.         case WMPRIV_POKEFOCUS:
  118.         {
  119.             break;
  120.         }
  121.         case WM_DESTROY:
  122.         case WM_HELP:
  123.         case WM_CONTEXTMENU:
  124.             break;
  125.         case WM_COMMAND:
  126.             switch (GET_WM_COMMAND_ID(wParam, lParam))
  127.             {
  128.                 case IDHELP:
  129.                     break;
  130.                 case IDC_COMMAND:
  131.                     break;
  132.             } // end of switch on WM_COMMAND
  133.             break;
  134.         default:
  135.             return FALSE;
  136.     } // end of switch on message
  137.     return TRUE;
  138. }  // ChgusrFinishDlgProc
  139. //
  140. //  Main dialog procedure for last page of setup wizard.
  141. //
  142. BOOL_PTR CALLBACK ChgusrFinishDlgProc(HWND hDlg, UINT message , WPARAM wParam, LPARAM lParam)
  143. {
  144.     NMHDR FAR *lpnm;
  145.     LPPROPSHEETPAGE lpPropSheet = (LPPROPSHEETPAGE)(GetWindowLongPtr(hDlg, DWLP_USER));
  146.     LPWIZDATA lpwd;
  147.     if (lpPropSheet)
  148.     {
  149.         lpwd = (LPWIZDATA)lpPropSheet->lParam;
  150.     }
  151.     switch(message)
  152.     {
  153.         case WM_NOTIFY:
  154.             lpnm = (NMHDR FAR *)lParam;
  155.             switch(lpnm->code)
  156.             {
  157.                 case PSN_SETACTIVE:
  158.                     lpwd->hwnd = hDlg;
  159.                     ChgusrFinishSetActive(lpwd);
  160.                     break;
  161.                 case PSN_WIZFINISH:
  162.                 case PSN_RESET:
  163.                 {
  164.                     SetTermsrvAppInstallMode(lpwd->bPrevMode);
  165.                     if (lpnm->code == PSN_RESET)
  166.                         CleanUpWizData(lpwd);
  167.                     break;
  168.                 }
  169.                 default:
  170.                     return FALSE;
  171.             }
  172.             break;
  173.         case WM_INITDIALOG:
  174.             ChgusrFinishInitPropSheet(hDlg, lParam);
  175.             break;
  176.         case WMPRIV_POKEFOCUS:
  177.         {
  178.             break;
  179.         }
  180.         case WM_DESTROY:
  181.         case WM_HELP:
  182.         case WM_CONTEXTMENU:
  183.             break;
  184.         case WM_COMMAND:
  185.             switch (GET_WM_COMMAND_ID(wParam, lParam))
  186.             {
  187.                 case IDHELP:
  188.                     break;
  189.                 case IDC_COMMAND:
  190.                     break;
  191.             } // end of switch on WM_COMMAND
  192.             break;
  193.         default:
  194.             return FALSE;
  195.     } // end of switch on message
  196.     return TRUE;
  197. }  // ChgusrFinishDlgProc
  198. #endif // WINNT
  199. #endif // DOWNLEVEL_PLATFORM