Windows: permit aklog to build with krb4 support and roken
[openafs.git] / src / WINNT / afssvrmgr / svc_delete.cpp
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
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
8  */
9
10 #include <winsock2.h>
11 #include <ws2tcpip.h>
12
13 extern "C" {
14 #include <afs/param.h>
15 #include <afs/stds.h>
16 }
17
18 #include "svrmgr.h"
19 #include "svc_delete.h"
20
21
22 /*
23  * PROTOTYPES _________________________________________________________________
24  *
25  */
26
27 BOOL CALLBACK Services_Delete_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
28 void Services_Delete_OnInitDialog (HWND hDlg, LPIDENT lpi);
29
30
31 /*
32  * ROUTINES ___________________________________________________________________
33  *
34  */
35
36 void Services_Delete (LPIDENT lpiService)
37 {
38    INT_PTR rc = ModalDialogParam (IDD_SVC_DELETE, GetActiveWindow(), (DLGPROC)Services_Delete_DlgProc, (LPARAM)lpiService);
39    if (rc == IDOK)
40       {
41       StartTask (taskSVC_DELETE, NULL, lpiService);
42       }
43 }
44
45
46
47 BOOL CALLBACK Services_Delete_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
48 {
49    if (AfsAppLib_HandleHelp (IDD_SVC_DELETE, hDlg, msg, wp, lp))
50       return TRUE;
51
52    static LPIDENT lpi = NULL;
53    if (msg == WM_INITDIALOG)
54       lpi = (LPIDENT)lp;
55
56    if (lpi != NULL)
57       {
58       switch (msg)
59          {
60          case WM_INITDIALOG:
61             Services_Delete_OnInitDialog (hDlg, lpi);
62             break;
63
64          case WM_COMMAND:
65             switch (LOWORD(wp))
66                {
67                case IDOK:
68                case IDCANCEL:
69                   EndDialog (hDlg, LOWORD(wp));
70                   break;
71                }
72             break;
73
74          case WM_DESTROY:
75             lpi = NULL;
76             break;
77          }
78       }
79
80    return FALSE;
81 }
82
83
84 void Services_Delete_OnInitDialog (HWND hDlg, LPIDENT lpi)
85 {
86    TCHAR szServer[ cchNAME ];
87    TCHAR szService[ cchNAME ];
88    lpi->GetServerName (szServer);
89    lpi->GetServiceName (szService);
90
91    TCHAR szOld[ cchRESOURCE ];
92    GetDlgItemText (hDlg, IDC_DELSVC_DESC, szOld, cchRESOURCE);
93
94    LPTSTR pszNew = FormatString (szOld, TEXT("%s%s"), szServer, szService);
95    SetDlgItemText (hDlg, IDC_DELSVC_DESC, pszNew);
96    FreeString (pszNew);
97 }
98