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
14 #include <afsconfig.h>
15 #include <afs/param.h>
20 #include "svr_uninstall.h"
21 #include "propcache.h"
24 * PROTOTYPES _________________________________________________________________
28 BOOL WINAPI Server_Uninstall_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
30 void Server_Uninstall_OnInitDialog (HWND hDlg, LPSVR_UNINSTALL_PARAMS lpp);
31 void Server_Uninstall_OnEndTask_InitDialog (HWND hDlg, LPTASKPACKET ptp, LPSVR_UNINSTALL_PARAMS lpp);
32 void Server_Uninstall_EnableOK (HWND hDlg);
33 void Server_Uninstall_OnOK (HWND hDlg);
37 * ROUTINES ___________________________________________________________________
41 void Server_Uninstall (LPIDENT lpiServer)
45 if ((hCurrent = PropCache_Search (pcSVR_UNINSTALL, NULL)) != NULL)
51 LPSVR_UNINSTALL_PARAMS lpp = New (SVR_UNINSTALL_PARAMS);
52 lpp->lpiServer = lpiServer;
53 lpp->szUninstall[0] = TEXT('\0');
55 HWND hDlg = ModelessDialogParam (IDD_SVR_UNINSTALL, NULL, (DLGPROC)Server_Uninstall_DlgProc, (LPARAM)lpp);
56 ShowWindow (hDlg, SW_SHOW);
61 BOOL WINAPI Server_Uninstall_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
63 if (AfsAppLib_HandleHelp (IDD_SVR_UNINSTALL, hDlg, msg, wp, lp))
66 LPSVR_UNINSTALL_PARAMS lpp;
68 if (msg == WM_INITDIALOG)
69 SetWindowLongPtr (hDlg, DWLP_USER, lp);
71 if ((lpp = (LPSVR_UNINSTALL_PARAMS)GetWindowLongPtr(hDlg,DWLP_USER)) != NULL)
76 PropCache_Add (pcSVR_UNINSTALL, NULL, hDlg);
77 Server_Uninstall_OnInitDialog (hDlg, lpp);
82 if ((ptp = (LPTASKPACKET)lp) != NULL)
84 if (ptp->idTask == taskSVR_ENUM_TO_COMBOBOX)
85 Server_Uninstall_OnEndTask_InitDialog (hDlg, ptp, lpp);
94 Server_Uninstall_OnOK (hDlg);
104 Server_Uninstall_EnableOK (hDlg);
110 SetWindowLongPtr (hDlg, DWLP_USER, 0);
111 PropCache_Delete (pcSVR_UNINSTALL, NULL);
121 void Server_Uninstall_OnInitDialog (HWND hDlg, LPSVR_UNINSTALL_PARAMS lpp)
123 LPSVR_ENUM_TO_COMBOBOX_PACKET lppEnum = New (SVR_ENUM_TO_COMBOBOX_PACKET);
124 lppEnum->hCombo = GetDlgItem (hDlg, IDC_SERVER);
125 lppEnum->lpiSelect = lpp->lpiServer;
126 StartTask (taskSVR_ENUM_TO_COMBOBOX, hDlg, lppEnum);
128 EnableWindow (GetDlgItem (hDlg, IDC_SERVER), FALSE);
129 EnableWindow (GetDlgItem (hDlg, IDOK), FALSE);
133 void Server_Uninstall_OnEndTask_InitDialog (HWND hDlg, LPTASKPACKET ptp, LPSVR_UNINSTALL_PARAMS lpp)
135 EnableWindow (GetDlgItem (hDlg, IDC_SERVER), TRUE);
136 Server_Uninstall_EnableOK (hDlg);
140 void Server_Uninstall_EnableOK (HWND hDlg)
142 LPIDENT lpiServer = NULL;
144 if (IsWindowEnabled (GetDlgItem (hDlg, IDC_SERVER)))
145 lpiServer = (LPIDENT)CB_GetSelectedData (GetDlgItem (hDlg, IDC_SERVER));
147 BOOL fEnable = (lpiServer != NULL) ? TRUE : FALSE;
151 TCHAR szName[ MAX_PATH ];
152 GetDlgItemText (hDlg, IDC_FILENAME, szName, MAX_PATH);
153 if (szName[0] == TEXT('\0'))
157 EnableWindow (GetDlgItem (hDlg, IDOK), fEnable);
161 void Server_Uninstall_OnOK (HWND hDlg)
163 LPSVR_UNINSTALL_PARAMS lpp = New (SVR_UNINSTALL_PARAMS);
164 lpp->lpiServer = (LPIDENT)CB_GetSelectedData (GetDlgItem (hDlg, IDC_SERVER));
165 GetDlgItemText (hDlg, IDC_FILENAME, lpp->szUninstall, MAX_PATH);
167 StartTask (taskSVR_UNINSTALL, NULL, lpp);