2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
11 #include <afs/param.h>
16 #include "svr_uninstall.h"
17 #include "propcache.h"
20 * PROTOTYPES _________________________________________________________________
24 BOOL WINAPI Server_Uninstall_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
26 void Server_Uninstall_OnInitDialog (HWND hDlg, LPSVR_UNINSTALL_PARAMS lpp);
27 void Server_Uninstall_OnEndTask_InitDialog (HWND hDlg, LPTASKPACKET ptp, LPSVR_UNINSTALL_PARAMS lpp);
28 void Server_Uninstall_EnableOK (HWND hDlg);
29 void Server_Uninstall_OnOK (HWND hDlg);
33 * ROUTINES ___________________________________________________________________
37 void Server_Uninstall (LPIDENT lpiServer)
41 if ((hCurrent = PropCache_Search (pcSVR_UNINSTALL, NULL)) != NULL)
47 LPSVR_UNINSTALL_PARAMS lpp = New (SVR_UNINSTALL_PARAMS);
48 lpp->lpiServer = lpiServer;
49 lpp->szUninstall[0] = TEXT('\0');
51 HWND hDlg = ModelessDialogParam (IDD_SVR_UNINSTALL, NULL, (DLGPROC)Server_Uninstall_DlgProc, (LPARAM)lpp);
52 ShowWindow (hDlg, SW_SHOW);
57 BOOL WINAPI Server_Uninstall_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
59 if (AfsAppLib_HandleHelp (IDD_SVR_UNINSTALL, hDlg, msg, wp, lp))
62 LPSVR_UNINSTALL_PARAMS lpp;
64 if (msg == WM_INITDIALOG)
65 SetWindowLong (hDlg, DWL_USER, lp);
67 if ((lpp = (LPSVR_UNINSTALL_PARAMS)GetWindowLong(hDlg,DWL_USER)) != NULL)
72 PropCache_Add (pcSVR_UNINSTALL, NULL, hDlg);
73 Server_Uninstall_OnInitDialog (hDlg, lpp);
78 if ((ptp = (LPTASKPACKET)lp) != NULL)
80 if (ptp->idTask == taskSVR_ENUM_TO_COMBOBOX)
81 Server_Uninstall_OnEndTask_InitDialog (hDlg, ptp, lpp);
90 Server_Uninstall_OnOK (hDlg);
100 Server_Uninstall_EnableOK (hDlg);
106 SetWindowLong (hDlg, DWL_USER, 0);
107 PropCache_Delete (pcSVR_UNINSTALL, NULL);
117 void Server_Uninstall_OnInitDialog (HWND hDlg, LPSVR_UNINSTALL_PARAMS lpp)
119 LPSVR_ENUM_TO_COMBOBOX_PACKET lppEnum = New (SVR_ENUM_TO_COMBOBOX_PACKET);
120 lppEnum->hCombo = GetDlgItem (hDlg, IDC_SERVER);
121 lppEnum->lpiSelect = lpp->lpiServer;
122 StartTask (taskSVR_ENUM_TO_COMBOBOX, hDlg, lppEnum);
124 EnableWindow (GetDlgItem (hDlg, IDC_SERVER), FALSE);
125 EnableWindow (GetDlgItem (hDlg, IDOK), FALSE);
129 void Server_Uninstall_OnEndTask_InitDialog (HWND hDlg, LPTASKPACKET ptp, LPSVR_UNINSTALL_PARAMS lpp)
131 EnableWindow (GetDlgItem (hDlg, IDC_SERVER), TRUE);
132 Server_Uninstall_EnableOK (hDlg);
136 void Server_Uninstall_EnableOK (HWND hDlg)
138 LPIDENT lpiServer = NULL;
140 if (IsWindowEnabled (GetDlgItem (hDlg, IDC_SERVER)))
141 lpiServer = (LPIDENT)CB_GetSelectedData (GetDlgItem (hDlg, IDC_SERVER));
143 BOOL fEnable = (lpiServer != NULL) ? TRUE : FALSE;
147 TCHAR szName[ MAX_PATH ];
148 GetDlgItemText (hDlg, IDC_FILENAME, szName, MAX_PATH);
149 if (szName[0] == TEXT('\0'))
153 EnableWindow (GetDlgItem (hDlg, IDOK), fEnable);
157 void Server_Uninstall_OnOK (HWND hDlg)
159 LPSVR_UNINSTALL_PARAMS lpp = New (SVR_UNINSTALL_PARAMS);
160 lpp->lpiServer = (LPIDENT)CB_GetSelectedData (GetDlgItem (hDlg, IDC_SERVER));
161 GetDlgItemText (hDlg, IDC_FILENAME, lpp->szUninstall, MAX_PATH);
163 StartTask (taskSVR_UNINSTALL, NULL, lpp);