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 <afs/param.h>
19 #include "svr_uninstall.h"
20 #include "propcache.h"
23 * PROTOTYPES _________________________________________________________________
27 BOOL WINAPI Server_Uninstall_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
29 void Server_Uninstall_OnInitDialog (HWND hDlg, LPSVR_UNINSTALL_PARAMS lpp);
30 void Server_Uninstall_OnEndTask_InitDialog (HWND hDlg, LPTASKPACKET ptp, LPSVR_UNINSTALL_PARAMS lpp);
31 void Server_Uninstall_EnableOK (HWND hDlg);
32 void Server_Uninstall_OnOK (HWND hDlg);
36 * ROUTINES ___________________________________________________________________
40 void Server_Uninstall (LPIDENT lpiServer)
44 if ((hCurrent = PropCache_Search (pcSVR_UNINSTALL, NULL)) != NULL)
50 LPSVR_UNINSTALL_PARAMS lpp = New (SVR_UNINSTALL_PARAMS);
51 lpp->lpiServer = lpiServer;
52 lpp->szUninstall[0] = TEXT('\0');
54 HWND hDlg = ModelessDialogParam (IDD_SVR_UNINSTALL, NULL, (DLGPROC)Server_Uninstall_DlgProc, (LPARAM)lpp);
55 ShowWindow (hDlg, SW_SHOW);
60 BOOL WINAPI Server_Uninstall_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
62 if (AfsAppLib_HandleHelp (IDD_SVR_UNINSTALL, hDlg, msg, wp, lp))
65 LPSVR_UNINSTALL_PARAMS lpp;
67 if (msg == WM_INITDIALOG)
68 SetWindowLongPtr (hDlg, DWLP_USER, lp);
70 if ((lpp = (LPSVR_UNINSTALL_PARAMS)GetWindowLongPtr(hDlg,DWLP_USER)) != NULL)
75 PropCache_Add (pcSVR_UNINSTALL, NULL, hDlg);
76 Server_Uninstall_OnInitDialog (hDlg, lpp);
81 if ((ptp = (LPTASKPACKET)lp) != NULL)
83 if (ptp->idTask == taskSVR_ENUM_TO_COMBOBOX)
84 Server_Uninstall_OnEndTask_InitDialog (hDlg, ptp, lpp);
93 Server_Uninstall_OnOK (hDlg);
103 Server_Uninstall_EnableOK (hDlg);
109 SetWindowLongPtr (hDlg, DWLP_USER, 0);
110 PropCache_Delete (pcSVR_UNINSTALL, NULL);
120 void Server_Uninstall_OnInitDialog (HWND hDlg, LPSVR_UNINSTALL_PARAMS lpp)
122 LPSVR_ENUM_TO_COMBOBOX_PACKET lppEnum = New (SVR_ENUM_TO_COMBOBOX_PACKET);
123 lppEnum->hCombo = GetDlgItem (hDlg, IDC_SERVER);
124 lppEnum->lpiSelect = lpp->lpiServer;
125 StartTask (taskSVR_ENUM_TO_COMBOBOX, hDlg, lppEnum);
127 EnableWindow (GetDlgItem (hDlg, IDC_SERVER), FALSE);
128 EnableWindow (GetDlgItem (hDlg, IDOK), FALSE);
132 void Server_Uninstall_OnEndTask_InitDialog (HWND hDlg, LPTASKPACKET ptp, LPSVR_UNINSTALL_PARAMS lpp)
134 EnableWindow (GetDlgItem (hDlg, IDC_SERVER), TRUE);
135 Server_Uninstall_EnableOK (hDlg);
139 void Server_Uninstall_EnableOK (HWND hDlg)
141 LPIDENT lpiServer = NULL;
143 if (IsWindowEnabled (GetDlgItem (hDlg, IDC_SERVER)))
144 lpiServer = (LPIDENT)CB_GetSelectedData (GetDlgItem (hDlg, IDC_SERVER));
146 BOOL fEnable = (lpiServer != NULL) ? TRUE : FALSE;
150 TCHAR szName[ MAX_PATH ];
151 GetDlgItemText (hDlg, IDC_FILENAME, szName, MAX_PATH);
152 if (szName[0] == TEXT('\0'))
156 EnableWindow (GetDlgItem (hDlg, IDOK), fEnable);
160 void Server_Uninstall_OnOK (HWND hDlg)
162 LPSVR_UNINSTALL_PARAMS lpp = New (SVR_UNINSTALL_PARAMS);
163 lpp->lpiServer = (LPIDENT)CB_GetSelectedData (GetDlgItem (hDlg, IDC_SERVER));
164 GetDlgItemText (hDlg, IDC_FILENAME, lpp->szUninstall, MAX_PATH);
166 StartTask (taskSVR_UNINSTALL, NULL, lpp);