*/
BOOL GetAdminInfo(HWND hParent, GET_ADMIN_INFO_OPTIONS options)
{
- eOptions = options;
+ eOptions = options;
- int nResult = ModalDialog(IDD_ADMIN_INFO, hParent, (DLGPROC)AdminInfoDlgProc);
+ int nResult = ModalDialog(IDD_ADMIN_INFO, hParent, (DLGPROC)AdminInfoDlgProc);
- return (nResult == IDOK);
+ return (nResult == IDOK);
}
*
*/
BOOL CALLBACK AdminInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp)
-{
- if (AfsAppLib_HandleHelp(IDD_ADMIN_INFO, hwndDlg, msg, wp, lp))
- return TRUE;
-
- switch (msg) {
- case WM_INITDIALOG:
- OnInitDialog(hwndDlg);
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wp)) {
- case IDC_ADMIN_NAME:
- case IDC_ADMIN_PW:
- case IDC_HOSTNAME:
- case IDC_SCS:
- if (HIWORD(wp) == EN_CHANGE)
- CheckEnableButtons();
- break;
-
- case IDCANCEL:
- EndDialog(hDlg, IDCANCEL);
- break;
-
-
- case IDOK:
- SaveDlgInfo();
- EndDialog(hDlg, IDOK);
- break;
- }
- break;
+{
+ if (AfsAppLib_HandleHelp(IDD_ADMIN_INFO, hwndDlg, msg, wp, lp))
+ return TRUE;
+
+ switch (msg) {
+ case WM_INITDIALOG:
+ OnInitDialog(hwndDlg);
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wp)) {
+ case IDC_ADMIN_NAME:
+ case IDC_ADMIN_PW:
+ case IDC_HOSTNAME:
+ case IDC_SCS:
+ if (HIWORD(wp) == EN_CHANGE)
+ CheckEnableButtons();
+ break;
+
+ case IDCANCEL:
+ EndDialog(hDlg, IDCANCEL);
+ break;
+
+ case IDOK:
+ SaveDlgInfo();
+ EndDialog(hDlg, IDOK);
+ break;
+ }
+ break;
}
return FALSE;
{
static int nOffset = 0;
- hDlg = hwndDlg;
+ hDlg = hwndDlg;
- // Hide the additional server stuff if we don't need it
- if (eOptions == GAIO_LOGIN_ONLY) {
- HideAndDisable(hDlg, IDC_HOSTNAME_FRAME);
- HideAndDisable(hDlg, IDC_HOSTNAME_PROMPT);
- HideAndDisable(hDlg, IDC_HOSTNAME_LABEL);
- HideAndDisable(hDlg, IDC_HOSTNAME);
+ // Hide the additional server stuff if we don't need it
+ if (eOptions == GAIO_LOGIN_ONLY) {
+ HideAndDisable(hDlg, IDC_HOSTNAME_FRAME);
+ HideAndDisable(hDlg, IDC_HOSTNAME_PROMPT);
+ HideAndDisable(hDlg, IDC_HOSTNAME_LABEL);
+ HideAndDisable(hDlg, IDC_HOSTNAME);
if (nOffset == 0) {
// Get dimensions of the frame containing the things we will hide or show
}
// Move the buttons
- MoveWnd(hDlg, IDOK, 0, -nOffset);
- MoveWnd(hDlg, IDCANCEL, 0, -nOffset);
- MoveWnd(hDlg, IDHELP, 0, -nOffset);
+ MoveWnd(hDlg, IDOK, 0, -nOffset);
+ MoveWnd(hDlg, IDCANCEL, 0, -nOffset);
+ MoveWnd(hDlg, IDHELP, 0, -nOffset);
// Resize the dialog
RECT rectDlg;
GetWindowRect(hDlg, &rectDlg);
- MoveWindow(hDlg, rectDlg.left, rectDlg.top, rectDlg.right - rectDlg.left + 1, rectDlg.bottom - rectDlg.top - nOffset, TRUE);
-
- }
+ MoveWindow(hDlg, rectDlg.left, rectDlg.top, rectDlg.right - rectDlg.left + 1, rectDlg.bottom - rectDlg.top - nOffset, TRUE);
+ }
- ShowPageInfo();
+ ShowPageInfo();
}
/*
*/
static void CheckEnableButtons()
{
- BOOL bDisable = FALSE;
+ BOOL bDisable = FALSE;
- TCHAR szDummy[cchRESOURCE];
+ TCHAR szDummy[cchRESOURCE];
- bDisable |= lstrlen(GetWndText(hDlg, IDC_ADMIN_NAME, szDummy)) == 0;
- bDisable |= lstrlen(GetWndText(hDlg, IDC_ADMIN_PW, szDummy)) == 0;
+ bDisable |= lstrlen(GetWndText(hDlg, IDC_ADMIN_NAME, szDummy)) == 0;
+ bDisable |= lstrlen(GetWndText(hDlg, IDC_ADMIN_PW, szDummy)) == 0;
- SetEnable(hDlg, IDOK, (ENABLE_STATE)!bDisable);
+ SetEnable(hDlg, IDOK, (ENABLE_STATE)!bDisable);
}
static void SaveDlgInfo()
{
- TCHAR szText[cchRESOURCE];
+ TCHAR szText[cchRESOURCE];
- lstrncpy(g_CfgData.szAdminName, GetWndText(hDlg, IDC_ADMIN_NAME, szText), MAX_ADMIN_NAME_LEN);
- lstrncpy(g_CfgData.szAdminPW, GetWndText(hDlg, IDC_ADMIN_PW, szText), MAX_ADMIN_PW_LEN);
+ lstrncpy(g_CfgData.szAdminName, GetWndText(hDlg, IDC_ADMIN_NAME, szText), MAX_ADMIN_NAME_LEN);
+ lstrncpy(g_CfgData.szAdminPW, GetWndText(hDlg, IDC_ADMIN_PW, szText), MAX_ADMIN_PW_LEN);
- if (eOptions == GAIO_GET_SCS)
- lstrncpy(g_CfgData.szSysControlMachine, GetWndText(hDlg, IDC_HOSTNAME, szText), MAX_MACHINE_NAME_LEN);
+ if (eOptions == GAIO_GET_SCS)
+ lstrncpy(g_CfgData.szSysControlMachine, GetWndText(hDlg, IDC_HOSTNAME, szText), MAX_MACHINE_NAME_LEN);
}
static void ShowPageInfo()
{
- SetWndText(hDlg, IDC_ADMIN_NAME, g_CfgData.szAdminName);
- SetWndText(hDlg, IDC_ADMIN_PW, g_CfgData.szAdminPW);
+ SetWndText(hDlg, IDC_ADMIN_NAME, g_CfgData.szAdminName);
+ SetWndText(hDlg, IDC_ADMIN_PW, g_CfgData.szAdminPW);
- if (eOptions == GAIO_GET_SCS)
- SetWndText(hDlg, IDC_HOSTNAME, g_CfgData.szSysControlMachine);
+ if (eOptions == GAIO_GET_SCS)
+ SetWndText(hDlg, IDC_HOSTNAME, g_CfgData.szSysControlMachine);
}
static WIZARD_STATE g_aStates[] = {
- { sidSTEP_ONE, IDD_INTRO_PAGE, (DLGPROC)IntroPageDlgProc, 0 },
- { sidSTEP_TWO, IDD_INFO_PAGE, (DLGPROC)InfoPageDlgProc, 0 },
+ { sidSTEP_ONE, IDD_INTRO_PAGE, (DLGPROC)IntroPageDlgProc, 0 },
+ { sidSTEP_TWO, IDD_INFO_PAGE, (DLGPROC)InfoPageDlgProc, 0 },
{ sidSTEP_THREE, IDD_INFO_PAGE2_FIRST_SERVER, (DLGPROC)InfoPage2DlgProc, 0 },
- { sidSTEP_FOUR, IDD_INFO_PAGE2_NOT_FIRST_SERVER,(DLGPROC)InfoPage2DlgProc, 0 },
- { sidSTEP_FIVE, IDD_FILE_SERVER_PAGE, (DLGPROC)FileServerPageDlgProc, 0 },
- { sidSTEP_SIX, IDD_DB_SERVER_PAGE, (DLGPROC)DBServerPageDlgProc, 0 },
- { sidSTEP_SEVEN, IDD_BACKUP_SERVER_PAGE, (DLGPROC)BackupPageDlgProc, 0 },
- { sidSTEP_EIGHT, IDD_PARTITION_PAGE, (DLGPROC)PartitionPageDlgProc, 0 },
- { sidSTEP_NINE, IDD_ROOT_VOLUMES_PAGE, (DLGPROC)RootAfsPageDlgProc, 0 },
- { sidSTEP_TEN, IDD_REPLICATION_PAGE, (DLGPROC)ReplicationPageDlgProc, 0 },
- { sidSTEP_ELEVEN, IDD_SYS_CONTROL_PAGE, (DLGPROC)SysControlPageDlgProc, 0 },
- { sidSTEP_TWELVE, IDD_CONFIG_SERVER_PAGE, (DLGPROC)ConfigServerPageDlgProc, 0 }
+ { sidSTEP_FOUR, IDD_INFO_PAGE2_NOT_FIRST_SERVER,(DLGPROC)InfoPage2DlgProc, 0 },
+ { sidSTEP_FIVE, IDD_FILE_SERVER_PAGE, (DLGPROC)FileServerPageDlgProc, 0 },
+ { sidSTEP_SIX, IDD_DB_SERVER_PAGE, (DLGPROC)DBServerPageDlgProc, 0 },
+ { sidSTEP_SEVEN, IDD_BACKUP_SERVER_PAGE, (DLGPROC)BackupPageDlgProc, 0 },
+ { sidSTEP_EIGHT, IDD_PARTITION_PAGE, (DLGPROC)PartitionPageDlgProc, 0 },
+ { sidSTEP_NINE, IDD_ROOT_VOLUMES_PAGE, (DLGPROC)RootAfsPageDlgProc, 0 },
+ { sidSTEP_TEN, IDD_REPLICATION_PAGE, (DLGPROC)ReplicationPageDlgProc, 0 },
+ { sidSTEP_ELEVEN, IDD_SYS_CONTROL_PAGE, (DLGPROC)SysControlPageDlgProc, 0 },
+ { sidSTEP_TWELVE, IDD_CONFIG_SERVER_PAGE, (DLGPROC)ConfigServerPageDlgProc, 0 }
};
size_t g_nNumStates = sizeof(g_aStates) / sizeof(g_aStates[0]);
*/
extern "C" int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR pszCmdLineA, int nCmdShow)
{
- afs_status_t nStatus;
+ afs_status_t nStatus;
- TaLocale_LoadCorrespondingModule (hInst);
+ TaLocale_LoadCorrespondingModule (hInst);
- // Tell the applib our application's name
- TCHAR szAppName[cchRESOURCE];
- AfsAppLib_SetAppName(GetResString(GetAppTitleID(), szAppName));
+ // Tell the applib our application's name
+ TCHAR szAppName[cchRESOURCE];
+ AfsAppLib_SetAppName(GetResString(GetAppTitleID(), szAppName));
- // Open the admin libraries
- int nResult = afsclient_Init(&nStatus);
- if (!nResult) {
- ShowError(0, nStatus, IDS_CANT_INIT_ADMIN_LIBS);
- return 0;
- }
+ // Open the admin libraries
+ int nResult = afsclient_Init(&nStatus);
+ if (!nResult) {
+ ShowError(0, nStatus, IDS_CANT_INIT_ADMIN_LIBS);
+ return 0;
+ }
- // Open the log file
- char szLogPath[MAX_PATH];
- sprintf(szLogPath, "%s\\%s", AFSDIR_SERVER_LOGS_DIRPATH, LOG_FILE_NAME);
- if (!g_LogFile.Open(szLogPath))
- ShowError(0, 0, IDS_CANT_OPEN_LOG_FILE);
+ // Open the log file
+ char szLogPath[MAX_PATH];
+ sprintf(szLogPath, "%s\\%s", AFSDIR_SERVER_LOGS_DIRPATH, LOG_FILE_NAME);
+ if (!g_LogFile.Open(szLogPath))
+ ShowError(0, 0, IDS_CANT_OPEN_LOG_FILE);
- // Register the help file with the applib's help system
- AfsAppLib_RegisterHelpFile(TEXT("TaAfsCfg.hlp"));
+ // Register the help file with the applib's help system
+ AfsAppLib_RegisterHelpFile(TEXT("TaAfsCfg.hlp"));
/* Start up sockets */
WSADATA WSAjunk;
WSAStartup(0x0101, &WSAjunk);
- memset(&g_CfgData, 0, sizeof(CFG_DATA));
+ memset(&g_CfgData, 0, sizeof(CFG_DATA));
- // Get this machine's local name
- char szLocalName[sizeof(g_CfgData.szLocalName) / sizeof(TCHAR)];
+ // Get this machine's local name
+ char szLocalName[sizeof(g_CfgData.szLocalName) / sizeof(TCHAR)];
if (gethostname(szLocalName, sizeof(szLocalName)) != 0) {
- ShowError(GetFocus(), WSAGetLastError(), IDS_ERROR_LOCAL_HOST_NAME);
- return 0;
- }
+ ShowError(GetFocus(), WSAGetLastError(), IDS_ERROR_LOCAL_HOST_NAME);
+ return 0;
+ }
CopyAnsiToString(g_CfgData.szLocalName, szLocalName);
- // Turn the local name into a host name
+ // Turn the local name into a host name
struct hostent *pHostEnt = gethostbyname(szLocalName);
if (!pHostEnt) {
- ShowError(GetFocus(), WSAGetLastError(), IDS_ERROR_HOST_NAME);
- return 0;
- }
+ ShowError(GetFocus(), WSAGetLastError(), IDS_ERROR_HOST_NAME);
+ return 0;
+ }
CopyAnsiToString(g_CfgData.szHostname, pHostEnt->h_name, sizeof(g_CfgData.szHostname));
- RegisterFastListClass();
+ RegisterFastListClass();
- // Get current config status
- BOOL bCanceled = FALSE;
- DWORD dwStatus = GetCurrentConfig(NULL, bCanceled);
- if (dwStatus || bCanceled) {
- if (!bCanceled)
- ShowError(GetFocus(), dwStatus, IDS_CONFIG_CHECK_FAILED);
- return 0;
- }
+ // Get current config status
+ BOOL bCanceled = FALSE;
+ DWORD dwStatus = GetCurrentConfig(NULL, bCanceled);
+ if (dwStatus || bCanceled) {
+ if (!bCanceled)
+ ShowError(GetFocus(), dwStatus, IDS_CONFIG_CHECK_FAILED);
+ return 0;
+ }
- // Run the appropriate interface
- if ((strstr(_strlwr(pszCmdLineA), "wizard") != 0))
- RunWizard();
- else
- RunCfgTool();
+ // Run the appropriate interface
+ if ((strstr(_strlwr(pszCmdLineA), "wizard") != 0))
+ RunWizard();
+ else
+ RunCfgTool();
- FreePartitionTable();
+ FreePartitionTable();
- // Disconnect from the config and admin libraries
- CloseLibHandles(TRUE);
+ // Disconnect from the config and admin libraries
+ CloseLibHandles(TRUE);
- return 0;
+ return 0;
}
/*
*/
BOOL CALLBACK WizStep_Common_DlgProc(HWND hRHS, UINT msg, WPARAM wp, LPARAM lp)
{
- // Get the dialog's resource ID
- int nIDD = GetWindowLong(hRHS, GWL_ID);
+ // Get the dialog's resource ID
+ int nIDD = GetWindowLong(hRHS, GWL_ID);
- if (AfsAppLib_HandleHelp(nIDD, hRHS, msg, wp, lp))
- return TRUE;
+ if (AfsAppLib_HandleHelp(nIDD, hRHS, msg, wp, lp))
+ return TRUE;
- switch (msg) {
- case WM_INITDIALOG: MakeBold(hRHS, IDC_TITLE);
- RedrawGraphic();
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wp)) {
- case IDCANCEL:
- QueryCancelWiz();
- return TRUE;
- }
- break;
+ switch (msg) {
+ case WM_INITDIALOG: MakeBold(hRHS, IDC_TITLE);
+ RedrawGraphic();
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wp)) {
+ case IDCANCEL:
+ QueryCancelWiz();
+ return TRUE;
}
+ break;
+ }
- return FALSE;
+ return FALSE;
}
BOOL QueryCancelWiz()
{
- int nChoice = Message(MB_YESNO, IDS_WIZARD_APP_TITLE, IDS_CANCEL_DESC);
- if (nChoice == IDYES) {
- g_LogFile.Write("User has chosen to cancel the program.\r\n");
- if (g_pWiz)
- g_pWiz->Show(FALSE);
- return TRUE;
- }
+ int nChoice = Message(MB_YESNO, IDS_WIZARD_APP_TITLE, IDS_CANCEL_DESC);
+ if (nChoice == IDYES) {
+ g_LogFile.Write("User has chosen to cancel the program.\r\n");
+ if (g_pWiz)
+ g_pWiz->Show(FALSE);
+ return TRUE;
+ }
- return FALSE;
+ return FALSE;
}
{
static TCHAR szValue[MAX_MACHINE_NAME_LEN + 1] = "";
- if ( szValue[0] == 0 )
- CopyAnsiToString(GetClientNetbiosNameA(), szValue);
+ if ( szValue[0] == 0 )
+ CopyAnsiToString(GetClientNetbiosNameA(), szValue);
return szValue;
}
{
static char szValueA[MAX_MACHINE_NAME_LEN + 1]="";
- if ( szValueA[0] == 0 )
+ if ( szValueA[0] == 0 )
lana_GetNetbiosName(szValueA, LANA_NETBIOS_NAME_FULL);
- return szValueA;
+ return szValueA;
}
char *GetSalvageLogFileNameA()
BOOL GetLibHandles(afs_status_t *pStatus)
{
- ASSERT(g_CfgData.szHostname[0]);
+ ASSERT(g_CfgData.szHostname[0]);
- int nResult;
-
- // ************************* NOTE ********************************
- // * You MUST have already determined whether or not the host
- // * and client config info is valid before calling this function.
- // ***************************************************************
-
- // This function can be called at any time to get handles to the cell and
- // the config library. It will try to get the most powerful handle to the
- // cell that it can, and then use that to open the config library. If the
- // libraries are already open, it will close them first. Two handles to
- // the config library will be opened, one to the server to be configured,
- // and one to the client machine we are configuring from.
+ int nResult;
- // There are two types of cell handles, NULL and Standard. A null handle
- // can make calls to any server except DB servers. We need this primarily
- // to talk to the bos server to determine the machine's current configuration,
- // and to configure the client information if it is not already. A standard
- // handle can talk to any server. Standard handles can be either authenticated
- // or unauthenticated.
-
- // Close all current handles
- CloseLibHandles();
-
- g_LogFile.Write("Getting handles to the cell and the config library.\r\n");
+ // ************************* NOTE ********************************
+ // * You MUST have already determined whether or not the host
+ // * and client config info is valid before calling this function.
+ // ***************************************************************
+
+ // This function can be called at any time to get handles to the cell and
+ // the config library. It will try to get the most powerful handle to the
+ // cell that it can, and then use that to open the config library. If the
+ // libraries are already open, it will close them first. Two handles to
+ // the config library will be opened, one to the server to be configured,
+ // and one to the client machine we are configuring from.
+
+ // There are two types of cell handles, NULL and Standard. A null handle
+ // can make calls to any server except DB servers. We need this primarily
+ // to talk to the bos server to determine the machine's current configuration,
+ // and to configure the client information if it is not already. A standard
+ // handle can talk to any server. Standard handles can be either authenticated
+ // or unauthenticated.
+
+ // Close all current handles
+ CloseLibHandles();
+
+ g_LogFile.Write("Getting handles to the cell and the config library.\r\n");
if (!hClientCell) {
// Start by getting a null cell handle and using it to open the client
}
}
- // Now we need to get the most powerful cell handle that we can and use it
- // to open the config library for the server.
+ // Now we need to get the most powerful cell handle that we can and use it
+ // to open the config library for the server.
- // If the client info is valid and we know what cell the server should be in,
- // and the client has that cell in its CellServDB, then we can get a Standard cell
- // handle. However there is an exception: if this is the first server in the
- // cell then there may not yet be an authentication server to talk to. In that
- // case we use a null cell handle.
+ // If the client info is valid and we know what cell the server should be in,
+ // and the client has that cell in its CellServDB, then we can get a Standard cell
+ // handle. However there is an exception: if this is the first server in the
+ // cell then there may not yet be an authentication server to talk to. In that
+ // case we use a null cell handle.
if (g_CfgData.bValidClientInfo && // Client config is valid
g_CfgData.szCellName[0] && // We have a cell name
(!g_CfgData.bFirstServer || g_CfgData.bAuthServerRunning)) // Auth server is running
{
- g_LogFile.Write("Opening a non-NULL cell handle to use with the server config library handle.\r\n");
+ g_LogFile.Write("Opening a non-NULL cell handle to use with the server config library handle.\r\n");
// Do we have the user info necessary to authenticate?
BOOL bHaveUserInfo = g_CfgData.szAdminName[0] && g_CfgData.szAdminPW[0];
- // Open a standard cell handle. szAdminName and szAdminPW will either be NULL, or
- // if they have been entered by the user, will be the admin name and password strings.
- if ((!g_CfgData.bFirstServer || g_CfgData.bAdminPrincipalCreated) && bHaveUserInfo) {
- g_LogFile.Write("Getting tokens in cell %s for user '%s'.\r\n", GetCellNameA(), GetAdminNameA());
- nResult = afsclient_TokenGetNew(GetCellNameA(), GetAdminNameA(), GetAdminPWA(), &g_hToken, pStatus);
- } else {
- g_LogFile.Write("Getting unauthenticated tokens for cell '%s'.\r\n", GetCellNameA());
- nResult = afsclient_TokenGetNew(GetCellNameA(), "", "", &g_hToken, pStatus);
- }
-
- if (!nResult) {
- g_LogFile.Write("Failed to get tokens for the specified cell: %lx.\r\n", (unsigned long)*pStatus);
- return FALSE;
- }
-
- // If the admin name and password are NULL, then this will be an unauthenticated
- // connection to the cell.
- g_LogFile.Write("Getting cell handle for cell %s.\r\n", GetCellNameA());
- nResult = afsclient_CellOpen(GetCellNameA(), g_hToken, &g_hCell, pStatus);
- if (!nResult) {
- g_LogFile.Write("Failed to open the cell: %lx.\r\n", (unsigned long)*pStatus);
- return FALSE;
- }
+ // Open a standard cell handle. szAdminName and szAdminPW will either be NULL, or
+ // if they have been entered by the user, will be the admin name and password strings.
+ if ((!g_CfgData.bFirstServer || g_CfgData.bAdminPrincipalCreated) && bHaveUserInfo) {
+ g_LogFile.Write("Getting tokens in cell %s for user '%s'.\r\n", GetCellNameA(), GetAdminNameA());
+ nResult = afsclient_TokenGetNew(GetCellNameA(), GetAdminNameA(), GetAdminPWA(), &g_hToken, pStatus);
} else {
+ g_LogFile.Write("Getting unauthenticated tokens for cell '%s'.\r\n", GetCellNameA());
+ nResult = afsclient_TokenGetNew(GetCellNameA(), "", "", &g_hToken, pStatus);
+ }
+
+ if (!nResult) {
+ g_LogFile.Write("Failed to get tokens for the specified cell: %lx.\r\n", (unsigned long)*pStatus);
+ return FALSE;
+ }
+
+ // If the admin name and password are NULL, then this will be an unauthenticated
+ // connection to the cell.
+ g_LogFile.Write("Getting cell handle for cell %s.\r\n", GetCellNameA());
+ nResult = afsclient_CellOpen(GetCellNameA(), g_hToken, &g_hCell, pStatus);
+ if (!nResult) {
+ g_LogFile.Write("Failed to open the cell: %lx.\r\n", (unsigned long)*pStatus);
+ return FALSE;
+ }
+ } else {
g_LogFile.Write("Opening a NULL cell handle to use with the server config library handle.\r\n");
nResult = afsclient_NullCellOpen(&g_hCell, pStatus);
if (!nResult) {
g_LogFile.Write("Failed to open a NULL cell handle: %lx.\r\n", (unsigned long)*pStatus);
- return FALSE;
- }
- }
+ return FALSE;
+ }
+ }
- // Get the server handle
- g_LogFile.Write("Getting config library handle for the server.\r\n");
- if (!cfg_HostOpen(g_hCell, GetHostnameA(), &g_hServer, pStatus)) {
+ // Get the server handle
+ g_LogFile.Write("Getting config library handle for the server.\r\n");
+ if (!cfg_HostOpen(g_hCell, GetHostnameA(), &g_hServer, pStatus)) {
g_LogFile.Write("Failed to get config library handle for the server: %lx.\r\n", (unsigned long)*pStatus);
- return FALSE;
- }
+ return FALSE;
+ }
- return TRUE;
+ return TRUE;
}
BOOL GetHandles(HWND hParentDlg)
*/
static void CloseLibHandles(BOOL bExiting)
{
- afs_status_t nStatus;
-
- // We will close them in the reverse order of their creation.
+ afs_status_t nStatus;
- if (g_hServer) {
- cfg_HostClose(g_hServer, &nStatus);
- g_hServer = 0;
- }
+ // We will close them in the reverse order of their creation.
+ if (g_hServer) {
+ cfg_HostClose(g_hServer, &nStatus);
+ g_hServer = 0;
+ }
- if (g_hCell) {
- afsclient_CellClose(g_hCell, &nStatus);
- g_hCell = 0;
- }
+ if (g_hCell) {
+ afsclient_CellClose(g_hCell, &nStatus);
+ g_hCell = 0;
+ }
- if (g_hToken) {
- afsclient_TokenClose(g_hToken, &nStatus);
- g_hToken = 0;
- }
+ if (g_hToken) {
+ afsclient_TokenClose(g_hToken, &nStatus);
+ g_hToken = 0;
+ }
// Only close the client cfg and cell handles if we are exiting.
- if (bExiting) {
+ if (bExiting) {
if (g_hClient) {
- cfg_HostClose(g_hClient, &nStatus);
- g_hClient = 0;
- }
+ cfg_HostClose(g_hClient, &nStatus);
+ g_hClient = 0;
+ }
if (hClientCell) {
- afsclient_CellClose(hClientCell, &nStatus);
- hClientCell = 0;
+ afsclient_CellClose(hClientCell, &nStatus);
+ hClientCell = 0;
}
}
}
static void SetConfigDefaults()
{
- if (g_CfgData.bWizard) {
- if (g_CfgData.configFS == CS_NULL)
- g_CfgData.configFS = CS_CONFIGURE;
+ if (g_CfgData.bWizard) {
+ if (g_CfgData.configFS == CS_NULL)
+ g_CfgData.configFS = CS_CONFIGURE;
- if (g_CfgData.configDB == CS_NULL)
- g_CfgData.configDB = CS_CONFIGURE;
-
- if (g_CfgData.configBak == CS_NULL)
- g_CfgData.configBak = CS_CONFIGURE;
+ if (g_CfgData.configDB == CS_NULL)
+ g_CfgData.configDB = CS_CONFIGURE;
- if (g_CfgData.configPartition == CS_NULL)
- g_CfgData.configPartition = CS_CONFIGURE;
+ if (g_CfgData.configBak == CS_NULL)
+ g_CfgData.configBak = CS_CONFIGURE;
- if (g_CfgData.configRootVolumes == CS_NULL)
- g_CfgData.configRootVolumes = CS_CONFIGURE;
+ if (g_CfgData.configPartition == CS_NULL)
+ g_CfgData.configPartition = CS_CONFIGURE;
- if (g_CfgData.configRep == CS_NULL)
- g_CfgData.configRep = CS_CONFIGURE;
+ if (g_CfgData.configRootVolumes == CS_NULL)
+ g_CfgData.configRootVolumes = CS_CONFIGURE;
- if (g_CfgData.configSCS == CS_NULL)
- g_CfgData.configSCS = CS_DONT_CONFIGURE;
+ if (g_CfgData.configRep == CS_NULL)
+ g_CfgData.configRep = CS_CONFIGURE;
- if (g_CfgData.configSCC == CS_NULL)
- g_CfgData.configSCC = CS_DONT_CONFIGURE;
- }
+ if (g_CfgData.configSCS == CS_NULL)
+ g_CfgData.configSCS = CS_DONT_CONFIGURE;
- lstrcpy(g_CfgData.szAdminName, TEXT("admin"));
- lstrcpy(g_CfgData.szAdminUID, TEXT("0"));
+ if (g_CfgData.configSCC == CS_NULL)
+ g_CfgData.configSCC = CS_DONT_CONFIGURE;
+ }
- g_CfgData.bUseNextUid = TRUE;
-}
+ lstrcpy(g_CfgData.szAdminName, TEXT("admin"));
+ lstrcpy(g_CfgData.szAdminUID, TEXT("0"));
+
+ g_CfgData.bUseNextUid = TRUE;
+}
// Prototypes for each property page's dialog proc
static void RunCfgTool()
{
- // If the client info is invalid, then the config tool cannot run. Inform the user and
- // ask if they want to run the wizard instead.
- if (!g_CfgData.bValidClientInfo) {
- int nChoice = MsgBox(0, IDS_NEED_CLIENT_INFO, GetAppTitleID(), MB_YESNO | MB_ICONSTOP);
- if (nChoice == IDYES)
- RunWizard();
- return;
- }
+ // If the client info is invalid, then the config tool cannot run. Inform the user and
+ // ask if they want to run the wizard instead.
+ if (!g_CfgData.bValidClientInfo) {
+ int nChoice = MsgBox(0, IDS_NEED_CLIENT_INFO, GetAppTitleID(), MB_YESNO | MB_ICONSTOP);
+ if (nChoice == IDYES)
+ RunWizard();
+ return;
+ }
+
+ // If the server info is invalid, then the config tool cannot run. The Wizard must be run
+ // to initially configure the server. Inform the user and ask if they want to run the wizard instead.
+ if (!g_CfgData.bValidServerInfo) {
+ int nChoice = MsgBox(0, IDS_NEED_SERVER_INFO, GetAppTitleID(), MB_OKCANCEL | MB_ICONEXCLAMATION);
+ if (nChoice == IDOK)
+ RunWizard();
+ return;
+ }
- // If the server info is invalid, then the config tool cannot run. The Wizard must be run
- // to initially configure the server. Inform the user and ask if they want to run the wizard instead.
- if (!g_CfgData.bValidServerInfo) {
- int nChoice = MsgBox(0, IDS_NEED_SERVER_INFO, GetAppTitleID(), MB_OKCANCEL | MB_ICONEXCLAMATION);
- if (nChoice == IDOK)
- RunWizard();
- return;
- }
+ g_CfgData.bWizard = FALSE;
- g_CfgData.bWizard = FALSE;
+ SetConfigDefaults();
- SetConfigDefaults();
+ RegisterConfigToolHelp();
- RegisterConfigToolHelp();
+ // Create the prop sheet
+ g_pSheet = PropSheet_Create(IDS_CFG_TOOL_APP_TITLE, TRUE);
- // Create the prop sheet
- g_pSheet = PropSheet_Create(IDS_CFG_TOOL_APP_TITLE, TRUE);
-
- // Add the pages
- PropSheet_AddTab(g_pSheet, IDS_PARTITIONS_PAGE_TITLE, IDD_PARTITIONS_PAGE, (DLGPROC)PartitionsPageDlgProc, 0, TRUE, TRUE);
- PropSheet_AddTab(g_pSheet, IDS_SERVICES_PAGE_TITLE, IDD_SERVICES_PAGE, (DLGPROC)ServicesPageDlgProc, 0, TRUE);
+ // Add the pages
+ PropSheet_AddTab(g_pSheet, IDS_PARTITIONS_PAGE_TITLE, IDD_PARTITIONS_PAGE, (DLGPROC)PartitionsPageDlgProc, 0, TRUE, TRUE);
+ PropSheet_AddTab(g_pSheet, IDS_SERVICES_PAGE_TITLE, IDD_SERVICES_PAGE, (DLGPROC)ServicesPageDlgProc, 0, TRUE);
- // Let the user see it
- PropSheet_ShowModal(g_pSheet);
-}
+ // Let the user see it
+ PropSheet_ShowModal(g_pSheet);
+}
static void RunWizard()
{
- g_CfgData.bWizard = TRUE;
+ g_CfgData.bWizard = TRUE;
SetConfigDefaults();
- RegisterWizardHelp();
-
- g_pWiz = new WIZARD;
- g_pWiz->SetDialogTemplate(IDD_WIZARD, IDC_WIZARD_LEFTPANE, IDC_WIZARD_RIGHTPANE, IDBACK, IDNEXT);
- g_pWiz->SetGraphic(IDB_GRAPHIC_16, IDB_GRAPHIC_256);
- g_pWiz->SetStates(g_aStates, g_nNumStates);
- g_pWiz->SetGraphicCallback(PaintPageGraphic);
+ RegisterWizardHelp();
- g_pWiz->SetState(sidSTEP_ONE);
- g_pWiz->Show();
+ g_pWiz = new WIZARD;
+ g_pWiz->SetDialogTemplate(IDD_WIZARD, IDC_WIZARD_LEFTPANE, IDC_WIZARD_RIGHTPANE, IDBACK, IDNEXT);
+ g_pWiz->SetGraphic(IDB_GRAPHIC_16, IDB_GRAPHIC_256);
+ g_pWiz->SetStates(g_aStates, g_nNumStates);
+ g_pWiz->SetGraphicCallback(PaintPageGraphic);
- delete g_pWiz;
+ g_pWiz->SetState(sidSTEP_ONE);
+ g_pWiz->Show();
- g_pWiz = 0;
-}
+ delete g_pWiz;
+
+ g_pWiz = 0;
+}
*/
BOOL CALLBACK BackupPageDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp)
{
- if (WizStep_Common_DlgProc (hwndDlg, msg, wp, lp))
- return FALSE;
-
- switch (msg) {
- case WM_INITDIALOG:
- OnInitDialog(hwndDlg);
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wp)) {
- case IDNEXT:
- g_pWiz->SetState(sidSTEP_EIGHT);
- break;
-
- case IDBACK:
- g_pWiz->SetState(sidSTEP_SIX);
- break;
-
- case IDC_DONT_CONFIG_BACKUP_SERVER:
- g_CfgData.configBak = CS_DONT_CONFIGURE;
- break;
-
- case IDC_CONFIG_BACKUP_SERVER:
- g_CfgData.configBak = CS_CONFIGURE;
- break;
- }
- break;
+ if (WizStep_Common_DlgProc (hwndDlg, msg, wp, lp))
+ return FALSE;
+
+ switch (msg) {
+ case WM_INITDIALOG:
+ OnInitDialog(hwndDlg);
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wp)) {
+ case IDNEXT:
+ g_pWiz->SetState(sidSTEP_EIGHT);
+ break;
+ case IDBACK:
+ g_pWiz->SetState(sidSTEP_SIX);
+ break;
+
+ case IDC_DONT_CONFIG_BACKUP_SERVER:
+ g_CfgData.configBak = CS_DONT_CONFIGURE;
+ break;
+
+ case IDC_CONFIG_BACKUP_SERVER:
+ g_CfgData.configBak = CS_CONFIGURE;
+ break;
}
+ break;
- return FALSE;
-}
+ }
+
+ return FALSE;
+}
/*
*/
static void OnInitDialog(HWND hwndDlg)
{
- hDlg = hwndDlg;
+ hDlg = hwndDlg;
CalcOptionButtonSeparationHeight();
- g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
- g_pWiz->SetButtonText(IDNEXT, IDS_NEXT);
- g_pWiz->SetDefaultControl(IDNEXT);
+ g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
+ g_pWiz->SetButtonText(IDNEXT, IDS_NEXT);
+ g_pWiz->SetDefaultControl(IDNEXT);
- if (g_CfgData.configBak == CS_ALREADY_CONFIGURED) {
- CantBackup(IDS_ALREADY_A_BACKUP_SERVER);
- return;
- }
+ if (g_CfgData.configBak == CS_ALREADY_CONFIGURED) {
+ CantBackup(IDS_ALREADY_A_BACKUP_SERVER);
+ return;
+ }
- // Should this step be disabled? Yes, if this machine
- // is not configured as a database server.
- if (!ConfiguredOrConfiguring(g_CfgData.configDB)) {
- CantBackup(IDS_NOT_A_DB_SERVER);
- EnableStep(g_CfgData.configBak, FALSE);
- return;
- }
+ // Should this step be disabled? Yes, if this machine
+ // is not configured as a database server.
+ if (!ConfiguredOrConfiguring(g_CfgData.configDB)) {
+ CantBackup(IDS_NOT_A_DB_SERVER);
+ EnableStep(g_CfgData.configBak, FALSE);
+ return;
+ }
- // Enable this in case it was disabled the last time
- EnableStep(g_CfgData.configBak);
+ // Enable this in case it was disabled the last time
+ EnableStep(g_CfgData.configBak);
- if (g_CfgData.configBak == CS_DONT_CONFIGURE)
- SetCheck(hDlg, IDC_DONT_CONFIG_BACKUP_SERVER);
- else if (g_CfgData.configBak == CS_CONFIGURE)
- SetCheck(hDlg, IDC_CONFIG_BACKUP_SERVER);
-}
+ if (g_CfgData.configBak == CS_DONT_CONFIGURE)
+ SetCheck(hDlg, IDC_DONT_CONFIG_BACKUP_SERVER);
+ else if (g_CfgData.configBak == CS_CONFIGURE)
+ SetCheck(hDlg, IDC_CONFIG_BACKUP_SERVER);
+}
/*
*/
static void CantBackup(UINT nMsgID)
{
- TCHAR szMsg[cchRESOURCE];
+ TCHAR szMsg[cchRESOURCE];
- GetString(szMsg, nMsgID);
+ GetString(szMsg, nMsgID);
- ShowWnd(hDlg, IDC_BACKUP_SERVER_QUESTION, FALSE);
- ShowWnd(hDlg, IDC_CONFIG_BACKUP_SERVER, FALSE);
- ShowWnd(hDlg, IDC_DONT_CONFIG_BACKUP_SERVER, FALSE);
+ ShowWnd(hDlg, IDC_BACKUP_SERVER_QUESTION, FALSE);
+ ShowWnd(hDlg, IDC_CONFIG_BACKUP_SERVER, FALSE);
+ ShowWnd(hDlg, IDC_DONT_CONFIG_BACKUP_SERVER, FALSE);
- ShowWnd(hDlg, IDC_CANT_BACKUP_MSG);
- SetWndText(hDlg, IDC_CANT_BACKUP_MSG, szMsg);
+ ShowWnd(hDlg, IDC_CANT_BACKUP_MSG);
+ SetWndText(hDlg, IDC_CANT_BACKUP_MSG, szMsg);
}
static void CalcOptionButtonSeparationHeight()
*/
BOOL IsStepEnabled(const CONFIG_STATE& step)
{
- return ((step & CS_DISABLED) == 0);
+ return ((step & CS_DISABLED) == 0);
}
void EnableStep(CONFIG_STATE& step, BOOL bEnable)
-{
- if (bEnable)
- step &= ~CS_DISABLED;
- else
- step |= CS_DISABLED;
-}
+{
+ if (bEnable)
+ step &= ~CS_DISABLED;
+ else
+ step |= CS_DISABLED;
+}
BOOL ShouldConfig(const CONFIG_STATE& state)
{
- return (state == CS_CONFIGURE);
+ return (state == CS_CONFIGURE);
}
BOOL DontConfig(const CONFIG_STATE& state)
{
- return (state == CS_DONT_CONFIGURE);
+ return (state == CS_DONT_CONFIGURE);
}
BOOL ShouldUnconfig(const CONFIG_STATE& state)
{
- return (state == CS_UNCONFIGURE);
+ return (state == CS_UNCONFIGURE);
}
BOOL ConfiguredOrConfiguring(const CONFIG_STATE& step)
{
- return (step == CS_CONFIGURE) || (step == CS_ALREADY_CONFIGURED);
+ return (step == CS_CONFIGURE) || (step == CS_ALREADY_CONFIGURED);
}
BOOL Configured(const CONFIG_STATE& step)
{
- return (step == CS_ALREADY_CONFIGURED);
+ return (step == CS_ALREADY_CONFIGURED);
}
void ToggleConfig(CONFIG_STATE& state)
{
- if (ShouldConfig(state))
- state = CS_DONT_CONFIGURE;
- else if (DontConfig(state))
- state = CS_CONFIGURE;
-}
+ if (ShouldConfig(state))
+ state = CS_DONT_CONFIGURE;
+ else if (DontConfig(state))
+ state = CS_CONFIGURE;
+}
void RedrawGraphic()
{
- HWND hWiz = g_pWiz->GetWindow();
+ HWND hWiz = g_pWiz->GetWindow();
- HWND hBg = GetDlgItem(hWiz, IDC_WIZARD_LEFTPANE);
+ HWND hBg = GetDlgItem(hWiz, IDC_WIZARD_LEFTPANE);
- RECT rect;
- GetClientRect(hBg, &rect);
+ RECT rect;
+ GetClientRect(hBg, &rect);
- InvalidateRect(hBg, &rect, FALSE);
- UpdateWindow(hBg);
-}
+ InvalidateRect(hBg, &rect, FALSE);
+ UpdateWindow(hBg);
+}
UINT GetAppTitleID()
{
- if (g_CfgData.bWizard)
- return IDS_WIZARD_APP_TITLE;
+ if (g_CfgData.bWizard)
+ return IDS_WIZARD_APP_TITLE;
- return IDS_CFG_TOOL_APP_TITLE;
+ return IDS_CFG_TOOL_APP_TITLE;
}
const char *GetAdminLibErrorCodeMessage(afs_status_t nErrorCode)
void ShowError(HWND hDlg, afs_status_t nErrorCode, UINT uiErrorMsgID)
{
- TCHAR szMsg[cchRESOURCE];
+ TCHAR szMsg[cchRESOURCE];
LogError(nErrorCode);
- GetString(szMsg, uiErrorMsgID);
-
- ErrorDialog(nErrorCode, szMsg);
+ GetString(szMsg, uiErrorMsgID);
+
+ ErrorDialog(nErrorCode, szMsg);
SetWndText(hDlg, IDC_STATUS_MSG, IDS_CONFIG_FAILED);
}
int ShowWarning(HWND hDlg, UINT uiMsgID)
{
- TCHAR szMsg[cchRESOURCE];
- TCHAR szTitle[cchRESOURCE];
+ TCHAR szMsg[cchRESOURCE];
+ TCHAR szTitle[cchRESOURCE];
- GetString(szTitle, GetAppTitleID());
- GetString(szMsg, uiMsgID);
+ GetString(szTitle, GetAppTitleID());
+ GetString(szMsg, uiMsgID);
- return MessageBox(hDlg, szMsg, szTitle, MB_OKCANCEL | MB_ICONWARNING);
+ return MessageBox(hDlg, szMsg, szTitle, MB_OKCANCEL | MB_ICONWARNING);
}
#include <afs\afs_clientAdmin.h>
#include <afs\volser.h>
#include <afs\dirpath.h>
+#include <WINNT\afsreg.h>
+#include <afs\smb_iocons.h>
+#include <afs\pioctl_nt.h>
}
#include "config.h"
#include "graphics.h"
* DEFINITIONS _________________________________________________________________
*
*/
-#define QUORUM_WAIT_TIMEOUT 3 * 60 // 3 minutes in seconds
-#define ROOT_VOLUMES_QUOTA 5000 // k bytes
-#define RX_TIMEOUT 15 * 1000 // 15 seconds in milleseconds
-#define CELLSERVDB_UPDATE_TIMEOUT RX_TIMEOUT * 2
-#define INVALID_PARTITION_ID (UINT)VOLMAXPARTS + 1
+#define QUORUM_WAIT_TIMEOUT 3 * 60 // 3 minutes in seconds
+#define ROOT_VOLUMES_QUOTA 5000 // k bytes
+#define RX_TIMEOUT 15 * 1000 // 15 seconds in milleseconds
+#define CELLSERVDB_UPDATE_TIMEOUT RX_TIMEOUT * 2
+#define INVALID_PARTITION_ID (UINT)VOLMAXPARTS + 1
#define CLIENT_START_TIMEOUT 2 * 60 // 2 minutes in seconds
#define CLIENT_STOP_TIMEOUT 3 * 60 // 2 minutes in seconds
* Structure that is used to form an array of all possible configuration steps.
*/
struct CONFIG_STEP {
- STEP_STATE eState; // Where we are at in performing this step
- STEP_FUNC pFunc; // Function used to perform this step
- UINT nDescCtrlID; // Control ID of the static used to hold the steps description
- UINT nGraphicCtrlID; // Control ID of the static that will display the graphic
- UINT nMsgID; // Message to show when performing this step
- UINT nDescID; // Step description to show
+ STEP_STATE eState; // Where we are at in performing this step
+ STEP_FUNC pFunc; // Function used to perform this step
+ UINT nDescCtrlID; // Control ID of the static used to hold the steps description
+ UINT nGraphicCtrlID; // Control ID of the static that will display the graphic
+ UINT nMsgID; // Message to show when performing this step
+ UINT nDescID; // Step description to show
};
* to just reproduce the two fields for ease of use.
*/
struct STEP_GUI_INFO {
- UINT nDescCtrlID; // Control ID of the static used to hold the steps description
- UINT nGraphicCtrlID; // Control ID of the static that will display the graphic
+ UINT nDescCtrlID; // Control ID of the static used to hold the steps description
+ UINT nGraphicCtrlID; // Control ID of the static that will display the graphic
};
static STEP_GUI_INFO StepGuiCtrlIDs[] = {
- { IDC_STEP1, IDC_STEP1_GRAPHIC },
- { IDC_STEP2, IDC_STEP2_GRAPHIC },
- { IDC_STEP3, IDC_STEP3_GRAPHIC },
- { IDC_STEP4, IDC_STEP4_GRAPHIC },
- { IDC_STEP5, IDC_STEP5_GRAPHIC },
- { IDC_STEP6, IDC_STEP6_GRAPHIC },
- { IDC_STEP7, IDC_STEP7_GRAPHIC },
- { IDC_STEP8, IDC_STEP8_GRAPHIC }
+ { IDC_STEP1, IDC_STEP1_GRAPHIC },
+ { IDC_STEP2, IDC_STEP2_GRAPHIC },
+ { IDC_STEP3, IDC_STEP3_GRAPHIC },
+ { IDC_STEP4, IDC_STEP4_GRAPHIC },
+ { IDC_STEP5, IDC_STEP5_GRAPHIC },
+ { IDC_STEP6, IDC_STEP6_GRAPHIC },
+ { IDC_STEP7, IDC_STEP7_GRAPHIC },
+ { IDC_STEP8, IDC_STEP8_GRAPHIC }
};
* enum MUST match the order of the steps in the STEPS arrray below.
*/
enum STEP_ID {
- SID_CONFIG_PARTITION,
- SID_DEFINE_CELL_FOR_SERVER,
- SID_DEFINE_CELL_FOR_CLIENT,
- SID_START_BOS,
- SID_START_AUTH,
- SID_CREATE_PRINCIPAL_AND_KEY,
- SID_START_DB,
- SID_START_DB_AND_BAK,
- SID_START_BAK,
- SID_CREATE_ADMIN_PRINCIPAL,
- SID_START_FS_VL_AND_SALVAGER,
- SID_CONFIG_SCC,
- SID_CONFIG_SCS,
- SID_CREATE_ROOT_AFS,
- SID_START_CLIENT,
- SID_SET_ROOT_ACL,
- SID_CREATE_ROOT_CELL,
- SID_MOUNT_ROOT_CELL_STANDARD,
- SID_SET_ROOT_CELL_ACL,
- SID_MOUNT_ROOT_CELL_RW,
- SID_REPLICATE,
- SID_ENABLE_AUTH_CHECKING,
- SID_RESTART_SERVERS,
- SID_ADD_TO_CELLSERVDB,
- SID_RESTART_ALL_DB_SERVERS,
- SID_VOS_OPEN_SERVER,
- SID_UNCONFIG_DB,
- SID_UNCONFIG_BAK,
- SID_UNCONFIG_FS,
- SID_UNCONFIG_SCS,
- SID_UNCONFIG_SCC,
- SID_POST_CONFIG,
- SID_GET_CREDENTIALS,
+ SID_CONFIG_PARTITION,
+ SID_DEFINE_CELL_FOR_SERVER,
+ SID_DEFINE_CELL_FOR_CLIENT,
+ SID_START_BOS,
+ SID_START_AUTH,
+ SID_CREATE_PRINCIPAL_AND_KEY,
+ SID_START_DB,
+ SID_START_DB_AND_BAK,
+ SID_START_BAK,
+ SID_CREATE_ADMIN_PRINCIPAL,
+ SID_START_FS_VL_AND_SALVAGER,
+ SID_CONFIG_SCC,
+ SID_CONFIG_SCS,
+ SID_CREATE_ROOT_AFS,
+ SID_START_CLIENT,
+ SID_SET_ROOT_ACL,
+ SID_CREATE_ROOT_CELL,
+ SID_MOUNT_ROOT_CELL_STANDARD,
+ SID_SET_ROOT_CELL_ACL,
+ SID_MOUNT_ROOT_CELL_RW,
+ SID_REPLICATE,
+ SID_ENABLE_AUTH_CHECKING,
+ SID_RESTART_SERVERS,
+ SID_ADD_TO_CELLSERVDB,
+ SID_RESTART_ALL_DB_SERVERS,
+ SID_VOS_OPEN_SERVER,
+ SID_UNCONFIG_DB,
+ SID_UNCONFIG_BAK,
+ SID_UNCONFIG_FS,
+ SID_UNCONFIG_SCS,
+ SID_UNCONFIG_SCC,
+ SID_POST_CONFIG,
+ SID_GET_CREDENTIALS,
SID_GET_ROOT_VOLUME_INFO
};
* depends on exactly how the server is being configured.
*/
static CONFIG_STEP STEPS[MAX_STEPS] = {
- { SS_STEP_TO_BE_DONE, ConfigPartition, 0, 0, IDS_PARTITION_STEP, IDS_PARTITION_STEP_DESC },
- { SS_STEP_TO_BE_DONE, DefineCellForServer, 0, 0, IDS_DEFINE_CELL_NAME_STEP, 0 },
- { SS_STEP_TO_BE_DONE, DefineCellForClient, 0, 0, IDS_DEFINE_CELL_MEMBERSHIP_STEP, 0 },
- { SS_STEP_TO_BE_DONE, StartBosServer, 0, 0, IDS_START_BOS_SERVER_STEP, 0 },
- { SS_STEP_TO_BE_DONE, StartAuthServer, 0, 0, IDS_START_AUTH_SERVER_STEP, 0 },
- { SS_STEP_TO_BE_DONE, CreatePrincipalAndKey,0, 0, IDS_CREATE_PRINCIPAL_AND_KEY_STEP, 0 },
- { SS_STEP_TO_BE_DONE, StartDbServers, 0, 0, IDS_START_DB_STEP, IDS_DB_STEP_DESC },
- { SS_STEP_TO_BE_DONE, StartDbServers, 0, 0, IDS_START_DB_AND_BK_STEP, IDS_DB_AND_BK_STEP_DESC },
- { SS_STEP_TO_BE_DONE, StartDbServers, 0, 0, IDS_START_BK_STEP, IDS_BK_STEP_DESC },
- { SS_STEP_TO_BE_DONE, CreateAdminPrincipal, 0, 0, IDS_CREATE_ADMIN_PRINCIPAL_STEP, 0 },
- { SS_STEP_TO_BE_DONE, StartFsVlAndSalvager, 0, 0, IDS_START_FS_STEP, IDS_FS_STEP_DESC },
- { SS_STEP_TO_BE_DONE, ConfigSCC, 0, 0, IDS_START_SCC_STEP, IDS_SCC_STEP_DESC },
- { SS_STEP_TO_BE_DONE, ConfigSCS, 0, 0, IDS_START_SCS_STEP, IDS_SCS_STEP_DESC },
- { SS_STEP_TO_BE_DONE, CreateRootAfs, 0, 0, IDS_CREATE_ROOT_AFS_STEP, IDS_ROOT_AFS_STEP_DESC },
- { SS_STEP_TO_BE_DONE, StartClient, 0, 0, IDS_START_CLIENT_STEP, 0 },
- { SS_STEP_TO_BE_DONE, SetRootAcl, 0, 0, IDS_SET_ROOT_ACL_STEP, 0 },
- { SS_STEP_TO_BE_DONE, CreateRootCell, 0, 0, IDS_CREATE_ROOT_CELL_STEP, 0 },
- { SS_STEP_TO_BE_DONE, MountRootCellStandard,0, 0, IDS_MOUNT_ROOT_CELL_STANDARD_STEP, 0 },
- { SS_STEP_TO_BE_DONE, SetRootCellAcl, 0, 0, IDS_SET_ROOT_CELL_ACL_STEP, 0 },
- { SS_STEP_TO_BE_DONE, MountRootCellRW, 0, 0, IDS_MOUNT_ROOT_CELL_RW_STEP, 0 },
- { SS_STEP_TO_BE_DONE, Replicate, 0, 0, IDS_REP_STEP, IDS_REP_STEP_DESC },
- { SS_STEP_TO_BE_DONE, EnableAuthChecking, 0, 0, IDS_ENABLE_AUTH_CHECKING_STEP, 0 },
- { SS_STEP_TO_BE_DONE, RestartServers, 0, 0, IDS_RESTART_SERVERS_STEP, 0 },
- { SS_STEP_TO_BE_DONE, AddToCellServDB, 0, 0, IDS_ADD_TO_CELLSERVDB_STEP, 0 },
- { SS_STEP_TO_BE_DONE, RestartAllDbServers, 0, 0, IDS_RESTART_ALL_DB_SERVERS_STEP, 0 },
- { SS_STEP_TO_BE_DONE, VosOpenServer, 0, 0, IDS_NO_MSG_STEP, 0 },
- { SS_STEP_TO_BE_DONE, UnconfigDB, 0, 0, IDS_UNCONFIG_DB_STEP, IDS_UNCONFIG_DB_STEP_DESC },
- { SS_STEP_TO_BE_DONE, UnconfigBak, 0, 0, IDS_UNCONFIG_BK_STEP, IDS_UNCONFIG_BK_STEP_DESC },
- { SS_STEP_TO_BE_DONE, UnconfigFS, 0, 0, IDS_UNCONFIG_FS_STEP, IDS_UNCONFIG_FS_STEP_DESC },
- { SS_STEP_TO_BE_DONE, UnconfigSCS, 0, 0, IDS_UNCONFIG_SCS_STEP, IDS_UNCONFIG_SCS_STEP_DESC },
- { SS_STEP_TO_BE_DONE, UnconfigSCC, 0, 0, IDS_UNCONFIG_SCC_STEP, IDS_UNCONFIG_SCC_STEP_DESC },
- { SS_STEP_TO_BE_DONE, PostConfig, 0, 0, IDS_NO_MSG_STEP, 0 },
- { SS_STEP_TO_BE_DONE, UpgradeLibHandles, 0, 0, IDS_GET_CREDENTIALS_STEP, 0 },
- { SS_STEP_TO_BE_DONE, GetRootVolumeInfo, 0, 0, IDS_NO_MSG_STEP, 0 },
+ { SS_STEP_TO_BE_DONE, ConfigPartition, 0, 0, IDS_PARTITION_STEP, IDS_PARTITION_STEP_DESC },
+ { SS_STEP_TO_BE_DONE, DefineCellForServer, 0, 0, IDS_DEFINE_CELL_NAME_STEP, 0 },
+ { SS_STEP_TO_BE_DONE, DefineCellForClient, 0, 0, IDS_DEFINE_CELL_MEMBERSHIP_STEP, 0 },
+ { SS_STEP_TO_BE_DONE, StartBosServer, 0, 0, IDS_START_BOS_SERVER_STEP, 0 },
+ { SS_STEP_TO_BE_DONE, StartAuthServer, 0, 0, IDS_START_AUTH_SERVER_STEP, 0 },
+ { SS_STEP_TO_BE_DONE, CreatePrincipalAndKey,0, 0, IDS_CREATE_PRINCIPAL_AND_KEY_STEP,0 },
+ { SS_STEP_TO_BE_DONE, StartDbServers, 0, 0, IDS_START_DB_STEP, IDS_DB_STEP_DESC },
+ { SS_STEP_TO_BE_DONE, StartDbServers, 0, 0, IDS_START_DB_AND_BK_STEP, IDS_DB_AND_BK_STEP_DESC },
+ { SS_STEP_TO_BE_DONE, StartDbServers, 0, 0, IDS_START_BK_STEP, IDS_BK_STEP_DESC },
+ { SS_STEP_TO_BE_DONE, CreateAdminPrincipal, 0, 0, IDS_CREATE_ADMIN_PRINCIPAL_STEP, 0 },
+ { SS_STEP_TO_BE_DONE, StartFsVlAndSalvager, 0, 0, IDS_START_FS_STEP, IDS_FS_STEP_DESC },
+ { SS_STEP_TO_BE_DONE, ConfigSCC, 0, 0, IDS_START_SCC_STEP, IDS_SCC_STEP_DESC },
+ { SS_STEP_TO_BE_DONE, ConfigSCS, 0, 0, IDS_START_SCS_STEP, IDS_SCS_STEP_DESC },
+ { SS_STEP_TO_BE_DONE, CreateRootAfs, 0, 0, IDS_CREATE_ROOT_AFS_STEP, IDS_ROOT_AFS_STEP_DESC },
+ { SS_STEP_TO_BE_DONE, StartClient, 0, 0, IDS_START_CLIENT_STEP, 0 },
+ { SS_STEP_TO_BE_DONE, SetRootAcl, 0, 0, IDS_SET_ROOT_ACL_STEP, 0 },
+ { SS_STEP_TO_BE_DONE, CreateRootCell, 0, 0, IDS_CREATE_ROOT_CELL_STEP, 0 },
+ { SS_STEP_TO_BE_DONE, MountRootCellStandard,0, 0, IDS_MOUNT_ROOT_CELL_STANDARD_STEP,0 },
+ { SS_STEP_TO_BE_DONE, SetRootCellAcl, 0, 0, IDS_SET_ROOT_CELL_ACL_STEP, 0 },
+ { SS_STEP_TO_BE_DONE, MountRootCellRW, 0, 0, IDS_MOUNT_ROOT_CELL_RW_STEP, 0 },
+ { SS_STEP_TO_BE_DONE, Replicate, 0, 0, IDS_REP_STEP, IDS_REP_STEP_DESC },
+ { SS_STEP_TO_BE_DONE, EnableAuthChecking, 0, 0, IDS_ENABLE_AUTH_CHECKING_STEP, 0 },
+ { SS_STEP_TO_BE_DONE, RestartServers, 0, 0, IDS_RESTART_SERVERS_STEP, 0 },
+ { SS_STEP_TO_BE_DONE, AddToCellServDB, 0, 0, IDS_ADD_TO_CELLSERVDB_STEP, 0 },
+ { SS_STEP_TO_BE_DONE, RestartAllDbServers, 0, 0, IDS_RESTART_ALL_DB_SERVERS_STEP, 0 },
+ { SS_STEP_TO_BE_DONE, VosOpenServer, 0, 0, IDS_NO_MSG_STEP, 0 },
+ { SS_STEP_TO_BE_DONE, UnconfigDB, 0, 0, IDS_UNCONFIG_DB_STEP, IDS_UNCONFIG_DB_STEP_DESC },
+ { SS_STEP_TO_BE_DONE, UnconfigBak, 0, 0, IDS_UNCONFIG_BK_STEP, IDS_UNCONFIG_BK_STEP_DESC },
+ { SS_STEP_TO_BE_DONE, UnconfigFS, 0, 0, IDS_UNCONFIG_FS_STEP, IDS_UNCONFIG_FS_STEP_DESC },
+ { SS_STEP_TO_BE_DONE, UnconfigSCS, 0, 0, IDS_UNCONFIG_SCS_STEP, IDS_UNCONFIG_SCS_STEP_DESC },
+ { SS_STEP_TO_BE_DONE, UnconfigSCC, 0, 0, IDS_UNCONFIG_SCC_STEP, IDS_UNCONFIG_SCC_STEP_DESC },
+ { SS_STEP_TO_BE_DONE, PostConfig, 0, 0, IDS_NO_MSG_STEP, 0 },
+ { SS_STEP_TO_BE_DONE, UpgradeLibHandles, 0, 0, IDS_GET_CREDENTIALS_STEP, 0 },
+ { SS_STEP_TO_BE_DONE, GetRootVolumeInfo, 0, 0, IDS_NO_MSG_STEP, 0 },
};
* These are the steps to perform when configuring the very first server.
*/
static STEP_ID FirstServerSteps[] = {
- SID_CONFIG_PARTITION,
- SID_DEFINE_CELL_FOR_SERVER,
- SID_DEFINE_CELL_FOR_CLIENT,
- SID_START_BOS,
- SID_START_AUTH,
- SID_CREATE_PRINCIPAL_AND_KEY,
- SID_START_DB,
- SID_CREATE_ADMIN_PRINCIPAL,
- SID_START_FS_VL_AND_SALVAGER,
- SID_CONFIG_SCS,
- SID_VOS_OPEN_SERVER,
- SID_CREATE_ROOT_AFS,
- SID_START_CLIENT,
- SID_SET_ROOT_ACL,
- SID_CREATE_ROOT_CELL,
- SID_MOUNT_ROOT_CELL_STANDARD,
- SID_SET_ROOT_CELL_ACL,
- SID_MOUNT_ROOT_CELL_RW,
- SID_REPLICATE,
- SID_ENABLE_AUTH_CHECKING
-};
+ SID_CONFIG_PARTITION,
+ SID_DEFINE_CELL_FOR_SERVER,
+ SID_DEFINE_CELL_FOR_CLIENT,
+ SID_START_BOS,
+ SID_START_AUTH,
+ SID_CREATE_PRINCIPAL_AND_KEY,
+ SID_START_DB,
+ SID_CREATE_ADMIN_PRINCIPAL,
+ SID_START_FS_VL_AND_SALVAGER,
+ SID_CONFIG_SCS,
+ SID_VOS_OPEN_SERVER,
+ SID_CREATE_ROOT_AFS,
+ SID_START_CLIENT,
+ SID_SET_ROOT_ACL,
+ SID_CREATE_ROOT_CELL,
+ SID_MOUNT_ROOT_CELL_STANDARD,
+ SID_SET_ROOT_CELL_ACL,
+ SID_MOUNT_ROOT_CELL_RW,
+ SID_REPLICATE,
+ SID_ENABLE_AUTH_CHECKING
+};
static STEP_ID InvalidServerInfoSteps[] = {
- SID_DEFINE_CELL_FOR_SERVER,
- SID_START_BOS,
- SID_CREATE_PRINCIPAL_AND_KEY,
- SID_CREATE_ADMIN_PRINCIPAL,
- SID_ENABLE_AUTH_CHECKING
+ SID_DEFINE_CELL_FOR_SERVER,
+ SID_START_BOS,
+ SID_CREATE_PRINCIPAL_AND_KEY,
+ SID_CREATE_ADMIN_PRINCIPAL,
+ SID_ENABLE_AUTH_CHECKING
};
static STEP_ID InvalidClientInfoSteps[] = {
- SID_DEFINE_CELL_FOR_CLIENT,
- SID_START_CLIENT
+ SID_DEFINE_CELL_FOR_CLIENT,
+ SID_START_CLIENT
};
static STEP_ID PreconfigSteps[] = {
- SID_GET_CREDENTIALS, // Always do this so we will always have credentials - need this for the config manager.
+ SID_GET_CREDENTIALS, // Always do this so we will always have credentials - need this for the config manager.
SID_VOS_OPEN_SERVER // We'll always do this step so we know we can make vos calls
};
static STEP_ID UnconfigDbSteps[] = {
- SID_UNCONFIG_DB,
- SID_RESTART_ALL_DB_SERVERS
+ SID_UNCONFIG_DB,
+ SID_RESTART_ALL_DB_SERVERS
};
static STEP_ID UnconfigBakSteps[] = {
- SID_UNCONFIG_BAK,
- SID_GET_CREDENTIALS
-};
+ SID_UNCONFIG_BAK,
+ SID_GET_CREDENTIALS
+};
static STEP_ID UnconfigFsSteps[] = {
- SID_UNCONFIG_FS
+ SID_UNCONFIG_FS
};
static STEP_ID UnconfigScsSteps[] = {
- SID_UNCONFIG_SCS
+ SID_UNCONFIG_SCS
};
static STEP_ID UnconfigSccSteps[] = {
- SID_UNCONFIG_SCC
+ SID_UNCONFIG_SCC
};
static STEP_ID FsSteps[] = {
- SID_START_FS_VL_AND_SALVAGER
+ SID_START_FS_VL_AND_SALVAGER
};
static STEP_ID DbSteps[] = {
- SID_ADD_TO_CELLSERVDB,
- SID_START_DB,
- SID_RESTART_ALL_DB_SERVERS
-};
+ SID_ADD_TO_CELLSERVDB,
+ SID_START_DB,
+ SID_RESTART_ALL_DB_SERVERS
+};
static STEP_ID DbAndBakSteps[] = {
- SID_ADD_TO_CELLSERVDB,
- SID_START_DB_AND_BAK,
- SID_RESTART_ALL_DB_SERVERS
+ SID_ADD_TO_CELLSERVDB,
+ SID_START_DB_AND_BAK,
+ SID_RESTART_ALL_DB_SERVERS
};
static STEP_ID BakOnlySteps[] = {
- SID_START_BAK,
+ SID_START_BAK,
};
static STEP_ID PartitionSteps[] = {
- SID_CONFIG_PARTITION
+ SID_CONFIG_PARTITION
};
static STEP_ID CheckRootVolumesSteps[] = {
};
static STEP_ID RootVolumesSteps[] = {
- SID_CREATE_ROOT_AFS,
- SID_START_CLIENT, // TODO: Must check what happens if client started previously and failed because root.afs didn't exist.
- SID_SET_ROOT_ACL,
- SID_CREATE_ROOT_CELL,
- SID_MOUNT_ROOT_CELL_STANDARD,
- SID_SET_ROOT_CELL_ACL,
- SID_MOUNT_ROOT_CELL_RW,
+ SID_CREATE_ROOT_AFS,
+ SID_START_CLIENT, // TODO: Must check what happens if client started previously and failed because root.afs didn't exist.
+ SID_SET_ROOT_ACL,
+ SID_CREATE_ROOT_CELL,
+ SID_MOUNT_ROOT_CELL_STANDARD,
+ SID_SET_ROOT_CELL_ACL,
+ SID_MOUNT_ROOT_CELL_RW,
};
static STEP_ID ReplicationSteps[] = {
- SID_REPLICATE
+ SID_REPLICATE
};
static STEP_ID ScsSteps[] = {
- SID_CONFIG_SCS
+ SID_CONFIG_SCS
};
static STEP_ID SccSteps[] = {
- SID_CONFIG_SCC
+ SID_CONFIG_SCC
};
static STEP_ID PostConfigSteps[] = {
- SID_POST_CONFIG
+ SID_POST_CONFIG
};
*/
BOOL Configure(HWND hParent, BOOL& bMustExit)
{
- int nResult = ModalDialog(IDD_CONFIG_SERVER, hParent, (DLGPROC)ConfigServerPageDlgProc);
+ int nResult = ModalDialog(IDD_CONFIG_SERVER, hParent, (DLGPROC)ConfigServerPageDlgProc);
bMustExit = m_bMustExit;
- return !m_bConfigFailed;
+ return !m_bConfigFailed;
}
*/
BOOL CALLBACK ConfigServerPageDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp)
{
- switch (msg) {
- case WM_INITDIALOG:
- OnInitDialog(hwndDlg);
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wp)) {
- case IDNEXT:
- OnConfig();
- break;
-
- case IDBACK:
- IF_WIZ(g_pWiz->SetState(sidSTEP_ELEVEN));
- break;
-
- case IDCANCEL:
- // If configuring, handle cancel here.
- // Otherwise, use common handler below.
- if (m_bConfiguring) {
- ShowCurrentStep(IDS_CANCEL_PENDING);
- m_bCheckCancel = TRUE;
- return FALSE;
- } else if (!g_pWiz)
- EndDialog(m_hDlg, m_bConfigured);
- break;
- }
- break;
+ switch (msg) {
+ case WM_INITDIALOG:
+ OnInitDialog(hwndDlg);
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wp)) {
+ case IDNEXT:
+ OnConfig();
+ break;
+
+ case IDBACK:
+ IF_WIZ(g_pWiz->SetState(sidSTEP_ELEVEN));
+ break;
+
+ case IDCANCEL:
+ // If configuring, handle cancel here.
+ // Otherwise, use common handler below.
+ if (m_bConfiguring) {
+ ShowCurrentStep(IDS_CANCEL_PENDING);
+ m_bCheckCancel = TRUE;
+ return FALSE;
+ } else if (!g_pWiz)
+ EndDialog(m_hDlg, m_bConfigured);
+ break;
}
+ break;
+ }
- if (g_pWiz) {
- if (WizStep_Common_DlgProc (hwndDlg, msg, wp, lp))
- return FALSE;
- }
+ if (g_pWiz) {
+ if (WizStep_Common_DlgProc (hwndDlg, msg, wp, lp))
+ return FALSE;
+ }
- return FALSE;
+ return FALSE;
}
/*
*/
static BOOL CALLBACK StepGrahpicDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- // We only handle the paint message. All other message are passed on to the
- // static control's normal window proc.
- if (uMsg == WM_PAINT) {
- for (int ii = 0; ii < m_nNumSteps; ii++) {
- // Find the step that corresponds to the window we are supposed to paint
- if (hwnd == GetDlgItem(m_hDlg, m_ConfigSteps[ii].nGraphicCtrlID)) {
- PaintStepGraphic(hwnd, m_ConfigSteps[ii].eState); // Show the graphic for this step
- return 0;
- }
- }
- }
+ // We only handle the paint message. All other message are passed on to the
+ // static control's normal window proc.
+ if (uMsg == WM_PAINT) {
+ for (int ii = 0; ii < m_nNumSteps; ii++) {
+ // Find the step that corresponds to the window we are supposed to paint
+ if (hwnd == GetDlgItem(m_hDlg, m_ConfigSteps[ii].nGraphicCtrlID)) {
+ PaintStepGraphic(hwnd, m_ConfigSteps[ii].eState); // Show the graphic for this step
+ return 0;
+ }
+ }
+ }
- return CallWindowProc((WNDPROC)Subclass_FindNextHook(hwnd, StepGrahpicDlgProc), hwnd, uMsg, wParam, lParam);
+ return CallWindowProc((WNDPROC)Subclass_FindNextHook(hwnd, StepGrahpicDlgProc), hwnd, uMsg, wParam, lParam);
}
*/
static void OnInitDialog(HWND hwndDlg)
{
- m_hDlg = hwndDlg;
-
- // Initialize our global variables - only the ones that should not
- // preserve their state if the user leaves and returns to this page.
- m_bConfiguring = FALSE;
- m_bConfigured = FALSE;
- m_bConfigFailed = FALSE;
- m_bCheckCancel = FALSE;
- m_bCancel = FALSE;
- m_bMustChangeClientCell = FALSE;
- m_hvosServer = 0;
- m_nPartitionID = INVALID_PARTITION_ID;
- m_bCellServDbUpdateErr = FALSE;
- m_nServerUpdates = 0;
- m_pszCellDbHosts = 0;
- m_nNumSteps = 0;
- m_bNoAuthMode = !g_CfgData.bValidServerInfo;
- m_szVicepName[0] = 0;
- m_bMustExit = FALSE;
- m_bCfgInfoInvalidated = FALSE;
- m_bUnconfiguringLastDBServer = g_CfgData.bLastDBServer && ShouldUnconfig(g_CfgData.configDB);
+ m_hDlg = hwndDlg;
+
+ // Initialize our global variables - only the ones that should not
+ // preserve their state if the user leaves and returns to this page.
+ m_bConfiguring = FALSE;
+ m_bConfigured = FALSE;
+ m_bConfigFailed = FALSE;
+ m_bCheckCancel = FALSE;
+ m_bCancel = FALSE;
+ m_bMustChangeClientCell = FALSE;
+ m_hvosServer = 0;
+ m_nPartitionID = INVALID_PARTITION_ID;
+ m_bCellServDbUpdateErr = FALSE;
+ m_nServerUpdates = 0;
+ m_pszCellDbHosts = 0;
+ m_nNumSteps = 0;
+ m_bNoAuthMode = !g_CfgData.bValidServerInfo;
+ m_szVicepName[0] = 0;
+ m_bMustExit = FALSE;
+ m_bCfgInfoInvalidated = FALSE;
+ m_bUnconfiguringLastDBServer = g_CfgData.bLastDBServer && ShouldUnconfig(g_CfgData.configDB);
m_bClientTokensSet = FALSE;
m_bRootAfsDriveMappingCreated = FALSE;
m_bWeCreatedRootAfs = FALSE;
m_bWeCreatedRootCell = FALSE;
- IF_WIZ(g_pWiz->EnableButtons(BACK_BUTTON));
- IF_WIZ(g_pWiz->SetButtonText(IDNEXT, IDS_CONFIGURE));
- IF_WIZ(g_pWiz->SetDefaultControl(IDNEXT));
-
- TCHAR szMsg[cchRESOURCE] = TEXT("");
-
- // Show the cellname in the title
- ShowTitle();
-
- // If this is the wizard, then check if there is nothing to do and
- // inform the user. If this is not the wizard, then we should
- // not even get to this point. The config tool will not call
- // the config function if there is nothing to do.
- if (g_pWiz) {
- // Is everything already configured?
- if ((g_CfgData.configFS == CS_ALREADY_CONFIGURED) &&
- (g_CfgData.configDB == CS_ALREADY_CONFIGURED) &&
- (g_CfgData.configBak == CS_ALREADY_CONFIGURED) &&
- (g_CfgData.configPartition == CS_ALREADY_CONFIGURED) &&
- (g_CfgData.configRootVolumes == CS_ALREADY_CONFIGURED) &&
- (g_CfgData.configRep == CS_ALREADY_CONFIGURED) &&
- ((g_CfgData.configSCS == CS_ALREADY_CONFIGURED) ||
- (g_CfgData.configSCC == CS_ALREADY_CONFIGURED)))
- {
- GetString(szMsg, IDS_ALREADY_CONFIGURED);
- }
- // Is there nothing to configure?
- else if ((g_CfgData.configFS != CS_CONFIGURE) &&
- (g_CfgData.configDB != CS_CONFIGURE) &&
- (g_CfgData.configBak != CS_CONFIGURE) &&
- (g_CfgData.configPartition != CS_CONFIGURE) &&
- (g_CfgData.configRootVolumes != CS_CONFIGURE) &&
- (g_CfgData.configRep != CS_CONFIGURE) &&
- (g_CfgData.configSCS != CS_CONFIGURE) &&
- (g_CfgData.configSCC != CS_CONFIGURE))
- {
- GetString(szMsg, IDS_NOTHING_TO_CONFIGURE);
- }
+ IF_WIZ(g_pWiz->EnableButtons(BACK_BUTTON));
+ IF_WIZ(g_pWiz->SetButtonText(IDNEXT, IDS_CONFIGURE));
+ IF_WIZ(g_pWiz->SetDefaultControl(IDNEXT));
+
+ TCHAR szMsg[cchRESOURCE] = TEXT("");
+
+ // Show the cellname in the title
+ ShowTitle();
+
+ // If this is the wizard, then check if there is nothing to do and
+ // inform the user. If this is not the wizard, then we should
+ // not even get to this point. The config tool will not call
+ // the config function if there is nothing to do.
+ if (g_pWiz) {
+ // Is everything already configured?
+ if ((g_CfgData.configFS == CS_ALREADY_CONFIGURED) &&
+ (g_CfgData.configDB == CS_ALREADY_CONFIGURED) &&
+ (g_CfgData.configBak == CS_ALREADY_CONFIGURED) &&
+ (g_CfgData.configPartition == CS_ALREADY_CONFIGURED) &&
+ (g_CfgData.configRootVolumes == CS_ALREADY_CONFIGURED) &&
+ (g_CfgData.configRep == CS_ALREADY_CONFIGURED) &&
+ ((g_CfgData.configSCS == CS_ALREADY_CONFIGURED) ||
+ (g_CfgData.configSCC == CS_ALREADY_CONFIGURED)))
+ {
+ GetString(szMsg, IDS_ALREADY_CONFIGURED);
+ }
+ // Is there nothing to configure?
+ else if ((g_CfgData.configFS != CS_CONFIGURE) &&
+ (g_CfgData.configDB != CS_CONFIGURE) &&
+ (g_CfgData.configBak != CS_CONFIGURE) &&
+ (g_CfgData.configPartition != CS_CONFIGURE) &&
+ (g_CfgData.configRootVolumes != CS_CONFIGURE) &&
+ (g_CfgData.configRep != CS_CONFIGURE) &&
+ (g_CfgData.configSCS != CS_CONFIGURE) &&
+ (g_CfgData.configSCC != CS_CONFIGURE))
+ {
+ GetString(szMsg, IDS_NOTHING_TO_CONFIGURE);
+ }
- // If there's a can't configure message, then show it
- if (*szMsg) {
- // Hide all controls except for the message window
- ShowWnd(m_hDlg, IDC_ALL_NEEDED_MSG, FALSE);
- ShowWnd(m_hDlg, IDC_FOLLOWING_STEPS_MSG, FALSE);
+ // If there's a can't configure message, then show it
+ if (*szMsg) {
+ // Hide all controls except for the message window
+ ShowWnd(m_hDlg, IDC_ALL_NEEDED_MSG, FALSE);
+ ShowWnd(m_hDlg, IDC_FOLLOWING_STEPS_MSG, FALSE);
- for (int i = 0; i < sizeof(StepGuiCtrlIDs) / sizeof(StepGuiCtrlIDs[0]); i++) {
- ShowWnd(m_hDlg, StepGuiCtrlIDs[i].nDescCtrlID, FALSE);
- ShowWnd(m_hDlg, StepGuiCtrlIDs[i].nGraphicCtrlID, FALSE);
- }
-
- ShowWnd(m_hDlg, IDC_CURRENT_STEP_LABEL, FALSE);
- ShowWnd(m_hDlg, IDC_CURRENT_STEP, FALSE);
- ShowWnd(m_hDlg, IDC_CONFIG_PROGRESS, FALSE);
- ShowWnd(m_hDlg, IDC_PERCENT_COMPLETE_LABEL, FALSE);
- ShowWnd(m_hDlg, IDC_PERCENT_COMPLETE, FALSE);
- ShowWnd(m_hDlg, IDC_CANT_CONFIG_MSG, FALSE);
+ for (int i = 0; i < sizeof(StepGuiCtrlIDs) / sizeof(StepGuiCtrlIDs[0]); i++) {
+ ShowWnd(m_hDlg, StepGuiCtrlIDs[i].nDescCtrlID, FALSE);
+ ShowWnd(m_hDlg, StepGuiCtrlIDs[i].nGraphicCtrlID, FALSE);
+ }
- // Show the message
- SetWndText(m_hDlg, IDC_STATUS_MSG, szMsg);
+ ShowWnd(m_hDlg, IDC_CURRENT_STEP_LABEL, FALSE);
+ ShowWnd(m_hDlg, IDC_CURRENT_STEP, FALSE);
+ ShowWnd(m_hDlg, IDC_CONFIG_PROGRESS, FALSE);
+ ShowWnd(m_hDlg, IDC_PERCENT_COMPLETE_LABEL, FALSE);
+ ShowWnd(m_hDlg, IDC_PERCENT_COMPLETE, FALSE);
+ ShowWnd(m_hDlg, IDC_CANT_CONFIG_MSG, FALSE);
- return;
- }
+ // Show the message
+ SetWndText(m_hDlg, IDC_STATUS_MSG, szMsg);
+
+ return;
}
+ }
- // Determine which steps to perform and which should be displayed
- SetupConfigSteps();
+ // Determine which steps to perform and which should be displayed
+ SetupConfigSteps();
- if (!g_CfgData.bWizard) {
- OnConfig();
- return;
- }
+ if (!g_CfgData.bWizard) {
+ OnConfig();
+ return;
+ }
- // This must be done after SetupConfigSteps(), which assings a nGraphicCtrlID
- // value to the appropriate steps. After the following code is executed, the graphic
- // for each step will be drawn automatically whenever the dialog is repainted.
- for (UINT ii = 0; ii < MAX_STEPS; ii++) {
- if (m_ConfigSteps[ii].nGraphicCtrlID)
- Subclass_AddHook(GetDlgItem(m_hDlg, m_ConfigSteps[ii].nGraphicCtrlID), StepGrahpicDlgProc);
- }
+ // This must be done after SetupConfigSteps(), which assings a nGraphicCtrlID
+ // value to the appropriate steps. After the following code is executed, the graphic
+ // for each step will be drawn automatically whenever the dialog is repainted.
+ for (UINT ii = 0; ii < MAX_STEPS; ii++) {
+ if (m_ConfigSteps[ii].nGraphicCtrlID)
+ Subclass_AddHook(GetDlgItem(m_hDlg, m_ConfigSteps[ii].nGraphicCtrlID), StepGrahpicDlgProc);
+ }
- IF_WIZ(g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON));
-}
+ IF_WIZ(g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON));
+}
// User has pressed the Config (or Exit) button.
static void OnConfig()
{
- ASSERT(g_CfgData.szCellName[0]);
+ ASSERT(g_CfgData.szCellName[0]);
- // Has user pressed the Exit button?
- if (m_bConfigured) {
- IF_WIZ(g_pWiz->Show(FALSE));
- return;
- }
+ // Has user pressed the Exit button?
+ if (m_bConfigured) {
+ IF_WIZ(g_pWiz->Show(FALSE));
+ return;
+ }
- // Has user pressed the View Log button?
- if (m_bConfigFailed) {
- ViewLog();
- return;
- }
+ // Has user pressed the View Log button?
+ if (m_bConfigFailed) {
+ ViewLog();
+ return;
+ }
- // Must we change the client's cell? See if user minds...
- if (m_bMustChangeClientCell) {
- if (ShowWarning(m_hDlg, IDS_CLIENT_CELL_WILL_CHANGE) == IDCANCEL) {
- return;
- }
+ // Must we change the client's cell? See if user minds...
+ if (m_bMustChangeClientCell) {
+ if (ShowWarning(m_hDlg, IDS_CLIENT_CELL_WILL_CHANGE) == IDCANCEL) {
+ return;
}
+ }
- // Create a thread to perform the configuration steps
- DWORD dwThreadID;
-
- // Start configuring...
- HANDLE hThread = CreateThread(0, 0, ConfigServer, 0, 0, &dwThreadID);
+ // Create a thread to perform the configuration steps
+ DWORD dwThreadID;
- CloseHandle(hThread);
+ // Start configuring...
+ HANDLE hThread = CreateThread(0, 0, ConfigServer, 0, 0, &dwThreadID);
+
+ CloseHandle(hThread);
}
*/
static void ShowExitButton()
{
- if (g_pWiz)
- g_pWiz->SetButtonText(IDNEXT, IDS_EXIT);
- else {
+ if (g_pWiz)
+ g_pWiz->SetButtonText(IDNEXT, IDS_EXIT);
+ else {
if (m_bMustExit)
SetWndText(m_hDlg, IDCANCEL, IDS_EXIT);
- else
- SetWndText(m_hDlg, IDCANCEL, IDS_CLOSE);
+ else
+ SetWndText(m_hDlg, IDCANCEL, IDS_CLOSE);
}
}
static void ShowTitle()
{
- ASSERT(g_CfgData.szCellName[0]);
+ ASSERT(g_CfgData.szCellName[0]);
- TCHAR szMsg[cchRESOURCE];
+ TCHAR szMsg[cchRESOURCE];
- GetString(szMsg, IDS_CONFIG_INTO_CELL_MSG);
+ GetString(szMsg, IDS_CONFIG_INTO_CELL_MSG);
- lstrcat(szMsg, g_CfgData.szCellName);
- lstrcat(szMsg, TEXT("."));
+ lstrcat(szMsg, g_CfgData.szCellName);
+ lstrcat(szMsg, TEXT("."));
- SetWndText(m_hDlg, IDC_TITLE, szMsg);
+ SetWndText(m_hDlg, IDC_TITLE, szMsg);
}
static BOOL Unconfiguring()
-{
- return ShouldUnconfig(g_CfgData.configFS) ||
- ShouldUnconfig(g_CfgData.configDB) ||
- ShouldUnconfig(g_CfgData.configBak) ||
- ShouldUnconfig(g_CfgData.configSCS) ||
- ShouldUnconfig(g_CfgData.configSCC);
-}
+{
+ return ShouldUnconfig(g_CfgData.configFS) ||
+ ShouldUnconfig(g_CfgData.configDB) ||
+ ShouldUnconfig(g_CfgData.configBak) ||
+ ShouldUnconfig(g_CfgData.configSCS) ||
+ ShouldUnconfig(g_CfgData.configSCC);
+}
static void AddSteps(STEP_ID *pSteps, int nNumNewSteps)
{
- ASSERT(pSteps);
- ASSERT(nNumNewSteps > 0);
+ ASSERT(pSteps);
+ ASSERT(nNumNewSteps > 0);
- if (m_nNumSteps + nNumNewSteps > MAX_STEPS) {
- ASSERT(FALSE);
- return;
- }
+ if (m_nNumSteps + nNumNewSteps > MAX_STEPS) {
+ ASSERT(FALSE);
+ return;
+ }
- // Add the new steps to the array of steps
- for (int nNewStep = 0; nNewStep < nNumNewSteps; nNewStep++) {
- STEP_ID nStepID = pSteps[nNewStep];
+ // Add the new steps to the array of steps
+ for (int nNewStep = 0; nNewStep < nNumNewSteps; nNewStep++) {
+ STEP_ID nStepID = pSteps[nNewStep];
- // Add the new step
- m_ConfigSteps[m_nNumSteps++] = STEPS[nStepID];
- }
-}
+ // Add the new step
+ m_ConfigSteps[m_nNumSteps++] = STEPS[nStepID];
+ }
+}
static void GetStepsToPerform()
{
#define NUM_STEPS(x) (sizeof((x)) / sizeof(STEP_ID))
- // Is this the first server?
- if (g_CfgData.bFirstServer) {
- // We may have to change the FirstServerSteps, so loop over them
- // and only add the ones we need. All of the FirstServerSteps
- // are required except for the ones for backup and sys control
- // machine. If the user doesn't want those then we won't put
- // them into the array of steps to perform. Also, we may not need
- // to make the AFS partition (if it already exists).
- for (int i = 0; i < NUM_STEPS(FirstServerSteps); i++) {
- STEP_ID curStep = FirstServerSteps[i];
-
- if ((curStep == SID_START_DB) && ShouldConfig(g_CfgData.configBak))
- curStep = SID_START_DB_AND_BAK;
- else if ((curStep == SID_CONFIG_SCS) && !ShouldConfig(g_CfgData.configSCS))
- continue;
- else if ((curStep == SID_CONFIG_PARTITION) && !ShouldConfig(g_CfgData.configPartition))
- continue;
-
- AddSteps(&curStep, 1);
- }
-
- return;
+ // Is this the first server?
+ if (g_CfgData.bFirstServer) {
+ // We may have to change the FirstServerSteps, so loop over them
+ // and only add the ones we need. All of the FirstServerSteps
+ // are required except for the ones for backup and sys control
+ // machine. If the user doesn't want those then we won't put
+ // them into the array of steps to perform. Also, we may not need
+ // to make the AFS partition (if it already exists).
+ for (int i = 0; i < NUM_STEPS(FirstServerSteps); i++) {
+ STEP_ID curStep = FirstServerSteps[i];
+
+ if ((curStep == SID_START_DB) && ShouldConfig(g_CfgData.configBak))
+ curStep = SID_START_DB_AND_BAK;
+ else if ((curStep == SID_CONFIG_SCS) && !ShouldConfig(g_CfgData.configSCS))
+ continue;
+ else if ((curStep == SID_CONFIG_PARTITION) && !ShouldConfig(g_CfgData.configPartition))
+ continue;
+
+ AddSteps(&curStep, 1);
}
- // Make sure client info is valid
- if (!g_CfgData.bValidClientInfo || (lstrcmp(g_CfgData.szClientCellName, g_CfgData.szCellName) != 0)) {
- m_bMustChangeClientCell = TRUE;
- AddSteps(InvalidClientInfoSteps, NUM_STEPS(InvalidClientInfoSteps));
+ return;
}
- // Make sure server info is valid
- if (!g_CfgData.bValidServerInfo)
- AddSteps(InvalidServerInfoSteps, NUM_STEPS(InvalidServerInfoSteps));
-
- // Add steps that should always be performed
- AddSteps(PreconfigSteps, NUM_STEPS(PreconfigSteps));
-
- /*
- * Do unconfiguration first
- */
-
- // Unconfigure File Server?
- if (ShouldUnconfig(g_CfgData.configFS))
- AddSteps(UnconfigFsSteps, NUM_STEPS(UnconfigFsSteps));
-
- // Unconfigure Database Server? Will also automatically unconfig backup server.
- if (ShouldUnconfig(g_CfgData.configDB))
- AddSteps(UnconfigDbSteps, NUM_STEPS(UnconfigDbSteps));
- // Unconfigure Backup Server?
- else if (ShouldUnconfig(g_CfgData.configBak))
- AddSteps(UnconfigBakSteps, NUM_STEPS(UnconfigBakSteps));
-
- // Unconfigure System Control Server?
- if (ShouldUnconfig(g_CfgData.configSCS))
- AddSteps(UnconfigScsSteps, NUM_STEPS(UnconfigScsSteps));
-
- // Unconfigure System Control Client?
- if (ShouldUnconfig(g_CfgData.configSCC))
- AddSteps(UnconfigSccSteps, NUM_STEPS(UnconfigSccSteps));
-
- /*
- * Now do configuration
- */
-
- // AFS Partition
- if (ShouldConfig(g_CfgData.configPartition))
- AddSteps(PartitionSteps, NUM_STEPS(PartitionSteps));
-
- // Database and backup server
- if (ShouldConfig(g_CfgData.configDB)) {
- if (ShouldConfig(g_CfgData.configBak))
- AddSteps(DbAndBakSteps, NUM_STEPS(DbAndBakSteps));
- else
- AddSteps(DbSteps, NUM_STEPS(DbSteps));
- } else if (ShouldConfig(g_CfgData.configBak))
- AddSteps(BakOnlySteps, NUM_STEPS(BakOnlySteps));
-
- // File server
- if (ShouldConfig(g_CfgData.configFS))
- AddSteps(FsSteps, NUM_STEPS(FsSteps));
+ // Make sure client info is valid
+ if (!g_CfgData.bValidClientInfo || (lstrcmp(g_CfgData.szClientCellName, g_CfgData.szCellName) != 0)) {
+ m_bMustChangeClientCell = TRUE;
+ AddSteps(InvalidClientInfoSteps, NUM_STEPS(InvalidClientInfoSteps));
+ }
+
+ // Make sure server info is valid
+ if (!g_CfgData.bValidServerInfo)
+ AddSteps(InvalidServerInfoSteps, NUM_STEPS(InvalidServerInfoSteps));
+
+ // Add steps that should always be performed
+ AddSteps(PreconfigSteps, NUM_STEPS(PreconfigSteps));
+
+ /*
+ * Do unconfiguration first
+ */
+
+ // Unconfigure File Server?
+ if (ShouldUnconfig(g_CfgData.configFS))
+ AddSteps(UnconfigFsSteps, NUM_STEPS(UnconfigFsSteps));
+
+ // Unconfigure Database Server? Will also automatically unconfig backup server.
+ if (ShouldUnconfig(g_CfgData.configDB))
+ AddSteps(UnconfigDbSteps, NUM_STEPS(UnconfigDbSteps));
+ // Unconfigure Backup Server?
+ else if (ShouldUnconfig(g_CfgData.configBak))
+ AddSteps(UnconfigBakSteps, NUM_STEPS(UnconfigBakSteps));
+
+ // Unconfigure System Control Server?
+ if (ShouldUnconfig(g_CfgData.configSCS))
+ AddSteps(UnconfigScsSteps, NUM_STEPS(UnconfigScsSteps));
+
+ // Unconfigure System Control Client?
+ if (ShouldUnconfig(g_CfgData.configSCC))
+ AddSteps(UnconfigSccSteps, NUM_STEPS(UnconfigSccSteps));
+
+ /*
+ * Now do configuration
+ */
+
+ // AFS Partition
+ if (ShouldConfig(g_CfgData.configPartition))
+ AddSteps(PartitionSteps, NUM_STEPS(PartitionSteps));
+
+ // Database and backup server
+ if (ShouldConfig(g_CfgData.configDB)) {
+ if (ShouldConfig(g_CfgData.configBak))
+ AddSteps(DbAndBakSteps, NUM_STEPS(DbAndBakSteps));
+ else
+ AddSteps(DbSteps, NUM_STEPS(DbSteps));
+ } else if (ShouldConfig(g_CfgData.configBak))
+ AddSteps(BakOnlySteps, NUM_STEPS(BakOnlySteps));
+
+ // File server
+ if (ShouldConfig(g_CfgData.configFS))
+ AddSteps(FsSteps, NUM_STEPS(FsSteps));
if (!g_CfgData.bRootVolumesExistanceKnown || !g_CfgData.bRootVolumesReplicationKnown)
AddSteps(CheckRootVolumesSteps, NUM_STEPS(CheckRootVolumesSteps));
- // Root volumes
- if (ShouldConfig(g_CfgData.configRootVolumes))
- AddSteps(RootVolumesSteps, NUM_STEPS(RootVolumesSteps));
+ // Root volumes
+ if (ShouldConfig(g_CfgData.configRootVolumes))
+ AddSteps(RootVolumesSteps, NUM_STEPS(RootVolumesSteps));
- // Replication
- if (ShouldConfig(g_CfgData.configRep))
- AddSteps(ReplicationSteps, NUM_STEPS(ReplicationSteps));
+ // Replication
+ if (ShouldConfig(g_CfgData.configRep))
+ AddSteps(ReplicationSteps, NUM_STEPS(ReplicationSteps));
- // System control server
- if (ShouldConfig(g_CfgData.configSCS))
- AddSteps(ScsSteps, NUM_STEPS(ScsSteps));
+ // System control server
+ if (ShouldConfig(g_CfgData.configSCS))
+ AddSteps(ScsSteps, NUM_STEPS(ScsSteps));
- // System control client
- if (ShouldConfig(g_CfgData.configSCC))
- AddSteps(SccSteps, NUM_STEPS(SccSteps));
+ // System control client
+ if (ShouldConfig(g_CfgData.configSCC))
+ AddSteps(SccSteps, NUM_STEPS(SccSteps));
// Perform any steps necessary after all normal configuration has finished.
// For instance, if all servers were shut down, then we ask the user if they
// want the config info invalidated. Also, if the last db server was stopped,
// then we will stop the client as well.
- AddSteps(PostConfigSteps, NUM_STEPS(PostConfigSteps));
+ AddSteps(PostConfigSteps, NUM_STEPS(PostConfigSteps));
}
// For steps that should have a place on the dialog, assign them the
// next available position.
static void SetupStepGUI(CONFIG_STEP& step, UINT& nDispPos)
{
- step.eState = SS_STEP_TO_BE_DONE;
+ step.eState = SS_STEP_TO_BE_DONE;
- // If this step has a msg ID then it is a step that gets displayed to the
- // user. Show it in the dialog.
- if (step.nDescID) {
- // Give this step a position on the dialog in which to show its message
- step.nDescCtrlID = StepGuiCtrlIDs[nDispPos].nDescCtrlID;
- step.nGraphicCtrlID = StepGuiCtrlIDs[nDispPos].nGraphicCtrlID;
+ // If this step has a msg ID then it is a step that gets displayed to the
+ // user. Show it in the dialog.
+ if (step.nDescID) {
+ // Give this step a position on the dialog in which to show its message
+ step.nDescCtrlID = StepGuiCtrlIDs[nDispPos].nDescCtrlID;
+ step.nGraphicCtrlID = StepGuiCtrlIDs[nDispPos].nGraphicCtrlID;
- // Show this step's text in the proper static control
- SetWndText(m_hDlg, step.nDescCtrlID, step.nDescID);
+ // Show this step's text in the proper static control
+ SetWndText(m_hDlg, step.nDescCtrlID, step.nDescID);
- // Show the static control
- ShowWnd(m_hDlg, step.nDescCtrlID);
+ // Show the static control
+ ShowWnd(m_hDlg, step.nDescCtrlID);
- // Show the graphic control
- ShowWnd(m_hDlg, step.nGraphicCtrlID);
+ // Show the graphic control
+ ShowWnd(m_hDlg, step.nGraphicCtrlID);
- nDispPos++;
- }
+ nDispPos++;
+ }
}
static void SetupConfigSteps()
{
- UINT nDispPos = 0; // Which StepGuiCtrlID to use, if applicable
- int nStep = 0;
+ UINT nDispPos = 0; // Which StepGuiCtrlID to use, if applicable
+ int nStep = 0;
- // Determine which steps are going to be performed. For the ones that
- // will be, show their description message in the appropriate place on
- // the dialog.
- GetStepsToPerform();
- ASSERT(m_nNumSteps > 0);
+ // Determine which steps are going to be performed. For the ones that
+ // will be, show their description message in the appropriate place on
+ // the dialog.
+ GetStepsToPerform();
+ ASSERT(m_nNumSteps > 0);
- // For steps that should have a place on the dialog, assign them the
- // next available position.
- for (int i = 0; i < m_nNumSteps; i++)
- SetupStepGUI(m_ConfigSteps[i], nDispPos);
+ // For steps that should have a place on the dialog, assign them the
+ // next available position.
+ for (int i = 0; i < m_nNumSteps; i++)
+ SetupStepGUI(m_ConfigSteps[i], nDispPos);
}
static BOOL CheckResult(int nResult, int nStatus)
{
- CHECK_CANCEL;
+ CHECK_CANCEL;
- if (nResult)
- return TRUE;
+ if (nResult)
+ return TRUE;
- ShowError(m_hDlg, nStatus, IDS_CONFIG_ERROR);
+ ShowError(m_hDlg, nStatus, IDS_CONFIG_ERROR);
- return FALSE;
+ return FALSE;
}
static BOOL CheckCancel()
{
- // If we already know we are cancelling then return
- if (m_bCancel)
- return TRUE;
+ // If we already know we are cancelling then return
+ if (m_bCancel)
+ return TRUE;
- // If user didn't press Cancel button, then return FALSE
- if (!m_bCheckCancel)
- return FALSE;
+ // If user didn't press Cancel button, then return FALSE
+ if (!m_bCheckCancel)
+ return FALSE;
- ASSERT(m_bConfiguring);
+ ASSERT(m_bConfiguring);
- TCHAR szMsg[cchRESOURCE];
- TCHAR szTitle[cchRESOURCE];
+ TCHAR szMsg[cchRESOURCE];
+ TCHAR szTitle[cchRESOURCE];
- GetString(szMsg, IDS_CANCEL_CONFIG_MSG);
- GetString(szTitle, GetAppTitleID());
-
- // Ask user if they really want to cancel
- int nChoice = MessageBox(m_hDlg, szMsg, szTitle, MB_YESNO | MB_ICONQUESTION);
+ GetString(szMsg, IDS_CANCEL_CONFIG_MSG);
+ GetString(szTitle, GetAppTitleID());
+
+ // Ask user if they really want to cancel
+ int nChoice = MessageBox(m_hDlg, szMsg, szTitle, MB_YESNO | MB_ICONQUESTION);
- m_bCancel = (nChoice == IDYES);
+ m_bCancel = (nChoice == IDYES);
- m_bCheckCancel = FALSE;
+ m_bCheckCancel = FALSE;
- return m_bCancel;
-}
+ return m_bCancel;
+}
/*
* Show the current config step, UNLESS the user has pressed the Cancel
*/
static void ShowCurrentStep(UINT uiMsgID)
{
- if (!m_bCheckCancel && uiMsgID) {
- SetWndText(m_hDlg, IDC_CURRENT_STEP, uiMsgID);
+ if (!m_bCheckCancel && uiMsgID) {
+ SetWndText(m_hDlg, IDC_CURRENT_STEP, uiMsgID);
ForceUpdateWindow(m_hDlg, IDC_CURRENT_STEP);
}
}
static void ShowCurrentStep(TCHAR *pszMsg)
{
- if (!m_bCheckCancel && pszMsg) {
- SetWndText(m_hDlg, IDC_CURRENT_STEP, pszMsg);
+ if (!m_bCheckCancel && pszMsg) {
+ SetWndText(m_hDlg, IDC_CURRENT_STEP, pszMsg);
ForceUpdateWindow(m_hDlg, IDC_CURRENT_STEP);
}
}
// Set the range and step increment for the progress bar.
static void InitProgressBar()
{
- SendDlgItemMessage(m_hDlg, IDC_CONFIG_PROGRESS, PBM_SETRANGE, 0, MAKELPARAM(0, m_nNumSteps));
- SendDlgItemMessage(m_hDlg, IDC_CONFIG_PROGRESS, PBM_SETSTEP, 1, 0);
+ SendDlgItemMessage(m_hDlg, IDC_CONFIG_PROGRESS, PBM_SETRANGE, 0, MAKELPARAM(0, m_nNumSteps));
+ SendDlgItemMessage(m_hDlg, IDC_CONFIG_PROGRESS, PBM_SETSTEP, 1, 0);
}
static char *GetVicepName()
{
- ASSERT((lstrlen(g_CfgData.szPartitionName) == 1) || (lstrlen(g_CfgData.szPartitionName) == 2));
+ ASSERT((lstrlen(g_CfgData.szPartitionName) == 1) || (lstrlen(g_CfgData.szPartitionName) == 2));
- // Construct the partition name
- if (!m_szVicepName[0])
- sprintf(m_szVicepName, "/vicep%s", GetPartitionNameA());
+ // Construct the partition name
+ if (!m_szVicepName[0])
+ sprintf(m_szVicepName, "/vicep%s", GetPartitionNameA());
- return m_szVicepName;
+ return m_szVicepName;
}
static BOOL VosOpenServer()
{
- ASSERT(m_hvosServer == 0);
- ASSERT(g_CfgData.szHostname[0]);
- ASSERT(g_hCell);
+ ASSERT(m_hvosServer == 0);
+ ASSERT(g_CfgData.szHostname[0]);
+ ASSERT(g_hCell);
- g_LogFile.Write("Opening server %s.\r\n", GetHostnameA());
+ g_LogFile.Write("Opening server %s.\r\n", GetHostnameA());
- m_nResult = vos_ServerOpen(g_hCell, GetHostnameA(), &m_hvosServer, &m_nStatus);
- CHECK_RESULT;
+ m_nResult = vos_ServerOpen(g_hCell, GetHostnameA(), &m_hvosServer, &m_nStatus);
+ CHECK_RESULT;
- return TRUE;
+ return TRUE;
}
static BOOL ConfigPartition()
{
- ASSERT(g_hServer);
- ASSERT(g_CfgData.chDeviceName);
+ ASSERT(g_hServer);
+ ASSERT(g_CfgData.chDeviceName);
- // Constuct the device name
- char szDevName[] = "?:";
- szDevName[0] = GetDeviceNameA();
+ // Constuct the device name
+ char szDevName[] = "?:";
+ szDevName[0] = GetDeviceNameA();
- g_LogFile.Write("Adding an AFS partition on device '%s' with name '%s'.\r\n", szDevName, GetVicepName());
+ g_LogFile.Write("Adding an AFS partition on device '%s' with name '%s'.\r\n", szDevName, GetVicepName());
- m_nResult = cfg_HostPartitionTableAddEntry(g_hServer, GetVicepName(), szDevName, &m_nStatus);
- CHECK_RESULT;
-
- return TRUE;
+ m_nResult = cfg_HostPartitionTableAddEntry(g_hServer, GetVicepName(), szDevName, &m_nStatus);
+ CHECK_RESULT;
+
+ return TRUE;
}
static BOOL FreeCellServDB()
{
- afs_status_t nIgnore;
+ afs_status_t nIgnore;
- if (m_pszCellDbHosts) {
- cfg_StringDeallocate(m_pszCellDbHosts, &nIgnore);
- CHECK_RESULT;
- }
+ if (m_pszCellDbHosts) {
+ cfg_StringDeallocate(m_pszCellDbHosts, &nIgnore);
+ CHECK_RESULT;
+ }
- return TRUE;
+ return TRUE;
}
static BOOL GetCellServDB(char **ppszCellServDB)
{
- ASSERT(g_CfgData.szCellServDbHostname[0]);
+ ASSERT(g_CfgData.szCellServDbHostname[0]);
- afs_status_t nIgnore;
- char *pszCellname = 0;
+ afs_status_t nIgnore;
+ char *pszCellname = 0;
- g_LogFile.Write("Getting CellServDB from host %s.\r\n", GetCellServDbHostnameA());
- m_nResult = cfg_CellServDbEnumerate(GetCellServDbHostnameA(), &pszCellname, ppszCellServDB, &m_nStatus);
- CHECK_RESULT;
+ g_LogFile.Write("Getting CellServDB from host %s.\r\n", GetCellServDbHostnameA());
+ m_nResult = cfg_CellServDbEnumerate(GetCellServDbHostnameA(), &pszCellname, ppszCellServDB, &m_nStatus);
+ CHECK_RESULT;
- // The cell name from this call better match the cell name we got previously
- if (strcmp(GetCellNameA(), pszCellname) != 0) {
- ShowError(m_hDlg, 0, IDS_WRONG_CELL);
- m_nResult = 0;
- return FALSE;
- }
+ // The cell name from this call better match the cell name we got previously
+ if (strcmp(GetCellNameA(), pszCellname) != 0) {
+ ShowError(m_hDlg, 0, IDS_WRONG_CELL);
+ m_nResult = 0;
+ return FALSE;
+ }
- cfg_StringDeallocate(pszCellname, &nIgnore);
+ cfg_StringDeallocate(pszCellname, &nIgnore);
- g_LogFile.WriteMultistring(*ppszCellServDB);
+ g_LogFile.WriteMultistring(*ppszCellServDB);
- return TRUE;
+ return TRUE;
}
// Define cell name and cell membership for server
static BOOL DefineCellForServer()
{
- ASSERT(g_hServer);
- ASSERT(g_CfgData.szCellName[0]);
+ ASSERT(g_hServer);
+ ASSERT(g_CfgData.szCellName[0]);
- // CellServDB entries
- char *pszEntries = 0;
+ // CellServDB entries
+ char *pszEntries = 0;
- // If not first server, get list of other hosts
- if (!g_CfgData.bFirstServer) {
- if (!m_pszCellDbHosts) {
- m_nResult = GetCellServDB(&m_pszCellDbHosts);
- if (!m_nResult)
- return m_nResult;
- }
- pszEntries = m_pszCellDbHosts;
- } else {
- // Make the hostname a multistring
- _tcsncat(g_CfgData.szHostname, TEXT("\0"), MAX_PARTITION_NAME_LEN);
- pszEntries = GetHostnameA();
+ // If not first server, get list of other hosts
+ if (!g_CfgData.bFirstServer) {
+ if (!m_pszCellDbHosts) {
+ m_nResult = GetCellServDB(&m_pszCellDbHosts);
+ if (!m_nResult)
+ return m_nResult;
}
+ pszEntries = m_pszCellDbHosts;
+ } else {
+ // Make the hostname a multistring
+ _tcsncat(g_CfgData.szHostname, TEXT("\0"), MAX_PARTITION_NAME_LEN);
+ pszEntries = GetHostnameA();
+ }
- g_LogFile.Write("Putting this host in cell '%s'.\r\n", GetCellNameA());
+ g_LogFile.Write("Putting this host in cell '%s'.\r\n", GetCellNameA());
- ASSERT(g_CfgData.szCellName[0]);
+ ASSERT(g_CfgData.szCellName[0]);
- m_nResult = cfg_HostSetCell(g_hServer, GetCellNameA(), pszEntries, &m_nStatus);
- CHECK_RESULT;
+ m_nResult = cfg_HostSetCell(g_hServer, GetCellNameA(), pszEntries, &m_nStatus);
+ CHECK_RESULT;
- g_CfgData.bValidServerInfo = TRUE;
+ g_CfgData.bValidServerInfo = TRUE;
- return TRUE;
-}
+ return TRUE;
+}
static BOOL StopClient()
{
static BOOL DefineCellForClient()
{
- ASSERT(g_hClient);
- ASSERT(g_CfgData.szCellName[0]);
+ ASSERT(g_hClient);
+ ASSERT(g_CfgData.szCellName[0]);
// Stop the client
if (!StopClient())
return FALSE;
- // CellServDB entries
- char *pszEntries = 0;
+ // CellServDB entries
+ char *pszEntries = 0;
- // If not first server, get list of other hosts
- if (!g_CfgData.bFirstServer) {
- if (!m_pszCellDbHosts) {
- m_nResult = GetCellServDB(&m_pszCellDbHosts);
- if (!m_nResult)
- return m_nResult;
- }
- pszEntries = m_pszCellDbHosts;
- } else {
- // Make the hostname a multistring
- _tcsncat(g_CfgData.szHostname, TEXT("\0"), MAX_PARTITION_NAME_LEN);
- pszEntries = GetHostnameA();
+ // If not first server, get list of other hosts
+ if (!g_CfgData.bFirstServer) {
+ if (!m_pszCellDbHosts) {
+ m_nResult = GetCellServDB(&m_pszCellDbHosts);
+ if (!m_nResult)
+ return m_nResult;
}
+ pszEntries = m_pszCellDbHosts;
+ } else {
+ // Make the hostname a multistring
+ _tcsncat(g_CfgData.szHostname, TEXT("\0"), MAX_PARTITION_NAME_LEN);
+ pszEntries = GetHostnameA();
+ }
- g_LogFile.Write("Putting the AFS Client in this host's cell.\r\n");
+ g_LogFile.Write("Putting the AFS Client in this host's cell.\r\n");
- m_nResult = cfg_ClientSetCell(g_hClient, GetCellNameA(), pszEntries, &m_nStatus);
- CHECK_RESULT;
+ m_nResult = cfg_ClientSetCell(g_hClient, GetCellNameA(), pszEntries, &m_nStatus);
+ CHECK_RESULT;
- // Update our state info about the client
- g_CfgData.bValidClientInfo = TRUE;
- lstrcpy(g_CfgData.szClientCellName, g_CfgData.szCellName);
+ // Update our state info about the client
+ g_CfgData.bValidClientInfo = TRUE;
+ lstrcpy(g_CfgData.szClientCellName, g_CfgData.szCellName);
- if (!g_CfgData.bFirstServer) {
- if (!UpgradeLibHandles())
- return FALSE;
- }
+ if (!g_CfgData.bFirstServer) {
+ if (!UpgradeLibHandles())
+ return FALSE;
+ }
- return TRUE;
-}
+ return TRUE;
+}
static BOOL StartBosServer()
{
- ASSERT(g_hServer);
+ ASSERT(g_hServer);
- g_LogFile.Write("Starting the bos server in %s mode.\r\n", m_bNoAuthMode ? "no auth" : "auth");
-
- m_nResult = cfg_BosServerStart(g_hServer, m_bNoAuthMode, BOSSERVER_START_TIMEOUT, &m_nStatus);
- CHECK_RESULT;
+ g_LogFile.Write("Starting the bos server in %s mode.\r\n", m_bNoAuthMode ? "no auth" : "auth");
- return TRUE;
+ m_nResult = cfg_BosServerStart(g_hServer, m_bNoAuthMode, BOSSERVER_START_TIMEOUT, &m_nStatus);
+ CHECK_RESULT;
+
+ return TRUE;
}
static BOOL StartAuthServer()
{
- ASSERT(g_hServer);
- ASSERT(g_CfgData.bFirstServer);
+ ASSERT(g_hServer);
+ ASSERT(g_CfgData.bFirstServer);
- g_LogFile.Write("Starting the authentication server.\r\n");
+ g_LogFile.Write("Starting the authentication server.\r\n");
- m_nResult = cfg_AuthServerStart(g_hServer, &m_nStatus);
- CHECK_RESULT;
+ m_nResult = cfg_AuthServerStart(g_hServer, &m_nStatus);
+ CHECK_RESULT;
- g_CfgData.bAuthServerRunning = TRUE;
+ g_CfgData.bAuthServerRunning = TRUE;
- return TRUE;
+ return TRUE;
}
static BOOL CreatePrincipalAndKey()
{
- ASSERT(g_hServer);
+ ASSERT(g_hServer);
- if (!UpgradeLibHandles())
- return FALSE;
+ if (!UpgradeLibHandles())
+ return FALSE;
- // Create AFS server principal and put key in local Keyfile
- LPTSTR pszServerPW = 0;
+ // Create AFS server principal and put key in local Keyfile
+ LPTSTR pszServerPW = 0;
- g_LogFile.Write("Setting the AFS Principal.\r\n");
+ g_LogFile.Write("Setting the AFS Principal.\r\n");
- if (g_CfgData.bFirstServer) {
- ASSERT(g_CfgData.szServerPW[0]);
- pszServerPW = GetServerPW();
- }
+ if (g_CfgData.bFirstServer) {
+ ASSERT(g_CfgData.szServerPW[0]);
+ pszServerPW = GetServerPW();
+ }
BOOL bDone = FALSE;
bDone = TRUE;
}
- CHECK_RESULT;
+ CHECK_RESULT;
- return TRUE;
+ return TRUE;
}
static BOOL StartDbServers()
{
- ASSERT(g_hServer);
+ ASSERT(g_hServer);
- g_LogFile.Write("Starting the following servers: Protection Volume Location ");
- if (IsStepEnabled(g_CfgData.configBak))
- g_LogFile.Write("Backup ");
- if (!g_CfgData.bFirstServer)
- g_LogFile.Write("Authentication");
- g_LogFile.Write("\r\n");
+ g_LogFile.Write("Starting the following servers: Protection Volume Location ");
+ if (IsStepEnabled(g_CfgData.configBak))
+ g_LogFile.Write("Backup ");
+ if (!g_CfgData.bFirstServer)
+ g_LogFile.Write("Authentication");
+ g_LogFile.Write("\r\n");
- // Start Protection, Volume Location, and Backup (optional) database servers
- m_nResult = cfg_DbServersStart(g_hServer, ShouldConfig(g_CfgData.configBak), &m_nStatus);
- CHECK_RESULT;
+ // Start Protection, Volume Location, and Backup (optional) database servers
+ m_nResult = cfg_DbServersStart(g_hServer, ShouldConfig(g_CfgData.configBak), &m_nStatus);
+ CHECK_RESULT;
- // Must wait for this now so we can then talk to them.
- if (g_CfgData.bFirstServer) {
- g_LogFile.Write("Waiting for database servers to reach quorum.\r\n");
- m_nResult = cfg_DbServersWaitForQuorum(g_hServer, QUORUM_WAIT_TIMEOUT, &m_nStatus);
- CHECK_RESULT;
- }
+ // Must wait for this now so we can then talk to them.
+ if (g_CfgData.bFirstServer) {
+ g_LogFile.Write("Waiting for database servers to reach quorum.\r\n");
+ m_nResult = cfg_DbServersWaitForQuorum(g_hServer, QUORUM_WAIT_TIMEOUT, &m_nStatus);
+ CHECK_RESULT;
+ }
- return TRUE;
+ return TRUE;
}
static BOOL CreateAdminPrincipal()
{
- ASSERT(g_hServer);
- ASSERT(g_CfgData.szAdminName[0]);
+ ASSERT(g_hServer);
+ ASSERT(g_CfgData.szAdminName[0]);
- // Create generic admin principal and put in local Userlist
- char *pszAdminPW = 0;
- int nUID = 0;
-
- if (g_CfgData.bFirstServer) {
- ASSERT(g_CfgData.szAdminPW[0]);
- ASSERT(g_CfgData.szAdminUID[0]);
- pszAdminPW = GetAdminPWA();
- nUID = atoi(GetAdminUIDA());
- g_LogFile.Write("Setting Admin Principal to '%s' and UID to %d.\r\n", GetAdminNameA(), nUID);
- } else
- g_LogFile.Write("Setting Admin Principal to '%s'.\r\n", GetAdminNameA());
-
- m_nResult = cfg_HostSetAdminPrincipal(g_hServer, (short)g_CfgData.bFirstServer, GetAdminNameA(), pszAdminPW, nUID, &m_nStatus);
- CHECK_RESULT;
+ // Create generic admin principal and put in local Userlist
+ char *pszAdminPW = 0;
+ int nUID = 0;
- g_CfgData.bAdminPrincipalCreated = TRUE;
+ if (g_CfgData.bFirstServer) {
+ ASSERT(g_CfgData.szAdminPW[0]);
+ ASSERT(g_CfgData.szAdminUID[0]);
+ pszAdminPW = GetAdminPWA();
+ nUID = atoi(GetAdminUIDA());
+ g_LogFile.Write("Setting Admin Principal to '%s' and UID to %d.\r\n", GetAdminNameA(), nUID);
+ } else
+ g_LogFile.Write("Setting Admin Principal to '%s'.\r\n", GetAdminNameA());
+
+ m_nResult = cfg_HostSetAdminPrincipal(g_hServer, (short)g_CfgData.bFirstServer, GetAdminNameA(), pszAdminPW, nUID, &m_nStatus);
+ CHECK_RESULT;
- if (g_CfgData.bFirstServer) {
- if (!UpgradeLibHandles())
- return FALSE;
- }
+ g_CfgData.bAdminPrincipalCreated = TRUE;
- return TRUE;
-}
+ if (g_CfgData.bFirstServer) {
+ if (!UpgradeLibHandles())
+ return FALSE;
+ }
+
+ return TRUE;
+}
static BOOL StartFsVlAndSalvager()
{
- ASSERT(g_hServer);
+ ASSERT(g_hServer);
- g_LogFile.Write("Starting the File Server.\r\n");
+ g_LogFile.Write("Starting the File Server.\r\n");
- m_nResult = cfg_FileServerStart(g_hServer, &m_nStatus);
- CHECK_RESULT;
+ m_nResult = cfg_FileServerStart(g_hServer, &m_nStatus);
+ CHECK_RESULT;
- return TRUE;
+ return TRUE;
}
static BOOL ConfigSCS()
{
- ASSERT(g_hServer);
+ ASSERT(g_hServer);
- g_LogFile.Write("Configuring the System Control Server.\r\n");
+ g_LogFile.Write("Configuring the System Control Server.\r\n");
- m_nResult = cfg_SysBinServerStart(g_hServer, TRUE, FALSE, &m_nStatus);
- CHECK_RESULT;
+ m_nResult = cfg_SysBinServerStart(g_hServer, TRUE, FALSE, &m_nStatus);
+ CHECK_RESULT;
- return TRUE;
+ return TRUE;
}
static BOOL ConfigSCC()
{
- ASSERT(g_hServer);
- ASSERT(g_CfgData.szSysControlMachine[0]);
+ ASSERT(g_hServer);
+ ASSERT(g_CfgData.szSysControlMachine[0]);
- g_LogFile.Write("Configuring the System Control Client.\r\n");
+ g_LogFile.Write("Configuring the System Control Client.\r\n");
- m_nResult = cfg_SysControlClientStart(g_hServer, GetSysControlMachineA(), &m_nStatus);
- CHECK_RESULT;
+ m_nResult = cfg_SysControlClientStart(g_hServer, GetSysControlMachineA(), &m_nStatus);
+ CHECK_RESULT;
- return TRUE;
-}
+ return TRUE;
+}
static BOOL GetPartitionID()
{
- if (m_nPartitionID != INVALID_PARTITION_ID)
- return TRUE;
+ if (m_nPartitionID != INVALID_PARTITION_ID)
+ return TRUE;
- g_LogFile.Write("Translating the parition name '%s' to an ID.\r\n", GetVicepName());
+ g_LogFile.Write("Translating the parition name '%s' to an ID.\r\n", GetVicepName());
- m_nResult = vos_PartitionNameToId(GetVicepName(), &m_nPartitionID, &m_nStatus);
- CHECK_RESULT;
+ m_nResult = vos_PartitionNameToId(GetVicepName(), &m_nPartitionID, &m_nStatus);
+ CHECK_RESULT;
- g_LogFile.Write("The ID for partition '%s' is %d.\r\n", GetVicepName(), m_nPartitionID);
+ g_LogFile.Write("The ID for partition '%s' is %d.\r\n", GetVicepName(), m_nPartitionID);
- ASSERT(m_nPartitionID != INVALID_PARTITION_ID);
+ ASSERT(m_nPartitionID != INVALID_PARTITION_ID);
- return TRUE;
+ return TRUE;
}
static BOOL GetRootVolumeInfo()
static BOOL CreateRootAfs()
{
- ASSERT(g_hCell);
- ASSERT(m_hvosServer);
+ ASSERT(g_hCell);
+ ASSERT(m_hvosServer);
// If the root.afs volume already exists, then just return. We can get to this step
// and root.afs already exist if:
// we only create the one that doesn't exist.
//
if (g_CfgData.bRootAfsExists)
- return TRUE;
+ return TRUE;
- if (!GetPartitionID())
- return FALSE;
+ if (!GetPartitionID())
+ return FALSE;
// If the client is running then stop it - creating root.afs will confuse it.
// It will be started again after root.afs is created.
if (!StopClient())
return FALSE;
- g_LogFile.Write("Creating volume root.afs on partition %d with a quota of %d.\r\n", m_nPartitionID, ROOT_VOLUMES_QUOTA);
+ g_LogFile.Write("Creating volume root.afs on partition %d with a quota of %d.\r\n", m_nPartitionID, ROOT_VOLUMES_QUOTA);
- m_nResult = vos_VolumeCreate(g_hCell, m_hvosServer, 0, m_nPartitionID, "root.afs", ROOT_VOLUMES_QUOTA, &g_CfgData.nRootAfsID, &m_nStatus);
+ m_nResult = vos_VolumeCreate(g_hCell, m_hvosServer, 0, m_nPartitionID, "root.afs", ROOT_VOLUMES_QUOTA, &g_CfgData.nRootAfsID, &m_nStatus);
- CHECK_RESULT;
+ CHECK_RESULT;
- g_LogFile.Write("Volume root.afs was created with an ID of %d.\r\n", g_CfgData.nRootAfsID);
+ g_LogFile.Write("Volume root.afs was created with an ID of %d.\r\n", g_CfgData.nRootAfsID);
- g_CfgData.bRootAfsExists = TRUE;
+ g_CfgData.bRootAfsExists = TRUE;
m_bWeCreatedRootAfs = TRUE;
- return TRUE;
-}
+ return TRUE;
+}
static BOOL StartClient()
{
- ASSERT(g_hClient);
+ ASSERT(g_hClient);
- g_LogFile.Write("Starting the AFS Client.\r\n");
+ g_LogFile.Write("Starting the AFS Client.\r\n");
- m_nResult = cfg_ClientStart(g_hClient, CLIENT_START_TIMEOUT, &m_nStatus);
- CHECK_RESULT;
+ m_nResult = cfg_ClientStart(g_hClient, CLIENT_START_TIMEOUT, &m_nStatus);
+ CHECK_RESULT;
- return TRUE;
+ return TRUE;
}
static BOOL SetTokensInClient()
if (m_bClientTokensSet)
return TRUE;
- g_LogFile.Write("Putting our tokens into the AFS Client.\r\n");
+ g_LogFile.Write("Putting our tokens into the AFS Client.\r\n");
m_nResult = afsclient_TokenSet(g_hToken, &m_nStatus);
CHECK_RESULT;
return TRUE;
}
-static BOOL CreateRootAfsDriveMapping()
+static BOOL IsClientFreelance(void)
+{
+ HKEY parmKey;
+ DWORD code;
+ DWORD dummyLen;
+ DWORD enabled = 0;
+
+ code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY,
+ 0, KEY_QUERY_VALUE, &parmKey);
+ if (code == ERROR_SUCCESS) {
+ dummyLen = sizeof(enabled);
+ code = RegQueryValueEx(parmKey, "FreelanceClient", NULL, NULL,
+ (BYTE *) &enabled, &dummyLen);
+ RegCloseKey (parmKey);
+ }
+ return (enabled?TRUE:FALSE);
+}
+
+static char space[2048];
+static BOOL IsRootAfsMountPoint(void)
+{
+ struct ViceIoctl blob;
+ afs_int32 code;
+
+ blob.in = ".root.afs";
+ blob.in_size = 9L;
+ blob.out_size = sizeof(space);
+ blob.out = space;
+ memset(space, 0, sizeof(space));
+
+ code = pioctl(GetClientNetbiosNameA(), VIOC_AFS_STAT_MT_PT, &blob, 1);
+ return (code == 0);
+}
+
+static BOOL CreateFreelanceRootAfsMountPoint(char * path)
+{
+ struct ViceIoctl blob;
+ afs_int32 code;
+
+ if (IsRootAfsMountPoint())
+ return TRUE;
+
+ blob.in = "%root.afs";
+ blob.in_size = 10L;
+ blob.out_size = sizeof(space);
+ blob.out = space;
+ memset(space, 0, sizeof(space));
+
+ code = pioctl(path, VIOC_AFS_CREATE_MT_PT, &blob, 1);
+ return (code == 0);
+}
+
+static BOOL CreateRootAfsDriveMapping(void)
{
if (m_bRootAfsDriveMappingCreated)
return TRUE;
g_LogFile.Write("Attempting to create a drive mapping into AFS.\r\n");
- char szAfsRootDir[_MAX_PATH];
- sprintf(szAfsRootDir, "\\\\%s\\all", GetClientNetbiosNameA());
+ char szAfsRootDir[_MAX_PATH];
+ if ( IsClientFreelance() )
+ {
+ sprintf(szAfsRootDir, "\\\\%s\\all\\.root.afs", GetClientNetbiosNameA());
+ if ( !CreateFreelanceRootAfsMountPoint(szAfsRootDir) )
+ return FALSE;
+ } else {
+ sprintf(szAfsRootDir, "\\\\%s\\all", GetClientNetbiosNameA());
+ }
strcpy(m_szDriveToMapTo, "_:");
// We will try all drives from D to Z.
NETRESOURCE nr;
memset (&nr, 0x00, sizeof(NETRESOURCE));
- for (chDriveLetter = 'D'; (chDriveLetter <= 'Z') && !m_bRootAfsDriveMappingCreated; chDriveLetter++) {
+ for (chDriveLetter = 'Z'; (chDriveLetter > 'C') && !m_bRootAfsDriveMappingCreated; chDriveLetter--) {
m_szDriveToMapTo[0] = chDriveLetter;
g_LogFile.Write("Attempting to map %s to %s: ", m_szDriveToMapTo, szAfsRootDir);
if (!CreateRootAfsDriveMapping())
return FALSE;
- g_LogFile.Write("Setting the ACL on root.afs.\r\n");
+ g_LogFile.Write("Setting the ACL on root.afs.\r\n");
- acl_t acl = { READ, NO_WRITE, LOOKUP, NO_DELETE, NO_INSERT, NO_LOCK, NO_ADMIN };
+ acl_t acl = { READ, NO_WRITE, LOOKUP, NO_DELETE, NO_INSERT, NO_LOCK, NO_ADMIN };
- m_nResult = afsclient_ACLEntryAdd(m_szDriveToMapTo, "system:anyuser", &acl, &m_nStatus);
- CHECK_RESULT;
-
- return TRUE;
+ m_nResult = afsclient_ACLEntryAdd(m_szDriveToMapTo, "system:anyuser", &acl, &m_nStatus);
+ CHECK_RESULT;
+
+ return TRUE;
}
static BOOL CreateRootCell()
{
- ASSERT(g_hCell);
- ASSERT(m_hvosServer);
+ ASSERT(g_hCell);
+ ASSERT(m_hvosServer);
// If the root.cell volume already exists, then just return. We can get to this step
// and root.cell already exist if:
// we only create the one that doesn't exist.
//
if (g_CfgData.bRootCellExists)
- return TRUE;
+ return TRUE;
// If root.afs exists and we did not just create it, then we cannot make root.cell. For
// now, just pretend we succeeded. TODO: We must handle this better in a future version.
// We can't at this time because the program strings are frozen - we can't add new
// error messages.
- if (g_CfgData.bRootAfsExists && !m_bWeCreatedRootAfs)
+ if (g_CfgData.bRootAfsExists && !m_bWeCreatedRootAfs)
return TRUE;
- if (!GetPartitionID())
- return FALSE;
+ if (!GetPartitionID())
+ return FALSE;
- g_LogFile.Write("Creating volume root.cell on partition %d with a quota of %d.\r\n", m_nPartitionID, ROOT_VOLUMES_QUOTA);
+ g_LogFile.Write("Creating volume root.cell on partition %d with a quota of %d.\r\n", m_nPartitionID, ROOT_VOLUMES_QUOTA);
- m_nResult = vos_VolumeCreate(g_hCell, m_hvosServer, 0, m_nPartitionID, "root.cell", ROOT_VOLUMES_QUOTA, &g_CfgData.nRootCellID, &m_nStatus);
- CHECK_RESULT;
-
- g_LogFile.Write("Volume root.cell was created with an ID of %d.\r\n", g_CfgData.nRootCellID);
+ m_nResult = vos_VolumeCreate(g_hCell, m_hvosServer, 0, m_nPartitionID, "root.cell", ROOT_VOLUMES_QUOTA, &g_CfgData.nRootCellID, &m_nStatus);
+ CHECK_RESULT;
+
+ g_LogFile.Write("Volume root.cell was created with an ID of %d.\r\n", g_CfgData.nRootCellID);
- g_CfgData.bRootCellExists = TRUE;
+ g_CfgData.bRootCellExists = TRUE;
m_bWeCreatedRootCell = TRUE;
- return TRUE;
-}
+ return TRUE;
+}
static char *GetRootCellDir()
{
- static char szDir[MAX_CELL_NAME_LEN + 5] = "";
+ static char szDir[MAX_CELL_NAME_LEN + 5] = "";
- if (!szDir[0]) {
- ASSERT(g_CfgData.szCellName[0]);
- sprintf(szDir, "%s\\%s", m_szDriveToMapTo, GetCellNameA());
- }
+ if (!szDir[0]) {
+ ASSERT(g_CfgData.szCellName[0]);
+ sprintf(szDir, "%s\\%s", m_szDriveToMapTo, GetCellNameA());
+ }
- return szDir;
+ return szDir;
}
static char *GetRootCellReadWriteDir()
{
- static char szDir[MAX_CELL_NAME_LEN + 5] = "";
+ static char szDir[MAX_CELL_NAME_LEN + 5] = "";
- if (!szDir[0]) {
- ASSERT(g_CfgData.szCellName[0]);
- sprintf(szDir, "%s\\.%s", m_szDriveToMapTo, GetCellNameA());
- }
+ if (!szDir[0]) {
+ ASSERT(g_CfgData.szCellName[0]);
+ sprintf(szDir, "%s\\.%s", m_szDriveToMapTo, GetCellNameA());
+ }
- return szDir;
-}
+ return szDir;
+}
static BOOL MountRootCellStandard()
{
- ASSERT(g_CfgData.szCellName[0]);
+ ASSERT(g_CfgData.szCellName[0]);
// Only do this if we just created root.cell
if (!m_bWeCreatedRootCell)
if (!CreateRootAfsDriveMapping())
return FALSE;
- g_LogFile.Write("Mouting root.cell with a Standard mount point at path %s.\r\n", GetRootCellDir());
+ g_LogFile.Write("Mouting root.cell with a Standard mount point at path %s.\r\n", GetRootCellDir());
- m_nResult = afsclient_MountPointCreate(g_hCell, GetRootCellDir(), "root.cell", READ_ONLY, CHECK_VOLUME, &m_nStatus);
- CHECK_RESULT;
+ m_nResult = afsclient_MountPointCreate(g_hCell, GetRootCellDir(), "root.cell", READ_ONLY, CHECK_VOLUME, &m_nStatus);
+ CHECK_RESULT;
- return TRUE;
+ return TRUE;
}
static BOOL SetRootCellAcl()
if (!SetTokensInClient())
return FALSE;
- g_LogFile.Write("Setting the ACL on root.cell (dir %s).\r\n", GetRootCellDir());
+ g_LogFile.Write("Setting the ACL on root.cell (dir %s).\r\n", GetRootCellDir());
- acl_t acl = { READ, NO_WRITE, LOOKUP, NO_DELETE, NO_INSERT, NO_LOCK, NO_ADMIN };
+ acl_t acl = { READ, NO_WRITE, LOOKUP, NO_DELETE, NO_INSERT, NO_LOCK, NO_ADMIN };
- m_nResult = afsclient_ACLEntryAdd(GetRootCellDir(), "system:anyuser", &acl, &m_nStatus);
- CHECK_RESULT;
+ m_nResult = afsclient_ACLEntryAdd(GetRootCellDir(), "system:anyuser", &acl, &m_nStatus);
+ CHECK_RESULT;
- return TRUE;
+ return TRUE;
}
static BOOL MountRootCellRW()
{
- ASSERT(g_CfgData.szCellName[0]);
+ ASSERT(g_CfgData.szCellName[0]);
// Only do this if we just created root.cell
if (!m_bWeCreatedRootCell)
if (!CreateRootAfsDriveMapping())
return FALSE;
- g_LogFile.Write("Mounting root.cell with a Read/Write mount point at path %s.\r\n", GetRootCellReadWriteDir());
+ g_LogFile.Write("Mounting root.cell with a Read/Write mount point at path %s.\r\n", GetRootCellReadWriteDir());
- m_nResult = afsclient_MountPointCreate(g_hCell, GetRootCellReadWriteDir(), "root.cell", READ_WRITE, CHECK_VOLUME, &m_nStatus);
- CHECK_RESULT;
+ m_nResult = afsclient_MountPointCreate(g_hCell, GetRootCellReadWriteDir(), "root.cell", READ_WRITE, CHECK_VOLUME, &m_nStatus);
+ CHECK_RESULT;
- return TRUE;
-}
+ return TRUE;
+}
static BOOL Replicate()
{
- ASSERT(g_hCell);
- ASSERT(m_hvosServer);
+ ASSERT(g_hCell);
+ ASSERT(m_hvosServer);
- if (!GetPartitionID())
- return FALSE;
+ if (!GetPartitionID())
+ return FALSE;
- // If only one of the volumes is not replicated, then only replicate
- // that volume, or if we could not determine if they were replicated
+ // If only one of the volumes is not replicated, then only replicate
+ // that volume, or if we could not determine if they were replicated
// until configuration began, and they are replicated, then do nothing.
- if (g_CfgData.bRootAfsExists && !g_CfgData.bRootAfsReplicated) {
- g_LogFile.Write("Creating a read only site for volume root.afs using partition ID %d and volume ID %d.\r\n", m_nPartitionID, g_CfgData.nRootAfsID);
+ if (g_CfgData.bRootAfsExists && !g_CfgData.bRootAfsReplicated) {
+ g_LogFile.Write("Creating a read only site for volume root.afs using partition ID %d and volume ID %d.\r\n", m_nPartitionID, g_CfgData.nRootAfsID);
- m_nResult = vos_VLDBReadOnlySiteCreate(g_hCell, m_hvosServer, 0, m_nPartitionID, g_CfgData.nRootAfsID, &m_nStatus);
- CHECK_RESULT;
+ m_nResult = vos_VLDBReadOnlySiteCreate(g_hCell, m_hvosServer, 0, m_nPartitionID, g_CfgData.nRootAfsID, &m_nStatus);
+ CHECK_RESULT;
- g_LogFile.Write("Releasing the root.afs volume using volume ID %d.\r\n", g_CfgData.nRootAfsID);
+ g_LogFile.Write("Releasing the root.afs volume using volume ID %d.\r\n", g_CfgData.nRootAfsID);
- m_nResult = vos_VolumeRelease(g_hCell, 0, g_CfgData.nRootAfsID, VOS_NORMAL, &m_nStatus);
- CHECK_RESULT;
+ m_nResult = vos_VolumeRelease(g_hCell, 0, g_CfgData.nRootAfsID, VOS_NORMAL, &m_nStatus);
+ CHECK_RESULT;
- g_CfgData.bRootAfsReplicated = TRUE;
- }
+ g_CfgData.bRootAfsReplicated = TRUE;
+ }
- if (g_CfgData.bRootCellExists && !g_CfgData.bRootCellReplicated) {
- g_LogFile.Write("Creating a read only site for volume root.cell using partition ID %d and volume ID %d.\r\n", m_nPartitionID, g_CfgData.nRootCellID);
+ if (g_CfgData.bRootCellExists && !g_CfgData.bRootCellReplicated) {
+ g_LogFile.Write("Creating a read only site for volume root.cell using partition ID %d and volume ID %d.\r\n", m_nPartitionID, g_CfgData.nRootCellID);
- m_nResult = vos_VLDBReadOnlySiteCreate(g_hCell, m_hvosServer, 0, m_nPartitionID, g_CfgData.nRootCellID, &m_nStatus);
- CHECK_RESULT;
+ m_nResult = vos_VLDBReadOnlySiteCreate(g_hCell, m_hvosServer, 0, m_nPartitionID, g_CfgData.nRootCellID, &m_nStatus);
+ CHECK_RESULT;
- g_LogFile.Write("Releasing the root.cell volume using volume ID %d.\r\n", g_CfgData.nRootCellID);
+ g_LogFile.Write("Releasing the root.cell volume using volume ID %d.\r\n", g_CfgData.nRootCellID);
- m_nResult = vos_VolumeRelease(g_hCell, 0, g_CfgData.nRootCellID, VOS_NORMAL, &m_nStatus);
- CHECK_RESULT;
+ m_nResult = vos_VolumeRelease(g_hCell, 0, g_CfgData.nRootCellID, VOS_NORMAL, &m_nStatus);
+ CHECK_RESULT;
- g_CfgData.bRootCellReplicated = TRUE;
- }
+ g_CfgData.bRootCellReplicated = TRUE;
+ }
- return TRUE;
-}
+ return TRUE;
+}
static BOOL EnableAuthChecking()
{
- ASSERT(g_hCell);
- ASSERT(g_CfgData.szHostname[0]);
+ ASSERT(g_hCell);
+ ASSERT(g_CfgData.szHostname[0]);
- void *hbosServer;
+ void *hbosServer;
- g_LogFile.Write("Bos open of server '%s'.\r\n", GetHostnameA());
- m_nResult = bos_ServerOpen(g_hCell, GetHostnameA(), &hbosServer, &m_nStatus);
- CHECK_RESULT;
+ g_LogFile.Write("Bos open of server '%s'.\r\n", GetHostnameA());
+ m_nResult = bos_ServerOpen(g_hCell, GetHostnameA(), &hbosServer, &m_nStatus);
+ CHECK_RESULT;
- ASSERT(hbosServer);
+ ASSERT(hbosServer);
- g_LogFile.Write("Enabling auth checking.\r\n");
- m_nResult = bos_AuthSet(hbosServer, BOS_AUTH_REQUIRED, &m_nStatus);
- CHECK_RESULT;
+ g_LogFile.Write("Enabling auth checking.\r\n");
+ m_nResult = bos_AuthSet(hbosServer, BOS_AUTH_REQUIRED, &m_nStatus);
+ CHECK_RESULT;
- g_LogFile.Write("Closing bos server connection.\r\n");
- m_nResult = bos_ServerClose(hbosServer, &m_nStatus);
- CHECK_RESULT;
+ g_LogFile.Write("Closing bos server connection.\r\n");
+ m_nResult = bos_ServerClose(hbosServer, &m_nStatus);
+ CHECK_RESULT;
- return TRUE;
+ return TRUE;
}
static BOOL UpgradeLibHandles()
{
- ASSERT(g_CfgData.szCellName[0]);
- ASSERT(g_CfgData.szAdminName[0]);
- ASSERT(g_CfgData.szAdminPW[0]);
+ ASSERT(g_CfgData.szCellName[0]);
+ ASSERT(g_CfgData.szAdminName[0]);
+ ASSERT(g_CfgData.szAdminPW[0]);
- g_LogFile.Write("Getting credentials in cell '%s' as admin '%s'.\r\n", GetCellNameA(), GetAdminNameA());
+ g_LogFile.Write("Getting credentials in cell '%s' as admin '%s'.\r\n", GetCellNameA(), GetAdminNameA());
- m_nResult = GetLibHandles(&m_nStatus);
- CHECK_RESULT;
+ m_nResult = GetLibHandles(&m_nStatus);
+ CHECK_RESULT;
- return TRUE;
+ return TRUE;
}
static BOOL RestartServers()
{
- ASSERT(g_hCell);
+ ASSERT(g_hCell);
- void *hbosServer;
+ void *hbosServer;
- g_LogFile.Write("Bos open of server '%s'.\r\n", GetHostnameA());
- m_nResult = bos_ServerOpen(g_hCell, GetHostnameA(), &hbosServer, &m_nStatus);
- CHECK_RESULT;
+ g_LogFile.Write("Bos open of server '%s'.\r\n", GetHostnameA());
+ m_nResult = bos_ServerOpen(g_hCell, GetHostnameA(), &hbosServer, &m_nStatus);
+ CHECK_RESULT;
- ASSERT(hbosServer);
+ ASSERT(hbosServer);
- g_LogFile.Write("Stopping and restarting all bos processes.\r\n");
- m_nResult = bos_ProcessAllStopAndRestart(hbosServer, BOS_RESTART_BOS_SERVER, &m_nStatus);
- CHECK_RESULT;
+ g_LogFile.Write("Stopping and restarting all bos processes.\r\n");
+ m_nResult = bos_ProcessAllStopAndRestart(hbosServer, BOS_RESTART_BOS_SERVER, &m_nStatus);
+ CHECK_RESULT;
- g_LogFile.Write("Closing bos server connection.\r\n");
- m_nResult = bos_ServerClose(hbosServer, &m_nStatus);
- CHECK_RESULT;
+ g_LogFile.Write("Closing bos server connection.\r\n");
+ m_nResult = bos_ServerClose(hbosServer, &m_nStatus);
+ CHECK_RESULT;
- return TRUE;
-}
+ return TRUE;
+}
void DbAddHostCallback(void *callBackId, cfg_cellServDbStatus_t *statusItemP, int status)
{
- // Is this our call back ID?
- if (callBackId != (void *)&m_CallBackID)
- return;
-
- // Update the var that tracks server updates so the main config thread won't
- // think we have timed out.
- EnterCriticalSection(&m_CritSec);
- m_nServerUpdates++;
- LeaveCriticalSection(&m_CritSec);
-
- // Is this the last callback?
- if (!statusItemP) {
- m_nStatus = status;
- m_nResult = !status;
- SetEvent(m_hCellServDBUpdateEvent); // Signal config thread that we are done
- return;
- }
+ // Is this our call back ID?
+ if (callBackId != (void *)&m_CallBackID)
+ return;
+
+ // Update the var that tracks server updates so the main config thread won't
+ // think we have timed out.
+ EnterCriticalSection(&m_CritSec);
+ m_nServerUpdates++;
+ LeaveCriticalSection(&m_CritSec);
+
+ // Is this the last callback?
+ if (!statusItemP) {
+ m_nStatus = status;
+ m_nResult = !status;
+ SetEvent(m_hCellServDBUpdateEvent); // Signal config thread that we are done
+ return;
+ }
- UINT nStrID;
+ UINT nStrID;
- // Did the update of the current host succeed?
- if (statusItemP->status == 0)
- nStrID = IDS_UPDATING_CELLSERVDB_HOST_SUCCEEDED;
- else {
- m_bCellServDbUpdateErr = TRUE;
- nStrID = IDS_UPDATING_CELLSERVDB_HOST_FAILED;
- }
+ // Did the update of the current host succeed?
+ if (statusItemP->status == 0)
+ nStrID = IDS_UPDATING_CELLSERVDB_HOST_SUCCEEDED;
+ else {
+ m_bCellServDbUpdateErr = TRUE;
+ nStrID = IDS_UPDATING_CELLSERVDB_HOST_FAILED;
+ }
- TCHAR szMsg[cchRESOURCE];
- GetString(szMsg, nStrID);
- _tcscat(szMsg, A2S(statusItemP->fsDbHost));
- ShowCurrentStep(szMsg);
+ TCHAR szMsg[cchRESOURCE];
+ GetString(szMsg, nStrID);
+ _tcscat(szMsg, A2S(statusItemP->fsDbHost));
+ ShowCurrentStep(szMsg);
- g_LogFile.Write("Update of the CellServDB file on host %s %s.\r\n", statusItemP->fsDbHost, statusItemP->status ? "failed" : "succeeded");
+ g_LogFile.Write("Update of the CellServDB file on host %s %s.\r\n", statusItemP->fsDbHost, statusItemP->status ? "failed" : "succeeded");
- cfg_CellServDbStatusDeallocate(statusItemP, &m_nStatus);
- // We don't care if this fails
-}
+ cfg_CellServDbStatusDeallocate(statusItemP, &m_nStatus);
+ // We don't care if this fails
+}
static BOOL UpdateCellServDB(BOOL bAdding)
{
- ASSERT(g_hServer);
- ASSERT(g_CfgData.szCellName[0]);
+ ASSERT(g_hServer);
+ ASSERT(g_CfgData.szCellName[0]);
- int nMaxUpdates;
+ int nMaxUpdates;
- cfg_cellServDbUpdateCallBack_t callBack = (cfg_cellServDbUpdateCallBack_t)DbAddHostCallback;
+ cfg_cellServDbUpdateCallBack_t callBack = (cfg_cellServDbUpdateCallBack_t)DbAddHostCallback;
- // Create the event that the callback routine will use to tell us it is finished.
- // If we fail to create the event then don't use a callback routine.
- m_hCellServDBUpdateEvent = CreateEvent(NULL /* Sec */, FALSE /* Manual Reset */, FALSE /* Initial State */, m_pszCellServDBUpdateEventName);
- if (!m_hCellServDBUpdateEvent) {
- // Cause the CHECK_RESULT below to fail
- m_nResult = 0;
- m_nStatus = GetLastError();
- }
- CHECK_RESULT;
+ // Create the event that the callback routine will use to tell us it is finished.
+ // If we fail to create the event then don't use a callback routine.
+ m_hCellServDBUpdateEvent = CreateEvent(NULL /* Sec */, FALSE /* Manual Reset */, FALSE /* Initial State */, m_pszCellServDBUpdateEventName);
+ if (!m_hCellServDBUpdateEvent) {
+ // Cause the CHECK_RESULT below to fail
+ m_nResult = 0;
+ m_nStatus = GetLastError();
+ }
+ CHECK_RESULT;
- // Create our critical section
- InitializeCriticalSection(&m_CritSec);
+ // Create our critical section
+ InitializeCriticalSection(&m_CritSec);
- // Update CellServDB via a SCM if the user specified one
- char *pszSCM = 0;
- if (g_CfgData.szSysControlMachine[0]) {
- pszSCM = GetSysControlMachineA();
- g_LogFile.Write("We will update CellServDB using Sys Control Machine %s.\r\n", pszSCM);
- }
+ // Update CellServDB via a SCM if the user specified one
+ char *pszSCM = 0;
+ if (g_CfgData.szSysControlMachine[0]) {
+ pszSCM = GetSysControlMachineA();
+ g_LogFile.Write("We will update CellServDB using Sys Control Machine %s.\r\n", pszSCM);
+ }
- // Update CellServDB on all servers
- g_LogFile.Write("Updating CellServDB on all servers in the cell.\r\n");
- if (bAdding)
- m_nResult = cfg_CellServDbAddHost(g_hServer, pszSCM, callBack, (void *)&m_CallBackID, &nMaxUpdates, &m_nStatus);
- else
- m_nResult = cfg_CellServDbRemoveHost(g_hServer, pszSCM, callBack, (void *)&m_CallBackID, &nMaxUpdates, &m_nStatus);
- CHECK_RESULT;
+ // Update CellServDB on all servers
+ g_LogFile.Write("Updating CellServDB on all servers in the cell.\r\n");
+ if (bAdding)
+ m_nResult = cfg_CellServDbAddHost(g_hServer, pszSCM, callBack, (void *)&m_CallBackID, &nMaxUpdates, &m_nStatus);
+ else
+ m_nResult = cfg_CellServDbRemoveHost(g_hServer, pszSCM, callBack, (void *)&m_CallBackID, &nMaxUpdates, &m_nStatus);
+ CHECK_RESULT;
- // Update CellServDB for the client on this machine
- g_LogFile.Write("Updating the client's CellServDB.\r\n");
- if (bAdding)
- cfg_ClientCellServDbAdd(g_hClient, GetCellNameA(), GetHostnameA(), &m_nStatus);
- else
- cfg_ClientCellServDbRemove(g_hClient, GetCellNameA(), GetHostnameA(), &m_nStatus);
- CHECK_RESULT;
+ // Update CellServDB for the client on this machine
+ g_LogFile.Write("Updating the client's CellServDB.\r\n");
+ if (bAdding)
+ cfg_ClientCellServDbAdd(g_hClient, GetCellNameA(), GetHostnameA(), &m_nStatus);
+ else
+ cfg_ClientCellServDbRemove(g_hClient, GetCellNameA(), GetHostnameA(), &m_nStatus);
+ CHECK_RESULT;
- BOOL bDone = FALSE;
-
- while (!bDone) {
- switch (WaitForSingleObject(m_hCellServDBUpdateEvent, CELLSERVDB_UPDATE_TIMEOUT))
- {
- case WAIT_OBJECT_0: bDone = TRUE; // The callback function signalled us that it is done.
- break;
-
- case WAIT_TIMEOUT:
- // We timed out so see if a server was updated. If it was then all is cool
- // and we can keep going (after clearing the server update count flag).
- EnterCriticalSection(&m_CritSec);
-
- if (m_nServerUpdates)
- m_nServerUpdates = 0;
- else {
- // There were no server updates, so we really did timeout
- TCHAR szMsg[cchRESOURCE];
- GetString(szMsg, IDS_CELLSERVDB_UPDATE_PROBLEM);
- _tcscat(m_szCellServDbUpdateErrMsg, szMsg);
- bDone = TRUE;
- }
-
- LeaveCriticalSection(&m_CritSec);
+ BOOL bDone = FALSE;
- break;
- default:
- // No other return values are valid when waiting on an event object
- ASSERT(FALSE);
- break;
- }
+ while (!bDone) {
+ switch (WaitForSingleObject(m_hCellServDBUpdateEvent, CELLSERVDB_UPDATE_TIMEOUT))
+ {
+ case WAIT_OBJECT_0: bDone = TRUE; // The callback function signalled us that it is done.
+ break;
+
+ case WAIT_TIMEOUT:
+ // We timed out so see if a server was updated. If it was then all is cool
+ // and we can keep going (after clearing the server update count flag).
+ EnterCriticalSection(&m_CritSec);
+
+ if (m_nServerUpdates)
+ m_nServerUpdates = 0;
+ else {
+ // There were no server updates, so we really did timeout
+ TCHAR szMsg[cchRESOURCE];
+ GetString(szMsg, IDS_CELLSERVDB_UPDATE_PROBLEM);
+ _tcscat(m_szCellServDbUpdateErrMsg, szMsg);
+ bDone = TRUE;
+ }
+
+ LeaveCriticalSection(&m_CritSec);
+
+ break;
+ default:
+ // No other return values are valid when waiting on an event object
+ ASSERT(FALSE);
+ break;
}
+ }
- DeleteCriticalSection(&m_CritSec);
+ DeleteCriticalSection(&m_CritSec);
- CloseHandle(m_hCellServDBUpdateEvent);
+ CloseHandle(m_hCellServDBUpdateEvent);
- // See if a failure occurred in the callback
- CHECK_RESULT;
+ // See if a failure occurred in the callback
+ CHECK_RESULT;
- return TRUE;
-}
+ return TRUE;
+}
static BOOL AddToCellServDB()
{
- return UpdateCellServDB(TRUE);
+ return UpdateCellServDB(TRUE);
}
static BOOL RemoveFromCellServDB()
-{
- return UpdateCellServDB(FALSE);
+{
+ return UpdateCellServDB(FALSE);
}
static BOOL RestartAllDbServers()
-{
- ASSERT(g_hServer);
+{
+ ASSERT(g_hServer);
- if (m_bUnconfiguringLastDBServer)
- return TRUE;
+ if (m_bUnconfiguringLastDBServer)
+ return TRUE;
- g_LogFile.Write("Restarting all DB servers.\r\n");
- m_nResult = cfg_DbServersRestartAll(g_hServer, &m_nStatus);
- CHECK_RESULT;
+ g_LogFile.Write("Restarting all DB servers.\r\n");
+ m_nResult = cfg_DbServersRestartAll(g_hServer, &m_nStatus);
+ CHECK_RESULT;
- g_LogFile.Write("Waiting for all DB servers to reach quorum.\r\n");
- m_nResult = cfg_DbServersWaitForQuorum(g_hServer, QUORUM_WAIT_TIMEOUT, &m_nStatus);
- CHECK_RESULT;
+ g_LogFile.Write("Waiting for all DB servers to reach quorum.\r\n");
+ m_nResult = cfg_DbServersWaitForQuorum(g_hServer, QUORUM_WAIT_TIMEOUT, &m_nStatus);
+ CHECK_RESULT;
- m_bDbServersRestarted = TRUE;
+ m_bDbServersRestarted = TRUE;
- return TRUE;
-}
+ return TRUE;
+}
static BOOL UnconfigDB()
{
- ASSERT(g_hServer);
+ ASSERT(g_hServer);
- m_nResult = RemoveFromCellServDB();
- CHECK_RESULT;
+ m_nResult = RemoveFromCellServDB();
+ CHECK_RESULT;
- m_nResult = cfg_DbServersStop(g_hServer, &m_nStatus);
- CHECK_RESULT;
+ m_nResult = cfg_DbServersStop(g_hServer, &m_nStatus);
+ CHECK_RESULT;
- return TRUE;
+ return TRUE;
}
static BOOL UnconfigBak()
{
- ASSERT(g_hServer);
+ ASSERT(g_hServer);
- int nResult = cfg_DbServersStopAllBackup(g_hServer, &m_nStatus);
- CHECK_RESULT;
+ int nResult = cfg_DbServersStopAllBackup(g_hServer, &m_nStatus);
+ CHECK_RESULT;
- return TRUE;
+ return TRUE;
}
static BOOL UnconfigFS()
{
- ASSERT(g_hServer);
+ ASSERT(g_hServer);
- m_nResult = cfg_FileServerStop(g_hServer, &m_nStatus);
- CHECK_RESULT;
+ m_nResult = cfg_FileServerStop(g_hServer, &m_nStatus);
+ CHECK_RESULT;
- return TRUE;
-}
+ return TRUE;
+}
static BOOL UnconfigSCS()
-{
- ASSERT(g_hServer);
+{
+ ASSERT(g_hServer);
- m_nResult = cfg_UpdateServerStop(g_hServer, &m_nStatus);
- CHECK_RESULT;
+ m_nResult = cfg_UpdateServerStop(g_hServer, &m_nStatus);
+ CHECK_RESULT;
// Since we are no longer the SCS machine, we better null this guy.
g_CfgData.szSysControlMachine[0] = 0;
- return TRUE;
+ return TRUE;
}
static BOOL UnconfigSCC()
{
- ASSERT(g_hServer);
+ ASSERT(g_hServer);
- m_nResult = cfg_UpdateClientStop(g_hServer, cfg_upclientSysBosSuffix, &m_nStatus);
- CHECK_RESULT;
+ m_nResult = cfg_UpdateClientStop(g_hServer, cfg_upclientSysBosSuffix, &m_nStatus);
+ CHECK_RESULT;
- return TRUE;
+ return TRUE;
}
static BOOL AllServicesUnconfigured()
{
#define NOTCONFIGURED(x) (((x) == CS_UNCONFIGURE) || ((x) == CS_NULL))
- return (NOTCONFIGURED(g_CfgData.configFS) &&
- NOTCONFIGURED(g_CfgData.configDB) &&
- NOTCONFIGURED(g_CfgData.configBak) &&
- NOTCONFIGURED(g_CfgData.configSCS) &&
- NOTCONFIGURED(g_CfgData.configSCC));
+ return (NOTCONFIGURED(g_CfgData.configFS) &&
+ NOTCONFIGURED(g_CfgData.configDB) &&
+ NOTCONFIGURED(g_CfgData.configBak) &&
+ NOTCONFIGURED(g_CfgData.configSCS) &&
+ NOTCONFIGURED(g_CfgData.configSCC));
}
static BOOL PostConfig()
{
- ASSERT(g_hServer);
+ ASSERT(g_hServer);
- short isStarted = 0, bosProcsRunning = 0;
+ short isStarted = 0, bosProcsRunning = 0;
- if (!AllServicesUnconfigured())
- return TRUE;
+ if (!AllServicesUnconfigured())
+ return TRUE;
// If there is now no cell, then stop the client
if (m_bUnconfiguringLastDBServer) {
}
// Ask user if the config info should be invalided
- g_LogFile.Write("No services are configured so we will ask the user if they want to invalidate the server config info.\r\n");
- int nChoice = Message(MB_OK | MB_YESNO, GetAppTitleID(), IDS_INVALIDATE_CFG_INFO);
- if (nChoice == IDNO) {
- g_LogFile.Write("User has chosen NOT to invalidate the server config info.\r\n");
- return TRUE;
- }
+ g_LogFile.Write("No services are configured so we will ask the user if they want to invalidate the server config info.\r\n");
+ int nChoice = Message(MB_OK | MB_YESNO, GetAppTitleID(), IDS_INVALIDATE_CFG_INFO);
+ if (nChoice == IDNO) {
+ g_LogFile.Write("User has chosen NOT to invalidate the server config info.\r\n");
+ return TRUE;
+ }
- ShowCurrentStep(IDS_INVALIDATE_CONFIG_INFO_STEP);
+ ShowCurrentStep(IDS_INVALIDATE_CONFIG_INFO_STEP);
g_LogFile.Write("User has chosen to invalidate the server config info.\r\n");
- g_LogFile.Write("Stopping the bos server.\r\n");
- m_nResult = cfg_BosServerStop(g_hServer, BOSSERVER_STOP_TIMEOUT, &m_nStatus);
- CHECK_RESULT;
+ g_LogFile.Write("Stopping the bos server.\r\n");
+ m_nResult = cfg_BosServerStop(g_hServer, BOSSERVER_STOP_TIMEOUT, &m_nStatus);
+ CHECK_RESULT;
- g_LogFile.Write("Invalidating the config info.\r\n");
- m_nResult = cfg_HostInvalidate(g_hServer, &m_nStatus);
- CHECK_RESULT;
+ g_LogFile.Write("Invalidating the config info.\r\n");
+ m_nResult = cfg_HostInvalidate(g_hServer, &m_nStatus);
+ CHECK_RESULT;
- m_bCfgInfoInvalidated = TRUE;
+ m_bCfgInfoInvalidated = TRUE;
m_bMustExit = TRUE;
- return TRUE;
-}
+ return TRUE;
+}
static void VosCloseServer()
{
- if (m_hvosServer) {
- g_LogFile.Write("Closing the connection to this server.\r\n");
- vos_ServerClose(m_hvosServer, &m_nStatus);
- m_hvosServer = 0;
- }
-}
+ if (m_hvosServer) {
+ g_LogFile.Write("Closing the connection to this server.\r\n");
+ vos_ServerClose(m_hvosServer, &m_nStatus);
+ m_hvosServer = 0;
+ }
+}
static void ShowConfigControls(BOOL bShow)
{
- ShowWnd(m_hDlg, IDC_CURRENT_STEP_LABEL, bShow);
- ShowWnd(m_hDlg, IDC_CURRENT_STEP, bShow);
- ShowWnd(m_hDlg, IDC_CONFIG_PROGRESS, bShow);
- ShowWnd(m_hDlg, IDC_PERCENT_COMPLETE_LABEL, bShow);
- ShowWnd(m_hDlg, IDC_PERCENT_COMPLETE, bShow);
- ShowWnd(m_hDlg, IDC_STATUS_MSG, !bShow);
+ ShowWnd(m_hDlg, IDC_CURRENT_STEP_LABEL, bShow);
+ ShowWnd(m_hDlg, IDC_CURRENT_STEP, bShow);
+ ShowWnd(m_hDlg, IDC_CONFIG_PROGRESS, bShow);
+ ShowWnd(m_hDlg, IDC_PERCENT_COMPLETE_LABEL, bShow);
+ ShowWnd(m_hDlg, IDC_PERCENT_COMPLETE, bShow);
+ ShowWnd(m_hDlg, IDC_STATUS_MSG, !bShow);
}
static void UpdateConfigProgress(int nStepNum)
{
- // Update the progress bar
- SendDlgItemMessage(m_hDlg, IDC_CONFIG_PROGRESS, PBM_STEPIT, 0, 0);
+ // Update the progress bar
+ SendDlgItemMessage(m_hDlg, IDC_CONFIG_PROGRESS, PBM_STEPIT, 0, 0);
- // Update the percent complete
- TCHAR buf[16];
- _stprintf(buf, TEXT("%2d%%"), nStepNum * 100 / m_nNumSteps);
+ // Update the percent complete
+ TCHAR buf[16];
+ _stprintf(buf, TEXT("%2d%%"), nStepNum * 100 / m_nNumSteps);
- SetWndText(m_hDlg, IDC_PERCENT_COMPLETE, buf);
- ForceUpdateWindow(m_hDlg, IDC_PERCENT_COMPLETE);
+ SetWndText(m_hDlg, IDC_PERCENT_COMPLETE, buf);
+ ForceUpdateWindow(m_hDlg, IDC_PERCENT_COMPLETE);
}
static void ViewLog()
{
- char szCmdLine[MAX_PATH];
+ char szCmdLine[MAX_PATH];
- if (_access(g_LogFile.GetPath(), 0) != 0) {
- ShowError(m_hDlg, 0, IDS_ERROR_NO_LOG_FILE);
- return;
- }
+ if (_access(g_LogFile.GetPath(), 0) != 0) {
+ ShowError(m_hDlg, 0, IDS_ERROR_NO_LOG_FILE);
+ return;
+ }
- sprintf(szCmdLine, "notepad.exe %s", g_LogFile.GetPath());
-
- UINT result = WinExec(szCmdLine, SW_SHOW);
- if (result < 32)
- ShowError(m_hDlg, result, IDS_VIEW_LOG_ERROR);
+ sprintf(szCmdLine, "notepad.exe %s", g_LogFile.GetPath());
+
+ UINT result = WinExec(szCmdLine, SW_SHOW);
+ if (result < 32)
+ ShowError(m_hDlg, result, IDS_VIEW_LOG_ERROR);
}
static void AssignFailure(int nCurStep, int nLastMainStep)
{
- // A config step has failed, so we will first set its state to
- // failure. If the step does not have a place on the dialog
- // the we must find some other control to show the red X that
- // indicates failure.
+ // A config step has failed, so we will first set its state to
+ // failure. If the step does not have a place on the dialog
+ // the we must find some other control to show the red X that
+ // indicates failure.
- m_ConfigSteps[nCurStep].eState = SS_STEP_FAILED;
+ m_ConfigSteps[nCurStep].eState = SS_STEP_FAILED;
- // Is the step displayed on the dialog?
- if (m_ConfigSteps[nCurStep].nDescID != 0)
- return;
+ // Is the step displayed on the dialog?
+ if (m_ConfigSteps[nCurStep].nDescID != 0)
+ return;
- // It isn't so find nearest one that is
- for (int ii = nCurStep + 1; ii < m_nNumSteps; ii++) {
- CONFIG_STEP& step = m_ConfigSteps[ii];
- if (step.nDescID != 0) {
- step.eState = SS_STEP_FAILED;
- IF_WIZ(ForceUpdateWindow(m_hDlg, step.nGraphicCtrlID));
- return;
- }
+ // It isn't so find nearest one that is
+ for (int ii = nCurStep + 1; ii < m_nNumSteps; ii++) {
+ CONFIG_STEP& step = m_ConfigSteps[ii];
+ if (step.nDescID != 0) {
+ step.eState = SS_STEP_FAILED;
+ IF_WIZ(ForceUpdateWindow(m_hDlg, step.nGraphicCtrlID));
+ return;
}
+ }
- // There is no step on the dialog that is after us, so
- // use the last one that is there.
- m_ConfigSteps[nLastMainStep].eState = SS_STEP_FAILED;
- IF_WIZ(ForceUpdateWindow(m_hDlg, m_ConfigSteps[nLastMainStep].nGraphicCtrlID));
-}
+ // There is no step on the dialog that is after us, so
+ // use the last one that is there.
+ m_ConfigSteps[nLastMainStep].eState = SS_STEP_FAILED;
+ IF_WIZ(ForceUpdateWindow(m_hDlg, m_ConfigSteps[nLastMainStep].nGraphicCtrlID));
+}
static int GetLastMainStep()
{
- for (int ii = m_nNumSteps - 1; ii >= 0; ii--) {
- if (m_ConfigSteps[ii].nDescID != 0)
- return ii;
- }
+ for (int ii = m_nNumSteps - 1; ii >= 0; ii--) {
+ if (m_ConfigSteps[ii].nDescID != 0)
+ return ii;
+ }
- ASSERT(FALSE); // This should never happen!
+ ASSERT(FALSE); // This should never happen!
- return 0;
-}
+ return 0;
+}
static void ShowConfigFailedMsg()
{
- LPTSTR pszMsg = FormatString(IDS_CONFIG_FAILED, TEXT("%hs%hs"), LOG_FILE_NAME, AFSDIR_SERVER_LOGS_DIRPATH);
+ LPTSTR pszMsg = FormatString(IDS_CONFIG_FAILED, TEXT("%hs%hs"), LOG_FILE_NAME, AFSDIR_SERVER_LOGS_DIRPATH);
- SetWndText(m_hDlg, IDC_STATUS_MSG, pszMsg);
+ SetWndText(m_hDlg, IDC_STATUS_MSG, pszMsg);
- FreeString(pszMsg);
+ FreeString(pszMsg);
}
static void ShowViewLogButton()
{
- if (g_pWiz)
- g_pWiz->SetButtonText(IDNEXT, IDS_VIEW_LOG);
- else {
- ShowAndEnable(m_hDlg, IDNEXT);
- MoveWnd(m_hDlg, IDCANCEL, -45, 0);
+ if (g_pWiz)
+ g_pWiz->SetButtonText(IDNEXT, IDS_VIEW_LOG);
+ else {
+ ShowAndEnable(m_hDlg, IDNEXT);
+ MoveWnd(m_hDlg, IDCANCEL, -45, 0);
// I had to add the code below because of a problem, where if config failed, the
// error message dialog would display over our window, and when our window next got
// fully displayed, the buttons would be misdrawn.
ForceUpdateWindow(m_hDlg, IDNEXT);
ForceUpdateWindow(m_hDlg, IDCANCEL);
- }
+ }
}
static DWORD WINAPI ConfigServer(LPVOID param)
{
- HWND hLogo;
+ HWND hLogo;
- if (!g_pWiz) {
- hLogo = GetDlgItem(m_hDlg, IDC_LOGO);
- AfsAppLib_StartAnimation(hLogo);
- }
+ if (!g_pWiz) {
+ hLogo = GetDlgItem(m_hDlg, IDC_LOGO);
+ AfsAppLib_StartAnimation(hLogo);
+ }
- // Disable all buttons (doesn't affect the Cancel button)
- IF_WIZ(g_pWiz->EnableButtons(0));
+ // Disable all buttons (doesn't affect the Cancel button)
+ IF_WIZ(g_pWiz->EnableButtons(0));
- g_LogFile.Write("Configuring server\r\n");
+ g_LogFile.Write("Configuring server\r\n");
- m_bConfiguring = TRUE;
- m_bConfigured = FALSE;
- m_bDbServersRestarted = FALSE;
+ m_bConfiguring = TRUE;
+ m_bConfigured = FALSE;
+ m_bDbServersRestarted = FALSE;
- // Hide the message window and show the config controls
- ShowConfigControls();
+ // Hide the message window and show the config controls
+ ShowConfigControls();
- InitProgressBar();
+ InitProgressBar();
- BOOL bResult = TRUE;
- int nStepNum = 0;
+ BOOL bResult = TRUE;
+ int nStepNum = 0;
int nLastMainStep;
- IF_WIZ(nLastMainStep = GetLastMainStep());
+ IF_WIZ(nLastMainStep = GetLastMainStep());
- // Loop over each config step performing the ones that are enabled.
- for (int nCurStep = 0; (nCurStep < m_nNumSteps) && bResult; nCurStep++) {
- CONFIG_STEP& step = m_ConfigSteps[nCurStep];
+ // Loop over each config step performing the ones that are enabled.
+ for (int nCurStep = 0; (nCurStep < m_nNumSteps) && bResult; nCurStep++) {
+ CONFIG_STEP& step = m_ConfigSteps[nCurStep];
- nStepNum++;
+ nStepNum++;
- // Show this step's status message
- ShowCurrentStep(step.nMsgID);
+ // Show this step's status message
+ ShowCurrentStep(step.nMsgID);
- step.eState = SS_STEP_IN_PROGRESS;
+ step.eState = SS_STEP_IN_PROGRESS;
- // If this is a displayed step, then update its display
- if (step.nGraphicCtrlID)
- IF_WIZ(ForceUpdateWindow(m_hDlg, step.nGraphicCtrlID));
+ // If this is a displayed step, then update its display
+ if (step.nGraphicCtrlID)
+ IF_WIZ(ForceUpdateWindow(m_hDlg, step.nGraphicCtrlID));
- if (CheckCancel())
- break;
+ if (CheckCancel())
+ break;
- // Perform the config function
- bResult = step.pFunc();
+ // Perform the config function
+ bResult = step.pFunc();
- if (bResult) {
+ if (bResult) {
if (g_pWiz) {
- // Changing a step's state changes what picture is shown on the dialog
- // (if that state is displayed on the dialog).
-
- // If this is the last displayed step, then don't change its state
- // because there may still be more steps to perform. We want to use
- // the last step's picture to indicate the final config state.
-
- // If not last step, then change state
- if (nCurStep != nLastMainStep)
- step.eState = SS_STEP_FINISHED;
-
- // If last step then go ahead and show the state - but do it on the last
- // step displayed on the dialog (nLastMainStep).
- if (nCurStep == m_nNumSteps - 1) {
- m_ConfigSteps[nLastMainStep].eState = SS_STEP_FINISHED;
- // Do the next line so ForceUpdateWindow below will redraw the
- // correct control
- step = m_ConfigSteps[nLastMainStep];
- }
- }
-
- UpdateConfigProgress(nStepNum);
- } else {
- // Show the 'X' error marker on the next unprocessed step, or on the
- // last step if there are no more.
- IF_WIZ(AssignFailure(nCurStep, nLastMainStep));
- step.eState = SS_STEP_FAILED;
+ // Changing a step's state changes what picture is shown on the dialog
+ // (if that state is displayed on the dialog).
+
+ // If this is the last displayed step, then don't change its state
+ // because there may still be more steps to perform. We want to use
+ // the last step's picture to indicate the final config state.
+
+ // If not last step, then change state
+ if (nCurStep != nLastMainStep)
+ step.eState = SS_STEP_FINISHED;
+
+ // If last step then go ahead and show the state - but do it on the last
+ // step displayed on the dialog (nLastMainStep).
+ if (nCurStep == m_nNumSteps - 1) {
+ m_ConfigSteps[nLastMainStep].eState = SS_STEP_FINISHED;
+ // Do the next line so ForceUpdateWindow below will redraw the
+ // correct control
+ step = m_ConfigSteps[nLastMainStep];
}
-
- if (step.nGraphicCtrlID)
- IF_WIZ(ForceUpdateWindow(m_hDlg, step.nGraphicCtrlID));
+ }
+
+ UpdateConfigProgress(nStepNum);
+ } else {
+ // Show the 'X' error marker on the next unprocessed step, or on the
+ // last step if there are no more.
+ IF_WIZ(AssignFailure(nCurStep, nLastMainStep));
+ step.eState = SS_STEP_FAILED;
}
- // Close m_hvosServer if it is open
- VosCloseServer();
-
- // Hide the config controls and show the message window
- ShowConfigControls(FALSE);
-
- // Did we succeed?
- if (CheckCancel()) {
- g_LogFile.Write("User has canceled configuration.\r\n");
- SetWndText(m_hDlg, IDC_STATUS_MSG, IDS_CONFIG_CANCELED);
- IF_WIZ(g_pWiz->EnableButtons(BACK_BUTTON));
- if (!g_pWiz)
- ShowExitButton();
- } else if (bResult) {
- g_LogFile.Write("Configuration succeeded.\r\n");
- if (g_CfgData.bFirstServer)
- SetWndText(m_hDlg, IDC_STATUS_MSG, IDS_CONFIG_SUCCEEDED_FIRST_SERVER);
- else if (m_bDbServersRestarted)
- SetWndText(m_hDlg, IDC_STATUS_MSG, IDS_CONFIG_SUCCEEDED_NEED_CELLSERVDB_UPDATE);
- else
- SetWndText(m_hDlg, IDC_STATUS_MSG, IDS_CONFIG_SUCCEEDED);
- IF_WIZ(g_pWiz->EnableButtons(NEXT_BUTTON));
- ShowExitButton();
- m_bConfigured = TRUE;
-
- // Disable cancel button
- IF_WIZ(SetEnable(g_pWiz->GetWindow(), IDCANCEL, ES_DISABLE));
- } else {
- g_LogFile.Write("Configuration has failed.\r\n");
- ShowConfigFailedMsg();
- // Prevent partial configuration
- if (!g_CfgData.bValidServerInfo)
- cfg_HostInvalidate(g_hServer, &m_nStatus);
- IF_WIZ(g_pWiz->EnableButtons(NEXT_BUTTON));
- ShowViewLogButton();
- m_bConfigFailed = TRUE;
- }
+ if (step.nGraphicCtrlID)
+ IF_WIZ(ForceUpdateWindow(m_hDlg, step.nGraphicCtrlID));
+ }
+
+ // Close m_hvosServer if it is open
+ VosCloseServer();
+
+ // Hide the config controls and show the message window
+ ShowConfigControls(FALSE);
+ // Did we succeed?
+ if (CheckCancel()) {
+ g_LogFile.Write("User has canceled configuration.\r\n");
+ SetWndText(m_hDlg, IDC_STATUS_MSG, IDS_CONFIG_CANCELED);
+ IF_WIZ(g_pWiz->EnableButtons(BACK_BUTTON));
if (!g_pWiz)
- AfsAppLib_StopAnimation(hLogo);
+ ShowExitButton();
+ } else if (bResult) {
+ g_LogFile.Write("Configuration succeeded.\r\n");
+ if (g_CfgData.bFirstServer)
+ SetWndText(m_hDlg, IDC_STATUS_MSG, IDS_CONFIG_SUCCEEDED_FIRST_SERVER);
+ else if (m_bDbServersRestarted)
+ SetWndText(m_hDlg, IDC_STATUS_MSG, IDS_CONFIG_SUCCEEDED_NEED_CELLSERVDB_UPDATE);
+ else
+ SetWndText(m_hDlg, IDC_STATUS_MSG, IDS_CONFIG_SUCCEEDED);
+ IF_WIZ(g_pWiz->EnableButtons(NEXT_BUTTON));
+ ShowExitButton();
+ m_bConfigured = TRUE;
+
+ // Disable cancel button
+ IF_WIZ(SetEnable(g_pWiz->GetWindow(), IDCANCEL, ES_DISABLE));
+ } else {
+ g_LogFile.Write("Configuration has failed.\r\n");
+ ShowConfigFailedMsg();
+ // Prevent partial configuration
+ if (!g_CfgData.bValidServerInfo)
+ cfg_HostInvalidate(g_hServer, &m_nStatus);
+ IF_WIZ(g_pWiz->EnableButtons(NEXT_BUTTON));
+ ShowViewLogButton();
+ m_bConfigFailed = TRUE;
+ }
+
+ if (!g_pWiz)
+ AfsAppLib_StopAnimation(hLogo);
- IF_WIZ(g_pWiz->SetDefaultControl(IDNEXT));
+ IF_WIZ(g_pWiz->SetDefaultControl(IDNEXT));
- m_bConfiguring = FALSE;
+ m_bConfiguring = FALSE;
// Show the user any CellServDB update errors
if (m_bCellServDbUpdateErr) {
- TCHAR szTitle[cchRESOURCE], szMsg[cchRESOURCE + MAX_PATH];
- GetString(szTitle, GetAppTitleID());
- GetString(szMsg, IDS_CELLSERVDB_UPDATE_ERRORS_ARE_IN_LOG_FILE);
- lstrcat(szMsg, A2S(g_LogFile.GetPath()));
- lstrcat(szMsg, TEXT("."));
- MessageBox(m_hDlg, szMsg, szTitle, MB_OK | MB_ICONEXCLAMATION);
- }
+ TCHAR szTitle[cchRESOURCE], szMsg[cchRESOURCE + MAX_PATH];
+ GetString(szTitle, GetAppTitleID());
+ GetString(szMsg, IDS_CELLSERVDB_UPDATE_ERRORS_ARE_IN_LOG_FILE);
+ lstrcat(szMsg, A2S(g_LogFile.GetPath()));
+ lstrcat(szMsg, TEXT("."));
+ MessageBox(m_hDlg, szMsg, szTitle, MB_OK | MB_ICONEXCLAMATION);
+ }
// Warn the user if we are going to force the config manager to exit
- if (m_bMustExit) {
+ if (m_bMustExit) {
if (m_bUnconfiguringLastDBServer)
- MsgBox(m_hDlg, IDS_CELL_IS_GONE_MUST_EXIT, GetAppTitleID(), MB_OK | MB_ICONSTOP);
- else
- MsgBox(m_hDlg, IDS_CONFIG_INFO_INVALIDATED, GetAppTitleID(), MB_OK);
- }
+ MsgBox(m_hDlg, IDS_CELL_IS_GONE_MUST_EXIT, GetAppTitleID(), MB_OK | MB_ICONSTOP);
+ else
+ MsgBox(m_hDlg, IDS_CONFIG_INFO_INVALIDATED, GetAppTitleID(), MB_OK);
+ }
// Unmap the root afs drive if we had one
if (m_bRootAfsDriveMappingCreated) {
BOOL bCanceled = WNetCancelConnection(A2S(m_szDriveToMapTo), TRUE) == NO_ERROR;
g_LogFile.Write(bCanceled ? "succeeded.\r\n" : "failed.\r\n");
m_bRootAfsDriveMappingCreated = !bCanceled;
- }
+ }
- return 0;
+ return 0;
}
static TCHAR szSize[32];
static rwWindowData arwDialog[] = {
- { IDC_TITLE, raSizeX | raRepaint, 0, 0 },
- { IDC_DRIVE_LIST, raSizeX | raSizeY, MAKELONG(350, 150), 0 },
- { IDC_ARGS_FRAME, raSizeX | raMoveY, 0, 0 },
- { IDC_NAME_STATIC, raMoveY | raRepaint, 0, 0 },
- { IDC_VICEP_STATIC, raMoveY | raRepaint, 0, 0 },
- { IDC_PARTITION_NAME, raMoveY | raRepaint, 0, 0 },
- { IDC_CREATE, raMoveX | raMoveY, 0, 0 },
- { IDC_CLOSE, raMoveX | raMoveY, 0, 0 },
- { 9, raMoveX | raMoveY, 0, 0 },
- { idENDLIST, 0, 0, 0 }
+ { IDC_TITLE, raSizeX | raRepaint, 0, 0 },
+ { IDC_DRIVE_LIST, raSizeX | raSizeY, MAKELONG(350, 150), 0 },
+ { IDC_ARGS_FRAME, raSizeX | raMoveY, 0, 0 },
+ { IDC_NAME_STATIC, raMoveY | raRepaint, 0, 0 },
+ { IDC_VICEP_STATIC, raMoveY | raRepaint, 0, 0 },
+ { IDC_PARTITION_NAME, raMoveY | raRepaint, 0, 0 },
+ { IDC_CREATE, raMoveX | raMoveY, 0, 0 },
+ { IDC_CLOSE, raMoveX | raMoveY, 0, 0 },
+ { 9, raMoveX | raMoveY, 0, 0 },
+ { idENDLIST, 0, 0, 0 }
};
*/
BOOL CreatePartition(HWND hParent)
{
- ModalDialog(IDD, hParent, (DLGPROC)DlgProc);
+ ModalDialog(IDD, hParent, (DLGPROC)DlgProc);
- return bCreated;
+ return bCreated;
}
*/
static BOOL CALLBACK DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- if (AfsAppLib_HandleHelp(IDD_CREATE_PARTITION, hwndDlg, uMsg, wParam, lParam))
- return TRUE;
-
- switch (uMsg) {
- case WM_INITDIALOG: OnInitDialog(hwndDlg);
- break;
-
- case WM_COMMAND: switch (LOWORD(wParam)) {
- case IDC_CLOSE: OnClose();
- break;
-
- case IDC_CREATE: OnCreate();
- break;
-
- case IDC_PARTITION_NAME:
- if (HIWORD(wParam) == EN_CHANGE) {
- OnPartitionName();
- SetFocus((HWND)lParam);
- }
- break;
- }
- break;
+ if (AfsAppLib_HandleHelp(IDD_CREATE_PARTITION, hwndDlg, uMsg, wParam, lParam))
+ return TRUE;
+
+ switch (uMsg) {
+ case WM_INITDIALOG: OnInitDialog(hwndDlg);
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_CLOSE:
+ OnClose();
+ break;
+
+ case IDC_CREATE:
+ OnCreate();
+ break;
+
+ case IDC_PARTITION_NAME:
+ if (HIWORD(wParam) == EN_CHANGE) {
+ OnPartitionName();
+ SetFocus((HWND)lParam);
+ }
+ break;
+ }
+ break;
- case WM_NCACTIVATE: if (wParam)
- UpdateDriveList();
- break;
+ case WM_NCACTIVATE: if (wParam)
+ UpdateDriveList();
+ break;
- case WM_NOTIFY: if ((((LPNMHDR)lParam)->code) == FLN_ITEMSELECT)
- OnListSelection((LPFLN_ITEMSELECT_PARAMS)lParam);
- break;
+ case WM_NOTIFY:
+ if ((((LPNMHDR)lParam)->code) == FLN_ITEMSELECT)
+ OnListSelection((LPFLN_ITEMSELECT_PARAMS)lParam);
+ break;
- case WM_SIZE: if (lParam != 0)
- ResizeWindow(hwndDlg, arwDialog, rwaFixupGuts);
- break;
+ case WM_SIZE:
+ if (lParam != 0)
+ ResizeWindow(hwndDlg, arwDialog, rwaFixupGuts);
+ break;
- }
+ }
- return FALSE;
+ return FALSE;
}
*/
static void OnInitDialog(HWND hwndDlg)
{
- hDlg = hwndDlg;
+ hDlg = hwndDlg;
- ResizeWindow(hDlg, arwDialog, rwaFixupGuts);
+ ResizeWindow(hDlg, arwDialog, rwaFixupGuts);
- hDriveList = GetDlgItem(hDlg, IDC_DRIVE_LIST);
+ hDriveList = GetDlgItem(hDlg, IDC_DRIVE_LIST);
- bAutoSetPartitionName = TRUE;
- hSelectedItem = 0;
+ bAutoSetPartitionName = TRUE;
+ hSelectedItem = 0;
- SetupDriveList(hDriveList);
+ SetupDriveList(hDriveList);
- bCreated = FALSE;
+ bCreated = FALSE;
}
static void OnClose()
{
- EndDialog(hDlg, IDCANCEL);
+ EndDialog(hDlg, IDCANCEL);
}
static void OnCreate()
{
- ASSERT(g_hServer);
+ ASSERT(g_hServer);
- HLISTITEM hItem = FastList_FindFirstSelected(hDriveList);
- _ASSERTE(hItem);
+ HLISTITEM hItem = FastList_FindFirstSelected(hDriveList);
+ _ASSERTE(hItem);
- GetWindowText(GetDlgItem(hDlg, IDC_PARTITION_NAME), szPartitionName, sizeof(szPartitionName));
+ GetWindowText(GetDlgItem(hDlg, IDC_PARTITION_NAME), szPartitionName, sizeof(szPartitionName));
if (!Validation_IsValid(szPartitionName, VALID_AFS_PARTITION_NAME))
return;
- lstrcpy(szDrive, FastList_GetItemText(hDriveList, hItem, 0));
- lstrcpy(szSize, FastList_GetItemText(hDriveList, hItem, 2));
+ lstrcpy(szDrive, FastList_GetItemText(hDriveList, hItem, 0));
+ lstrcpy(szSize, FastList_GetItemText(hDriveList, hItem, 2));
- // Constuct the device name
- char szDevNameA[] = "?:";
- S2A drive(szDrive);
+ // Constuct the device name
+ char szDevNameA[] = "?:";
+ S2A drive(szDrive);
szDevNameA[0] = ((char*)drive)[0];
- // Construct the partition name
- char szPartNameA[9] = "/vicep";
- strncat(szPartNameA, (char *)S2A(szPartitionName), 2);
+ // Construct the partition name
+ char szPartNameA[9] = "/vicep";
+ strncat(szPartNameA, (char *)S2A(szPartitionName), 2);
- if (DoesPartitionExist(A2S(szPartNameA))) {
- MsgBox(hDlg, IDS_PARTITION_EXISTS, GetAppTitleID(), MB_OK | MB_ICONSTOP);
- return;
- }
+ if (DoesPartitionExist(A2S(szPartNameA))) {
+ MsgBox(hDlg, IDS_PARTITION_EXISTS, GetAppTitleID(), MB_OK | MB_ICONSTOP);
+ return;
+ }
- g_LogFile.Write("Adding an AFS partition on device '%s' with name '%s'.\r\n", szDevNameA, szPartNameA);
+ g_LogFile.Write("Adding an AFS partition on device '%s' with name '%s'.\r\n", szDevNameA, szPartNameA);
- afs_status_t nStatus;
- int nResult = cfg_HostPartitionTableAddEntry(g_hServer, szPartNameA, szDevNameA, &nStatus);
- if (!nResult) {
- ShowError(hDlg, nStatus, IDS_CREATE_PARTITION_ERROR);
- return;
- }
+ afs_status_t nStatus;
+ int nResult = cfg_HostPartitionTableAddEntry(g_hServer, szPartNameA, szDevNameA, &nStatus);
+ if (!nResult) {
+ ShowError(hDlg, nStatus, IDS_CREATE_PARTITION_ERROR);
+ return;
+ }
- MsgBox(hDlg, IDS_PARTITION_CREATED, GetAppTitleID(), MB_OK);
+ MsgBox(hDlg, IDS_PARTITION_CREATED, GetAppTitleID(), MB_OK);
- bCreated = TRUE;
+ bCreated = TRUE;
- SetWndText(hDlg, IDC_PARTITION_NAME, TEXT(""));
+ SetWndText(hDlg, IDC_PARTITION_NAME, TEXT(""));
}
static void OnPartitionName()
-{
- TCHAR szBuf[MAX_PARTITION_NAME_LEN];
- GetWindowText(GetDlgItem(hDlg, IDC_PARTITION_NAME), szBuf, MAX_PARTITION_NAME_LEN);
+{
+ TCHAR szBuf[MAX_PARTITION_NAME_LEN];
+ GetWindowText(GetDlgItem(hDlg, IDC_PARTITION_NAME), szBuf, MAX_PARTITION_NAME_LEN);
- bAutoSetPartitionName = szBuf[0] == 0;
-
- CheckEnableButtons();
+ bAutoSetPartitionName = szBuf[0] == 0;
+
+ CheckEnableButtons();
}
static void OnListSelection(LPFLN_ITEMSELECT_PARAMS pItemParms)
{
- ASSERT(pItemParms);
-
- hSelectedItem = 0;
-
- if (pItemParms->hItem) {
- LPARAM lParam = FastList_GetItemParam(hDriveList, pItemParms->hItem);
- if (lParam == 0) {
- hSelectedItem = pItemParms->hItem;
-
- if (bAutoSetPartitionName) {
- TCHAR szName[2];
- LPCTSTR pDrive = FastList_GetItemText(hDriveList, hSelectedItem, 0);
- szName[0] = _totlower(pDrive[0]);
- szName[1] = 0;
-
- TCHAR szFullName[6] = TEXT("vice");
- lstrcat(szFullName, szName);
-
- if (!DoesPartitionExist(szFullName)) {
- SetWndText(hDlg, IDC_PARTITION_NAME, szName);
-
- // Must set this to true because the call to SetWndText will cause
- // a call to OnPartitionName, which would incorrectly think that the
- // Partition Name had been set by the user rather than by us, thus
- // setting bAutoSetPartitionName to false.
- bAutoSetPartitionName = TRUE;
- }
- }
+ ASSERT(pItemParms);
+
+ hSelectedItem = 0;
+
+ if (pItemParms->hItem) {
+ LPARAM lParam = FastList_GetItemParam(hDriveList, pItemParms->hItem);
+ if (lParam == 0) {
+ hSelectedItem = pItemParms->hItem;
+
+ if (bAutoSetPartitionName) {
+ TCHAR szName[2];
+ LPCTSTR pDrive = FastList_GetItemText(hDriveList, hSelectedItem, 0);
+ szName[0] = _totlower(pDrive[0]);
+ szName[1] = 0;
+
+ TCHAR szFullName[6] = TEXT("vice");
+ lstrcat(szFullName, szName);
+
+ if (!DoesPartitionExist(szFullName)) {
+ SetWndText(hDlg, IDC_PARTITION_NAME, szName);
+
+ // Must set this to true because the call to SetWndText will cause
+ // a call to OnPartitionName, which would incorrectly think that the
+ // Partition Name had been set by the user rather than by us, thus
+ // setting bAutoSetPartitionName to false.
+ bAutoSetPartitionName = TRUE;
}
+ }
}
+ }
- CheckEnableButtons();
-}
+ CheckEnableButtons();
+}
static void CheckEnableButtons()
{
- TCHAR szBuf[MAX_PARTITION_NAME_LEN];
+ TCHAR szBuf[MAX_PARTITION_NAME_LEN];
- GetWindowText(GetDlgItem(hDlg, IDC_PARTITION_NAME), szBuf, MAX_PARTITION_NAME_LEN);
+ GetWindowText(GetDlgItem(hDlg, IDC_PARTITION_NAME), szBuf, MAX_PARTITION_NAME_LEN);
- ENABLE_STATE es = ES_ENABLE;
+ ENABLE_STATE es = ES_ENABLE;
- if ((hSelectedItem == 0) || (szBuf[0] == 0))
- es = ES_DISABLE;
+ if ((hSelectedItem == 0) || (szBuf[0] == 0))
+ es = ES_DISABLE;
- SetEnable(hDlg, IDC_CREATE, es);
+ SetEnable(hDlg, IDC_CREATE, es);
}
*/
BOOL CALLBACK DBServerPageDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp)
{
- if (WizStep_Common_DlgProc (hwndDlg, msg, wp, lp))
- return FALSE;
-
- switch (msg) {
- case WM_INITDIALOG:
- OnInitDialog(hwndDlg);
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wp)) {
- case IDNEXT:
- SavePageInfo();
- g_pWiz->SetState(sidSTEP_SEVEN);
- break;
-
- case IDBACK:
- SavePageInfo();
- g_pWiz->SetState(sidSTEP_FIVE);
- break;
-
- case IDC_DONT_CONFIG_DB_SERVER:
- g_CfgData.configDB = CS_DONT_CONFIGURE;
- EnableSCM(ES_DISABLE);
- break;
-
- case IDC_CONFIG_DB_SERVER:
- g_CfgData.configDB = CS_CONFIGURE;
- EnableSCM(ES_ENABLE);
- break;
- }
- break;
+ if (WizStep_Common_DlgProc (hwndDlg, msg, wp, lp))
+ return FALSE;
+ switch (msg) {
+ case WM_INITDIALOG:
+ OnInitDialog(hwndDlg);
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wp)) {
+ case IDNEXT:
+ SavePageInfo();
+ g_pWiz->SetState(sidSTEP_SEVEN);
+ break;
+
+ case IDBACK:
+ SavePageInfo();
+ g_pWiz->SetState(sidSTEP_FIVE);
+ break;
+
+ case IDC_DONT_CONFIG_DB_SERVER:
+ g_CfgData.configDB = CS_DONT_CONFIGURE;
+ EnableSCM(ES_DISABLE);
+ break;
+
+ case IDC_CONFIG_DB_SERVER:
+ g_CfgData.configDB = CS_CONFIGURE;
+ EnableSCM(ES_ENABLE);
+ break;
}
+ break;
- return FALSE;
-}
+ }
+
+ return FALSE;
+}
/*
*/
static void OnInitDialog(HWND hwndDlg)
{
- hDlg = hwndDlg;
+ hDlg = hwndDlg;
- g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
- g_pWiz->SetButtonText(IDNEXT, IDS_NEXT);
- g_pWiz->SetDefaultControl(IDNEXT);
+ g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
+ g_pWiz->SetButtonText(IDNEXT, IDS_NEXT);
+ g_pWiz->SetDefaultControl(IDNEXT);
- if (g_CfgData.bFirstServer) {
- ConfigMsg(IDS_MUST_CONFIG_DB);
- g_CfgData.configDB = CS_CONFIGURE;
- return;
- }
+ if (g_CfgData.bFirstServer) {
+ ConfigMsg(IDS_MUST_CONFIG_DB);
+ g_CfgData.configDB = CS_CONFIGURE;
+ return;
+ }
- ShowPageInfo();
+ ShowPageInfo();
- switch (g_CfgData.configDB) {
- case CS_ALREADY_CONFIGURED:
- ConfigMsg(IDS_ALREADY_A_DB_SERVER);
- break;
+ switch (g_CfgData.configDB) {
+ case CS_ALREADY_CONFIGURED:
+ ConfigMsg(IDS_ALREADY_A_DB_SERVER);
+ break;
- case CS_DONT_CONFIGURE:
- SetCheck(hDlg, IDC_DONT_CONFIG_DB_SERVER);
- EnableSCM(ES_DISABLE);
- break;
+ case CS_DONT_CONFIGURE:
+ SetCheck(hDlg, IDC_DONT_CONFIG_DB_SERVER);
+ EnableSCM(ES_DISABLE);
+ break;
- case CS_CONFIGURE:
- default:
- SetCheck(hDlg, IDC_CONFIG_DB_SERVER);
- EnableSCM(ES_ENABLE);
- break;
- }
-}
+ case CS_CONFIGURE:
+ default:
+ SetCheck(hDlg, IDC_CONFIG_DB_SERVER);
+ EnableSCM(ES_ENABLE);
+ break;
+ }
+}
/*
static void ConfigMsg(UINT nMsgID)
{
- TCHAR szMsg[cchRESOURCE];
-
- GetString(szMsg, nMsgID);
-
- // Hide the controls that are at the same position as the message
- ShowWnd(hDlg, IDC_DB_SERVER_QUESTION, FALSE);
- ShowWnd(hDlg, IDC_CONFIG_DB_SERVER, FALSE);
- ShowWnd(hDlg, IDC_SCM_PROMPT, FALSE);
- ShowWnd(hDlg, IDC_SYS_CONTROL_MACHINE_LABEL, FALSE);
- ShowWnd(hDlg, IDC_SYS_CONTROL_MACHINE, FALSE);
-
- ShowWnd(hDlg, IDC_DONT_CONFIG_DB_SERVER, FALSE);
-
- SetWndText(hDlg, IDC_MSG, szMsg);
- ShowWnd(hDlg, IDC_MSG);
+ TCHAR szMsg[cchRESOURCE];
+
+ GetString(szMsg, nMsgID);
+
+ // Hide the controls that are at the same position as the message
+ ShowWnd(hDlg, IDC_DB_SERVER_QUESTION, FALSE);
+ ShowWnd(hDlg, IDC_CONFIG_DB_SERVER, FALSE);
+ ShowWnd(hDlg, IDC_SCM_PROMPT, FALSE);
+ ShowWnd(hDlg, IDC_SYS_CONTROL_MACHINE_LABEL, FALSE);
+ ShowWnd(hDlg, IDC_SYS_CONTROL_MACHINE, FALSE);
+
+ ShowWnd(hDlg, IDC_DONT_CONFIG_DB_SERVER, FALSE);
+
+ SetWndText(hDlg, IDC_MSG, szMsg);
+ ShowWnd(hDlg, IDC_MSG);
}
static void EnableSCM(ENABLE_STATE enable)
{
- SetEnable(hDlg, IDC_SCM_PROMPT, enable);
- SetEnable(hDlg, IDC_SYS_CONTROL_MACHINE_LABEL, enable);
- SetEnable(hDlg, IDC_SYS_CONTROL_MACHINE, enable);
-}
+ SetEnable(hDlg, IDC_SCM_PROMPT, enable);
+ SetEnable(hDlg, IDC_SYS_CONTROL_MACHINE_LABEL, enable);
+ SetEnable(hDlg, IDC_SYS_CONTROL_MACHINE, enable);
+}
static void ShowPageInfo()
{
- SetWndText(hDlg, IDC_SYS_CONTROL_MACHINE, g_CfgData.szSysControlMachine);
-}
+ SetWndText(hDlg, IDC_SYS_CONTROL_MACHINE, g_CfgData.szSysControlMachine);
+}
static void SavePageInfo()
{
- GetWndText(hDlg, IDC_SYS_CONTROL_MACHINE, g_CfgData.szSysControlMachine);
-}
+ GetWndText(hDlg, IDC_SYS_CONTROL_MACHINE, g_CfgData.szSysControlMachine);
+}
*/
BOOL CALLBACK FileServerPageDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp)
{
- if (WizStep_Common_DlgProc (hwndDlg, msg, wp, lp))
- return FALSE;
-
- switch (msg) {
- case WM_INITDIALOG:
- OnInitDialog(hwndDlg);
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wp)) {
- case IDNEXT:
- g_pWiz->SetState(sidSTEP_SIX);
- break;
-
- case IDBACK:
- g_pWiz->SetState(sidSTEP_FOUR);
- break;
-
- case IDC_DONT_CONFIG_FILE_SERVER:
- g_CfgData.configFS = CS_DONT_CONFIGURE;
- break;
-
- case IDC_SHOULD_CONFIG_FILE_SERVER:
- g_CfgData.configFS = CS_CONFIGURE;
- break;
- }
- break;
+ if (WizStep_Common_DlgProc (hwndDlg, msg, wp, lp))
+ return FALSE;
+
+ switch (msg) {
+ case WM_INITDIALOG:
+ OnInitDialog(hwndDlg);
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wp)) {
+ case IDNEXT:
+ g_pWiz->SetState(sidSTEP_SIX);
+ break;
+
+ case IDBACK:
+ g_pWiz->SetState(sidSTEP_FOUR);
+ break;
+ case IDC_DONT_CONFIG_FILE_SERVER:
+ g_CfgData.configFS = CS_DONT_CONFIGURE;
+ break;
+
+ case IDC_SHOULD_CONFIG_FILE_SERVER:
+ g_CfgData.configFS = CS_CONFIGURE;
+ break;
}
+ break;
- return FALSE;
+ }
+
+ return FALSE;
}
*/
static void OnInitDialog(HWND hwndDlg)
{
- hDlg = hwndDlg;
-
- g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
- g_pWiz->SetButtonText(IDNEXT, IDS_NEXT);
- g_pWiz->SetDefaultControl(IDNEXT);
-
- if (g_CfgData.bFirstServer) {
- ConfigMsg(IDS_MUST_CONFIG_FS);
- g_CfgData.configFS = CS_CONFIGURE;
- return;
- }
-
- switch (g_CfgData.configFS) {
- case CS_ALREADY_CONFIGURED:
- ConfigMsg(IDS_ALREADY_A_FS_SERVER);
- break;
-
- case CS_DONT_CONFIGURE:
- SetCheck(hDlg, IDC_DONT_CONFIG_FILE_SERVER);
- break;
-
- case CS_CONFIGURE:
- default:
- SetCheck(hDlg, IDC_SHOULD_CONFIG_FILE_SERVER);
- break;
- }
+ hDlg = hwndDlg;
+
+ g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
+ g_pWiz->SetButtonText(IDNEXT, IDS_NEXT);
+ g_pWiz->SetDefaultControl(IDNEXT);
+
+ if (g_CfgData.bFirstServer) {
+ ConfigMsg(IDS_MUST_CONFIG_FS);
+ g_CfgData.configFS = CS_CONFIGURE;
+ return;
+ }
+
+ switch (g_CfgData.configFS) {
+ case CS_ALREADY_CONFIGURED:
+ ConfigMsg(IDS_ALREADY_A_FS_SERVER);
+ break;
+
+ case CS_DONT_CONFIGURE:
+ SetCheck(hDlg, IDC_DONT_CONFIG_FILE_SERVER);
+ break;
+
+ case CS_CONFIGURE:
+ default:
+ SetCheck(hDlg, IDC_SHOULD_CONFIG_FILE_SERVER);
+ break;
+ }
}
*/
static void ConfigMsg(UINT nMsgID)
{
- TCHAR szMsg[cchRESOURCE];
+ TCHAR szMsg[cchRESOURCE];
- GetString(szMsg, nMsgID);
+ GetString(szMsg, nMsgID);
- // Hide the controls that are at the same position as the message
- ShowWnd(hDlg, IDC_CREATE_FS_QUESTION, FALSE);
- ShowWnd(hDlg, IDC_SHOULD_CONFIG_FILE_SERVER, FALSE);
- ShowWnd(hDlg, IDC_DONT_CONFIG_FILE_SERVER, FALSE);
+ // Hide the controls that are at the same position as the message
+ ShowWnd(hDlg, IDC_CREATE_FS_QUESTION, FALSE);
+ ShowWnd(hDlg, IDC_SHOULD_CONFIG_FILE_SERVER, FALSE);
+ ShowWnd(hDlg, IDC_DONT_CONFIG_FILE_SERVER, FALSE);
- SetWndText(hDlg, IDC_MSG, szMsg);
- ShowWnd(hDlg, IDC_MSG);
+ SetWndText(hDlg, IDC_MSG, szMsg);
+ ShowWnd(hDlg, IDC_MSG);
}
*/
int GetCurrentConfig(HWND hParent, BOOL& bCanceled)
{
- pProg = 0;
- bCancel = FALSE;
- bBakConfigured = FALSE;
+ pProg = 0;
+ bCancel = FALSE;
+ bBakConfigured = FALSE;
- pProg = New2 (PROGRESSDISPLAY,(hParent, IDD_GET_CURRENT_CONFIG, (DLGPROC)GetCurConfigDlgProc));
- pProg->SetProgressRange(0, MAX_STEPS);
+ pProg = New2 (PROGRESSDISPLAY,(hParent, IDD_GET_CURRENT_CONFIG, (DLGPROC)GetCurConfigDlgProc));
+ pProg->SetProgressRange(0, MAX_STEPS);
- HWND hLogo = GetDlgItem(pProg->GetWindow(), IDC_LOGO);
- AfsAppLib_StartAnimation(hLogo);
+ HWND hLogo = GetDlgItem(pProg->GetWindow(), IDC_LOGO);
+ AfsAppLib_StartAnimation(hLogo);
- pProg->Show(GetCurrentConfigState, 0);
+ pProg->Show(GetCurrentConfigState, 0);
- AfsAppLib_StopAnimation(hLogo);
+ AfsAppLib_StopAnimation(hLogo);
- int dwResult = pProg->GetStatus();
+ int dwResult = pProg->GetStatus();
- pProg->Close();
+ pProg->Close();
- bCanceled = bCancel;
+ bCanceled = bCancel;
- return dwResult;
+ return dwResult;
}
*/
static BOOL CALLBACK GetCurConfigDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp)
{
- BOOL bOn = FALSE;
+ BOOL bOn = FALSE;
- switch (msg) {
- case WM_INITDIALOG:
- bCancel = FALSE;
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wp))
- {
- case IDCANCEL: if (QueryCancelWiz()) {
- bCancel = TRUE;
- ShowMsg(IDS_CANCEL_GET_CONFIG);
- }
- break;
- }
- break;
+ switch (msg) {
+ case WM_INITDIALOG:
+ bCancel = FALSE;
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wp))
+ {
+ case IDCANCEL: if (QueryCancelWiz()) {
+ bCancel = TRUE;
+ ShowMsg(IDS_CANCEL_GET_CONFIG);
}
+ break;
+ }
+ break;
+ }
- return FALSE;
+ return FALSE;
}
static BOOL IsClientConfigured(BOOL& bConfigured, afs_status_t& nStatus)
{
- if (bCancel)
- return FALSE;
+ if (bCancel)
+ return FALSE;
- bConfigured = FALSE;
+ bConfigured = FALSE;
- NextStep(IDS_CHECK_AFS_CLIENT);
+ NextStep(IDS_CHECK_AFS_CLIENT);
- short isInstalled;
- afs_status_t configStatus;
- char *pszCellName = 0;
+ short isInstalled;
+ afs_status_t configStatus;
+ char *pszCellName = 0;
- g_LogFile.Write("Is the AFS Client installed on this machine: ");
- if (!cfg_ClientQueryStatus(GetHostnameA(), &isInstalled, &g_CfgData.nClientVersion, &configStatus, &pszCellName, &nStatus)) {
- ImmediateErrorDialog(nStatus, IDS_ERROR_AFS_CLIENT_CHECK);
- return FALSE;
- }
+ g_LogFile.Write("Is the AFS Client installed on this machine: ");
+ if (!cfg_ClientQueryStatus(GetHostnameA(), &isInstalled, &g_CfgData.nClientVersion, &configStatus, &pszCellName, &nStatus)) {
+ ImmediateErrorDialog(nStatus, IDS_ERROR_AFS_CLIENT_CHECK);
+ return FALSE;
+ }
- g_LogFile.WriteBoolResult((BOOL)isInstalled);
+ g_LogFile.WriteBoolResult((BOOL)isInstalled);
- bConfigured = (BOOL)(configStatus == 0);
- if (bConfigured)
- lstrncpy(g_CfgData.szClientCellName, A2S(pszCellName), MAX_CELL_NAME_LEN);
- else
- g_LogFile.WriteError("The client configuration information on this host is not valid", configStatus);
+ bConfigured = (BOOL)(configStatus == 0);
+ if (bConfigured)
+ lstrncpy(g_CfgData.szClientCellName, A2S(pszCellName), MAX_CELL_NAME_LEN);
+ else
+ g_LogFile.WriteError("The client configuration information on this host is not valid", configStatus);
- if (!isInstalled) {
- g_LogFile.Write("ERROR: AFS Client is not installed. The AFS Server requires the AFS Client.\r\n");
- ImmediateErrorDialog(0, IDS_ERROR_AFS_CLIENT_NOT_INSTALLED);
- nStatus = -1; // Just need something nonzero
- return FALSE;
- }
+ if (!isInstalled) {
+ g_LogFile.Write("ERROR: AFS Client is not installed. The AFS Server requires the AFS Client.\r\n");
+ ImmediateErrorDialog(0, IDS_ERROR_AFS_CLIENT_NOT_INSTALLED);
+ nStatus = -1; // Just need something nonzero
+ return FALSE;
+ }
- return TRUE;
-}
+ return TRUE;
+}
/*
* NOTE: This function has an important side effect. If this machine
*/
static int IsConfigInfoValid(BOOL& bValid, afs_status_t& nStatus)
{
- if (bCancel)
- return FALSE;
+ if (bCancel)
+ return FALSE;
- afs_status_t configStatus;
- char *pszCellName = 0;
+ afs_status_t configStatus;
+ char *pszCellName = 0;
- NextStep(IDS_CHECK_CONFIG_INFO);
+ NextStep(IDS_CHECK_CONFIG_INFO);
- bValid = FALSE;
+ bValid = FALSE;
- g_LogFile.Write("Is there valid configuration information on this machine: ");
- int nResult = cfg_HostQueryStatus(GetHostnameA(), &configStatus, &pszCellName, &nStatus);
- if (!nResult)
- return FALSE;
+ g_LogFile.Write("Is there valid configuration information on this machine: ");
+ int nResult = cfg_HostQueryStatus(GetHostnameA(), &configStatus, &pszCellName, &nStatus);
+ if (!nResult)
+ return FALSE;
- g_LogFile.WriteBoolResult((configStatus == 0));
+ g_LogFile.WriteBoolResult((configStatus == 0));
- if (configStatus == 0)
- lstrncpy(g_CfgData.szCellName, A2S(pszCellName), MAX_CELL_NAME_LEN);
- else
- g_LogFile.WriteError("The configuration information on this host is not valid", configStatus);
+ if (configStatus == 0)
+ lstrncpy(g_CfgData.szCellName, A2S(pszCellName), MAX_CELL_NAME_LEN);
+ else
+ g_LogFile.WriteError("The configuration information on this host is not valid", configStatus);
- bValid = (BOOL)(configStatus == 0);
+ bValid = (BOOL)(configStatus == 0);
- return TRUE;
+ return TRUE;
}
static int StartBosServer(afs_status_t& nStatus)
{
- short isStarted;
- short isBosProc;
+ short isStarted;
+ short isBosProc;
- g_LogFile.Write("Checking if bos server is running.\r\n");
- int nResult = cfg_BosServerQueryStatus(g_hServer, &isStarted, &isBosProc, &nStatus);
- if (!nResult)
- return nResult;
+ g_LogFile.Write("Checking if bos server is running.\r\n");
+ int nResult = cfg_BosServerQueryStatus(g_hServer, &isStarted, &isBosProc, &nStatus);
+ if (!nResult)
+ return nResult;
- if (!isStarted) {
- g_LogFile.Write("Starting the bos server in %s mode.\r\n", g_CfgData.bValidServerInfo ? "auth" : "no auth");
- nResult = cfg_BosServerStart(g_hServer, !g_CfgData.bValidServerInfo, BOSSERVER_START_TIMEOUT, &nStatus);
- }
+ if (!isStarted) {
+ g_LogFile.Write("Starting the bos server in %s mode.\r\n", g_CfgData.bValidServerInfo ? "auth" : "no auth");
+ nResult = cfg_BosServerStart(g_hServer, !g_CfgData.bValidServerInfo, BOSSERVER_START_TIMEOUT, &nStatus);
+ }
- return nResult;
-}
+ return nResult;
+}
static BOOL AreWeLastDBServer(BOOL& bLast, afs_status_t& nStatus)
{
- ASSERT(g_CfgData.szHostname[0]);
+ ASSERT(g_CfgData.szHostname[0]);
- char *pszCellname = 0;
- char *pszCellServDB = 0;
+ char *pszCellname = 0;
+ char *pszCellServDB = 0;
- bLast = FALSE;
+ bLast = FALSE;
- g_LogFile.Write("Checking if this machine is the last DB server in the cell.\r\n");
+ g_LogFile.Write("Checking if this machine is the last DB server in the cell.\r\n");
- g_LogFile.Write("Getting CellServDB from host %s.\r\n", GetHostnameA());
- int nResult = cfg_CellServDbEnumerate(GetHostnameA(), &pszCellname, &pszCellServDB, &nStatus);
- if (!nResult)
- return FALSE;
+ g_LogFile.Write("Getting CellServDB from host %s.\r\n", GetHostnameA());
+ int nResult = cfg_CellServDbEnumerate(GetHostnameA(), &pszCellname, &pszCellServDB, &nStatus);
+ if (!nResult)
+ return FALSE;
- if (!pszCellServDB) {
- g_LogFile.Write("There are no DB servers in CellServDB!!!!!");
- ASSERT(FALSE); // This should not be possible
- return FALSE;
- }
+ if (!pszCellServDB) {
+ g_LogFile.Write("There are no DB servers in CellServDB!!!!!");
+ ASSERT(FALSE); // This should not be possible
+ return FALSE;
+ }
- char *psz = pszCellServDB;
+ char *psz = pszCellServDB;
- int i;
- for (i = 0; *psz; psz += strlen(psz) + 1)
- i++;
+ int i;
+ for (i = 0; *psz; psz += strlen(psz) + 1)
+ i++;
- if (i == 1) {
- ASSERT(lstrcmp(g_CfgData.szHostname, A2S(pszCellServDB)) == 0);
- g_LogFile.Write("This machine IS the last DB server in the cell.\r\n");
- bLast = TRUE;
- } else
- g_LogFile.Write("This machine is NOT the last DB server in the cell.\r\n");
+ if (i == 1) {
+ ASSERT(lstrcmp(g_CfgData.szHostname, A2S(pszCellServDB)) == 0);
+ g_LogFile.Write("This machine IS the last DB server in the cell.\r\n");
+ bLast = TRUE;
+ } else
+ g_LogFile.Write("This machine is NOT the last DB server in the cell.\r\n");
- return TRUE;
+ return TRUE;
}
static afs_status_t IsFSConfigured(BOOL& bConfigured)
{
- g_LogFile.Write("Is this machine a file server: ");
+ g_LogFile.Write("Is this machine a file server: ");
- bConfigured = FALSE;
+ bConfigured = FALSE;
- short isStarted;
- afs_status_t nStatus;
+ short isStarted;
+ afs_status_t nStatus;
- int nResult = cfg_FileServerQueryStatus(g_hServer, &isStarted, &nStatus);
- if (!nResult)
- return nStatus;
+ int nResult = cfg_FileServerQueryStatus(g_hServer, &isStarted, &nStatus);
+ if (!nResult)
+ return nStatus;
- bConfigured = isStarted;
+ bConfigured = isStarted;
- g_LogFile.WriteBoolResult(bConfigured);
+ g_LogFile.WriteBoolResult(bConfigured);
- return 0;
-}
+ return 0;
+}
static afs_status_t IsDBConfigured(BOOL& bConfigured)
{
- g_LogFile.Write("Is this machine a db (or bak) server: ");
+ g_LogFile.Write("Is this machine a db (or bak) server: ");
- bConfigured = FALSE;
+ bConfigured = FALSE;
- short isStarted, isBakStarted;
- afs_status_t nStatus;
+ short isStarted, isBakStarted;
+ afs_status_t nStatus;
- int nResult = cfg_DbServersQueryStatus(g_hServer, &isStarted, &isBakStarted, 0, &nStatus);
- if (!nResult)
- return nStatus;
+ int nResult = cfg_DbServersQueryStatus(g_hServer, &isStarted, &isBakStarted, 0, &nStatus);
+ if (!nResult)
+ return nStatus;
- bConfigured = isStarted;
- bBakConfigured = isBakStarted;
+ bConfigured = isStarted;
+ bBakConfigured = isBakStarted;
- g_LogFile.Write(bConfigured ? "Yes DB" : "No DB");
- g_LogFile.Write(", %s.\r\n", bBakConfigured ? "Yes Bak" : "No Bak");
+ g_LogFile.Write(bConfigured ? "Yes DB" : "No DB");
+ g_LogFile.Write(", %s.\r\n", bBakConfigured ? "Yes Bak" : "No Bak");
- return 0;
-}
+ return 0;
+}
static afs_status_t IsBakConfigured(BOOL& bConfigured)
{
- bConfigured = bBakConfigured;
+ bConfigured = bBakConfigured;
- return 0;
+ return 0;
}
static afs_status_t DoesAPartitionExist(BOOL& bExists)
{
- g_LogFile.Write("Does a partition exist on this machine: ");
+ g_LogFile.Write("Does a partition exist on this machine: ");
- bExists = FALSE;
+ bExists = FALSE;
- afs_status_t nStatus;
+ afs_status_t nStatus;
- int nResult = ReadPartitionTable(&nStatus);
- if (!nResult)
- return nStatus;
+ int nResult = ReadPartitionTable(&nStatus);
+ if (!nResult)
+ return nStatus;
- int nNumPartitions = 0;
+ int nNumPartitions = 0;
- cfg_partitionEntry_t *pTable = GetPartitionTable(nNumPartitions);
+ cfg_partitionEntry_t *pTable = GetPartitionTable(nNumPartitions);
- bExists = nNumPartitions > 0;
- if (bExists) {
- g_CfgData.chDeviceName = pTable->deviceName[0];
- lstrcpy(g_CfgData.szPartitionName, ((TCHAR *)A2S(pTable->partitionName)) + lstrlen(TEXT("/vicep")));
- }
+ bExists = nNumPartitions > 0;
+ if (bExists) {
+ g_CfgData.chDeviceName = pTable->deviceName[0];
+ lstrcpy(g_CfgData.szPartitionName, ((TCHAR *)A2S(pTable->partitionName)) + lstrlen(TEXT("/vicep")));
+ }
- g_LogFile.WriteBoolResult(bExists);
+ g_LogFile.WriteBoolResult(bExists);
- return 0;
-}
+ return 0;
+}
afs_status_t DoRootVolumesExist(BOOL& bExists)
{
- bExists = FALSE;
+ bExists = FALSE;
- afs_status_t nStatus;
+ afs_status_t nStatus;
- g_LogFile.Write("Do the root volumes exist: ");
+ g_LogFile.Write("Do the root volumes exist: ");
- // Does root.afs exist? If it does not, the call will fail with the VL_NOENT
- // status. Any other error causes this function to fail.
- int nResult = vos_VLDBGet(g_hCell, 0, 0, "root.afs", &vldbRootAfsEntry, &nStatus);
- if (nResult) {
- g_CfgData.bRootAfsExists = TRUE;
+ // Does root.afs exist? If it does not, the call will fail with the VL_NOENT
+ // status. Any other error causes this function to fail.
+ int nResult = vos_VLDBGet(g_hCell, 0, 0, "root.afs", &vldbRootAfsEntry, &nStatus);
+ if (nResult) {
+ g_CfgData.bRootAfsExists = TRUE;
g_CfgData.nRootAfsID = vldbRootAfsEntry.volumeId[0];
- } else if (nStatus != VL_NOENT)
- return nStatus;
+ } else if (nStatus != VL_NOENT)
+ return nStatus;
- // Does root.cell exist?
- nResult = vos_VLDBGet(g_hCell, 0, 0, "root.cell", &vldbRootCellEntry, &nStatus);
- if (nResult) {
- g_CfgData.bRootCellExists = TRUE;
+ // Does root.cell exist?
+ nResult = vos_VLDBGet(g_hCell, 0, 0, "root.cell", &vldbRootCellEntry, &nStatus);
+ if (nResult) {
+ g_CfgData.bRootCellExists = TRUE;
g_CfgData.nRootCellID = vldbRootCellEntry.volumeId[0];
- } else if (nStatus != VL_NOENT)
- return nStatus;
+ } else if (nStatus != VL_NOENT)
+ return nStatus;
- bExists = g_CfgData.bRootAfsExists && g_CfgData.bRootCellExists;
+ bExists = g_CfgData.bRootAfsExists && g_CfgData.bRootCellExists;
- g_LogFile.WriteBoolResult(bExists);
+ g_LogFile.WriteBoolResult(bExists);
- return 0;
+ return 0;
}
static BOOL IsVolumeReplicated(vos_vldbEntry_t& vldbEntry)
{
- if (vldbEntry.numServers <= 1)
- return FALSE;
+ if (vldbEntry.numServers <= 1)
+ return FALSE;
- for (int i = 0; i < vldbEntry.numServers; i++) {
- if ((vldbEntry.volumeSites[i].serverFlags & VOS_VLDB_READ_ONLY) ||
- (vldbEntry.volumeSites[i].serverFlags & VOS_VLDB_NEW_REPSITE))
- return TRUE;
- }
+ for (int i = 0; i < vldbEntry.numServers; i++) {
+ if ((vldbEntry.volumeSites[i].serverFlags & VOS_VLDB_READ_ONLY) ||
+ (vldbEntry.volumeSites[i].serverFlags & VOS_VLDB_NEW_REPSITE))
+ return TRUE;
+ }
- return FALSE;
+ return FALSE;
}
afs_status_t AreRootVolumesReplicated(BOOL& bReplicated)
{
- g_LogFile.Write("Are the root volumes replicated: ");
+ g_LogFile.Write("Are the root volumes replicated: ");
- // Is root.afs replicated?
- g_CfgData.bRootAfsReplicated = IsVolumeReplicated(vldbRootAfsEntry);
+ // Is root.afs replicated?
+ g_CfgData.bRootAfsReplicated = IsVolumeReplicated(vldbRootAfsEntry);
- // Is root.cell replicated?
- g_CfgData.bRootCellReplicated = IsVolumeReplicated(vldbRootCellEntry);
+ // Is root.cell replicated?
+ g_CfgData.bRootCellReplicated = IsVolumeReplicated(vldbRootCellEntry);
- bReplicated = g_CfgData.bRootAfsReplicated && g_CfgData.bRootCellReplicated;
+ bReplicated = g_CfgData.bRootAfsReplicated && g_CfgData.bRootCellReplicated;
- g_LogFile.WriteBoolResult(bReplicated);
+ g_LogFile.WriteBoolResult(bReplicated);
- return 0;
-}
+ return 0;
+}
static afs_status_t IsSCSConfigured(BOOL& bConfigured)
{
- g_LogFile.Write("Is this machine a System Control Server: ");
+ g_LogFile.Write("Is this machine a System Control Server: ");
- bConfigured = FALSE;
+ bConfigured = FALSE;
- short isUpserver, isSC, isBin;
- afs_status_t nStatus;
+ short isUpserver, isSC, isBin;
+ afs_status_t nStatus;
- int nResult = cfg_UpdateServerQueryStatus(g_hServer, &isUpserver, &isSC, &isBin, &nStatus);
- if (!nResult)
- return nStatus;
+ int nResult = cfg_UpdateServerQueryStatus(g_hServer, &isUpserver, &isSC, &isBin, &nStatus);
+ if (!nResult)
+ return nStatus;
- bConfigured = isUpserver && isSC;
+ bConfigured = isUpserver && isSC;
- g_LogFile.WriteBoolResult(bConfigured);
+ g_LogFile.WriteBoolResult(bConfigured);
- return 0;
+ return 0;
}
static afs_status_t IsSCCConfigured(BOOL& bConfigured)
{
- g_LogFile.Write("Is this machine a System Control Client: ");
+ g_LogFile.Write("Is this machine a System Control Client: ");
- bConfigured = FALSE;
+ bConfigured = FALSE;
- short isUpclient, isSCC, isBin;
- afs_status_t nStatus;
+ short isUpclient, isSCC, isBin;
+ afs_status_t nStatus;
- int nResult = cfg_UpdateClientQueryStatus(g_hServer, &isUpclient, &isSCC, &isBin, &nStatus);
- if (!nResult)
- return nStatus;
+ int nResult = cfg_UpdateClientQueryStatus(g_hServer, &isUpclient, &isSCC, &isBin, &nStatus);
+ if (!nResult)
+ return nStatus;
- bConfigured = isUpclient && isSCC;
+ bConfigured = isUpclient && isSCC;
- g_LogFile.WriteBoolResult(bConfigured);
+ g_LogFile.WriteBoolResult(bConfigured);
- return 0;
+ return 0;
}
static void ShowMsg(UINT uiMsgID)
{
- TCHAR szMsg[cchRESOURCE];
+ TCHAR szMsg[cchRESOURCE];
- GetString(szMsg, uiMsgID);
+ GetString(szMsg, uiMsgID);
- pProg->SetOperation(szMsg);
+ pProg->SetOperation(szMsg);
}
static void NextStep(UINT uiMsgID)
{
- static int nCurStep = 1;
+ static int nCurStep = 1;
- if (bCancel)
- return;
+ if (bCancel)
+ return;
- ShowMsg(uiMsgID);
+ ShowMsg(uiMsgID);
- pProg->SetProgress(nCurStep++);
+ pProg->SetProgress(nCurStep++);
- Sleep(50);
+ Sleep(50);
}
static BOOL CheckConfigState(afs_status_t (*ConfigCheckFunc)(BOOL&), CONFIG_STATE& state, afs_status_t& nStatus, UINT uiMsgID)
{
- BOOL bState = FALSE;
+ BOOL bState = FALSE;
- if (bCancel)
- return FALSE;
+ if (bCancel)
+ return FALSE;
- NextStep(uiMsgID);
+ NextStep(uiMsgID);
- nStatus = ConfigCheckFunc(bState);
- if (nStatus) {
- g_LogFile.WriteError("Config check failed", nStatus);
- return FALSE;
- }
+ nStatus = ConfigCheckFunc(bState);
+ if (nStatus) {
+ g_LogFile.WriteError("Config check failed", nStatus);
+ return FALSE;
+ }
- state = bState ? CS_ALREADY_CONFIGURED : CS_NULL;
+ state = bState ? CS_ALREADY_CONFIGURED : CS_NULL;
- return TRUE;
+ return TRUE;
}
static DWORD CALLBACK GetCurrentConfigState(LPPROGRESSDISPLAY ppd, LPARAM lp)
{
- afs_status_t nStatus = 0;
+ afs_status_t nStatus = 0;
- ASSERT(pProg);
+ ASSERT(pProg);
- g_LogFile.Write("Checking this machine's current configuration...\r\n");
+ g_LogFile.Write("Checking this machine's current configuration...\r\n");
- if (!IsClientConfigured(g_CfgData.bValidClientInfo, nStatus))
- return nStatus;
+ if (!IsClientConfigured(g_CfgData.bValidClientInfo, nStatus))
+ return nStatus;
- if (!IsConfigInfoValid(g_CfgData.bValidServerInfo, nStatus))
- return nStatus;
+ if (!IsConfigInfoValid(g_CfgData.bValidServerInfo, nStatus))
+ return nStatus;
// If the server and client have good config info, and the client is in a
// different cell than the server, then the config routines will want to
lstrcpy(g_CfgData.szCellServDbHostname, g_CfgData.szHostname);
}
- if (!GetLibHandles(&nStatus))
- return nStatus;
+ if (!GetLibHandles(&nStatus))
+ return nStatus;
- if (!CheckConfigState(DoesAPartitionExist, g_CfgData.configPartition, nStatus, IDS_CHECK_PARTITION))
- return nStatus;
+ if (!CheckConfigState(DoesAPartitionExist, g_CfgData.configPartition, nStatus, IDS_CHECK_PARTITION))
+ return nStatus;
- if (g_CfgData.bValidServerInfo) {
- // Must check if bos server is running, and start it if it isn't. We can't determine
- // if the services are running except by asking the bosserver.
- if (!StartBosServer(nStatus))
- return nStatus;
+ if (g_CfgData.bValidServerInfo) {
+ // Must check if bos server is running, and start it if it isn't. We can't determine
+ // if the services are running except by asking the bosserver.
+ if (!StartBosServer(nStatus))
+ return nStatus;
- if (!CheckConfigState(IsFSConfigured, g_CfgData.configFS, nStatus, IDS_CHECK_FS_CONFIG))
- return nStatus;
+ if (!CheckConfigState(IsFSConfigured, g_CfgData.configFS, nStatus, IDS_CHECK_FS_CONFIG))
+ return nStatus;
- if (!CheckConfigState(IsDBConfigured, g_CfgData.configDB, nStatus, IDS_CHECK_DB_CONFIG))
- return nStatus;
+ if (!CheckConfigState(IsDBConfigured, g_CfgData.configDB, nStatus, IDS_CHECK_DB_CONFIG))
+ return nStatus;
- if (g_CfgData.configDB == CS_ALREADY_CONFIGURED) {
- if (!AreWeLastDBServer(g_CfgData.bLastDBServer, nStatus))
- return nStatus;
- }
+ if (g_CfgData.configDB == CS_ALREADY_CONFIGURED) {
+ if (!AreWeLastDBServer(g_CfgData.bLastDBServer, nStatus))
+ return nStatus;
+ }
- if (!CheckConfigState(IsBakConfigured, g_CfgData.configBak, nStatus, IDS_CHECK_BAK_CONFIG))
- return nStatus;
+ if (!CheckConfigState(IsBakConfigured, g_CfgData.configBak, nStatus, IDS_CHECK_BAK_CONFIG))
+ return nStatus;
- if (!CheckConfigState(DoRootVolumesExist, g_CfgData.configRootVolumes, nStatus, IDS_CHECK_ROOT_AFS))
+ if (!CheckConfigState(DoRootVolumesExist, g_CfgData.configRootVolumes, nStatus, IDS_CHECK_ROOT_AFS))
return nStatus;
g_CfgData.bRootVolumesExistanceKnown = TRUE;
- if (!CheckConfigState(AreRootVolumesReplicated, g_CfgData.configRep, nStatus, IDS_CHECK_REP))
+ if (!CheckConfigState(AreRootVolumesReplicated, g_CfgData.configRep, nStatus, IDS_CHECK_REP))
return nStatus;
g_CfgData.bRootVolumesReplicationKnown = TRUE;
- if (!CheckConfigState(IsSCSConfigured, g_CfgData.configSCS, nStatus, IDS_CHECK_SCS))
- return nStatus;
+ if (!CheckConfigState(IsSCSConfigured, g_CfgData.configSCS, nStatus, IDS_CHECK_SCS))
+ return nStatus;
- if (!CheckConfigState(IsSCCConfigured, g_CfgData.configSCC, nStatus, IDS_CHECK_SCC))
- return nStatus;
- }
+ if (!CheckConfigState(IsSCCConfigured, g_CfgData.configSCC, nStatus, IDS_CHECK_SCC))
+ return nStatus;
+ }
- if (!bCancel)
- pProg->SetProgress(MAX_STEPS);
+ if (!bCancel)
+ pProg->SetProgress(MAX_STEPS);
- return 0;
+ return 0;
}
*/
BOOL GetAfsPrincipalPassword(HWND hParent, TCHAR *&pszServerPW)
{
- int nResult = ModalDialog(IDD_GET_PW, hParent, (DLGPROC)GetPwDlgProc);
+ int nResult = ModalDialog(IDD_GET_PW, hParent, (DLGPROC)GetPwDlgProc);
if (nResult == IDOK) {
pszServerPW = g_CfgData.szServerPW;
return TRUE;
pszServerPW = 0;
- return FALSE;
+ return FALSE;
}
*/
BOOL CALLBACK GetPwDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp)
{
- if (AfsAppLib_HandleHelp(IDD_GET_PW, hwndDlg, msg, wp, lp))
- return TRUE;
-
- switch (msg) {
- case WM_INITDIALOG:
- OnInitDialog(hwndDlg);
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wp)) {
- case IDC_PW:
- if (HIWORD(wp) == EN_CHANGE)
- CheckEnableButtons();
- break;
-
- case IDCANCEL:
- EndDialog(hDlg, IDCANCEL);
- break;
-
-
- case IDOK:
- SaveDlgInfo();
- EndDialog(hDlg, IDOK);
- break;
- }
- break;
+ if (AfsAppLib_HandleHelp(IDD_GET_PW, hwndDlg, msg, wp, lp))
+ return TRUE;
+
+ switch (msg) {
+ case WM_INITDIALOG:
+ OnInitDialog(hwndDlg);
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wp)) {
+ case IDC_PW:
+ if (HIWORD(wp) == EN_CHANGE)
+ CheckEnableButtons();
+ break;
+
+ case IDCANCEL:
+ EndDialog(hDlg, IDCANCEL);
+ break;
+
+ case IDOK:
+ SaveDlgInfo();
+ EndDialog(hDlg, IDOK);
+ break;
+ }
+ break;
}
return FALSE;
*/
static void OnInitDialog(HWND hwndDlg)
{
- hDlg = hwndDlg;
+ hDlg = hwndDlg;
}
*/
static void CheckEnableButtons()
{
- BOOL bDisable = FALSE;
+ BOOL bDisable = FALSE;
- TCHAR szDummy[cchRESOURCE];
+ TCHAR szDummy[cchRESOURCE];
- bDisable |= lstrlen(GetWndText(hDlg, IDC_PW, szDummy)) == 0;
+ bDisable |= lstrlen(GetWndText(hDlg, IDC_PW, szDummy)) == 0;
- SetEnable(hDlg, IDOK, (ENABLE_STATE)!bDisable);
+ SetEnable(hDlg, IDOK, (ENABLE_STATE)!bDisable);
}
static void SaveDlgInfo()
{
- TCHAR szText[cchRESOURCE];
+ TCHAR szText[cchRESOURCE];
- lstrncpy(g_CfgData.szServerPW, GetWndText(hDlg, IDC_PW, szText), MAX_SERVER_PW_LEN);
+ lstrncpy(g_CfgData.szServerPW, GetWndText(hDlg, IDC_PW, szText), MAX_SERVER_PW_LEN);
}
static void ShowPageInfo()
{
- SetWndText(hDlg, IDC_PW, g_CfgData.szServerPW);
+ SetWndText(hDlg, IDC_PW, g_CfgData.szServerPW);
}
*/
static void EraseRect(HDC hdc, RECT rect)
{
- HBRUSH hbr = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
- HGDIOBJ hbrOld = SelectObject(hdc, hbr);
+ HBRUSH hbr = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
+ HGDIOBJ hbrOld = SelectObject(hdc, hbr);
- HPEN hPen = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_BTNFACE));
- HGDIOBJ hOldPen = SelectObject(hdc, hPen);
+ HPEN hPen = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_BTNFACE));
+ HGDIOBJ hOldPen = SelectObject(hdc, hPen);
- Rectangle(hdc, rect.left, rect.top, rect.right, rect.bottom);
-
- SelectObject(hdc, hOldPen);
- SelectObject(hdc, hbrOld);
+ Rectangle(hdc, rect.left, rect.top, rect.right, rect.bottom);
- DeleteObject(hPen);
- DeleteObject(hbr);
-}
+ SelectObject(hdc, hOldPen);
+ SelectObject(hdc, hbrOld);
+
+ DeleteObject(hPen);
+ DeleteObject(hbr);
+}
static void DrawCircle(HDC hdc, RECT rect, COLORREF crCircleColor)
{
- HBRUSH hBrush = CreateSolidBrush(crCircleColor);
- HGDIOBJ hOldBrush = SelectObject(hdc, hBrush);
+ HBRUSH hBrush = CreateSolidBrush(crCircleColor);
+ HGDIOBJ hOldBrush = SelectObject(hdc, hBrush);
- HPEN hPen = CreatePen(PS_SOLID, 1, crCircleColor);
- HGDIOBJ hOldPen = SelectObject(hdc, hPen);
+ HPEN hPen = CreatePen(PS_SOLID, 1, crCircleColor);
+ HGDIOBJ hOldPen = SelectObject(hdc, hPen);
- OffsetRect(&rect, 1, -1);
+ OffsetRect(&rect, 1, -1);
- int midX = rect.left + ((rect.right - rect.left) / 2);
- int midY = rect.top + ((rect.bottom - rect.top) / 2);
+ int midX = rect.left + ((rect.right - rect.left) / 2);
+ int midY = rect.top + ((rect.bottom - rect.top) / 2);
- MoveToEx(hdc, midX - 1, midY - 2, 0);
- LineTo(hdc, midX + 2, midY - 2);
+ MoveToEx(hdc, midX - 1, midY - 2, 0);
+ LineTo(hdc, midX + 2, midY - 2);
- MoveToEx(hdc, midX - 2, midY - 1, 0);
- LineTo(hdc, midX + 3, midY - 1);
+ MoveToEx(hdc, midX - 2, midY - 1, 0);
+ LineTo(hdc, midX + 3, midY - 1);
- MoveToEx(hdc, midX - 2, midY, 0);
- LineTo(hdc, midX + 3, midY);
+ MoveToEx(hdc, midX - 2, midY, 0);
+ LineTo(hdc, midX + 3, midY);
- MoveToEx(hdc, midX - 2, midY + 1, 0);
- LineTo(hdc, midX + 3, midY + 1);
+ MoveToEx(hdc, midX - 2, midY + 1, 0);
+ LineTo(hdc, midX + 3, midY + 1);
- MoveToEx(hdc, midX - 1, midY + 2, 0);
- LineTo(hdc, midX + 2, midY + 2);
-
- SelectObject(hdc, hOldPen);
- SelectObject(hdc, hOldBrush);
+ MoveToEx(hdc, midX - 1, midY + 2, 0);
+ LineTo(hdc, midX + 2, midY + 2);
- DeleteObject(hPen);
- DeleteObject(hBrush);
-}
+ SelectObject(hdc, hOldPen);
+ SelectObject(hdc, hOldBrush);
+
+ DeleteObject(hPen);
+ DeleteObject(hBrush);
+}
static void DrawCheckmark(HDC hdc, RECT rect)
{
#define cxCHECKBOX (2+9+2)
#define cyCHECKBOX (2+9+2)
- // Checkmark
- HPEN hpNew = CreatePen(PS_SOLID, 1, RGB(0,0,0));
- HGDIOBJ hpOld = (HPEN)SelectObject(hdc, hpNew);
+ // Checkmark
+ HPEN hpNew = CreatePen(PS_SOLID, 1, RGB(0,0,0));
+ HGDIOBJ hpOld = (HPEN)SelectObject(hdc, hpNew);
- POINT ptCheckbox;
- ptCheckbox.x = rect.left;
- ptCheckbox.y = rect.top + ((rect.bottom - rect.top) - cyCHECKBOX) / 2;
+ POINT ptCheckbox;
+ ptCheckbox.x = rect.left;
+ ptCheckbox.y = rect.top + ((rect.bottom - rect.top) - cyCHECKBOX) / 2;
- MoveToEx(hdc, ptCheckbox.x +3, ptCheckbox.y+5, NULL);
- LineTo(hdc, ptCheckbox.x +5, ptCheckbox.y+7);
- LineTo(hdc, ptCheckbox.x+10, ptCheckbox.y+2);
+ MoveToEx(hdc, ptCheckbox.x +3, ptCheckbox.y+5, NULL);
+ LineTo(hdc, ptCheckbox.x +5, ptCheckbox.y+7);
+ LineTo(hdc, ptCheckbox.x+10, ptCheckbox.y+2);
- MoveToEx(hdc, ptCheckbox.x +3, ptCheckbox.y+6, NULL);
- LineTo(hdc, ptCheckbox.x +5, ptCheckbox.y+8);
- LineTo(hdc, ptCheckbox.x+10, ptCheckbox.y+3);
+ MoveToEx(hdc, ptCheckbox.x +3, ptCheckbox.y+6, NULL);
+ LineTo(hdc, ptCheckbox.x +5, ptCheckbox.y+8);
+ LineTo(hdc, ptCheckbox.x+10, ptCheckbox.y+3);
- MoveToEx(hdc, ptCheckbox.x +3, ptCheckbox.y+7, NULL);
- LineTo(hdc, ptCheckbox.x +5, ptCheckbox.y+9);
- LineTo(hdc, ptCheckbox.x+10, ptCheckbox.y+4);
+ MoveToEx(hdc, ptCheckbox.x +3, ptCheckbox.y+7, NULL);
+ LineTo(hdc, ptCheckbox.x +5, ptCheckbox.y+9);
+ LineTo(hdc, ptCheckbox.x+10, ptCheckbox.y+4);
- SelectObject(hdc, hpOld);
- DeleteObject(hpNew);
+ SelectObject(hdc, hpOld);
+ DeleteObject(hpNew);
}
static void DrawX(HDC hdc, RECT rect)
{
- // Red X
- static COLORREF crXColor = 0X0000FF;
-
- HBRUSH hbrRed = CreateSolidBrush(crXColor);
- HGDIOBJ hbrOld = SelectObject(hdc, hbrRed);
+ // Red X
+ static COLORREF crXColor = 0X0000FF;
- HPEN hPen = CreatePen(PS_SOLID, 1, crXColor);
- HGDIOBJ hOldPen = SelectObject(hdc, hPen);
+ HBRUSH hbrRed = CreateSolidBrush(crXColor);
+ HGDIOBJ hbrOld = SelectObject(hdc, hbrRed);
- OffsetRect(&rect, 3, 0);
+ HPEN hPen = CreatePen(PS_SOLID, 1, crXColor);
+ HGDIOBJ hOldPen = SelectObject(hdc, hPen);
- rect.top++;
- rect.bottom++;
+ OffsetRect(&rect, 3, 0);
- int nLen = 7;
+ rect.top++;
+ rect.bottom++;
- MoveToEx(hdc, rect.left, rect.top, 0);
- LineTo(hdc, rect.left + nLen, rect.top + nLen);
+ int nLen = 7;
- MoveToEx(hdc, rect.left, rect.top + 1, 0);
- LineTo(hdc, rect.left + nLen, rect.top + nLen + 1);
+ MoveToEx(hdc, rect.left, rect.top, 0);
+ LineTo(hdc, rect.left + nLen, rect.top + nLen);
- MoveToEx(hdc, rect.left, rect.top - 1, 0);
- LineTo(hdc, rect.left + nLen, rect.top + nLen - 1);
+ MoveToEx(hdc, rect.left, rect.top + 1, 0);
+ LineTo(hdc, rect.left + nLen, rect.top + nLen + 1);
+ MoveToEx(hdc, rect.left, rect.top - 1, 0);
+ LineTo(hdc, rect.left + nLen, rect.top + nLen - 1);
- MoveToEx(hdc, rect.left + nLen - 1, rect.top, 0);
- LineTo(hdc, rect.left - 1, rect.top + nLen);
+ MoveToEx(hdc, rect.left + nLen - 1, rect.top, 0);
+ LineTo(hdc, rect.left - 1, rect.top + nLen);
- MoveToEx(hdc, rect.left + nLen - 1, rect.top + 1, 0);
- LineTo(hdc, rect.left - 1, rect.top + nLen + 1);
+ MoveToEx(hdc, rect.left + nLen - 1, rect.top + 1, 0);
+ LineTo(hdc, rect.left - 1, rect.top + nLen + 1);
- MoveToEx(hdc, rect.left + nLen - 1, rect.top - 1, 0);
- LineTo(hdc, rect.left - 1, rect.top + nLen - 1);
+ MoveToEx(hdc, rect.left + nLen - 1, rect.top - 1, 0);
+ LineTo(hdc, rect.left - 1, rect.top + nLen - 1);
- SelectObject(hdc, hOldPen);
- SelectObject(hdc, hbrOld);
+ SelectObject(hdc, hOldPen);
+ SelectObject(hdc, hbrOld);
- DeleteObject(hPen);
- DeleteObject(hbrRed);
+ DeleteObject(hPen);
+ DeleteObject(hbrRed);
}
*/
void PaintStepGraphic(HWND hwnd, STEP_STATE state)
{
- PAINTSTRUCT ps;
+ PAINTSTRUCT ps;
+
+ HDC hdc = BeginPaint(hwnd, &ps);
+ _ASSERTE(hdc);
- HDC hdc = BeginPaint(hwnd, &ps);
- _ASSERTE(hdc);
+ RECT rect;
+ GetClientRect(hwnd, &rect);
- RECT rect;
- GetClientRect(hwnd, &rect);
+ InflateRect(&rect, -2, -2);
- InflateRect(&rect, -2, -2);
+ // First erase the background
+ EraseRect(hdc, rect);
- // First erase the background
- EraseRect(hdc, rect);
+ // Draw an image that corresponds to the state
+ switch (state) {
+ case SS_STEP_IN_PROGRESS:
+ DrawCircle(hdc, rect, STEP_IN_PROGRESS_COLOR);
+ break;
- // Draw an image that corresponds to the state
- switch (state) {
- case SS_STEP_IN_PROGRESS: DrawCircle(hdc, rect, STEP_IN_PROGRESS_COLOR);
- break;
+ case SS_STEP_TO_BE_DONE:
+ DrawCircle(hdc, rect, STEP_TO_BE_DONE_COLOR);
+ break;
- case SS_STEP_TO_BE_DONE: DrawCircle(hdc, rect, STEP_TO_BE_DONE_COLOR);
- break;
-
- case SS_STEP_FINISHED: DrawCheckmark(hdc, rect);
- break;
+ case SS_STEP_FINISHED:
+ DrawCheckmark(hdc, rect);
+ break;
- case SS_STEP_FAILED: DrawX(hdc, rect);
- break;
- }
- EndPaint(hwnd, &ps);
+ case SS_STEP_FAILED:
+ DrawX(hdc, rect);
+ break;
+ }
+
+ EndPaint(hwnd, &ps);
}
void CALLBACK PaintPageGraphic(LPWIZARD pWiz, HDC hdc, LPRECT prTarget, HPALETTE hpal)
{
- static HFONT hFont = AfsAppLib_CreateFont(IDS_GRAPHIC_FONT);
- static HPEN hPenWhite = CreatePen(PS_SOLID, 1, clrWHITE);
- static HPEN hPenHighlight = CreatePen(PS_SOLID, 1, clrHIGHLIGHT);
- static HPEN hPenShadow = CreatePen(PS_SOLID, 1, clrSHADOW);
- static HPEN hPenBlack = CreatePen(PS_SOLID, 1, clrBLACK);
- static HPEN hPenBarIntLeft = CreatePen(PS_SOLID, 1, clrBAR_INT_LEFT);
- static HPEN hPenBarIntRight = CreatePen(PS_SOLID, 1, clrBAR_INT_RIGHT);
- static HPEN hPenArrowInterior = CreatePen(PS_SOLID, 1, clrARROW_INTERIOR);
-
- // First find out where we'll be drawing things.
- RECT rArea;
- rArea.top = prTarget->bottom - cyAREA - cyBOTTOM_MARGIN;
- rArea.bottom = prTarget->bottom - cyBOTTOM_MARGIN;
- rArea.left = prTarget->left + cxLEFT_MARGIN;
- rArea.right = prTarget->right - cxRIGHT_MARGIN;
-
- // Draw the "Current Step:" text
- HGDIOBJ hFontOld = SelectObject(hdc, hFont);
- COLORREF clrTextOld = SetTextColor (hdc, clrTEXT_CURRENT);
- SetBkMode (hdc, TRANSPARENT);
-
- TCHAR szText[cchRESOURCE];
- GetResString(IDS_CURRENT_STEP, szText);
-
- RECT rText = rArea;
- DWORD dwFlags = DT_CENTER | DT_TOP | DT_SINGLELINE;
- DrawTextEx (hdc, szText, lstrlen(szText), &rText, dwFlags | DT_CALCRECT, NULL);
-
- rText.right = rArea.right;
- DrawTextEx (hdc, szText, lstrlen(szText), &rText, dwFlags, NULL);
-
- // Draw the progress bar; it should look like this:
- // wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww // (w=white, b=black...
- // whhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhb // h=highlight, s=shadow...
- // whllllllllllllllllrrrrrrrrrrrrrrrsb // l=left/int, r=right/int)
- // whllllllllllllllllrrrrrrrrrrrrrrrsb // l=left/int, r=right/int)
- // whssssssssssssssssssssssssssssssssb // h=highlight, s=shadow...
- // wbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb // h=highlight, s=shadow...
-
- // Oh--we'll need to know where the pointer's point should go. We'll
- // make that be where the leftmost dot of the pointer's tip, and the
- // rightmost dot that's colored "l". One state 0, we want the pointer
- // to be all the way to the left--and on state {g_nNumStates-1}, we want
- // it all the way to the right
-
- RECT rBar = rArea;
- rBar.top = rText.bottom + cyBELOW_CURRENT;
- rBar.bottom = rBar.top + 6;
-
- RECT rBarInterior = rBar;
- InflateRect (&rBarInterior, -2, -2);
-
- int nStepSize = (rBarInterior.right - rBarInterior.left) / (g_nNumStates-1);
- int xCurPos = rBarInterior.left + (g_pWiz->GetState() * nStepSize);
- if (!g_pWiz->GetState())
- xCurPos = rBarInterior.left-1; // don't draw *any* green
- else if (g_pWiz->GetState() == (int)(g_nNumStates-1))
- xCurPos = rBarInterior.right-1; // don't draw *any* red
-
- // Draw that bar!
- HGDIOBJ hPenOld = SelectObject (hdc, hPenWhite);
- MoveToEx (hdc, rBar.left, rBar.bottom-1, 0);
- LineTo (hdc, rBar.left, rBar.top);
- LineTo (hdc, rBar.right, rBar.top);
- MoveToEx (hdc, rBar.left, rBar.bottom, 0);
-
- SelectObject (hdc, hPenHighlight);
- MoveToEx (hdc, rBar.left+1, rBar.bottom-2, 0);
- LineTo (hdc, rBar.left+1, rBar.top+1);
- LineTo (hdc, rBar.right-1, rBar.top+1);
-
- SelectObject (hdc, hPenShadow);
- MoveToEx (hdc, rBar.left+2, rBar.bottom-2, 0);
- LineTo (hdc, rBar.right-2, rBar.bottom-2);
- LineTo (hdc, rBar.right-2, rBar.top+1);
-
- SelectObject (hdc, hPenBlack);
- MoveToEx (hdc, rBar.left+1, rBar.bottom-1, 0);
- LineTo (hdc, rBar.right-1, rBar.bottom-1);
- LineTo (hdc, rBar.right-1, rBar.top);
-
- if (xCurPos >= rBarInterior.left) {
- SelectObject (hdc, hPenBarIntLeft);
- MoveToEx (hdc, rBarInterior.left, rBarInterior.top, 0);
- LineTo (hdc, xCurPos+1, rBarInterior.top);
- MoveToEx (hdc, rBarInterior.left, rBarInterior.top+1, 0);
- LineTo (hdc, xCurPos+1, rBarInterior.top+1);
- }
-
- if (xCurPos < rBarInterior.right-1) {
- SelectObject (hdc, hPenBarIntRight);
- MoveToEx (hdc, xCurPos+1, rBarInterior.top, 0);
- LineTo (hdc, rBarInterior.right, rBarInterior.top);
- MoveToEx (hdc, xCurPos+1, rBarInterior.top+1, 0);
- LineTo (hdc, rBarInterior.right, rBarInterior.top+1);
- }
- SelectObject (hdc, hPenOld);
-
- // Draw the arrow underneath it; it should look like this:
- // wb
- // whsb
- // whassb
- // whaaassb
- // whaaaaassb
- // wssssssssssb
- // Remember that the topmost "w" is where xCurPos is.
-
- RECT rArrow;
- rArrow.top = rBar.bottom +1;
- rArrow.bottom = rArrow.top +6;
- rArrow.left = xCurPos -5;
- rArrow.right = xCurPos +7;
-
- hPenOld = SelectObject (hdc, hPenWhite);
- MoveToEx (hdc, rArrow.left, rArrow.bottom-1, 0);
- LineTo (hdc, xCurPos+1, rArrow.top-1);
-
- SelectObject (hdc, hPenHighlight);
- MoveToEx (hdc, rArrow.left+2, rArrow.bottom-2, 0);
- LineTo (hdc, xCurPos+1, rArrow.top);
-
- SelectObject (hdc, hPenShadow);
- MoveToEx (hdc, rArrow.left+1, rArrow.bottom-1, 0);
- LineTo (hdc, rArrow.right-1, rArrow.bottom-1);
- MoveToEx (hdc, xCurPos+1, rArrow.top+1, 0);
- LineTo (hdc, rArrow.right, rArrow.bottom);
- MoveToEx (hdc, xCurPos+1, rArrow.top+2, 0);
- LineTo (hdc, rArrow.right-1, rArrow.bottom);
-
- SelectObject (hdc, hPenBlack);
- MoveToEx (hdc, xCurPos+1, rArrow.top, 0);
- LineTo (hdc, rArrow.right, rArrow.bottom);
-
- // wb
- // whsb
- // whassb
- // whaaassb
- // whaaaaassb
- // wssssssssssb
-
- SelectObject (hdc, hPenArrowInterior);
- MoveToEx (hdc, xCurPos, rArrow.top+2, 0);
- LineTo (hdc, xCurPos+1, rArrow.top+2);
- MoveToEx (hdc, xCurPos-1, rArrow.top+3, 0);
- LineTo (hdc, xCurPos+2, rArrow.top+3);
- MoveToEx (hdc, xCurPos-2, rArrow.top+4, 0);
- LineTo (hdc, xCurPos+3, rArrow.top+4);
-
- SelectObject (hdc, hPenOld);
-
- // Draw the description text
- SetTextColor (hdc, clrTEXT_STEP);
- GetResString(g_StateDesc[g_pWiz->GetState()], szText);
-
- rText = rArea;
- rText.top = rArrow.bottom + cyBELOW_ARROW;
- dwFlags = DT_CENTER | DT_TOP | DT_WORDBREAK;
- DrawTextEx (hdc, szText, lstrlen(szText), &rText, dwFlags, NULL);
-
- SetTextColor (hdc, clrTextOld);
- SelectObject (hdc, hFontOld);
-}
+ static HFONT hFont = AfsAppLib_CreateFont(IDS_GRAPHIC_FONT);
+ static HPEN hPenWhite = CreatePen(PS_SOLID, 1, clrWHITE);
+ static HPEN hPenHighlight = CreatePen(PS_SOLID, 1, clrHIGHLIGHT);
+ static HPEN hPenShadow = CreatePen(PS_SOLID, 1, clrSHADOW);
+ static HPEN hPenBlack = CreatePen(PS_SOLID, 1, clrBLACK);
+ static HPEN hPenBarIntLeft = CreatePen(PS_SOLID, 1, clrBAR_INT_LEFT);
+ static HPEN hPenBarIntRight = CreatePen(PS_SOLID, 1, clrBAR_INT_RIGHT);
+ static HPEN hPenArrowInterior = CreatePen(PS_SOLID, 1, clrARROW_INTERIOR);
+
+ // First find out where we'll be drawing things.
+ RECT rArea;
+ rArea.top = prTarget->bottom - cyAREA - cyBOTTOM_MARGIN;
+ rArea.bottom = prTarget->bottom - cyBOTTOM_MARGIN;
+ rArea.left = prTarget->left + cxLEFT_MARGIN;
+ rArea.right = prTarget->right - cxRIGHT_MARGIN;
+
+ // Draw the "Current Step:" text
+ HGDIOBJ hFontOld = SelectObject(hdc, hFont);
+ COLORREF clrTextOld = SetTextColor (hdc, clrTEXT_CURRENT);
+ SetBkMode (hdc, TRANSPARENT);
+
+ TCHAR szText[cchRESOURCE];
+ GetResString(IDS_CURRENT_STEP, szText);
+
+ RECT rText = rArea;
+ DWORD dwFlags = DT_CENTER | DT_TOP | DT_SINGLELINE;
+ DrawTextEx (hdc, szText, lstrlen(szText), &rText, dwFlags | DT_CALCRECT, NULL);
+
+ rText.right = rArea.right;
+ DrawTextEx (hdc, szText, lstrlen(szText), &rText, dwFlags, NULL);
+
+ // Draw the progress bar; it should look like this:
+ // wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww // (w=white, b=black...
+ // whhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhb // h=highlight, s=shadow...
+ // whllllllllllllllllrrrrrrrrrrrrrrrsb // l=left/int, r=right/int)
+ // whllllllllllllllllrrrrrrrrrrrrrrrsb // l=left/int, r=right/int)
+ // whssssssssssssssssssssssssssssssssb // h=highlight, s=shadow...
+ // wbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb // h=highlight, s=shadow...
+
+ // Oh--we'll need to know where the pointer's point should go. We'll
+ // make that be where the leftmost dot of the pointer's tip, and the
+ // rightmost dot that's colored "l". One state 0, we want the pointer
+ // to be all the way to the left--and on state {g_nNumStates-1}, we want
+ // it all the way to the right
+
+ RECT rBar = rArea;
+ rBar.top = rText.bottom + cyBELOW_CURRENT;
+ rBar.bottom = rBar.top + 6;
+
+ RECT rBarInterior = rBar;
+ InflateRect (&rBarInterior, -2, -2);
+
+ int nStepSize = (rBarInterior.right - rBarInterior.left) / (g_nNumStates-1);
+ int xCurPos = rBarInterior.left + (g_pWiz->GetState() * nStepSize);
+ if (!g_pWiz->GetState())
+ xCurPos = rBarInterior.left-1; // don't draw *any* green
+ else if (g_pWiz->GetState() == (int)(g_nNumStates-1))
+ xCurPos = rBarInterior.right-1; // don't draw *any* red
+
+ // Draw that bar!
+ HGDIOBJ hPenOld = SelectObject (hdc, hPenWhite);
+ MoveToEx (hdc, rBar.left, rBar.bottom-1, 0);
+ LineTo (hdc, rBar.left, rBar.top);
+ LineTo (hdc, rBar.right, rBar.top);
+ MoveToEx (hdc, rBar.left, rBar.bottom, 0);
+
+ SelectObject (hdc, hPenHighlight);
+ MoveToEx (hdc, rBar.left+1, rBar.bottom-2, 0);
+ LineTo (hdc, rBar.left+1, rBar.top+1);
+ LineTo (hdc, rBar.right-1, rBar.top+1);
+
+ SelectObject (hdc, hPenShadow);
+ MoveToEx (hdc, rBar.left+2, rBar.bottom-2, 0);
+ LineTo (hdc, rBar.right-2, rBar.bottom-2);
+ LineTo (hdc, rBar.right-2, rBar.top+1);
+
+ SelectObject (hdc, hPenBlack);
+ MoveToEx (hdc, rBar.left+1, rBar.bottom-1, 0);
+ LineTo (hdc, rBar.right-1, rBar.bottom-1);
+ LineTo (hdc, rBar.right-1, rBar.top);
+
+ if (xCurPos >= rBarInterior.left) {
+ SelectObject (hdc, hPenBarIntLeft);
+ MoveToEx (hdc, rBarInterior.left, rBarInterior.top, 0);
+ LineTo (hdc, xCurPos+1, rBarInterior.top);
+ MoveToEx (hdc, rBarInterior.left, rBarInterior.top+1, 0);
+ LineTo (hdc, xCurPos+1, rBarInterior.top+1);
+ }
+
+ if (xCurPos < rBarInterior.right-1) {
+ SelectObject (hdc, hPenBarIntRight);
+ MoveToEx (hdc, xCurPos+1, rBarInterior.top, 0);
+ LineTo (hdc, rBarInterior.right, rBarInterior.top);
+ MoveToEx (hdc, xCurPos+1, rBarInterior.top+1, 0);
+ LineTo (hdc, rBarInterior.right, rBarInterior.top+1);
+ }
+ SelectObject (hdc, hPenOld);
+
+ // Draw the arrow underneath it; it should look like this:
+ // wb
+ // whsb
+ // whassb
+ // whaaassb
+ // whaaaaassb
+ // wssssssssssb
+ // Remember that the topmost "w" is where xCurPos is.
+
+ RECT rArrow;
+ rArrow.top = rBar.bottom +1;
+ rArrow.bottom = rArrow.top +6;
+ rArrow.left = xCurPos -5;
+ rArrow.right = xCurPos +7;
+
+ hPenOld = SelectObject (hdc, hPenWhite);
+ MoveToEx (hdc, rArrow.left, rArrow.bottom-1, 0);
+ LineTo (hdc, xCurPos+1, rArrow.top-1);
+
+ SelectObject (hdc, hPenHighlight);
+ MoveToEx (hdc, rArrow.left+2, rArrow.bottom-2, 0);
+ LineTo (hdc, xCurPos+1, rArrow.top);
+
+ SelectObject (hdc, hPenShadow);
+ MoveToEx (hdc, rArrow.left+1, rArrow.bottom-1, 0);
+ LineTo (hdc, rArrow.right-1, rArrow.bottom-1);
+ MoveToEx (hdc, xCurPos+1, rArrow.top+1, 0);
+ LineTo (hdc, rArrow.right, rArrow.bottom);
+ MoveToEx (hdc, xCurPos+1, rArrow.top+2, 0);
+ LineTo (hdc, rArrow.right-1, rArrow.bottom);
+
+ SelectObject (hdc, hPenBlack);
+ MoveToEx (hdc, xCurPos+1, rArrow.top, 0);
+ LineTo (hdc, rArrow.right, rArrow.bottom);
+
+ // wb
+ // whsb
+ // whassb
+ // whaaassb
+ // whaaaaassb
+ // wssssssssssb
+
+ SelectObject (hdc, hPenArrowInterior);
+ MoveToEx (hdc, xCurPos, rArrow.top+2, 0);
+ LineTo (hdc, xCurPos+1, rArrow.top+2);
+ MoveToEx (hdc, xCurPos-1, rArrow.top+3, 0);
+ LineTo (hdc, xCurPos+2, rArrow.top+3);
+ MoveToEx (hdc, xCurPos-2, rArrow.top+4, 0);
+ LineTo (hdc, xCurPos+3, rArrow.top+4);
+
+ SelectObject (hdc, hPenOld);
+
+ // Draw the description text
+ SetTextColor (hdc, clrTEXT_STEP);
+ GetResString(g_StateDesc[g_pWiz->GetState()], szText);
+
+ rText = rArea;
+ rText.top = rArrow.bottom + cyBELOW_ARROW;
+ dwFlags = DT_CENTER | DT_TOP | DT_WORDBREAK;
+ DrawTextEx (hdc, szText, lstrlen(szText), &rText, dwFlags, NULL);
+
+ SetTextColor (hdc, clrTextOld);
+ SelectObject (hdc, hFontOld);
+}
};
static DWORD IDH_BACKUP_SERVER_CTX_HELP[] = {
- IDC_CONFIG_BACKUP_SERVER, IDH_CONFIG_BACKUP_SERVER,
- IDC_DONT_CONFIG_BACKUP_SERVER, IDH_DONT_CONFIG_BACKUP_SERVER,
+ IDC_CONFIG_BACKUP_SERVER, IDH_CONFIG_BACKUP_SERVER,
+ IDC_DONT_CONFIG_BACKUP_SERVER, IDH_DONT_CONFIG_BACKUP_SERVER,
0, 0
};
static DWORD IDH_FILE_SERVER_CTX_HELP[] = {
- IDC_SHOULD_CONFIG_FILE_SERVER, IDH_SHOULD_CONFIG_FILE_SERVER,
- IDC_DONT_CONFIG_FILE_SERVER, IDH_DONT_CONFIG_FILE_SERVER,
+ IDC_SHOULD_CONFIG_FILE_SERVER, IDH_SHOULD_CONFIG_FILE_SERVER,
+ IDC_DONT_CONFIG_FILE_SERVER, IDH_DONT_CONFIG_FILE_SERVER,
0, 0
};
static DWORD IDH_CELL_AND_SERVER_INFO_CTX_HELP[] = {
- IDC_JOIN_EXISTING_CELL, IDH_JOIN_EXISTING_CELL,
- IDC_FIRST_SERVER, IDH_FIRST_SERVER,
- IDC_CELL_NAME, IDH_CELL_NAME,
- IDC_PRINCIPAL, IDH_PRINCIPAL,
- IDC_SERVER_PW, IDH_SERVER_PW,
- IDC_VERIFY_PW, IDH_VERIFY_PW,
+ IDC_JOIN_EXISTING_CELL, IDH_JOIN_EXISTING_CELL,
+ IDC_FIRST_SERVER, IDH_FIRST_SERVER,
+ IDC_CELL_NAME, IDH_CELL_NAME,
+ IDC_PRINCIPAL, IDH_PRINCIPAL,
+ IDC_SERVER_PW, IDH_SERVER_PW,
+ IDC_VERIFY_PW, IDH_VERIFY_PW,
0, 0
};
static DWORD IDH_FIRST_SERVER_CTX_HELP[] = {
- IDC_ADMIN_NAME, IDH_ADMIN_NAME,
- IDC_ADMIN_PW, IDH_ADMIN_PW,
- IDC_VERIFY_ADMIN_PW, IDH_VERIFY_ADMIN_PW,
- IDC_USE_NEXT_UID, IDH_USE_NEXT_UID,
- IDC_USE_THIS_UID, IDH_USE_THIS_UID,
- IDC_AFS_UID, IDH_AFS_UID,
- IDC_AFS_UID_SPINNER, IDH_AFS_UID_SPINNER,
+ IDC_ADMIN_NAME, IDH_ADMIN_NAME,
+ IDC_ADMIN_PW, IDH_ADMIN_PW,
+ IDC_VERIFY_ADMIN_PW, IDH_VERIFY_ADMIN_PW,
+ IDC_USE_NEXT_UID, IDH_USE_NEXT_UID,
+ IDC_USE_THIS_UID, IDH_USE_THIS_UID,
+ IDC_AFS_UID, IDH_AFS_UID,
+ IDC_AFS_UID_SPINNER, IDH_AFS_UID_SPINNER,
0, 0
-};
+};
static DWORD IDH_EXISTING_CELL_CTX_HELP[] = {
- IDC_ADMIN_NAME, IDH_ADMIN_NAME2,
- IDC_ADMIN_PW, IDH_ADMIN_PW2,
- IDC_HOSTNAME, IDH_HOSTNAME,
+ IDC_ADMIN_NAME, IDH_ADMIN_NAME2,
+ IDC_ADMIN_PW, IDH_ADMIN_PW2,
+ IDC_HOSTNAME, IDH_HOSTNAME,
0, 0
};
static DWORD IDH_DB_SERVER_CTX_HELP[] = {
- IDC_CONFIG_DB_SERVER, IDH_CONFIG_DB_SERVER,
- IDC_DONT_CONFIG_DB_SERVER, IDH_DONT_CONFIG_DB_SERVER,
- IDC_SYS_CONTROL_MACHINE, IDH_SYS_CONTROL_MACHINE,
+ IDC_CONFIG_DB_SERVER, IDH_CONFIG_DB_SERVER,
+ IDC_DONT_CONFIG_DB_SERVER, IDH_DONT_CONFIG_DB_SERVER,
+ IDC_SYS_CONTROL_MACHINE, IDH_SYS_CONTROL_MACHINE,
0, 0
};
static DWORD IDH_PARTITION_CTX_HELP[] = {
- IDC_CREATE_PARTITION, IDH_CREATE_PARTITION,
- IDC_DRIVE_LIST, IDH_DRIVE_LIST,
- IDC_PARTITION_NAME, IDH_PARTITION_NAME,
- IDC_DONT_CREATE_PARTITION, IDH_DONT_CREATE_PARTITION,
+ IDC_CREATE_PARTITION, IDH_CREATE_PARTITION,
+ IDC_DRIVE_LIST, IDH_DRIVE_LIST,
+ IDC_PARTITION_NAME, IDH_PARTITION_NAME,
+ IDC_DONT_CREATE_PARTITION, IDH_DONT_CREATE_PARTITION,
0, 0
};
static DWORD IDH_ROOT_VOLUMES_CTX_HELP[] = {
- IDC_CREATE_ROOT_VOLUMES, IDH_CREATE_VOLUME,
- IDC_DONT_CREATE_ROOT_VOLUMES, IDH_DONT_CREATE_ROOT_VOLUMES,
+ IDC_CREATE_ROOT_VOLUMES, IDH_CREATE_VOLUME,
+ IDC_DONT_CREATE_ROOT_VOLUMES, IDH_DONT_CREATE_ROOT_VOLUMES,
0, 0
};
static DWORD IDH_REPLICATION_CTX_HELP[] = {
- IDC_REPLICATE, IDH_REPLICATE,
- IDC_DONT_REPLICATE, IDH_DONT_REPLICATE,
+ IDC_REPLICATE, IDH_REPLICATE,
+ IDC_DONT_REPLICATE, IDH_DONT_REPLICATE,
0, 0
};
static DWORD IDH_SYS_CONTROL_CTX_HELP[] = {
- IDC_SYS_CONTROL_SERVER, IDH_SYS_CONTROL_SERVER,
- IDC_SYS_CONTROL_CLIENT, IDH_SYS_CONTROL_CLIENT,
- IDC_SYS_CONTROL_MACHINE, IDH_SYS_CONTROL_MACHINE2,
- IDC_DONT_CONFIGURE, IDH_DONT_CONFIGURE,
+ IDC_SYS_CONTROL_SERVER, IDH_SYS_CONTROL_SERVER,
+ IDC_SYS_CONTROL_CLIENT, IDH_SYS_CONTROL_CLIENT,
+ IDC_SYS_CONTROL_MACHINE, IDH_SYS_CONTROL_MACHINE2,
+ IDC_DONT_CONFIGURE, IDH_DONT_CONFIGURE,
0, 0
};
*/
static DWORD IDH_CREATE_PARTITION_CTX_HELP[] = {
- IDC_DRIVE_LIST, IDH_DRIVE_LIST,
- IDC_PARTITION_NAME, IDH_CT_PARTITION_NAME,
- IDC_CREATE, IDH_CREATE,
- IDC_CLOSE, IDH_CLOSE,
+ IDC_DRIVE_LIST, IDH_DRIVE_LIST,
+ IDC_PARTITION_NAME, IDH_CT_PARTITION_NAME,
+ IDC_CREATE, IDH_CREATE,
+ IDC_CLOSE, IDH_CLOSE,
0, 0
};
static DWORD IDH_PARTITIONS_CTX_HELP[] = {
- IDC_PARTITION_LIST, IDH_PARTITIONS_LIST,
- IDC_CREATE_PARTITIONS, IDH_CREATE_PARTITIONS,
- IDC_SALVAGE, IDH_SALVAGE,
- IDC_REFORMAT, IDH_REFORMAT,
- IDC_REMOVE, IDH_REMOVE,
+ IDC_PARTITION_LIST, IDH_PARTITIONS_LIST,
+ IDC_CREATE_PARTITIONS, IDH_CREATE_PARTITIONS,
+ IDC_SALVAGE, IDH_SALVAGE,
+ IDC_REFORMAT, IDH_REFORMAT,
+ IDC_REMOVE, IDH_REMOVE,
0, 0
};
static DWORD IDH_SERVICES_CTX_HELP[] = {
- IDC_FS_SERVICE, IDH_FS_SERVICE,
- IDC_DB_SERVICE, IDH_DB_SERVICE,
- IDC_DB_DETAILS, IDH_DB_DETAILS,
- IDC_BK_SERVICE, IDH_BK_SERVICE,
- IDC_SCS, IDH_SCS,
- IDC_SCC, IDH_SCC,
- IDC_SC_MACHINE, IDH_SC_MACHINE,
+ IDC_FS_SERVICE, IDH_FS_SERVICE,
+ IDC_DB_SERVICE, IDH_DB_SERVICE,
+ IDC_DB_DETAILS, IDH_DB_DETAILS,
+ IDC_BK_SERVICE, IDH_BK_SERVICE,
+ IDC_SCS, IDH_SCS,
+ IDC_SCC, IDH_SCC,
+ IDC_SC_MACHINE, IDH_SC_MACHINE,
0, 0
};
static DWORD IDH_ADMIN_INFO_CTX_HELP[] = {
- IDC_ADMIN_NAME, IDH_CT_ADMIN_NAME,
- IDC_ADMIN_PW, IDH_CT_ADMIN_PW,
- IDC_HOSTNAME, IDH_CT_HOSTNAME,
- IDOK, IDH_CONFIG,
+ IDC_ADMIN_NAME, IDH_CT_ADMIN_NAME,
+ IDC_ADMIN_PW, IDH_CT_ADMIN_PW,
+ IDC_HOSTNAME, IDH_CT_HOSTNAME,
+ IDOK, IDH_CONFIG,
0, 0
};
*/
void RegisterConfigToolHelp()
{
- AfsAppLib_RegisterHelp(IDD_CREATE_PARTITION, IDH_CREATE_PARTITION_CTX_HELP, IDH_CREATE_PARTITION_DLG);
- AfsAppLib_RegisterHelp(IDD_PARTITIONS_PAGE, IDH_PARTITIONS_CTX_HELP, IDH_PARTITIONS_PAGE);
- AfsAppLib_RegisterHelp(IDD_SERVICES_PAGE, IDH_SERVICES_CTX_HELP, IDH_SERVICES_PAGE);
- AfsAppLib_RegisterHelp(IDD_ADMIN_INFO, IDH_ADMIN_INFO_CTX_HELP, IDH_ADMIN_INFO_DLG);
- AfsAppLib_RegisterHelp(IDD_GET_PW, IDH_GET_PW_CTX_HELP, IDH_GET_PW_DLG);
- AfsAppLib_RegisterHelp(IDD_SALVAGE, IDH_SALVAGE_CTX_HELP, IDH_SALVAGE_DLG);
- AfsAppLib_RegisterHelp(IDD_SALVAGE_RESULTS, IDH_SALVAGE_RESULTS_CTX_HELP, IDH_SALVAGE_RESULTS_DLG);
+ AfsAppLib_RegisterHelp(IDD_CREATE_PARTITION, IDH_CREATE_PARTITION_CTX_HELP, IDH_CREATE_PARTITION_DLG);
+ AfsAppLib_RegisterHelp(IDD_PARTITIONS_PAGE, IDH_PARTITIONS_CTX_HELP, IDH_PARTITIONS_PAGE);
+ AfsAppLib_RegisterHelp(IDD_SERVICES_PAGE, IDH_SERVICES_CTX_HELP, IDH_SERVICES_PAGE);
+ AfsAppLib_RegisterHelp(IDD_ADMIN_INFO, IDH_ADMIN_INFO_CTX_HELP, IDH_ADMIN_INFO_DLG);
+ AfsAppLib_RegisterHelp(IDD_GET_PW, IDH_GET_PW_CTX_HELP, IDH_GET_PW_DLG);
+ AfsAppLib_RegisterHelp(IDD_SALVAGE, IDH_SALVAGE_CTX_HELP, IDH_SALVAGE_DLG);
+ AfsAppLib_RegisterHelp(IDD_SALVAGE_RESULTS, IDH_SALVAGE_RESULTS_CTX_HELP, IDH_SALVAGE_RESULTS_DLG);
}
void RegisterWizardHelp()
{
- AfsAppLib_RegisterHelp(IDD_INTRO_PAGE, IDH_INTRO_CTX_HELP, IDH_INTRO_PAGE);
+ AfsAppLib_RegisterHelp(IDD_INTRO_PAGE, IDH_INTRO_CTX_HELP, IDH_INTRO_PAGE);
AfsAppLib_RegisterHelp(IDD_INFO_PAGE, IDH_CELL_AND_SERVER_INFO_CTX_HELP, IDH_INFO_PAGE);
- AfsAppLib_RegisterHelp(IDD_INFO_PAGE2_FIRST_SERVER, IDH_FIRST_SERVER_CTX_HELP, IDH_FIRST_SERVER_PAGE);
- AfsAppLib_RegisterHelp(IDD_INFO_PAGE2_NOT_FIRST_SERVER, IDH_EXISTING_CELL_CTX_HELP, IDH_EXISTING_CELL_PAGE);
- AfsAppLib_RegisterHelp(IDD_FILE_SERVER_PAGE, IDH_FILE_SERVER_CTX_HELP, IDH_FILE_SERVER_PAGE);
- AfsAppLib_RegisterHelp(IDD_DB_SERVER_PAGE, IDH_DB_SERVER_CTX_HELP, IDH_DB_SERVER_PAGE);
- AfsAppLib_RegisterHelp(IDD_BACKUP_SERVER_PAGE, IDH_BACKUP_SERVER_CTX_HELP, IDH_BACKUP_SERVER_PAGE);
- AfsAppLib_RegisterHelp(IDD_PARTITION_PAGE, IDH_PARTITION_CTX_HELP, IDH_PARTITION_PAGE);
- AfsAppLib_RegisterHelp(IDD_ROOT_VOLUMES_PAGE, IDH_ROOT_VOLUMES_CTX_HELP, IDH_ROOT_VOLUMES_PAGE);
- AfsAppLib_RegisterHelp(IDD_REPLICATION_PAGE, IDH_REPLICATION_CTX_HELP, IDH_REPLICATION_PAGE);
- AfsAppLib_RegisterHelp(IDD_SYS_CONTROL_PAGE, IDH_SYS_CONTROL_CTX_HELP, IDH_SYS_CONTROL_PAGE);
- AfsAppLib_RegisterHelp(IDD_GET_PW, IDH_GET_PW_CTX_HELP, IDH_GET_PW_DLG);
+ AfsAppLib_RegisterHelp(IDD_INFO_PAGE2_FIRST_SERVER, IDH_FIRST_SERVER_CTX_HELP, IDH_FIRST_SERVER_PAGE);
+ AfsAppLib_RegisterHelp(IDD_INFO_PAGE2_NOT_FIRST_SERVER, IDH_EXISTING_CELL_CTX_HELP, IDH_EXISTING_CELL_PAGE);
+ AfsAppLib_RegisterHelp(IDD_FILE_SERVER_PAGE, IDH_FILE_SERVER_CTX_HELP, IDH_FILE_SERVER_PAGE);
+ AfsAppLib_RegisterHelp(IDD_DB_SERVER_PAGE, IDH_DB_SERVER_CTX_HELP, IDH_DB_SERVER_PAGE);
+ AfsAppLib_RegisterHelp(IDD_BACKUP_SERVER_PAGE, IDH_BACKUP_SERVER_CTX_HELP, IDH_BACKUP_SERVER_PAGE);
+ AfsAppLib_RegisterHelp(IDD_PARTITION_PAGE, IDH_PARTITION_CTX_HELP, IDH_PARTITION_PAGE);
+ AfsAppLib_RegisterHelp(IDD_ROOT_VOLUMES_PAGE, IDH_ROOT_VOLUMES_CTX_HELP, IDH_ROOT_VOLUMES_PAGE);
+ AfsAppLib_RegisterHelp(IDD_REPLICATION_PAGE, IDH_REPLICATION_CTX_HELP, IDH_REPLICATION_PAGE);
+ AfsAppLib_RegisterHelp(IDD_SYS_CONTROL_PAGE, IDH_SYS_CONTROL_CTX_HELP, IDH_SYS_CONTROL_PAGE);
+ AfsAppLib_RegisterHelp(IDD_GET_PW, IDH_GET_PW_CTX_HELP, IDH_GET_PW_DLG);
AfsAppLib_RegisterHelp(IDD_CONFIG_SERVER_PAGE, IDH_CONFIG_SERVER_CTX_HELP, IDH_CONFIG_SERVER_PAGE);
}
if (WizStep_Common_DlgProc (hRHS, msg, wp, lp))
return FALSE;
- switch (msg) {
- case WM_INITDIALOG:
- OnInitDialog(hRHS);
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wp)) {
- case IDC_WIZARD:
- if (HIWORD(wp) == wcIS_STATE_DISABLED) {
- int nState = g_pWiz->GetState();
-
- // Disable step 3 if we are not the first server
- if (nState == sidSTEP_THREE)
- return !g_CfgData.bFirstServer;
-
- // Disable step 4 if we are the first server
- if (nState == sidSTEP_FOUR)
- return g_CfgData.bFirstServer;
- }
- break;
-
- case IDNEXT:
- SavePageInfo();
- g_pWiz->SetState (sidSTEP_FIVE);
- break;
-
- case IDBACK:
- SavePageInfo();
- g_pWiz->SetState (sidSTEP_TWO);
- break;
-
- case IDC_USE_NEXT_UID:
- UseNextUid(TRUE);
- CheckEnableButtons();
- break;
-
- case IDC_USE_THIS_UID:
- UseNextUid(FALSE);
- CheckEnableButtons();
- break;
-
- case IDC_ADMIN_NAME:
- case IDC_ADMIN_PW:
- case IDC_VERIFY_ADMIN_PW:
- case IDC_HOSTNAME:
- if (HIWORD(wp) == EN_CHANGE)
- CheckEnableButtons();
- break;
-
- }
- break;
- }
+ switch (msg) {
+ case WM_INITDIALOG:
+ OnInitDialog(hRHS);
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wp)) {
+ case IDC_WIZARD:
+ if (HIWORD(wp) == wcIS_STATE_DISABLED) {
+ int nState = g_pWiz->GetState();
+
+ // Disable step 3 if we are not the first server
+ if (nState == sidSTEP_THREE)
+ return !g_CfgData.bFirstServer;
+
+ // Disable step 4 if we are the first server
+ if (nState == sidSTEP_FOUR)
+ return g_CfgData.bFirstServer;
+ }
+ break;
+
+ case IDNEXT:
+ SavePageInfo();
+ g_pWiz->SetState (sidSTEP_FIVE);
+ break;
+
+ case IDBACK:
+ SavePageInfo();
+ g_pWiz->SetState (sidSTEP_TWO);
+ break;
+
+ case IDC_USE_NEXT_UID:
+ UseNextUid(TRUE);
+ CheckEnableButtons();
+ break;
+
+ case IDC_USE_THIS_UID:
+ UseNextUid(FALSE);
+ CheckEnableButtons();
+ break;
+
+ case IDC_ADMIN_NAME:
+ case IDC_ADMIN_PW:
+ case IDC_VERIFY_ADMIN_PW:
+ case IDC_HOSTNAME:
+ if (HIWORD(wp) == EN_CHANGE)
+ CheckEnableButtons();
+ break;
+
+ }
+ break;
+ }
return FALSE;
}
*/
static void OnInitDialog(HWND hwndDlg)
{
- hDlg = hwndDlg;
+ hDlg = hwndDlg;
- g_pWiz->EnableButtons(BACK_BUTTON);
+ g_pWiz->EnableButtons(BACK_BUTTON);
- SetUpDownRange(hDlg, IDC_AFS_UID_SPINNER, MIN_AFS_UID, MAX_AFS_UID);
+ SetUpDownRange(hDlg, IDC_AFS_UID_SPINNER, MIN_AFS_UID, MAX_AFS_UID);
- ShowPageInfo();
+ ShowPageInfo();
- g_pWiz->SetDefaultControl(IDC_ADMIN_NAME);
+ g_pWiz->SetDefaultControl(IDC_ADMIN_NAME);
}
*
*/
static void CheckEnableButtons()
-{
- BOOL bDisable = FALSE;
+{
+ BOOL bDisable = FALSE;
- TCHAR szDummy[cchRESOURCE];
- TCHAR szPW[cchRESOURCE];
- TCHAR szVerifyPW[cchRESOURCE];
+ TCHAR szDummy[cchRESOURCE];
+ TCHAR szPW[cchRESOURCE];
+ TCHAR szVerifyPW[cchRESOURCE];
- bDisable |= lstrlen(GetWndText(hDlg, IDC_ADMIN_NAME, szDummy)) == 0;
+ bDisable |= lstrlen(GetWndText(hDlg, IDC_ADMIN_NAME, szDummy)) == 0;
- bDisable |= lstrlen(GetWndText(hDlg, IDC_ADMIN_PW, szPW)) == 0;
+ bDisable |= lstrlen(GetWndText(hDlg, IDC_ADMIN_PW, szPW)) == 0;
- if (IsWindowEnabled(GetDlgItem(hDlg, IDC_VERIFY_ADMIN_PW))) {
- GetWndText(hDlg, IDC_VERIFY_ADMIN_PW, szVerifyPW);
- bDisable |= !lstrlen(szVerifyPW) || lstrcmp(szPW, szVerifyPW);
- }
+ if (IsWindowEnabled(GetDlgItem(hDlg, IDC_VERIFY_ADMIN_PW))) {
+ GetWndText(hDlg, IDC_VERIFY_ADMIN_PW, szVerifyPW);
+ bDisable |= !lstrlen(szVerifyPW) || lstrcmp(szPW, szVerifyPW);
+ }
- if (IsWindowEnabled(GetDlgItem(hDlg, IDC_ADMIN_UID)))
- bDisable |= lstrlen(GetWndText(hDlg, IDC_ADMIN_UID, szDummy)) == 0;
+ if (IsWindowEnabled(GetDlgItem(hDlg, IDC_ADMIN_UID)))
+ bDisable |= lstrlen(GetWndText(hDlg, IDC_ADMIN_UID, szDummy)) == 0;
- if (IsWindowEnabled(GetDlgItem(hDlg, IDC_HOSTNAME)))
- bDisable |= lstrlen(GetWndText(hDlg, IDC_HOSTNAME, szDummy)) == 0;
+ if (IsWindowEnabled(GetDlgItem(hDlg, IDC_HOSTNAME)))
+ bDisable |= lstrlen(GetWndText(hDlg, IDC_HOSTNAME, szDummy)) == 0;
- if (bDisable)
- g_pWiz->EnableButtons(BACK_BUTTON);
- else
- g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
-}
+ if (bDisable)
+ g_pWiz->EnableButtons(BACK_BUTTON);
+ else
+ g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
+}
static void SavePageInfo()
{
- TCHAR szText[cchRESOURCE];
+ TCHAR szText[cchRESOURCE];
- lstrncpy(g_CfgData.szAdminName, GetWndText(hDlg, IDC_ADMIN_NAME, szText), MAX_ADMIN_NAME_LEN);
- lstrncpy(g_CfgData.szAdminPW, GetWndText(hDlg, IDC_ADMIN_PW, szText), MAX_ADMIN_PW_LEN);
+ lstrncpy(g_CfgData.szAdminName, GetWndText(hDlg, IDC_ADMIN_NAME, szText), MAX_ADMIN_NAME_LEN);
+ lstrncpy(g_CfgData.szAdminPW, GetWndText(hDlg, IDC_ADMIN_PW, szText), MAX_ADMIN_PW_LEN);
- if (g_pWiz->GetState() == FIRST_SERVER_STEP) {
- g_CfgData.bUseNextUid = IsButtonChecked(hDlg, IDC_USE_NEXT_UID);
- if (!g_CfgData.bUseNextUid)
- lstrncpy(g_CfgData.szAdminUID, GetWndText(hDlg, IDC_ADMIN_UID, szText), MAX_UID_LEN);
- }
+ if (g_pWiz->GetState() == FIRST_SERVER_STEP) {
+ g_CfgData.bUseNextUid = IsButtonChecked(hDlg, IDC_USE_NEXT_UID);
+ if (!g_CfgData.bUseNextUid)
+ lstrncpy(g_CfgData.szAdminUID, GetWndText(hDlg, IDC_ADMIN_UID, szText), MAX_UID_LEN);
+ }
- if (g_pWiz->GetState() == NOT_FIRST_SERVER_STEP)
- lstrncpy(g_CfgData.szCellServDbHostname, GetWndText(hDlg, IDC_HOSTNAME, szText), MAX_MACHINE_NAME_LEN);
-}
+ if (g_pWiz->GetState() == NOT_FIRST_SERVER_STEP)
+ lstrncpy(g_CfgData.szCellServDbHostname, GetWndText(hDlg, IDC_HOSTNAME, szText), MAX_MACHINE_NAME_LEN);
+}
static void ShowPageInfo()
{
- SetWndText(hDlg, IDC_ADMIN_NAME, g_CfgData.szAdminName);
- SetWndText(hDlg, IDC_ADMIN_PW, g_CfgData.szAdminPW);
- SetWndText(hDlg, IDC_VERIFY_ADMIN_PW, g_CfgData.szAdminPW);
- SetWndText(hDlg, IDC_HOSTNAME, g_CfgData.szCellServDbHostname);
-
- if (g_pWiz->GetState() == FIRST_SERVER_STEP) {
- if (g_CfgData.bUseNextUid)
- SetCheck(hDlg, IDC_USE_NEXT_UID);
- else
- SetCheck(hDlg, IDC_USE_THIS_UID);
- UseNextUid(g_CfgData.bUseNextUid);
- SetWndText(hDlg, IDC_ADMIN_UID, g_CfgData.szAdminUID);
- }
+ SetWndText(hDlg, IDC_ADMIN_NAME, g_CfgData.szAdminName);
+ SetWndText(hDlg, IDC_ADMIN_PW, g_CfgData.szAdminPW);
+ SetWndText(hDlg, IDC_VERIFY_ADMIN_PW, g_CfgData.szAdminPW);
+ SetWndText(hDlg, IDC_HOSTNAME, g_CfgData.szCellServDbHostname);
+
+ if (g_pWiz->GetState() == FIRST_SERVER_STEP) {
+ if (g_CfgData.bUseNextUid)
+ SetCheck(hDlg, IDC_USE_NEXT_UID);
+ else
+ SetCheck(hDlg, IDC_USE_THIS_UID);
+ UseNextUid(g_CfgData.bUseNextUid);
+ SetWndText(hDlg, IDC_ADMIN_UID, g_CfgData.szAdminUID);
+ }
}
static void UseNextUid(BOOL bUseNext)
{
- ENABLE_STATE es = bUseNext ? ES_DISABLE : ES_ENABLE;
+ ENABLE_STATE es = bUseNext ? ES_DISABLE : ES_ENABLE;
- SetEnable(hDlg, IDC_ADMIN_UID, es);
- SetEnable(hDlg, IDC_AFS_UID_SPINNER, es);
+ SetEnable(hDlg, IDC_ADMIN_UID, es);
+ SetEnable(hDlg, IDC_AFS_UID_SPINNER, es);
}
if (WizStep_Common_DlgProc (hRHS, msg, wp, lp))
return FALSE;
- switch (msg) {
- case WM_INITDIALOG:
- OnInitDialog(hRHS);
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wp)) {
- case IDNEXT:
- if (SavePageInfo())
- g_pWiz->SetState (sidSTEP_THREE);
- break;
-
- case IDBACK:
- if (SavePageInfo())
- g_pWiz->SetState (sidSTEP_ONE);
- break;
-
- case IDC_FIRST_SERVER:
- IsFirstServer();
- break;
-
- case IDC_JOIN_EXISTING_CELL:
- IsFirstServer(FALSE);
- break;
-
- case IDC_CELL_NAME:
- case IDC_SERVER_PW:
- case IDC_VERIFY_PW:
- if (HIWORD(wp) == EN_CHANGE)
- CheckEnableButtons();
- break;
-
- }
- break;
- }
+ switch (msg) {
+ case WM_INITDIALOG:
+ OnInitDialog(hRHS);
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wp)) {
+ case IDNEXT:
+ if (SavePageInfo())
+ g_pWiz->SetState (sidSTEP_THREE);
+ break;
+
+ case IDBACK:
+ if (SavePageInfo())
+ g_pWiz->SetState (sidSTEP_ONE);
+ break;
+
+ case IDC_FIRST_SERVER:
+ IsFirstServer();
+ break;
+
+ case IDC_JOIN_EXISTING_CELL:
+ IsFirstServer(FALSE);
+ break;
+
+ case IDC_CELL_NAME:
+ case IDC_SERVER_PW:
+ case IDC_VERIFY_PW:
+ if (HIWORD(wp) == EN_CHANGE)
+ CheckEnableButtons();
+ break;
+
+ }
+ break;
+ }
return FALSE;
}
*/
static void OnInitDialog(HWND hwndDlg)
{
- hDlg = hwndDlg;
+ hDlg = hwndDlg;
- g_pWiz->EnableButtons(BACK_BUTTON);
+ g_pWiz->EnableButtons(BACK_BUTTON);
- ShowPageInfo();
+ ShowPageInfo();
- if (g_CfgData.bFirstServer)
- IsFirstServer();
+ if (g_CfgData.bFirstServer)
+ IsFirstServer();
- g_pWiz->SetDefaultControl(IDC_CELL_NAME);
+ g_pWiz->SetDefaultControl(IDC_CELL_NAME);
}
*/
static void CheckEnableButtons()
{
- BOOL bDisable = FALSE;
+ BOOL bDisable = FALSE;
- TCHAR szCellName[cchRESOURCE];
- TCHAR szPW[cchRESOURCE];
- TCHAR szVerifyPW[cchRESOURCE];
+ TCHAR szCellName[cchRESOURCE];
+ TCHAR szPW[cchRESOURCE];
+ TCHAR szVerifyPW[cchRESOURCE];
- bDisable = lstrlen(GetWndText(hDlg, IDC_CELL_NAME, szCellName)) == 0;
+ bDisable = lstrlen(GetWndText(hDlg, IDC_CELL_NAME, szCellName)) == 0;
- GetWndText(hDlg, IDC_SERVER_PW, szPW);
- GetWndText(hDlg, IDC_VERIFY_PW, szVerifyPW);
+ GetWndText(hDlg, IDC_SERVER_PW, szPW);
+ GetWndText(hDlg, IDC_VERIFY_PW, szVerifyPW);
- if (IsButtonChecked(hDlg, IDC_FIRST_SERVER))
- bDisable |= !lstrlen(szPW) || !lstrlen(szVerifyPW) || lstrcmp(szPW, szVerifyPW);
+ if (IsButtonChecked(hDlg, IDC_FIRST_SERVER))
+ bDisable |= !lstrlen(szPW) || !lstrlen(szVerifyPW) || lstrcmp(szPW, szVerifyPW);
- if (bDisable)
- g_pWiz->EnableButtons(BACK_BUTTON);
- else
- g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
-}
+ if (bDisable)
+ g_pWiz->EnableButtons(BACK_BUTTON);
+ else
+ g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
+}
static BOOL SavePageInfo()
{
- TCHAR szText[cchRESOURCE];
+ TCHAR szText[cchRESOURCE];
- GetWndText(hDlg, IDC_CELL_NAME, szText);
- if (lstrlen(szText) > MAX_CELL_NAME_LEN) {
- MsgBox(hDlg, IDS_CELL_NAME_LEN_ERROR, GetAppTitleID(), MB_ICONSTOP | MB_OK);
- return FALSE;
- }
+ GetWndText(hDlg, IDC_CELL_NAME, szText);
+ if (lstrlen(szText) > MAX_CELL_NAME_LEN) {
+ MsgBox(hDlg, IDS_CELL_NAME_LEN_ERROR, GetAppTitleID(), MB_ICONSTOP | MB_OK);
+ return FALSE;
+ }
- lstrcpy(g_CfgData.szCellName, szText);
- lstrncpy(g_CfgData.szServerPW, GetWndText(hDlg, IDC_SERVER_PW, szText), MAX_SERVER_PW_LEN);
- g_CfgData.bFirstServer = IsButtonChecked(hDlg, IDC_FIRST_SERVER);
+ lstrcpy(g_CfgData.szCellName, szText);
+ lstrncpy(g_CfgData.szServerPW, GetWndText(hDlg, IDC_SERVER_PW, szText), MAX_SERVER_PW_LEN);
+ g_CfgData.bFirstServer = IsButtonChecked(hDlg, IDC_FIRST_SERVER);
- return TRUE;
+ return TRUE;
}
static void ShowPageInfo()
-{
- SetWndText(hDlg, IDC_CELL_NAME, g_CfgData.szCellName);
- SetWndText(hDlg, IDC_SERVER_PW, g_CfgData.szServerPW);
- SetWndText(hDlg, IDC_VERIFY_PW, g_CfgData.szServerPW);
-
- if (g_CfgData.bFirstServer)
- SetCheck(hDlg, IDC_FIRST_SERVER);
- else
- SetCheck(hDlg, IDC_JOIN_EXISTING_CELL);
+{
+ SetWndText(hDlg, IDC_CELL_NAME, g_CfgData.szCellName);
+ SetWndText(hDlg, IDC_SERVER_PW, g_CfgData.szServerPW);
+ SetWndText(hDlg, IDC_VERIFY_PW, g_CfgData.szServerPW);
+
+ if (g_CfgData.bFirstServer)
+ SetCheck(hDlg, IDC_FIRST_SERVER);
+ else
+ SetCheck(hDlg, IDC_JOIN_EXISTING_CELL);
}
static void IsFirstServer(BOOL bIs)
{
- ENABLE_STATE es;
+ ENABLE_STATE es;
- if (bIs)
- es = ES_ENABLE;
- else
- es = ES_DISABLE;
+ if (bIs)
+ es = ES_ENABLE;
+ else
+ es = ES_DISABLE;
- SetEnable(hDlg, IDC_PRINCIPAL_LABEL, es);
- SetEnable(hDlg, IDC_PRINCIPAL, es);
+ SetEnable(hDlg, IDC_PRINCIPAL_LABEL, es);
+ SetEnable(hDlg, IDC_PRINCIPAL, es);
- SetEnable(hDlg, IDC_SERVER_PW_FRAME, es);
- SetEnable(hDlg, IDC_SERVER_PW_LABEL, es);
- SetEnable(hDlg, IDC_SERVER_PW_PROMPT, es);
- SetEnable(hDlg, IDC_SERVER_PW, es);
- SetEnable(hDlg, IDC_VERIFY_PW_LABEL, es);
- SetEnable(hDlg, IDC_VERIFY_PW, es);
+ SetEnable(hDlg, IDC_SERVER_PW_FRAME, es);
+ SetEnable(hDlg, IDC_SERVER_PW_LABEL, es);
+ SetEnable(hDlg, IDC_SERVER_PW_PROMPT, es);
+ SetEnable(hDlg, IDC_SERVER_PW, es);
+ SetEnable(hDlg, IDC_VERIFY_PW_LABEL, es);
+ SetEnable(hDlg, IDC_VERIFY_PW, es);
- CheckEnableButtons();
+ CheckEnableButtons();
}
if (WizStep_Common_DlgProc (hRHS, msg, wp, lp))
return FALSE;
- switch (msg) {
- case WM_INITDIALOG:
- OnInitDialog(hRHS);
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wp)) {
- case IDNEXT:
- g_pWiz->SetState(sidSTEP_TWO);
- break;
- }
- break;
- }
+ switch (msg) {
+ case WM_INITDIALOG:
+ OnInitDialog(hRHS);
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wp)) {
+ case IDNEXT:
+ g_pWiz->SetState(sidSTEP_TWO);
+ break;
+ }
+ break;
+ }
return FALSE;
}
*/
static BOOL OnInitDialog(HWND hwndDlg)
{
- hDlg = hwndDlg;
+ hDlg = hwndDlg;
- g_pWiz->EnableButtons(NEXT_BUTTON);
+ g_pWiz->EnableButtons(NEXT_BUTTON);
- return TRUE;
+ return TRUE;
}
*/
LOGFILE::LOGFILE()
{
- m_fp = 0;
+ m_fp = 0;
}
LOGFILE::~LOGFILE()
{
- if (m_fp)
- Close();
+ if (m_fp)
+ Close();
}
BOOL LOGFILE::Open(const char *pszLogFilePath,
- LOGFILE_OPEN_MODE eOpenMode,
- LOGFILE_TIMESTAMP_MODE eTimeStampMode)
+ LOGFILE_OPEN_MODE eOpenMode,
+ LOGFILE_TIMESTAMP_MODE eTimeStampMode)
{
- char *pszOpenMode;
+ char *pszOpenMode;
- m_eTimeStampMode = eTimeStampMode;
+ m_eTimeStampMode = eTimeStampMode;
- if (eOpenMode == OM_OVERWRITE)
- pszOpenMode = "w";
- else
- pszOpenMode = "a+";
+ if (eOpenMode == OM_OVERWRITE)
+ pszOpenMode = "w";
+ else
+ pszOpenMode = "a+";
- strcpy(m_szPath, pszLogFilePath);
-
- m_fp = fopen(pszLogFilePath, pszOpenMode);
- if (m_fp) {
- if (m_eTimeStampMode != TSM_NEVER)
- WriteTimeStamp();
- fprintf(m_fp, "Log file open.\r\n");
+ strcpy(m_szPath, pszLogFilePath);
- return TRUE;
- }
+ m_fp = fopen(pszLogFilePath, pszOpenMode);
+ if (m_fp) {
+ if (m_eTimeStampMode != TSM_NEVER)
+ WriteTimeStamp();
+ fprintf(m_fp, "Log file open.\r\n");
- return FALSE;
-}
+ return TRUE;
+ }
+
+ return FALSE;
+}
BOOL LOGFILE::Close()
{
- int nResult = 0;
+ int nResult = 0;
- if (m_fp) {
- if (m_eTimeStampMode != TSM_NEVER)
- WriteTimeStamp();
- fprintf(m_fp, "Closing log file.\r\n");
- nResult = fclose(m_fp);
- if (nResult == 0)
- m_fp = 0;
- }
-
- return (nResult == 0);
+ if (m_fp) {
+ if (m_eTimeStampMode != TSM_NEVER)
+ WriteTimeStamp();
+ fprintf(m_fp, "Closing log file.\r\n");
+ nResult = fclose(m_fp);
+ if (nResult == 0)
+ m_fp = 0;
+ }
+
+ return (nResult == 0);
}
BOOL LOGFILE::Write(const char *pszEntry, ...)
{
- static BOOL bTimestampNextLine = TRUE;
+ static BOOL bTimestampNextLine = TRUE;
- if (!m_fp)
- return FALSE;
+ if (!m_fp)
+ return FALSE;
- if (bTimestampNextLine && (m_eTimeStampMode == TSM_EACH_ENTRY))
- WriteTimeStamp();
-
- va_list args;
-
- va_start(args, pszEntry);
+ if (bTimestampNextLine && (m_eTimeStampMode == TSM_EACH_ENTRY))
+ WriteTimeStamp();
- int nWritten = vfprintf(m_fp, pszEntry, args);
+ va_list args;
- va_end(args);
+ va_start(args, pszEntry);
- fflush(m_fp);
+ int nWritten = vfprintf(m_fp, pszEntry, args);
- // Don't timestamp next line unless current line ended with a newline
- bTimestampNextLine = (pszEntry[strlen(pszEntry) - 1] == '\n');
+ va_end(args);
- return (nWritten > 0);
-}
+ fflush(m_fp);
+
+ // Don't timestamp next line unless current line ended with a newline
+ bTimestampNextLine = (pszEntry[strlen(pszEntry) - 1] == '\n');
+
+ return (nWritten > 0);
+}
BOOL LOGFILE::WriteError(const char *pszMsg, DWORD nErrorCode, ...)
{
- if (!m_fp)
- return FALSE;
+ if (!m_fp)
+ return FALSE;
- if (m_eTimeStampMode == TSM_EACH_ENTRY)
- WriteTimeStamp();
-
- va_list args;
-
- va_start(args, nErrorCode);
+ if (m_eTimeStampMode == TSM_EACH_ENTRY)
+ WriteTimeStamp();
- int nWritten = vfprintf(m_fp, pszMsg, args);
- va_end(args);
+ va_list args;
- if (nWritten < 1)
- return FALSE;
+ va_start(args, nErrorCode);
- afs_status_t nStatus;
- const char *pszErrorText;
+ int nWritten = vfprintf(m_fp, pszMsg, args);
+ va_end(args);
- int nResult = util_AdminErrorCodeTranslate(nErrorCode, TaLocale_GetLanguage(), &pszErrorText, &nStatus);
- if (nResult)
- fprintf(m_fp, ": (0x%lx), %s.\r\n", nErrorCode, pszErrorText);
- else
- fprintf(m_fp, ": (0x%lx).\r\n", nErrorCode);
+ if (nWritten < 1)
+ return FALSE;
- fflush(m_fp);
+ afs_status_t nStatus;
+ const char *pszErrorText;
- return (nWritten > 0);
-}
+ int nResult = util_AdminErrorCodeTranslate(nErrorCode, TaLocale_GetLanguage(), &pszErrorText, &nStatus);
+ if (nResult)
+ fprintf(m_fp, ": (0x%lx), %s.\r\n", nErrorCode, pszErrorText);
+ else
+ fprintf(m_fp, ": (0x%lx).\r\n", nErrorCode);
+
+ fflush(m_fp);
+
+ return (nWritten > 0);
+}
BOOL LOGFILE::WriteTimeStamp()
{
- if (!m_fp)
- return FALSE;
+ if (!m_fp)
+ return FALSE;
- char szTime[64], szDate[64];
+ char szTime[64], szDate[64];
- _strtime(szTime);
- _strdate(szDate);
+ _strtime(szTime);
+ _strdate(szDate);
- fprintf(m_fp, "%s %s: ", szTime, szDate);
-
- return TRUE;
+ fprintf(m_fp, "%s %s: ", szTime, szDate);
+
+ return TRUE;
}
BOOL LOGFILE::WriteBoolResult(BOOL bResult)
{
- if (!m_fp)
- return FALSE;
+ if (!m_fp)
+ return FALSE;
- fprintf(m_fp, "%s.\r\n", bResult ? "Yes" : "No");
+ fprintf(m_fp, "%s.\r\n", bResult ? "Yes" : "No");
- fflush(m_fp);
+ fflush(m_fp);
- return TRUE;
+ return TRUE;
}
BOOL LOGFILE::WriteMultistring(const char *pszMultiStr)
{
- if (!m_fp)
- return FALSE;
+ if (!m_fp)
+ return FALSE;
- for (const char *p = pszMultiStr; *p; p += strlen(p))
- Write("%s\r\n", p);
+ for (const char *p = pszMultiStr; *p; p += strlen(p))
+ Write("%s\r\n", p);
- return TRUE;
-}
+ return TRUE;
+}
*/
static BOOL CALLBACK WizardDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- if ((g_pWiz->GetState() == sidSTEP_EIGHT) && (uMsg == WM_ACTIVATEAPP) && wParam) {
- UpdateDriveList();
- ShowPartitionInfo();
- }
+ if ((g_pWiz->GetState() == sidSTEP_EIGHT) && (uMsg == WM_ACTIVATEAPP) && wParam) {
+ UpdateDriveList();
+ ShowPartitionInfo();
+ }
- return CallWindowProc((WNDPROC)Subclass_FindNextHook(hwndDlg, WizardDlgProc), hwndDlg, uMsg, wParam, lParam);
+ return CallWindowProc((WNDPROC)Subclass_FindNextHook(hwndDlg, WizardDlgProc), hwndDlg, uMsg, wParam, lParam);
}
BOOL CALLBACK PartitionPageDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp)
{
- if (WizStep_Common_DlgProc (hwndDlg, msg, wp, lp))
- return FALSE;
-
- switch (msg) {
- case WM_INITDIALOG:
- OnInitDialog(hwndDlg);
- CheckEnableButtons();
- break;
-
- case WM_DESTROY_SHEET:
- Subclass_RemoveHook(g_pWiz->GetWindow(), WizardDlgProc);
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wp)) {
- case IDNEXT:
- if (SavePartitionInfo(TRUE))
- g_pWiz->SetState(sidSTEP_NINE);
- break;
-
- case IDBACK:
- if (SavePartitionInfo(FALSE))
- g_pWiz->SetState(sidSTEP_SEVEN);
- break;
-
- case IDC_CREATE_PARTITION:
- g_CfgData.configPartition = CS_CONFIGURE;
- CheckEnableButtons();
- EnableDriveListCtrls();
- break;
-
- case IDC_DONT_CREATE_PARTITION:
- g_CfgData.configPartition = CS_DONT_CONFIGURE;
- CheckEnableButtons();
- EnableDriveListCtrls(FALSE);
- break;
-
- case IDC_PARTITION_NAME:
- if (HIWORD(wp) == EN_CHANGE) {
- OnPartitionName();
- SetFocus((HWND)lp);
- }
- break;
- }
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lp)->code) {
- case FLN_ITEMSELECT: OnListSelection((LPFLN_ITEMSELECT_PARAMS)lp);
- }
- break;
+ if (WizStep_Common_DlgProc (hwndDlg, msg, wp, lp))
+ return FALSE;
+ switch (msg) {
+ case WM_INITDIALOG:
+ OnInitDialog(hwndDlg);
+ CheckEnableButtons();
+ break;
+
+ case WM_DESTROY_SHEET:
+ Subclass_RemoveHook(g_pWiz->GetWindow(), WizardDlgProc);
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wp)) {
+ case IDNEXT:
+ if (SavePartitionInfo(TRUE))
+ g_pWiz->SetState(sidSTEP_NINE);
+ break;
+
+ case IDBACK:
+ if (SavePartitionInfo(FALSE))
+ g_pWiz->SetState(sidSTEP_SEVEN);
+ break;
+
+ case IDC_CREATE_PARTITION:
+ g_CfgData.configPartition = CS_CONFIGURE;
+ CheckEnableButtons();
+ EnableDriveListCtrls();
+ break;
+
+ case IDC_DONT_CREATE_PARTITION:
+ g_CfgData.configPartition = CS_DONT_CONFIGURE;
+ CheckEnableButtons();
+ EnableDriveListCtrls(FALSE);
+ break;
+
+ case IDC_PARTITION_NAME:
+ if (HIWORD(wp) == EN_CHANGE) {
+ OnPartitionName();
+ SetFocus((HWND)lp);
+ }
+ break;
}
+ break;
- return FALSE;
-}
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lp)->code) {
+ case FLN_ITEMSELECT: OnListSelection((LPFLN_ITEMSELECT_PARAMS)lp);
+ }
+ break;
+
+ }
+
+ return FALSE;
+}
*/
static void OnInitDialog(HWND hwndDlg)
{
- HOURGLASS hg;
+ HOURGLASS hg;
- hDlg = hwndDlg;
+ hDlg = hwndDlg;
- hDriveList = GetDlgItem(hDlg, IDC_DRIVE_LIST);
+ hDriveList = GetDlgItem(hDlg, IDC_DRIVE_LIST);
- g_pWiz->SetButtonText(IDNEXT, IDS_NEXT);
- g_pWiz->SetDefaultControl(IDNEXT);
+ g_pWiz->SetButtonText(IDNEXT, IDS_NEXT);
+ g_pWiz->SetDefaultControl(IDNEXT);
- if (g_CfgData.configPartition == CS_ALREADY_CONFIGURED) {
- CantMakePartition(IDS_PARTITION_ALREADY_CREATED);
- return;
- }
+ if (g_CfgData.configPartition == CS_ALREADY_CONFIGURED) {
+ CantMakePartition(IDS_PARTITION_ALREADY_CREATED);
+ return;
+ }
- // Should this step be disabled? Yes, if this machine is
- // not configured as a file server.
- if (!ConfiguredOrConfiguring(g_CfgData.configFS)) {
- CantMakePartition(IDS_NOT_A_FS_SERVER);
- EnableStep(g_CfgData.configPartition, FALSE);
- return;
- }
+ // Should this step be disabled? Yes, if this machine is
+ // not configured as a file server.
+ if (!ConfiguredOrConfiguring(g_CfgData.configFS)) {
+ CantMakePartition(IDS_NOT_A_FS_SERVER);
+ EnableStep(g_CfgData.configPartition, FALSE);
+ return;
+ }
- // Do this in case it was disabled the last time
- EnableStep(g_CfgData.configPartition);
+ // Do this in case it was disabled the last time
+ EnableStep(g_CfgData.configPartition);
- switch (g_CfgData.configPartition) {
- case CS_DONT_CONFIGURE:
- SetCheck(hDlg, IDC_DONT_CREATE_PARTITION);
- EnableDriveListCtrls(FALSE);
- break;
+ switch (g_CfgData.configPartition) {
+ case CS_DONT_CONFIGURE:
+ SetCheck(hDlg, IDC_DONT_CREATE_PARTITION);
+ EnableDriveListCtrls(FALSE);
+ break;
- case CS_CONFIGURE:
- default:
- SetCheck(hDlg, IDC_CREATE_PARTITION);
- EnableDriveListCtrls();
- break;
- }
+ case CS_CONFIGURE:
+ default:
+ SetCheck(hDlg, IDC_CREATE_PARTITION);
+ EnableDriveListCtrls();
+ break;
+ }
- Subclass_AddHook(g_pWiz->GetWindow(), WizardDlgProc);
+ Subclass_AddHook(g_pWiz->GetWindow(), WizardDlgProc);
- SetupDriveList(hDriveList);
- UpdateDriveList();
- ShowPartitionInfo();
+ SetupDriveList(hDriveList);
+ UpdateDriveList();
+ ShowPartitionInfo();
- if (g_CfgData.bFirstServer)
- MustMakePartition();
+ if (g_CfgData.bFirstServer)
+ MustMakePartition();
}
static void OnPartitionName()
{
- TCHAR szBuf[MAX_PARTITION_NAME_LEN];
- GetWindowText(GetDlgItem(hDlg, IDC_PARTITION_NAME), szBuf, MAX_PARTITION_NAME_LEN);
+ TCHAR szBuf[MAX_PARTITION_NAME_LEN];
+ GetWindowText(GetDlgItem(hDlg, IDC_PARTITION_NAME), szBuf, MAX_PARTITION_NAME_LEN);
- bAutoSetPartitionName = szBuf[0] == 0;
-
- CheckEnableButtons();
-}
+ bAutoSetPartitionName = szBuf[0] == 0;
+
+ CheckEnableButtons();
+}
static void OnListSelection(LPFLN_ITEMSELECT_PARAMS pItemParms)
{
- ASSERT(pItemParms);
-
- hSelectedItem = 0;
-
- if (pItemParms->hItem) {
- LPARAM lParam = FastList_GetItemParam(hDriveList, pItemParms->hItem);
- if (lParam == 0) {
- hSelectedItem = pItemParms->hItem;
-
- if (bAutoSetPartitionName) {
- LPCTSTR pDrive = FastList_GetItemText(hDriveList, hSelectedItem, 0);
- g_CfgData.szPartitionName[0] = _totlower(pDrive[0]);
- g_CfgData.szPartitionName[1] = 0;
- SetWndText(hDlg, IDC_PARTITION_NAME, g_CfgData.szPartitionName);
-
- // Must set this to true because the call to SetWndText will cause
- // a call to OnPartitionName, which would incorrectly think that the
- // Partition Name had been set by the user rather than by us, thus
- // setting bAutoSetPartitionName to false.
- bAutoSetPartitionName = TRUE;
- }
- }
+ ASSERT(pItemParms);
+
+ hSelectedItem = 0;
+
+ if (pItemParms->hItem) {
+ LPARAM lParam = FastList_GetItemParam(hDriveList, pItemParms->hItem);
+ if (lParam == 0) {
+ hSelectedItem = pItemParms->hItem;
+
+ if (bAutoSetPartitionName) {
+ LPCTSTR pDrive = FastList_GetItemText(hDriveList, hSelectedItem, 0);
+ g_CfgData.szPartitionName[0] = _totlower(pDrive[0]);
+ g_CfgData.szPartitionName[1] = 0;
+ SetWndText(hDlg, IDC_PARTITION_NAME, g_CfgData.szPartitionName);
+
+ // Must set this to true because the call to SetWndText will cause
+ // a call to OnPartitionName, which would incorrectly think that the
+ // Partition Name had been set by the user rather than by us, thus
+ // setting bAutoSetPartitionName to false.
+ bAutoSetPartitionName = TRUE;
+ }
}
+ }
- CheckEnableButtons();
+ CheckEnableButtons();
}
*/
static void CantMakePartition(UINT nMsgID)
{
- TCHAR szMsg[cchRESOURCE];
+ TCHAR szMsg[cchRESOURCE];
- GetString(szMsg, nMsgID);
+ GetString(szMsg, nMsgID);
- ShowWnd(hDlg, IDC_CREATE_PARTITION, FALSE);
- ShowWnd(hDlg, IDC_DONT_CREATE_PARTITION, FALSE);
- ShowWnd(hDlg, IDC_ASK_CREATE_PARTITION, FALSE);
- ShowWnd(hDlg, IDC_SELECT_DRIVE, FALSE);
- ShowWnd(hDlg, IDC_DRIVE_LIST, FALSE);
- ShowWnd(hDlg, IDC_NAME_LABEL, FALSE);
- ShowWnd(hDlg, IDC_PARTITION_NAME, FALSE);
+ ShowWnd(hDlg, IDC_CREATE_PARTITION, FALSE);
+ ShowWnd(hDlg, IDC_DONT_CREATE_PARTITION, FALSE);
+ ShowWnd(hDlg, IDC_ASK_CREATE_PARTITION, FALSE);
+ ShowWnd(hDlg, IDC_SELECT_DRIVE, FALSE);
+ ShowWnd(hDlg, IDC_DRIVE_LIST, FALSE);
+ ShowWnd(hDlg, IDC_NAME_LABEL, FALSE);
+ ShowWnd(hDlg, IDC_PARTITION_NAME, FALSE);
- ShowWnd(hDlg, IDC_PARTITION_COVER);
- HWND hMsg = GetDlgItem(hDlg, IDC_PARTITION_MSG);
- ShowWindow(hMsg, SW_SHOW);
- SetWindowText(hMsg, szMsg);
+ ShowWnd(hDlg, IDC_PARTITION_COVER);
+ HWND hMsg = GetDlgItem(hDlg, IDC_PARTITION_MSG);
+ ShowWindow(hMsg, SW_SHOW);
+ SetWindowText(hMsg, szMsg);
- bCantCreate = TRUE;
-}
+ bCantCreate = TRUE;
+}
static void MustMakePartition()
{
- TCHAR szMsg[cchRESOURCE];
+ TCHAR szMsg[cchRESOURCE];
- GetString(szMsg, IDS_MUST_MAKE_PARTITION);
-
- ShowWnd(hDlg, IDC_CREATE_PARTITION, FALSE);
- ShowWnd(hDlg, IDC_DONT_CREATE_PARTITION, FALSE);
+ GetString(szMsg, IDS_MUST_MAKE_PARTITION);
- SetWndText(hDlg, IDC_ASK_CREATE_PARTITION, szMsg);
+ ShowWnd(hDlg, IDC_CREATE_PARTITION, FALSE);
+ ShowWnd(hDlg, IDC_DONT_CREATE_PARTITION, FALSE);
+
+ SetWndText(hDlg, IDC_ASK_CREATE_PARTITION, szMsg);
}
static void EnableDriveListCtrls(BOOL bEnable)
{
- EnableWnd(hDlg, IDC_SELECT_DRIVE, bEnable);
- EnableWnd(hDlg, IDC_DRIVE_LIST, bEnable);
- EnableWnd(hDlg, IDC_NAME_LABEL, bEnable);
- EnableWnd(hDlg, IDC_PARTITION_NAME, bEnable);
+ EnableWnd(hDlg, IDC_SELECT_DRIVE, bEnable);
+ EnableWnd(hDlg, IDC_DRIVE_LIST, bEnable);
+ EnableWnd(hDlg, IDC_NAME_LABEL, bEnable);
+ EnableWnd(hDlg, IDC_PARTITION_NAME, bEnable);
}
static BOOL SavePartitionInfo(BOOL bValidate)
{
- if (bCantCreate)
- return TRUE;
+ if (bCantCreate)
+ return TRUE;
if (GetButtonState(hDlg, IDC_CREATE_PARTITION) != BST_CHECKED) {
- g_CfgData.szPartitionName[0] = 0;
- bAutoSetPartitionName = TRUE;
- } else {
- GetWindowText(GetDlgItem(hDlg, IDC_PARTITION_NAME), g_CfgData.szPartitionName, MAX_PARTITION_NAME_LEN);
+ g_CfgData.szPartitionName[0] = 0;
+ bAutoSetPartitionName = TRUE;
+ } else {
+ GetWindowText(GetDlgItem(hDlg, IDC_PARTITION_NAME), g_CfgData.szPartitionName, MAX_PARTITION_NAME_LEN);
if (bValidate && !Validation_IsValid(g_CfgData.szPartitionName, VALID_AFS_PARTITION_NAME))
return FALSE;
- }
+ }
- if (hSelectedItem == 0)
- g_CfgData.chDeviceName = 0;
- else {
- LPCTSTR pDrive = FastList_GetItemText(hDriveList, hSelectedItem, 0);
- g_CfgData.chDeviceName = pDrive[0];
- }
+ if (hSelectedItem == 0)
+ g_CfgData.chDeviceName = 0;
+ else {
+ LPCTSTR pDrive = FastList_GetItemText(hDriveList, hSelectedItem, 0);
+ g_CfgData.chDeviceName = pDrive[0];
+ }
return TRUE;
}
SetWndText(hDlg, IDC_PARTITION_NAME, g_CfgData.szPartitionName);
bAutoSetPartitionName = bAutoSet;
- if (g_CfgData.chDeviceName != 0) {
- HLISTITEM hItem = NULL;
- while ((hItem = FastList_FindNext(hDriveList, hItem)) != NULL) {
- LPCTSTR pDrive = FastList_GetItemText(hDriveList, hItem, 0);
- if (pDrive[0] == g_CfgData.chDeviceName) {
- FastList_SelectItem(hDriveList, hItem, TRUE);
- hSelectedItem = hItem;
- break;
- }
- }
+ if (g_CfgData.chDeviceName != 0) {
+ HLISTITEM hItem = NULL;
+ while ((hItem = FastList_FindNext(hDriveList, hItem)) != NULL) {
+ LPCTSTR pDrive = FastList_GetItemText(hDriveList, hItem, 0);
+ if (pDrive[0] == g_CfgData.chDeviceName) {
+ FastList_SelectItem(hDriveList, hItem, TRUE);
+ hSelectedItem = hItem;
+ break;
+ }
}
+ }
}
static void CheckEnableButtons()
{
- if (IsButtonChecked(hDlg, IDC_CREATE_PARTITION)) {
- TCHAR szBuf[MAX_PARTITION_NAME_LEN];
-
- GetWindowText(GetDlgItem(hDlg, IDC_PARTITION_NAME), szBuf, MAX_PARTITION_NAME_LEN);
- if ((hSelectedItem == 0) || (szBuf[0] == 0)) {
- g_pWiz->EnableButtons(BACK_BUTTON);
- g_pWiz->SetDefaultControl(IDBACK);
- return;
- }
+ if (IsButtonChecked(hDlg, IDC_CREATE_PARTITION)) {
+ TCHAR szBuf[MAX_PARTITION_NAME_LEN];
+
+ GetWindowText(GetDlgItem(hDlg, IDC_PARTITION_NAME), szBuf, MAX_PARTITION_NAME_LEN);
+ if ((hSelectedItem == 0) || (szBuf[0] == 0)) {
+ g_pWiz->EnableButtons(BACK_BUTTON);
+ g_pWiz->SetDefaultControl(IDBACK);
+ return;
}
-
- g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
+ }
+
+ g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
}
*/
cfg_partitionEntry_t *GetPartitionTable(int &nNumPartitions)
{
- nNumPartitions = cPartitions;
+ nNumPartitions = cPartitions;
- return pTable;
+ return pTable;
}
int GetNumPartitions()
-{
- return cPartitions;
-}
+{
+ return cPartitions;
+}
int ReadPartitionTable(afs_status_t *pStatus)
{
- ASSERT(g_hServer);
+ ASSERT(g_hServer);
- FreePartitionTable();
+ FreePartitionTable();
- cPartitions = 0;
- pTable = 0;
+ cPartitions = 0;
+ pTable = 0;
- int nResult = cfg_HostPartitionTableEnumerate(g_hServer, &pTable, &cPartitions, pStatus);
+ int nResult = cfg_HostPartitionTableEnumerate(g_hServer, &pTable, &cPartitions, pStatus);
- return nResult;
+ return nResult;
}
BOOL IsAnAfsPartition(LPCTSTR pszRootDir)
{
- for (int ii = 0; ii < cPartitions; ii++) {
+ for (int ii = 0; ii < cPartitions; ii++) {
- TCHAR ch1 = pTable[ii].deviceName[0];
- if (_istupper(ch1))
- ch1 = _totlower(ch1);
+ TCHAR ch1 = pTable[ii].deviceName[0];
+ if (_istupper(ch1))
+ ch1 = _totlower(ch1);
- TCHAR ch2 = pszRootDir[0];
- if (_istupper(ch2))
- ch2 = _totlower(ch2);
+ TCHAR ch2 = pszRootDir[0];
+ if (_istupper(ch2))
+ ch2 = _totlower(ch2);
- if (ch1 == ch2)
- return TRUE;
- }
+ if (ch1 == ch2)
+ return TRUE;
+ }
- return FALSE;
+ return FALSE;
}
BOOL DoesPartitionExist(LPCTSTR pszName)
{
- for (int ii = 0; ii < cPartitions; ii++) {
- if (lstrcmp(A2S(pTable[ii].partitionName), pszName) == 0)
- return TRUE;
- }
+ for (int ii = 0; ii < cPartitions; ii++) {
+ if (lstrcmp(A2S(pTable[ii].partitionName), pszName) == 0)
+ return TRUE;
+ }
- return FALSE;
+ return FALSE;
}
void FreePartitionTable()
{
- if (pTable) {
- afs_status_t nStatus;
- cfg_PartitionListDeallocate(pTable, &nStatus);
- }
-
- pTable = 0;
- cPartitions = 0;
-}
+ if (pTable) {
+ afs_status_t nStatus;
+ cfg_PartitionListDeallocate(pTable, &nStatus);
+ }
+
+ pTable = 0;
+ cPartitions = 0;
+}
*/
BOOL CALLBACK PartitionsPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- if (AfsAppLib_HandleHelp(IDD_PARTITIONS_PAGE, hwndDlg, uMsg, wParam, lParam))
- return TRUE;
+ if (AfsAppLib_HandleHelp(IDD_PARTITIONS_PAGE, hwndDlg, uMsg, wParam, lParam))
+ return TRUE;
- switch (uMsg) {
- case WM_INITDIALOG: OnInitDialog(hwndDlg);
- break;
+ switch (uMsg) {
+ case WM_INITDIALOG:
+ OnInitDialog(hwndDlg);
+ break;
- case WM_COMMAND: switch (LOWORD(wParam)) {
- case IDINIT: CheckShowPartitions();
- break;
-
- case IDC_CREATE_PARTITIONS:
- OnCreatePartitions();
- break;
-
- case IDC_REMOVE: OnRemove();
- break;
-
- case IDC_SALVAGE: OnSalvage();
- break;
- }
- break;
-
- case WM_NOTIFY: if ((((LPNMHDR)lParam)->code) == FLN_ITEMSELECT)
- OnListSelection((LPFLN_ITEMSELECT_PARAMS)lParam);
- break;
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDINIT:
+ CheckShowPartitions();
+ break;
+
+ case IDC_CREATE_PARTITIONS:
+ OnCreatePartitions();
+ break;
+
+ case IDC_REMOVE:
+ OnRemove();
+ break;
+
+ case IDC_SALVAGE:
+ OnSalvage();
+ break;
}
+ break;
- return FALSE;
-}
+ case WM_NOTIFY:
+ if ((((LPNMHDR)lParam)->code) == FLN_ITEMSELECT)
+ OnListSelection((LPFLN_ITEMSELECT_PARAMS)lParam);
+ break;
+ }
+
+ return FALSE;
+}
void UpdatePartitionList()
{
- ShowPartitions();
- CheckEnableSalvage();
+ ShowPartitions();
+ CheckEnableSalvage();
}
*/
static void OnInitDialog(HWND hwndDlg)
{
- hDlg = hwndDlg;
+ hDlg = hwndDlg;
-// PropSheet_CancelToClose(GetParent(hDlg));
+// PropSheet_CancelToClose(GetParent(hDlg));
- hSelectedItem = 0;
+ hSelectedItem = 0;
- hPartitionList = GetDlgItem(hDlg, IDC_PARTITION_LIST);
- _ASSERTE(hPartitionList);
+ hPartitionList = GetDlgItem(hDlg, IDC_PARTITION_LIST);
+ _ASSERTE(hPartitionList);
- SetupImageLists();
+ SetupImageLists();
- GetString(szYes, IDS_YES);
- GetString(szNo, IDS_NO);
+ GetString(szYes, IDS_YES);
+ GetString(szNo, IDS_NO);
- SetupListCols();
+ SetupListCols();
- configFS = g_CfgData.configFS;
+ configFS = g_CfgData.configFS;
- ShowPartitions();
+ ShowPartitions();
- CheckEnableSalvage();
-}
+ CheckEnableSalvage();
+}
static void OnCreatePartitions()
{
- if (CreatePartition(hDlg))
- ShowPartitions();
+ if (CreatePartition(hDlg))
+ ShowPartitions();
}
static void OnListSelection(LPFLN_ITEMSELECT_PARAMS pItemParms)
{
- ASSERT(pItemParms);
+ ASSERT(pItemParms);
- hSelectedItem = pItemParms->hItem;
+ hSelectedItem = pItemParms->hItem;
- ENABLE_STATE es = pItemParms->hItem ? ES_ENABLE : ES_DISABLE;
+ ENABLE_STATE es = pItemParms->hItem ? ES_ENABLE : ES_DISABLE;
- SetEnable(hDlg, IDC_REMOVE, es);
- SetEnable(hDlg, IDC_REMOVE_MSG, es);
+ SetEnable(hDlg, IDC_REMOVE, es);
+ SetEnable(hDlg, IDC_REMOVE_MSG, es);
}
static void OnRemove()
{
- ASSERT(hSelectedItem);
- ASSERT(g_hServer);
+ ASSERT(hSelectedItem);
+ ASSERT(g_hServer);
- afs_status_t nStatus;
+ afs_status_t nStatus;
- BOOL bExported = (BOOL)FastList_GetItemParam(hPartitionList, hSelectedItem);
- if (bExported) {
- MsgBox(hDlg, IDS_CANT_DELETE_EXPORTED_PARTITION, GetAppTitleID(), MB_OK | MB_ICONSTOP);
- return;
- }
+ BOOL bExported = (BOOL)FastList_GetItemParam(hPartitionList, hSelectedItem);
+ if (bExported) {
+ MsgBox(hDlg, IDS_CANT_DELETE_EXPORTED_PARTITION, GetAppTitleID(), MB_OK | MB_ICONSTOP);
+ return;
+ }
- LPCTSTR pszPartitionName = FastList_GetItemText(hPartitionList, hSelectedItem, 0);
- ASSERT(pszPartitionName);
+ LPCTSTR pszPartitionName = FastList_GetItemText(hPartitionList, hSelectedItem, 0);
+ ASSERT(pszPartitionName);
- int nResult = Message(MB_ICONQUESTION | MB_YESNO, GetAppTitleID(), IDS_DELETE_PARTITION_PROMPT, TEXT("%s"), pszPartitionName);
- if (nResult == IDNO)
- return;
+ int nResult = Message(MB_ICONQUESTION | MB_YESNO, GetAppTitleID(), IDS_DELETE_PARTITION_PROMPT, TEXT("%s"), pszPartitionName);
+ if (nResult == IDNO)
+ return;
- g_LogFile.Write("Removing partition '%s'.\r\n", (char *)S2A(pszPartitionName));
- nResult = cfg_HostPartitionTableRemoveEntry(g_hServer, S2A(pszPartitionName), &nStatus);
- if (!nResult) {
- ShowError(hDlg, nStatus, IDS_REMOVE_PARTITION_ERROR);
- return;
- }
+ g_LogFile.Write("Removing partition '%s'.\r\n", (char *)S2A(pszPartitionName));
+ nResult = cfg_HostPartitionTableRemoveEntry(g_hServer, S2A(pszPartitionName), &nStatus);
+ if (!nResult) {
+ ShowError(hDlg, nStatus, IDS_REMOVE_PARTITION_ERROR);
+ return;
+ }
- FastList_RemoveItem(hPartitionList, hSelectedItem);
+ FastList_RemoveItem(hPartitionList, hSelectedItem);
- CheckEnableSalvage();
-}
+ CheckEnableSalvage();
+}
static void OnSalvage()
{
return;
}
- LPCTSTR pszPartitionName = TEXT("");
+ LPCTSTR pszPartitionName = TEXT("");
- if (hSelectedItem) {
- pszPartitionName = FastList_GetItemText(hPartitionList, hSelectedItem, 0);
- ASSERT(pszPartitionName);
- }
+ if (hSelectedItem) {
+ pszPartitionName = FastList_GetItemText(hPartitionList, hSelectedItem, 0);
+ ASSERT(pszPartitionName);
+ }
- if (!ShowSalvageDlg(hDlg, pszPartitionName))
+ if (!ShowSalvageDlg(hDlg, pszPartitionName))
return;
ShowSalvageResults(hDlg);
*/
static BOOL CheckShowPartitions()
{
- if (configFS != g_CfgData.configFS) {
- configFS = g_CfgData.configFS;
+ if (configFS != g_CfgData.configFS) {
+ configFS = g_CfgData.configFS;
UpdatePartitionList();
- return TRUE;
- }
+ return TRUE;
+ }
- return FALSE;
+ return FALSE;
}
static void SetupImageLists()
{
- HIMAGELIST hiList = ImageList_Create(16, 16, TRUE, 1, 1);
+ HIMAGELIST hiList = ImageList_Create(16, 16, TRUE, 1, 1);
- AfsAppLib_AddToImageList(hiList, IDI_AGGREGATE, FALSE);
- AfsAppLib_AddToImageList(hiList, IDI_DISABLED_DISK_DRIVE, FALSE);
+ AfsAppLib_AddToImageList(hiList, IDI_AGGREGATE, FALSE);
+ AfsAppLib_AddToImageList(hiList, IDI_DISABLED_DISK_DRIVE, FALSE);
- FastList_SetImageLists(hPartitionList, hiList, 0);
-}
+ FastList_SetImageLists(hPartitionList, hiList, 0);
+}
static void AddColumn(int nWidth, LPCTSTR pszTitle, DWORD dwFlags)
{
- static int nCol = 1;
- FASTLISTCOLUMN col;
-
- col.dwFlags = dwFlags;
- col.cxWidth = nWidth;
- lstrcpy(col.szText, pszTitle);
+ static int nCol = 1;
+ FASTLISTCOLUMN col;
- FastList_SetColumn(hPartitionList, nCol++, &col);
+ col.dwFlags = dwFlags;
+ col.cxWidth = nWidth;
+ lstrcpy(col.szText, pszTitle);
+
+ FastList_SetColumn(hPartitionList, nCol++, &col);
}
static void SetupListCols()
{
- TCHAR szMsg[cchRESOURCE];
+ TCHAR szMsg[cchRESOURCE];
- AddColumn(75, GetResString(IDS_NAME, szMsg));
- AddColumn(55, GetResString(IDS_DRIVE, szMsg));
- AddColumn(60, GetResString(IDS_EXPORTED, szMsg));
- AddColumn(75, GetResString(IDS_TOTAL, szMsg), FLCF_JUSTIFY_RIGHT);
- AddColumn(75, GetResString(IDS_FREE, szMsg), FLCF_JUSTIFY_RIGHT);
+ AddColumn(75, GetResString(IDS_NAME, szMsg));
+ AddColumn(55, GetResString(IDS_DRIVE, szMsg));
+ AddColumn(60, GetResString(IDS_EXPORTED, szMsg));
+ AddColumn(75, GetResString(IDS_TOTAL, szMsg), FLCF_JUSTIFY_RIGHT);
+ AddColumn(75, GetResString(IDS_FREE, szMsg), FLCF_JUSTIFY_RIGHT);
}
cfg_partitionEntry_t *GetPartitionTableFromRegistry(int& cEntries)
{
- afs_status_t nStatus;
+ afs_status_t nStatus;
- // Read the parition table out of the registry
- int nResult = ReadPartitionTable(&nStatus);
- if (!nResult) {
- ShowError(hDlg, nStatus, IDS_READ_PARTITIONS_ERROR);
- return 0;
- }
+ // Read the parition table out of the registry
+ int nResult = ReadPartitionTable(&nStatus);
+ if (!nResult) {
+ ShowError(hDlg, nStatus, IDS_READ_PARTITIONS_ERROR);
+ return 0;
+ }
- return GetPartitionTable(cEntries);
+ return GetPartitionTable(cEntries);
}
static vos_partitionEntry_t *GetPartitionTableFromVos(int &nNumPartitions)
{
- ASSERT(g_hCell);
- ASSERT(g_CfgData.szHostname[0]);
+ ASSERT(g_hCell);
+ ASSERT(g_CfgData.szHostname[0]);
- nNumPartitions = 0;
+ nNumPartitions = 0;
- if (g_CfgData.configFS != CS_ALREADY_CONFIGURED)
- return 0;
+ if (g_CfgData.configFS != CS_ALREADY_CONFIGURED)
+ return 0;
- static vos_partitionEntry_t aPartitions[MAX_PARTITIONS];
- afs_status_t nStatus, nIgnore;
- void *hServer = 0;
- int nNumParts = 0;
+ static vos_partitionEntry_t aPartitions[MAX_PARTITIONS];
+ afs_status_t nStatus, nIgnore;
+ void *hServer = 0;
+ int nNumParts = 0;
- // Open this server
- g_LogFile.Write("Opening server %s.\r\n", GetHostnameA());
- int nResult = vos_ServerOpen(g_hCell, GetHostnameA(), &hServer, &nStatus);
+ // Open this server
+ g_LogFile.Write("Opening server %s.\r\n", GetHostnameA());
+ int nResult = vos_ServerOpen(g_hCell, GetHostnameA(), &hServer, &nStatus);
+ if (nResult) {
+
+ // Read the partition info
+ g_LogFile.Write("Reading paritition information for this server.\r\n");
+ void *iterID;
+
+ nResult = vos_PartitionGetBegin(g_hCell, hServer, 0, &iterID, &nStatus);
if (nResult) {
-
- // Read the partition info
- g_LogFile.Write("Reading paritition information for this server.\r\n");
- void *iterID;
-
- nResult = vos_PartitionGetBegin(g_hCell, hServer, 0, &iterID, &nStatus);
- if (nResult) {
- while (nNumParts < MAX_PARTITIONS) {
- nResult = vos_PartitionGetNext(iterID, &aPartitions[nNumParts], &nStatus);
- if (!nResult) {
- if (nStatus == ADMITERATORDONE) {
- nResult = 1;
- nStatus = 0;
- }
- break;
- }
-
- nNumParts++;
- }
- vos_PartitionGetDone(iterID, &nIgnore);
+ while (nNumParts < MAX_PARTITIONS) {
+ nResult = vos_PartitionGetNext(iterID, &aPartitions[nNumParts], &nStatus);
+ if (!nResult) {
+ if (nStatus == ADMITERATORDONE) {
+ nResult = 1;
+ nStatus = 0;
+ }
+ break;
}
- vos_ServerClose(hServer, &nIgnore);
- }
-
- if (!nResult) {
- ShowError(hDlg, nStatus, IDS_GET_PARTITION_LIST_ERROR);
- return 0;
+
+ nNumParts++;
+ }
+ vos_PartitionGetDone(iterID, &nIgnore);
}
+ vos_ServerClose(hServer, &nIgnore);
+ }
- nNumPartitions = nNumParts;
+ if (!nResult) {
+ ShowError(hDlg, nStatus, IDS_GET_PARTITION_LIST_ERROR);
+ return 0;
+ }
- return aPartitions;
+ nNumPartitions = nNumParts;
+
+ return aPartitions;
}
// Convert a disk space value in Kbytes into a string
static LPTSTR DiskSpaceToString(int nSpace)
{
- const float oneMB = 1024; // in K bytes
- const double oneGB = oneMB * 1024;
- const double oneTB = oneGB * 1024;
-
- static TCHAR szSpace[64];
- double space;
- LPTSTR pszUnits;
-
- space = nSpace;
-
- if (space >= oneTB) {
- space /= oneTB;
- pszUnits = TEXT(" TB");
- } else if (space >= oneGB) {
- space /= oneGB;
- pszUnits = TEXT(" GB");
+ const float oneMB = 1024; // in K bytes
+ const double oneGB = oneMB * 1024;
+ const double oneTB = oneGB * 1024;
+
+ static TCHAR szSpace[64];
+ double space;
+ LPTSTR pszUnits;
+
+ space = nSpace;
+
+ if (space >= oneTB) {
+ space /= oneTB;
+ pszUnits = TEXT(" TB");
+ } else if (space >= oneGB) {
+ space /= oneGB;
+ pszUnits = TEXT(" GB");
} else if (space >= oneMB) {
- space /= oneMB;
- pszUnits = TEXT(" MB");
- } else
- pszUnits = TEXT(" KB");
+ space /= oneMB;
+ pszUnits = TEXT(" MB");
+ } else
+ pszUnits = TEXT(" KB");
- int nNumDecimals = 0;
- if (space - double(int(space)) > 0)
- nNumDecimals = 2;
+ int nNumDecimals = 0;
+ if (space - double(int(space)) > 0)
+ nNumDecimals = 2;
- _stprintf(szSpace, TEXT("%3.*f%s"), nNumDecimals, space, pszUnits);
+ _stprintf(szSpace, TEXT("%3.*f%s"), nNumDecimals, space, pszUnits);
- return szSpace;
-}
+ return szSpace;
+}
static void ShowPartitions()
{
- FastList_RemoveAll(hPartitionList);
+ FastList_RemoveAll(hPartitionList);
- int cRegParts = 0, cVosParts = 0;
+ int cRegParts = 0, cVosParts = 0;
// If we got nothing from the registry, then leave the list empty
- cfg_partitionEntry_t *pRegParts = GetPartitionTableFromRegistry(cRegParts);
+ cfg_partitionEntry_t *pRegParts = GetPartitionTableFromRegistry(cRegParts);
if (!pRegParts)
return;
// If we failed to get vos info, then only show the registry info
- vos_partitionEntry_t *pVosParts = GetPartitionTableFromVos(cVosParts);
+ vos_partitionEntry_t *pVosParts = GetPartitionTableFromVos(cVosParts);
if (!pVosParts)
cVosParts = 0;
- // We have two partition tables, one from the registry and one from the vos
- // library. The one from the vos library tells us the partitions that are
- // currently exported. The one from the registry tells us the partitions
- // that will be exported after the file server restarts. The registry list
- // should always be at least as big as the vos list. The vos list can be
- // smaller if one of the disks could not be exported. To add a new partition,
- // an entry must be added to the registry table and then the file server must
- // be restarted. To remove an entry, the partition must not be exported (due
- // to an error) or the file server must not be running, in which case nothing
- // will be exported.
+ // We have two partition tables, one from the registry and one from the vos
+ // library. The one from the vos library tells us the partitions that are
+ // currently exported. The one from the registry tells us the partitions
+ // that will be exported after the file server restarts. The registry list
+ // should always be at least as big as the vos list. The vos list can be
+ // smaller if one of the disks could not be exported. To add a new partition,
+ // an entry must be added to the registry table and then the file server must
+ // be restarted. To remove an entry, the partition must not be exported (due
+ // to an error) or the file server must not be running, in which case nothing
+ // will be exported.
- // To display the partitions to the user, we use the list from the registry,
- // looking up each of its entries in the vos list to see if it is exported,
- // and if it is, to get its size info.
+ // To display the partitions to the user, we use the list from the registry,
+ // looking up each of its entries in the vos list to see if it is exported,
+ // and if it is, to get its size info.
- for (int nCurRegPart = 0; nCurRegPart < cRegParts; nCurRegPart++) {
+ for (int nCurRegPart = 0; nCurRegPart < cRegParts; nCurRegPart++) {
LPTSTR pPartNameAsString = AnsiToString(pRegParts[nCurRegPart].partitionName);
// Show the partition in the list
- FASTLISTADDITEM ai = { 0, DISK_DRIVE_IMAGE, IMAGE_NOIMAGE, pPartNameAsString, 0, 0 };
- HLISTITEM hItem = FastList_AddItem(hPartitionList, &ai);
+ FASTLISTADDITEM ai = { 0, DISK_DRIVE_IMAGE, IMAGE_NOIMAGE, pPartNameAsString, 0, 0 };
+ HLISTITEM hItem = FastList_AddItem(hPartitionList, &ai);
FreeString(pPartNameAsString);
- FastList_SetItemText(hPartitionList, hItem, 1, pRegParts[nCurRegPart].deviceName);
-
- // For the rest of the info we need to know if this guy is exported.
- // Look him up in the vos table.
- BOOL bExported = FALSE;
- int nTotalSpace = 0;
- int nFreeSpace = 0;
-
- for (int nCurVosPart = 0; nCurVosPart < cVosParts; nCurVosPart++) {
- if (stricmp(pVosParts[nCurVosPart].name, pRegParts[nCurRegPart].partitionName) == 0) {
- bExported = TRUE;
- nTotalSpace = pVosParts[nCurVosPart].totalSpace;
- nFreeSpace = pVosParts[nCurVosPart].totalFreeSpace;
- break;
- }
- }
+ FastList_SetItemText(hPartitionList, hItem, 1, pRegParts[nCurRegPart].deviceName);
+
+ // For the rest of the info we need to know if this guy is exported.
+ // Look him up in the vos table.
+ BOOL bExported = FALSE;
+ int nTotalSpace = 0;
+ int nFreeSpace = 0;
+
+ for (int nCurVosPart = 0; nCurVosPart < cVosParts; nCurVosPart++) {
+ if (stricmp(pVosParts[nCurVosPart].name, pRegParts[nCurRegPart].partitionName) == 0) {
+ bExported = TRUE;
+ nTotalSpace = pVosParts[nCurVosPart].totalSpace;
+ nFreeSpace = pVosParts[nCurVosPart].totalFreeSpace;
+ break;
+ }
+ }
- FastList_SetItemText(hPartitionList, hItem, 2, bExported ? szYes : szNo);
- FastList_SetItemText(hPartitionList, hItem, 3, bExported ? DiskSpaceToString(nTotalSpace) : TEXT(""));
- FastList_SetItemText(hPartitionList, hItem, 4, bExported ? DiskSpaceToString(nFreeSpace) : TEXT(""));
-
- // Set the item param to indicate that this partition is exported or not
- FastList_SetItemParam(hPartitionList, hItem, bExported);
-
-
+ FastList_SetItemText(hPartitionList, hItem, 2, bExported ? szYes : szNo);
+ FastList_SetItemText(hPartitionList, hItem, 3, bExported ? DiskSpaceToString(nTotalSpace) : TEXT(""));
+ FastList_SetItemText(hPartitionList, hItem, 4, bExported ? DiskSpaceToString(nFreeSpace) : TEXT(""));
+
+ // Set the item param to indicate that this partition is exported or not
+ FastList_SetItemParam(hPartitionList, hItem, bExported);
}
}
static void CheckEnableSalvage()
{
- ENABLE_STATE es = (FastList_GetItemCount(hPartitionList) > 0) ? ES_ENABLE : ES_DISABLE;
+ ENABLE_STATE es = (FastList_GetItemCount(hPartitionList) > 0) ? ES_ENABLE : ES_DISABLE;
- SetEnable(hDlg, IDC_SALVAGE, es);
- SetEnable(hDlg, IDC_SALVAGE_MSG, es);
+ SetEnable(hDlg, IDC_SALVAGE, es);
+ SetEnable(hDlg, IDC_SALVAGE_MSG, es);
}
*/
BOOL CALLBACK ReplicationPageDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp)
{
- if (WizStep_Common_DlgProc (hwndDlg, msg, wp, lp))
- return FALSE;
-
- switch (msg) {
- case WM_INITDIALOG:
- OnInitDialog(hwndDlg);
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wp)) {
- case IDNEXT:
- g_pWiz->SetState(sidSTEP_ELEVEN);
- break;
-
- case IDBACK:
- g_pWiz->SetState(sidSTEP_NINE);
- break;
-
- case IDC_DONT_REPLICATE:
- g_CfgData.configRep = CS_DONT_CONFIGURE;
- break;
-
- case IDC_REPLICATE:
- g_CfgData.configRep = CS_CONFIGURE;
- break;
- }
- break;
+ if (WizStep_Common_DlgProc (hwndDlg, msg, wp, lp))
+ return FALSE;
+
+ switch (msg) {
+ case WM_INITDIALOG:
+ OnInitDialog(hwndDlg);
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wp)) {
+ case IDNEXT:
+ g_pWiz->SetState(sidSTEP_ELEVEN);
+ break;
+ case IDBACK:
+ g_pWiz->SetState(sidSTEP_NINE);
+ break;
+
+ case IDC_DONT_REPLICATE:
+ g_CfgData.configRep = CS_DONT_CONFIGURE;
+ break;
+
+ case IDC_REPLICATE:
+ g_CfgData.configRep = CS_CONFIGURE;
+ break;
}
+ break;
- return FALSE;
+ }
+
+ return FALSE;
}
*/
static void OnInitDialog(HWND hwndDlg)
{
- hDlg = hwndDlg;
+ hDlg = hwndDlg;
- g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
- g_pWiz->SetButtonText(IDNEXT, IDS_NEXT);
- g_pWiz->SetDefaultControl(IDNEXT);
+ g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
+ g_pWiz->SetButtonText(IDNEXT, IDS_NEXT);
+ g_pWiz->SetDefaultControl(IDNEXT);
- if (g_CfgData.bFirstServer) {
- ShowStatusMsg(IDS_MUST_REPLICATE);
- g_CfgData.configRep = CS_CONFIGURE;
- return;
- }
+ if (g_CfgData.bFirstServer) {
+ ShowStatusMsg(IDS_MUST_REPLICATE);
+ g_CfgData.configRep = CS_CONFIGURE;
+ return;
+ }
- if (g_CfgData.configRep == CS_ALREADY_CONFIGURED) {
- ShowStatusMsg(IDS_ALREADY_REPLICATED);
+ if (g_CfgData.configRep == CS_ALREADY_CONFIGURED) {
+ ShowStatusMsg(IDS_ALREADY_REPLICATED);
return;
- }
+ }
- // If the replication of the root volumes could not be determined, we'll
- // ask the user if they want to create them if they don't already exist.
- if (!g_CfgData.bRootVolumesReplicationKnown) {
- SetWndText(hDlg, IDC_REPLICATE_QUESTION, IDS_REP_ROOT_VOLUMES_IF_NECESSARY_PROMPT);
+ // If the replication of the root volumes could not be determined, we'll
+ // ask the user if they want to create them if they don't already exist.
+ if (!g_CfgData.bRootVolumesReplicationKnown) {
+ SetWndText(hDlg, IDC_REPLICATE_QUESTION, IDS_REP_ROOT_VOLUMES_IF_NECESSARY_PROMPT);
g_CfgData.configRep = CS_CONFIGURE;
- SetCheck(hDlg, IDC_REPLICATE);
+ SetCheck(hDlg, IDC_REPLICATE);
return;
- }
+ }
- // Should this step be disabled? Yes, if this machine does
- // not have a root.afs volume.
- if (!ConfiguredOrConfiguring(g_CfgData.configRootVolumes)) {
- ShowStatusMsg(IDS_ROOT_AFS_DOESNT_EXIST);
- EnableStep(g_CfgData.configRep, FALSE);
- return;
- }
+ // Should this step be disabled? Yes, if this machine does
+ // not have a root.afs volume.
+ if (!ConfiguredOrConfiguring(g_CfgData.configRootVolumes)) {
+ ShowStatusMsg(IDS_ROOT_AFS_DOESNT_EXIST);
+ EnableStep(g_CfgData.configRep, FALSE);
+ return;
+ }
- // Must do this in case it was disabled on the last run through
- EnableStep(g_CfgData.configRep);
+ // Must do this in case it was disabled on the last run through
+ EnableStep(g_CfgData.configRep);
- if (g_CfgData.configRep == CS_DONT_CONFIGURE)
- SetCheck(hDlg, IDC_DONT_REPLICATE);
- else if (g_CfgData.configRep == CS_CONFIGURE)
- SetCheck(hDlg, IDC_REPLICATE);
-}
+ if (g_CfgData.configRep == CS_DONT_CONFIGURE)
+ SetCheck(hDlg, IDC_DONT_REPLICATE);
+ else if (g_CfgData.configRep == CS_CONFIGURE)
+ SetCheck(hDlg, IDC_REPLICATE);
+}
/*
*/
static void ShowStatusMsg(UINT nMsgID)
{
- TCHAR szMsg[cchRESOURCE];
+ TCHAR szMsg[cchRESOURCE];
- GetString(szMsg, nMsgID);
+ GetString(szMsg, nMsgID);
- ShowWnd(hDlg, IDC_REPLICATE_QUESTION, FALSE);
- ShowWnd(hDlg, IDC_REPLICATE, FALSE);
- ShowWnd(hDlg, IDC_DONT_REPLICATE, FALSE);
+ ShowWnd(hDlg, IDC_REPLICATE_QUESTION, FALSE);
+ ShowWnd(hDlg, IDC_REPLICATE, FALSE);
+ ShowWnd(hDlg, IDC_DONT_REPLICATE, FALSE);
- ShowWnd(hDlg, IDC_CANT_REPLICATE_MSG);
- SetWndText(hDlg, IDC_CANT_REPLICATE_MSG, szMsg);
+ ShowWnd(hDlg, IDC_CANT_REPLICATE_MSG);
+ SetWndText(hDlg, IDC_CANT_REPLICATE_MSG, szMsg);
}
*/
BOOL CALLBACK RootAfsPageDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp)
{
- if (WizStep_Common_DlgProc (hwndDlg, msg, wp, lp))
- return FALSE;
+ if (WizStep_Common_DlgProc (hwndDlg, msg, wp, lp))
+ return FALSE;
- switch (msg) {
- case WM_INITDIALOG:
- OnInitDialog(hwndDlg);
- break;
+ switch (msg) {
+ case WM_INITDIALOG:
+ OnInitDialog(hwndDlg);
+ break;
- case WM_COMMAND:
- switch (LOWORD(wp)) {
- case IDNEXT:
- g_pWiz->SetState(sidSTEP_TEN);
- break;
+ case WM_COMMAND:
+ switch (LOWORD(wp)) {
+ case IDNEXT:
+ g_pWiz->SetState(sidSTEP_TEN);
+ break;
- case IDBACK:
- g_pWiz->SetState(sidSTEP_EIGHT);
- break;
+ case IDBACK:
+ g_pWiz->SetState(sidSTEP_EIGHT);
+ break;
- case IDC_DONT_CREATE_ROOT_VOLUMES:
- g_CfgData.configRootVolumes = CS_DONT_CONFIGURE;
- break;
+ case IDC_DONT_CREATE_ROOT_VOLUMES:
+ g_CfgData.configRootVolumes = CS_DONT_CONFIGURE;
+ break;
- case IDC_CREATE_ROOT_VOLUMES:
- g_CfgData.configRootVolumes = CS_CONFIGURE;
- break;
- }
- break;
+ case IDC_CREATE_ROOT_VOLUMES:
+ g_CfgData.configRootVolumes = CS_CONFIGURE;
+ break;
+ }
+ break;
- }
+ }
- return FALSE;
-}
+ return FALSE;
+}
*/
static void OnInitDialog(HWND hwndDlg)
{
- hDlg = hwndDlg;
+ hDlg = hwndDlg;
- g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
- g_pWiz->SetButtonText(IDNEXT, IDS_NEXT);
- g_pWiz->SetDefaultControl(IDNEXT);
+ g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
+ g_pWiz->SetButtonText(IDNEXT, IDS_NEXT);
+ g_pWiz->SetDefaultControl(IDNEXT);
- if (g_CfgData.bFirstServer) {
- ShowStatusMsg(IDS_MUST_CREATE_ROOT_AFS);
- g_CfgData.configRootVolumes = CS_CONFIGURE;
- return;
- }
+ if (g_CfgData.bFirstServer) {
+ ShowStatusMsg(IDS_MUST_CREATE_ROOT_AFS);
+ g_CfgData.configRootVolumes = CS_CONFIGURE;
+ return;
+ }
- if (g_CfgData.configRootVolumes == CS_ALREADY_CONFIGURED) {
- ShowStatusMsg(IDS_ROOT_AFS_ALREADY_EXISTS);
+ if (g_CfgData.configRootVolumes == CS_ALREADY_CONFIGURED) {
+ ShowStatusMsg(IDS_ROOT_AFS_ALREADY_EXISTS);
return;
- }
+ }
- // If the existence of the root volumes could not be determined, we'll
- // ask the user if they want to create them if they don't already exist.
- if (!g_CfgData.bRootVolumesExistanceKnown) {
+ // If the existence of the root volumes could not be determined, we'll
+ // ask the user if they want to create them if they don't already exist.
+ if (!g_CfgData.bRootVolumesExistanceKnown) {
SetWndText(hDlg, IDC_ROOT_AFS_QUESTION, IDS_CREATE_ROOT_VOLUMES_IF_NECESSARY_PROMPT);
- SetCheck(hDlg, IDC_CREATE_ROOT_VOLUMES);
+ SetCheck(hDlg, IDC_CREATE_ROOT_VOLUMES);
g_CfgData.configRootVolumes = CS_CONFIGURE;
return;
- }
+ }
- // Should this step be disabled? Yes, if this machine does
- // not have a partition to make root.afs on.
- if (!ConfiguredOrConfiguring(g_CfgData.configPartition)) {
- ShowStatusMsg(IDS_NO_PARTITION_EXISTS);
- EnableStep(g_CfgData.configRootVolumes, FALSE);
- return;
- }
+ // Should this step be disabled? Yes, if this machine does
+ // not have a partition to make root.afs on.
+ if (!ConfiguredOrConfiguring(g_CfgData.configPartition)) {
+ ShowStatusMsg(IDS_NO_PARTITION_EXISTS);
+ EnableStep(g_CfgData.configRootVolumes, FALSE);
+ return;
+ }
// If root.afs exists already but root.cell does not exist, then
// the wizard cannot make root.cell and must disable this option.
// TODO: We should handle this better in a future version where we can
// add new messages. The message catalog is frozen for this version
// so we have to handle this case without adding new messages.
- if (g_CfgData.bRootAfsExists && !g_CfgData.bRootCellExists) {
+ if (g_CfgData.bRootAfsExists && !g_CfgData.bRootCellExists) {
EnableWnd(hDlg, IDC_CREATE_ROOT_VOLUMES, FALSE);
- SetCheck(hDlg, IDC_DONT_CREATE_ROOT_VOLUMES);
+ SetCheck(hDlg, IDC_DONT_CREATE_ROOT_VOLUMES);
g_CfgData.configRootVolumes = CS_DONT_CONFIGURE;
return;
- }
+ }
- // Must do this in case it was disabled on the last run through
- EnableStep(g_CfgData.configRootVolumes);
+ // Must do this in case it was disabled on the last run through
+ EnableStep(g_CfgData.configRootVolumes);
- if (g_CfgData.configRootVolumes == CS_DONT_CONFIGURE)
- SetCheck(hDlg, IDC_DONT_CREATE_ROOT_VOLUMES);
- else
- SetCheck(hDlg, IDC_CREATE_ROOT_VOLUMES);
-}
+ if (g_CfgData.configRootVolumes == CS_DONT_CONFIGURE)
+ SetCheck(hDlg, IDC_DONT_CREATE_ROOT_VOLUMES);
+ else
+ SetCheck(hDlg, IDC_CREATE_ROOT_VOLUMES);
+}
/*
*/
static void ShowStatusMsg(UINT nMsgID)
{
- TCHAR szMsg[cchRESOURCE];
+ TCHAR szMsg[cchRESOURCE];
- GetString(szMsg, nMsgID);
+ GetString(szMsg, nMsgID);
- // Hide the controls that are at the same position as the message
- ShowWnd(hDlg, IDC_ROOT_AFS_QUESTION, FALSE);
- ShowWnd(hDlg, IDC_CREATE_ROOT_VOLUMES, FALSE);
- ShowWnd(hDlg, IDC_DONT_CREATE_ROOT_VOLUMES, FALSE);
+ // Hide the controls that are at the same position as the message
+ ShowWnd(hDlg, IDC_ROOT_AFS_QUESTION, FALSE);
+ ShowWnd(hDlg, IDC_CREATE_ROOT_VOLUMES, FALSE);
+ ShowWnd(hDlg, IDC_DONT_CREATE_ROOT_VOLUMES, FALSE);
- SetWndText(hDlg, IDC_ROOT_AFS_MSG, szMsg);
- ShowWnd(hDlg, IDC_ROOT_AFS_MSG);
+ SetWndText(hDlg, IDC_ROOT_AFS_MSG, szMsg);
+ ShowWnd(hDlg, IDC_ROOT_AFS_MSG);
}
*/
BOOL ShowSalvageDlg(HWND hParent, LPCTSTR pszPartitionName)
{
- ASSERT(pszPartitionName);
+ ASSERT(pszPartitionName);
- lstrcpy(szPartitionName, pszPartitionName);
+ lstrcpy(szPartitionName, pszPartitionName);
- int nResult = ModalDialog(IDD_SALVAGE, hParent, (DLGPROC)SalvageDlgProc);
+ int nResult = ModalDialog(IDD_SALVAGE, hParent, (DLGPROC)SalvageDlgProc);
if (nResult != IDOK)
return FALSE;
- // Create a thread to perform the salvage
- DWORD dwThreadID;
- g_CfgData.hSalvageThread = CreateThread(0, 0, Salvage, 0, 0, &dwThreadID);
+ // Create a thread to perform the salvage
+ DWORD dwThreadID;
+ g_CfgData.hSalvageThread = CreateThread(0, 0, Salvage, 0, 0, &dwThreadID);
- return (g_CfgData.hSalvageThread != 0);
+ return (g_CfgData.hSalvageThread != 0);
}
*/
BOOL CALLBACK SalvageDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp)
{
- if (AfsAppLib_HandleHelp(IDD_SALVAGE, hwndDlg, msg, wp, lp))
- return TRUE;
-
- switch (msg) {
- case WM_INITDIALOG:
- OnInitDialog(hwndDlg);
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wp)) {
- case IDC_VOLUME_NAME:
- case IDC_NUM_PROCESSES:
- case IDC_LOG_FILE:
- case IDC_TEMP_DIR:
- if (HIWORD(wp) == EN_CHANGE)
- UpdateControls();
- break;
-
- case IDC_SERVER:
- case IDC_PARTITION:
- case IDC_VOLUME:
- case IDC_NUM_PROCESSES_CHECKBOX:
- UpdateControls();
- break;
-
- case IDC_ADVANCED:
- OnAdvanced();
- break;
-
- case IDCANCEL:
- EndDialog(hDlg, IDCANCEL);
- break;
-
- case IDOK:
- if (OnSalvage())
- EndDialog(hDlg, IDOK);
- break;
- }
- break;
- }
+ if (AfsAppLib_HandleHelp(IDD_SALVAGE, hwndDlg, msg, wp, lp))
+ return TRUE;
+
+ switch (msg) {
+ case WM_INITDIALOG:
+ OnInitDialog(hwndDlg);
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wp)) {
+ case IDC_VOLUME_NAME:
+ case IDC_NUM_PROCESSES:
+ case IDC_LOG_FILE:
+ case IDC_TEMP_DIR:
+ if (HIWORD(wp) == EN_CHANGE)
+ UpdateControls();
+ break;
+
+ case IDC_SERVER:
+ case IDC_PARTITION:
+ case IDC_VOLUME:
+ case IDC_NUM_PROCESSES_CHECKBOX:
+ UpdateControls();
+ break;
+
+ case IDC_ADVANCED:
+ OnAdvanced();
+ break;
+
+ case IDCANCEL:
+ EndDialog(hDlg, IDCANCEL);
+ break;
+
+ case IDOK:
+ if (OnSalvage())
+ EndDialog(hDlg, IDOK);
+ break;
+ }
+ break;
+ }
return FALSE;
}
*/
static void OnInitDialog(HWND hwndDlg)
{
- hDlg = hwndDlg;
+ hDlg = hwndDlg;
- bAdvanced = TRUE;
+ bAdvanced = TRUE;
- TCHAR szNumProcesses[32];
- _itot(DEFAULT_NUM_PROCESSES, szNumProcesses, 10);
+ TCHAR szNumProcesses[32];
+ _itot(DEFAULT_NUM_PROCESSES, szNumProcesses, 10);
- SetWndText(hDlg, IDC_NUM_PROCESSES, szNumProcesses);
- SetCheck(hDlg, IDC_NUM_PROCESSES_CHECKBOX);
- SetWndText(hDlg, IDC_LOG_FILE, A2S(DEFAULT_LOG_FILE));
+ SetWndText(hDlg, IDC_NUM_PROCESSES, szNumProcesses);
+ SetCheck(hDlg, IDC_NUM_PROCESSES_CHECKBOX);
+ SetWndText(hDlg, IDC_LOG_FILE, A2S(DEFAULT_LOG_FILE));
- // If a partition name isn't selected, then only allow the salvage server option
- if (szPartitionName[0] == 0) {
- SetEnable(hDlg, IDC_PARTITION, ES_DISABLE);
- SetEnable(hDlg, IDC_VOLUME, ES_DISABLE);
- SetCheck(hDlg, IDC_SERVER);
- } else
- SetCheck(hDlg, IDC_PARTITION);
+ // If a partition name isn't selected, then only allow the salvage server option
+ if (szPartitionName[0] == 0) {
+ SetEnable(hDlg, IDC_PARTITION, ES_DISABLE);
+ SetEnable(hDlg, IDC_VOLUME, ES_DISABLE);
+ SetCheck(hDlg, IDC_SERVER);
+ } else
+ SetCheck(hDlg, IDC_PARTITION);
- // Close the Advanced portion of the dialog
- OnAdvanced();
+ // Close the Advanced portion of the dialog
+ OnAdvanced();
}
static void OnAdvanced()
{
static int nOffset = 0;
- bAdvanced = !bAdvanced;
-
- ShowAndEnable(hDlg, IDC_ADVANCED_FRAME, bAdvanced);
- ShowAndEnable(hDlg, IDC_LOG_FILE, bAdvanced);
- ShowAndEnable(hDlg, IDC_LOG_FILE_LABEL, bAdvanced);
- ShowAndEnable(hDlg, IDC_NUM_PROCESSES, bAdvanced);
- ShowAndEnable(hDlg, IDC_TEMP_DIR, bAdvanced);
- ShowAndEnable(hDlg, IDC_TEMP_DIR_LABEL, bAdvanced);
- ShowAndEnable(hDlg, IDC_NUM_PROCESSES_CHECKBOX, bAdvanced);
- ShowAndEnable(hDlg, IDC_DAMAGED_VOLUMES, bAdvanced);
- ShowAndEnable(hDlg, IDC_SMALL_BLOCK_READS, bAdvanced);
- ShowAndEnable(hDlg, IDC_FORCE_SALVAGE, bAdvanced);
- ShowAndEnable(hDlg, IDC_FORCE_REBUILD, bAdvanced);
- ShowAndEnable(hDlg, IDC_LIST_DAMAGED_INODES, bAdvanced);
- ShowAndEnable(hDlg, IDC_LIST_OWNED_INDOES, bAdvanced);
+ bAdvanced = !bAdvanced;
+
+ ShowAndEnable(hDlg, IDC_ADVANCED_FRAME, bAdvanced);
+ ShowAndEnable(hDlg, IDC_LOG_FILE, bAdvanced);
+ ShowAndEnable(hDlg, IDC_LOG_FILE_LABEL, bAdvanced);
+ ShowAndEnable(hDlg, IDC_NUM_PROCESSES, bAdvanced);
+ ShowAndEnable(hDlg, IDC_TEMP_DIR, bAdvanced);
+ ShowAndEnable(hDlg, IDC_TEMP_DIR_LABEL, bAdvanced);
+ ShowAndEnable(hDlg, IDC_NUM_PROCESSES_CHECKBOX, bAdvanced);
+ ShowAndEnable(hDlg, IDC_DAMAGED_VOLUMES, bAdvanced);
+ ShowAndEnable(hDlg, IDC_SMALL_BLOCK_READS, bAdvanced);
+ ShowAndEnable(hDlg, IDC_FORCE_SALVAGE, bAdvanced);
+ ShowAndEnable(hDlg, IDC_FORCE_REBUILD, bAdvanced);
+ ShowAndEnable(hDlg, IDC_LIST_DAMAGED_INODES, bAdvanced);
+ ShowAndEnable(hDlg, IDC_LIST_OWNED_INDOES, bAdvanced);
// To show or hide the advanced section, we have to resize the dialog
nOffset = rectDlg.bottom - rectFrame.top - 3;
}
- int nCurOffset = nOffset;
+ int nCurOffset = nOffset;
if (!bAdvanced)
- nCurOffset *= -1;
+ nCurOffset *= -1;
// Adjust dialog position
- MoveWindow(hDlg, rectDlg.left, rectDlg.top, rectDlg.right - rectDlg.left, rectDlg.bottom - rectDlg.top + nCurOffset, TRUE);
+ MoveWindow(hDlg, rectDlg.left, rectDlg.top, rectDlg.right - rectDlg.left, rectDlg.bottom - rectDlg.top + nCurOffset, TRUE);
- SetWndText(hDlg, IDC_ADVANCED, bAdvanced ? IDS_ADVANCED_OPEN : IDS_ADVANCED_CLOSED);
+ SetWndText(hDlg, IDC_ADVANCED, bAdvanced ? IDS_ADVANCED_OPEN : IDS_ADVANCED_CLOSED);
}
static void UpdateControls()
{
- // Update volume name controls
- BOOL bVolume = IsButtonChecked(hDlg, IDC_VOLUME);
- ENABLE_STATE es = bVolume ? ES_ENABLE : ES_DISABLE;
- SetEnable(hDlg, IDC_VOLUME_NAME, es);
- SetEnable(hDlg, IDC_VOLUME_NAME_LABEL, es);
- GetWndText(hDlg, IDC_VOLUME_NAME, szVolumeName);
+ // Update volume name controls
+ BOOL bVolume = IsButtonChecked(hDlg, IDC_VOLUME);
+ ENABLE_STATE es = bVolume ? ES_ENABLE : ES_DISABLE;
+ SetEnable(hDlg, IDC_VOLUME_NAME, es);
+ SetEnable(hDlg, IDC_VOLUME_NAME_LABEL, es);
+ GetWndText(hDlg, IDC_VOLUME_NAME, szVolumeName);
- // Num processes edit control
- BOOL bParallel = IsButtonChecked(hDlg, IDC_NUM_PROCESSES_CHECKBOX);
- SetEnable(hDlg, IDC_NUM_PROCESSES, (ENABLE_STATE)bParallel);
- GetWndText(hDlg, IDC_NUM_PROCESSES, szNumProcesses, NUM_PROCS_BUF_SIZE);
+ // Num processes edit control
+ BOOL bParallel = IsButtonChecked(hDlg, IDC_NUM_PROCESSES_CHECKBOX);
+ SetEnable(hDlg, IDC_NUM_PROCESSES, (ENABLE_STATE)bParallel);
+ GetWndText(hDlg, IDC_NUM_PROCESSES, szNumProcesses, NUM_PROCS_BUF_SIZE);
- GetWndText(hDlg, IDC_LOG_FILE, g_CfgData.szSalvageLogFileName, _MAX_PATH);
- GetWndText(hDlg, IDC_TEMP_DIR, szTempDir, _MAX_PATH);
+ GetWndText(hDlg, IDC_LOG_FILE, g_CfgData.szSalvageLogFileName, _MAX_PATH);
+ GetWndText(hDlg, IDC_TEMP_DIR, szTempDir, _MAX_PATH);
- // Should OK button be enabled or disabled?
- BOOL bEnable = TRUE;
+ // Should OK button be enabled or disabled?
+ BOOL bEnable = TRUE;
- if (bVolume)
- bEnable = !!lstrlen(szVolumeName);
+ if (bVolume)
+ bEnable = !!lstrlen(szVolumeName);
- if (bEnable && bParallel)
- bEnable = !!lstrlen(szNumProcesses);
+ if (bEnable && bParallel)
+ bEnable = !!lstrlen(szNumProcesses);
- SetEnable(hDlg, IDOK, (ENABLE_STATE)bEnable);
-}
+ SetEnable(hDlg, IDOK, (ENABLE_STATE)bEnable);
+}
/*
* Utility Functions _________________________________________________________________
*/
static BOOL OnSalvage()
{
- if (IsButtonChecked(hDlg, IDC_SERVER)) {
- pszPartitionName = 0;
- pszVolumeName = 0;
- } else if (IsButtonChecked(hDlg, IDC_PARTITION)) {
- pszPartitionName = szPartitionName;
- pszVolumeName = 0;
- } else if (IsButtonChecked(hDlg, IDC_VOLUME)) {
- pszPartitionName = szPartitionName;
- pszVolumeName = szVolumeName;
- }
+ if (IsButtonChecked(hDlg, IDC_SERVER)) {
+ pszPartitionName = 0;
+ pszVolumeName = 0;
+ } else if (IsButtonChecked(hDlg, IDC_PARTITION)) {
+ pszPartitionName = szPartitionName;
+ pszVolumeName = 0;
+ } else if (IsButtonChecked(hDlg, IDC_VOLUME)) {
+ pszPartitionName = szPartitionName;
+ pszVolumeName = szVolumeName;
+ }
- nNumProcesses = DEFAULT_NUM_PROCESSES;
- if (IsButtonChecked(hDlg, IDC_NUM_PROCESSES_CHECKBOX)) {
- nNumProcesses = _ttoi(szNumProcesses);
- if ((nNumProcesses < MIN_NUM_PROCESSES) || (nNumProcesses > MAX_NUM_PROCESSES)) {
- ShowError(hDlg, 0, IDS_INVALID_NUM_SALVAGE_PROCESSSES);
- return FALSE;
- }
+ nNumProcesses = DEFAULT_NUM_PROCESSES;
+ if (IsButtonChecked(hDlg, IDC_NUM_PROCESSES_CHECKBOX)) {
+ nNumProcesses = _ttoi(szNumProcesses);
+ if ((nNumProcesses < MIN_NUM_PROCESSES) || (nNumProcesses > MAX_NUM_PROCESSES)) {
+ ShowError(hDlg, 0, IDS_INVALID_NUM_SALVAGE_PROCESSSES);
+ return FALSE;
}
+ }
- if (!g_CfgData.bReuseAdminInfo) {
+ if (!g_CfgData.bReuseAdminInfo) {
if (!GetAdminInfo(hDlg, GAIO_LOGIN_ONLY))
- return FALSE;
+ return FALSE;
if (!GetHandles(hDlg))
return FALSE;
- }
+ }
- return TRUE;
+ return TRUE;
}
static DWORD WINAPI Salvage(LPVOID param)
{
- afs_status_t nStatus;
- void *hServer;
- int nResult;
-
- nResult = bos_ServerOpen(g_hCell, GetHostnameA(), &hServer, &nStatus);
- if (!nResult) {
- ShowError(hDlg, nStatus, IDS_BOS_OPEN_FAILED);
- return FALSE;
- }
+ afs_status_t nStatus;
+ void *hServer;
+ int nResult;
+
+ nResult = bos_ServerOpen(g_hCell, GetHostnameA(), &hServer, &nStatus);
+ if (!nResult) {
+ ShowError(hDlg, nStatus, IDS_BOS_OPEN_FAILED);
+ return FALSE;
+ }
- nResult = bos_Salvage(g_hCell, hServer, S2A(pszPartitionName), S2A(pszVolumeName), nNumProcesses, S2A(szTempDir), 0, VOS_NORMAL,
- BOS_SALVAGE_DAMAGED_VOLUMES, BOS_SALVAGE_DONT_WRITE_INODES, BOS_SALVAGE_DONT_WRITE_ROOT_INODES,
- BOS_SALVAGE_DONT_FORCE_DIRECTORIES, BOS_SALVAGE_DONT_FORCE_BLOCK_READS, &nStatus);
- if (!nResult)
+ nResult = bos_Salvage(g_hCell, hServer, S2A(pszPartitionName), S2A(pszVolumeName), nNumProcesses, S2A(szTempDir), 0, VOS_NORMAL,
+ BOS_SALVAGE_DAMAGED_VOLUMES, BOS_SALVAGE_DONT_WRITE_INODES, BOS_SALVAGE_DONT_WRITE_ROOT_INODES,
+ BOS_SALVAGE_DONT_FORCE_DIRECTORIES, BOS_SALVAGE_DONT_FORCE_BLOCK_READS, &nStatus);
+ if (!nResult)
ShowError(hDlg, nStatus, IDS_SALVAGE_ERROR);
bos_ServerClose(hServer, &nStatus);
g_CfgData.bReuseAdminInfo = nResult;
- return nResult;
+ return nResult;
}
*/
BOOL ShowSalvageResults(HWND hParent)
{
- int nResult = ModalDialog(IDD_SALVAGE_RESULTS, hParent, (DLGPROC)SalvageResultsDlgProc);
+ int nResult = ModalDialog(IDD_SALVAGE_RESULTS, hParent, (DLGPROC)SalvageResultsDlgProc);
- return (nResult == IDOK);
+ return (nResult == IDOK);
}
*/
BOOL CALLBACK SalvageResultsDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp)
{
- if (AfsAppLib_HandleHelp(IDD_SALVAGE_RESULTS, hwndDlg, msg, wp, lp))
- return TRUE;
-
- switch (msg) {
- case WM_INITDIALOG:
- OnInitDialog(hwndDlg);
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wp)) {
- case IDC_CLOSE:
- OnClose();
- break;
-
- case IDCANCEL:
- if (bSalvageComplete)
- OnClose();
- }
- break;
-
- case WM_SIZE:
- if (lp != 0)
- ResizeWindow(hwndDlg, arwDialog, rwaFixupGuts);
- break;
+ if (AfsAppLib_HandleHelp(IDD_SALVAGE_RESULTS, hwndDlg, msg, wp, lp))
+ return TRUE;
+
+ switch (msg) {
+ case WM_INITDIALOG:
+ OnInitDialog(hwndDlg);
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wp)) {
+ case IDC_CLOSE:
+ OnClose();
+ break;
+
+ case IDCANCEL:
+ if (bSalvageComplete)
+ OnClose();
}
+ break;
+
+ case WM_SIZE:
+ if (lp != 0)
+ ResizeWindow(hwndDlg, arwDialog, rwaFixupGuts);
+ break;
+ }
return FALSE;
-}
+}
/*
*/
static void OnInitDialog(HWND hwndDlg)
{
- hDlg = hwndDlg;
+ hDlg = hwndDlg;
bSalvageComplete = FALSE;
SetMessages(IDS_SALVAGING, IDS_CURRENT_SALVAGE_LOG);
- nResult = bos_ServerOpen(g_hCell, GetHostnameA(), &hServer, &nStatus);
- if (!nResult) {
- ShowError(hDlg, nStatus, IDS_BOS_OPEN_FAILED);
- return;
- }
+ nResult = bos_ServerOpen(g_hCell, GetHostnameA(), &hServer, &nStatus);
+ if (!nResult) {
+ ShowError(hDlg, nStatus, IDS_BOS_OPEN_FAILED);
+ return;
+ }
// Remove the start menu - we do this so the user can't close
// the dialog while salvage is being performed.
dw &= ~WS_SYSMENU;
SetWindowLong(hDlg, GWL_STYLE, dw);
- // Create a thread to keep the view of the log up to date
- DWORD dwThreadID;
- HANDLE hThread = CreateThread(0, 0, ShowResults, 0, 0, &dwThreadID);
- CloseHandle(hThread);
+ // Create a thread to keep the view of the log up to date
+ DWORD dwThreadID;
+ HANDLE hThread = CreateThread(0, 0, ShowResults, 0, 0, &dwThreadID);
+ CloseHandle(hThread);
}
static void OnClose()
{
- bos_ServerClose(hServer, &nStatus);
+ bos_ServerClose(hServer, &nStatus);
EndDialog(hDlg, IDOK);
}
while (*pInBuf) {
if (*pInBuf == '\n')
nNumNLs++;
- pInBuf++;
+ pInBuf++;
}
// Allocate enough memory for the log buffer plus CRs plus a NULL
} else
*pOutBuf++ = *pInBuf;
- pInBuf++;
+ pInBuf++;
}
*pOutBuf = 0;
while (*psz && (*psz != '\n'))
psz++;
- if (*psz == '\n')
- psz++;
+ if (*psz == '\n')
+ psz++;
return psz;
}
if (!pszFileName[0])
return;
- FILE *fp = fopen(pszFileName, "w");
- if (!fp) {
- ShowError(hDlg, 0, IDS_ERROR_SAVING_SALVAGE_LOG_TO_DISK);
- return;
- }
+ FILE *fp = fopen(pszFileName, "w");
+ if (!fp) {
+ ShowError(hDlg, 0, IDS_ERROR_SAVING_SALVAGE_LOG_TO_DISK);
+ return;
+ }
- fprintf(fp, "%s", pszLogBuf);
+ fprintf(fp, "%s", pszLogBuf);
- fclose(fp);
+ fclose(fp);
}
static DWORD WINAPI ShowResults(LPVOID param)
// In either case, update the log display for the user
// Get the salvage log as it currently exists
-getlog: nResult = bos_LogGet(hServer, "SalvageLog", &nLogSize, pszLogBuf, &nStatus);
+ getlog:
+ nResult = bos_LogGet(hServer, "SalvageLog", &nLogSize, pszLogBuf, &nStatus);
if (!nResult) {
if (nStatus == ADMMOREDATA) {
// If salvage isn't done, then get a bigger buffer than we need to
if (rc) {
SetMessages(IDS_SALVAGE_COMPLETE, IDS_FINAL_SALVAGE_LOG);
- SaveLogToDisk(pszLogBufWithCRs, GetSalvageLogFileNameA());
+ SaveLogToDisk(pszLogBufWithCRs, GetSalvageLogFileNameA());
MsgBox(hDlg, IDS_SALVAGE_COMPLETE, GetAppTitleID(), MB_OK);
} else {
SetMessages(IDS_SALVAGING, IDS_CANT_GET_SALVAGE_LOG);
*/
BOOL CALLBACK ServicesPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- if (AfsAppLib_HandleHelp(IDD_SERVICES_PAGE, hwndDlg, uMsg, wParam, lParam))
- return TRUE;
+ if (AfsAppLib_HandleHelp(IDD_SERVICES_PAGE, hwndDlg, uMsg, wParam, lParam))
+ return TRUE;
- switch (uMsg) {
- case WM_INITDIALOG: OnInitDialog(hwndDlg);
- break;
+ switch (uMsg) {
+ case WM_INITDIALOG:
+ OnInitDialog(hwndDlg);
+ break;
- case WM_COMMAND: switch (LOWORD(wParam)) {
- case IDC_DB_SERVICE: OnDbService();
- break;
-
- case IDC_BK_SERVICE: OnBakService();
- break;
-
- case IDC_FS_SERVICE: OnFsService();
- break;
-
- case IDC_SCC: OnScClient();
- break;
-
- case IDC_SCS: OnScServer();
- break;
-
- case IDC_SC_MACHINE: if (HIWORD(wParam) == EN_CHANGE) {
- OnScMachineChange();
- }
- break;
-
- case IDAPPLY: PrepareToConfig();
- break;
- }
- break;
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_DB_SERVICE:
+ OnDbService();
+ break;
+
+ case IDC_BK_SERVICE:
+ OnBakService();
+ break;
+
+ case IDC_FS_SERVICE:
+ OnFsService();
+ break;
+
+ case IDC_SCC:
+ OnScClient();
+ break;
+
+ case IDC_SCS:
+ OnScServer();
+ break;
+
+ case IDC_SC_MACHINE:
+ if (HIWORD(wParam) == EN_CHANGE) {
+ OnScMachineChange();
+ }
+ break;
+
+ case IDAPPLY:
+ PrepareToConfig();
+ break;
}
+ break;
+ }
- CheckEnableApply();
+ CheckEnableApply();
- return FALSE;
-}
+ return FALSE;
+}
/*
*/
static void OnInitDialog(HWND hwndDlg)
{
- hDlg = hwndDlg;
+ hDlg = hwndDlg;
- // Show the initial services config
- ShowInitialConfig();
- ShowServiceStates();
+ // Show the initial services config
+ ShowInitialConfig();
+ ShowServiceStates();
- MakeBold(hDlg, IDC_DB_SERVICE);
- MakeBold(hDlg, IDC_FS_SERVICE);
- MakeBold(hDlg, IDC_BK_SERVICE);
- MakeBold(hDlg, IDC_SCC);
- MakeBold(hDlg, IDC_SCS);
+ MakeBold(hDlg, IDC_DB_SERVICE);
+ MakeBold(hDlg, IDC_FS_SERVICE);
+ MakeBold(hDlg, IDC_BK_SERVICE);
+ MakeBold(hDlg, IDC_SCC);
+ MakeBold(hDlg, IDC_SCS);
}
static void EnableScMachine(BOOL bEnable)
-{
- SetEnable(hDlg, IDC_SC_MACHINE_LABEL, (ENABLE_STATE)bEnable);
- SetEnable(hDlg, IDC_SC_MACHINE, (ENABLE_STATE)bEnable);
+{
+ SetEnable(hDlg, IDC_SC_MACHINE_LABEL, (ENABLE_STATE)bEnable);
+ SetEnable(hDlg, IDC_SC_MACHINE, (ENABLE_STATE)bEnable);
- bSettingScMachine = TRUE;
- SetWndText(hDlg, IDC_SC_MACHINE, bEnable ? szScMachine : TEXT(""));
- bSettingScMachine = FALSE;
-}
+ bSettingScMachine = TRUE;
+ SetWndText(hDlg, IDC_SC_MACHINE, bEnable ? szScMachine : TEXT(""));
+ bSettingScMachine = FALSE;
+}
static void ShowInitialConfig()
{
- // FS
- bFsRunning = Configured(g_CfgData.configFS);
- if (bFsRunning) {
- SetCheck(hDlg, IDC_FS_SERVICE);
- SetWndText(hDlg, IDC_FS_STATUS_MSG, IDS_FS_RUNNING);
- SetWndText(hDlg, IDC_FS_ACTION_MSG, IDS_FS_HOW_TO_STOP);
- } else {
- SetCheck(hDlg, IDC_FS_SERVICE, FALSE);
- SetWndText(hDlg, IDC_FS_STATUS_MSG, IDS_FS_STOPPED);
- SetWndText(hDlg, IDC_FS_ACTION_MSG, IDS_FS_HOW_TO_RUN);
- }
+ // FS
+ bFsRunning = Configured(g_CfgData.configFS);
+ if (bFsRunning) {
+ SetCheck(hDlg, IDC_FS_SERVICE);
+ SetWndText(hDlg, IDC_FS_STATUS_MSG, IDS_FS_RUNNING);
+ SetWndText(hDlg, IDC_FS_ACTION_MSG, IDS_FS_HOW_TO_STOP);
+ } else {
+ SetCheck(hDlg, IDC_FS_SERVICE, FALSE);
+ SetWndText(hDlg, IDC_FS_STATUS_MSG, IDS_FS_STOPPED);
+ SetWndText(hDlg, IDC_FS_ACTION_MSG, IDS_FS_HOW_TO_RUN);
+ }
- bFsOn = bFsRunning;
+ bFsOn = bFsRunning;
// DB
- Set2State(hDlg, IDC_DB_SERVICE);
-
- bDbRunning = Configured(g_CfgData.configDB);
- if (bDbRunning) {
- SetCheck(hDlg, IDC_DB_SERVICE);
- SetWndText(hDlg, IDC_DB_STATUS_MSG, IDS_DB_RUNNING);
- SetWndText(hDlg, IDC_DB_ACTION_MSG, IDS_DB_HOW_TO_STOP);
- } else if (bDbParial) {
- SetCheck(hDlg, IDC_DB_SERVICE, BST_INDETERMINATE);
- SetWndText(hDlg, IDC_DB_STATUS_MSG, IDS_DB_PARTIAL_CONFIG);
- SetWndText(hDlg, IDC_DB_ACTION_MSG, IDS_DB_DETAILS);
- ShowWnd(hDlg, IDC_DB_DETAILS);
- Set3State(hDlg, IDC_DB_SERVICE);
- } else {
- SetCheck(hDlg, IDC_DB_SERVICE, FALSE);
- SetWndText(hDlg, IDC_DB_STATUS_MSG, IDS_DB_STOPPED);
- SetWndText(hDlg, IDC_DB_ACTION_MSG, IDS_DB_HOW_TO_RUN);
- }
+ Set2State(hDlg, IDC_DB_SERVICE);
+
+ bDbRunning = Configured(g_CfgData.configDB);
+ if (bDbRunning) {
+ SetCheck(hDlg, IDC_DB_SERVICE);
+ SetWndText(hDlg, IDC_DB_STATUS_MSG, IDS_DB_RUNNING);
+ SetWndText(hDlg, IDC_DB_ACTION_MSG, IDS_DB_HOW_TO_STOP);
+ } else if (bDbParial) {
+ SetCheck(hDlg, IDC_DB_SERVICE, BST_INDETERMINATE);
+ SetWndText(hDlg, IDC_DB_STATUS_MSG, IDS_DB_PARTIAL_CONFIG);
+ SetWndText(hDlg, IDC_DB_ACTION_MSG, IDS_DB_DETAILS);
+ ShowWnd(hDlg, IDC_DB_DETAILS);
+ Set3State(hDlg, IDC_DB_SERVICE);
+ } else {
+ SetCheck(hDlg, IDC_DB_SERVICE, FALSE);
+ SetWndText(hDlg, IDC_DB_STATUS_MSG, IDS_DB_STOPPED);
+ SetWndText(hDlg, IDC_DB_ACTION_MSG, IDS_DB_HOW_TO_RUN);
+ }
- bDbOn = bDbRunning;
+ bDbOn = bDbRunning;
+
+ // BK
+ bBakRunning = Configured(g_CfgData.configBak);
+ SetEnable(hDlg, IDC_BK_SERVICE, ES_ENABLE);
+ if (bBakRunning) {
+ SetCheck(hDlg, IDC_BK_SERVICE);
+ SetWndText(hDlg, IDC_BK_STATUS_MSG, IDS_BK_RUNNING);
+ SetWndText(hDlg, IDC_BK_ACTION_MSG, IDS_BK_HOW_TO_STOP);
+ } else {
+ SetCheck(hDlg, IDC_BK_SERVICE, FALSE);
+ SetWndText(hDlg, IDC_BK_STATUS_MSG, IDS_BK_STOPPED);
+ SetWndText(hDlg, IDC_BK_ACTION_MSG, IDS_BK_HOW_TO_RUN);
+ }
- // BK
- bBakRunning = Configured(g_CfgData.configBak);
- SetEnable(hDlg, IDC_BK_SERVICE, ES_ENABLE);
- if (bBakRunning) {
- SetCheck(hDlg, IDC_BK_SERVICE);
+ bBakOn = bBakRunning;
+
+ // SC Server
+ bScsRunning = Configured(g_CfgData.configSCS);
+ SetEnable(hDlg, IDC_SCS, ES_ENABLE);
+ if (bScsRunning) {
+ SetCheck(hDlg, IDC_SCS);
+ SetWndText(hDlg, IDC_SCS_ACTION_MSG, IDS_SCS_HOW_TO_STOP);
+ } else {
+ SetCheck(hDlg, IDC_SCS, FALSE);
+ SetWndText(hDlg, IDC_SCS_STATUS_MSG, IDS_SCS_STOPPED);
+ SetWndText(hDlg, IDC_SCS_ACTION_MSG, IDS_SCS_HOW_TO_RUN);
+ }
+
+ bScsOn = bScsRunning;
+
+ // SC Client
+ bSccRunning = Configured(g_CfgData.configSCC);
+ SetEnable(hDlg, IDC_SCC, ES_ENABLE);
+ if (bSccRunning) {
+ SetCheck(hDlg, IDC_SCC);
+ SetWndText(hDlg, IDC_SCC_ACTION_MSG, IDS_SCC_HOW_TO_STOP);
+ EnableScMachine();
+ lstrcpy(szScMachine, g_CfgData.szSysControlMachine);
+ } else {
+ SetCheck(hDlg, IDC_SCC, FALSE);
+ SetWndText(hDlg, IDC_SCC_STATUS_MSG, IDS_SCC_STOPPED);
+ SetWndText(hDlg, IDC_SCC_ACTION_MSG, IDS_SCC_HOW_TO_RUN);
+ EnableScMachine(FALSE);
+ }
+
+ bSccOn = bSccRunning;
+}
+
+static void ShowServiceStates()
+{
+ // FS
+ if (bFsOn) {
+ if (bFsRunning)
+ SetWndText(hDlg, IDC_FS_ACTION_MSG, IDS_FS_HOW_TO_STOP);
+ else
+ SetWndText(hDlg, IDC_FS_ACTION_MSG, IDS_FS_WILL_RUN);
+ } else {
+ if (bFsRunning)
+ SetWndText(hDlg, IDC_FS_ACTION_MSG, IDS_FS_WILL_STOP);
+ else
+ SetWndText(hDlg, IDC_FS_ACTION_MSG, IDS_FS_HOW_TO_RUN);
+ }
+
+ // DB
+ switch (GetButtonState(hDlg, IDC_DB_SERVICE)) {
+ case BST_CHECKED:
+ if (bDbRunning)
+ SetWndText(hDlg, IDC_DB_ACTION_MSG, IDS_DB_HOW_TO_STOP);
+ else
+ SetWndText(hDlg, IDC_DB_ACTION_MSG, IDS_DB_WILL_RUN);
+ break;
+
+ case BST_UNCHECKED:
+ if (bDbRunning)
+ SetWndText(hDlg, IDC_DB_ACTION_MSG, IDS_DB_WILL_STOP);
+ else
+ SetWndText(hDlg, IDC_DB_ACTION_MSG, IDS_DB_HOW_TO_RUN);
+ break;
+
+ case BST_INDETERMINATE:
+ SetWndText(hDlg, IDC_DB_ACTION_MSG, IDS_DB_DETAILS);
+ break;
+ }
+
+ // For the ones below, in addition to setting the action message, we also
+ // set the status message. This is because the status can change to the
+ // disabled state depending on how other servers are configured. The
+ // servers before this cannot have their status change except by re-
+ // configuring them.
+
+ // BK
+ if (bDbOn) {
+ if (IsButtonChecked(hDlg, IDC_BK_SERVICE)) {
+ if (bBakRunning) {
SetWndText(hDlg, IDC_BK_STATUS_MSG, IDS_BK_RUNNING);
SetWndText(hDlg, IDC_BK_ACTION_MSG, IDS_BK_HOW_TO_STOP);
+ } else {
+ SetWndText(hDlg, IDC_BK_STATUS_MSG, IDS_BK_STOPPED);
+ SetWndText(hDlg, IDC_BK_ACTION_MSG, IDS_BK_WILL_RUN);
+ }
} else {
- SetCheck(hDlg, IDC_BK_SERVICE, FALSE);
+ if (bBakRunning) {
+ SetWndText(hDlg, IDC_BK_STATUS_MSG, IDS_BK_RUNNING);
+ SetWndText(hDlg, IDC_BK_ACTION_MSG, IDS_BK_WILL_STOP);
+ } else {
SetWndText(hDlg, IDC_BK_STATUS_MSG, IDS_BK_STOPPED);
SetWndText(hDlg, IDC_BK_ACTION_MSG, IDS_BK_HOW_TO_RUN);
+ }
}
+ }
- bBakOn = bBakRunning;
+ CheckEnableBak();
- // SC Server
- bScsRunning = Configured(g_CfgData.configSCS);
- SetEnable(hDlg, IDC_SCS, ES_ENABLE);
- if (bScsRunning) {
- SetCheck(hDlg, IDC_SCS);
+ // SC Server
+ if (bFsOn || bDbOn && !bSccOn) {
+ if (bScsOn) {
+ if (bScsRunning) {
+ SetWndText(hDlg, IDC_SCS_STATUS_MSG, IDS_SCS_RUNNING);
SetWndText(hDlg, IDC_SCS_ACTION_MSG, IDS_SCS_HOW_TO_STOP);
+ } else {
+ SetWndText(hDlg, IDC_SCS_STATUS_MSG, IDS_SCS_STOPPED);
+ SetWndText(hDlg, IDC_SCS_ACTION_MSG, IDS_SCS_WILL_RUN);
+ }
} else {
- SetCheck(hDlg, IDC_SCS, FALSE);
+ if (bScsRunning) {
+ SetWndText(hDlg, IDC_SCS_STATUS_MSG, IDS_SCS_RUNNING);
+ SetWndText(hDlg, IDC_SCS_ACTION_MSG, IDS_SCS_WILL_STOP);
+ } else {
SetWndText(hDlg, IDC_SCS_STATUS_MSG, IDS_SCS_STOPPED);
SetWndText(hDlg, IDC_SCS_ACTION_MSG, IDS_SCS_HOW_TO_RUN);
+ }
}
+ }
- bScsOn = bScsRunning;
-
- // SC Client
- bSccRunning = Configured(g_CfgData.configSCC);
- SetEnable(hDlg, IDC_SCC, ES_ENABLE);
- if (bSccRunning) {
- SetCheck(hDlg, IDC_SCC);
+ // SC Client
+ if (bFsOn || bDbOn && !bScsOn) {
+ if (bSccOn) {
+ if (bSccRunning) {
+ SetWndText(hDlg, IDC_SCC_STATUS_MSG, IDS_SCC_RUNNING);
SetWndText(hDlg, IDC_SCC_ACTION_MSG, IDS_SCC_HOW_TO_STOP);
- EnableScMachine();
- lstrcpy(szScMachine, g_CfgData.szSysControlMachine);
+ } else {
+ SetWndText(hDlg, IDC_SCC_STATUS_MSG, IDS_SCC_STOPPED);
+ SetWndText(hDlg, IDC_SCC_ACTION_MSG, IDS_SCC_WILL_RUN);
+ }
} else {
- SetCheck(hDlg, IDC_SCC, FALSE);
+ if (bSccRunning) {
+ SetWndText(hDlg, IDC_SCC_STATUS_MSG, IDS_SCC_RUNNING);
+ SetWndText(hDlg, IDC_SCC_ACTION_MSG, IDS_SCC_WILL_STOP);
+ } else {
SetWndText(hDlg, IDC_SCC_STATUS_MSG, IDS_SCC_STOPPED);
SetWndText(hDlg, IDC_SCC_ACTION_MSG, IDS_SCC_HOW_TO_RUN);
- EnableScMachine(FALSE);
- }
-
- bSccOn = bSccRunning;
-}
-
-static void ShowServiceStates()
-{
- // FS
- if (bFsOn) {
- if (bFsRunning)
- SetWndText(hDlg, IDC_FS_ACTION_MSG, IDS_FS_HOW_TO_STOP);
- else
- SetWndText(hDlg, IDC_FS_ACTION_MSG, IDS_FS_WILL_RUN);
- } else {
- if (bFsRunning)
- SetWndText(hDlg, IDC_FS_ACTION_MSG, IDS_FS_WILL_STOP);
- else
- SetWndText(hDlg, IDC_FS_ACTION_MSG, IDS_FS_HOW_TO_RUN);
- }
-
- // DB
- switch (GetButtonState(hDlg, IDC_DB_SERVICE)) {
- case BST_CHECKED:
- if (bDbRunning)
- SetWndText(hDlg, IDC_DB_ACTION_MSG, IDS_DB_HOW_TO_STOP);
- else
- SetWndText(hDlg, IDC_DB_ACTION_MSG, IDS_DB_WILL_RUN);
- break;
-
- case BST_UNCHECKED:
- if (bDbRunning)
- SetWndText(hDlg, IDC_DB_ACTION_MSG, IDS_DB_WILL_STOP);
- else
- SetWndText(hDlg, IDC_DB_ACTION_MSG, IDS_DB_HOW_TO_RUN);
- break;
-
- case BST_INDETERMINATE:
- SetWndText(hDlg, IDC_DB_ACTION_MSG, IDS_DB_DETAILS);
- break;
- }
-
- // For the ones below, in addition to setting the action message, we also
- // set the status message. This is because the status can change to the
- // disabled state depending on how other servers are configured. The
- // servers before this cannot have their status change except by re-
- // configuring them.
-
- // BK
- if (bDbOn) {
- if (IsButtonChecked(hDlg, IDC_BK_SERVICE)) {
- if (bBakRunning) {
- SetWndText(hDlg, IDC_BK_STATUS_MSG, IDS_BK_RUNNING);
- SetWndText(hDlg, IDC_BK_ACTION_MSG, IDS_BK_HOW_TO_STOP);
- } else {
- SetWndText(hDlg, IDC_BK_STATUS_MSG, IDS_BK_STOPPED);
- SetWndText(hDlg, IDC_BK_ACTION_MSG, IDS_BK_WILL_RUN);
- }
- } else {
- if (bBakRunning) {
- SetWndText(hDlg, IDC_BK_STATUS_MSG, IDS_BK_RUNNING);
- SetWndText(hDlg, IDC_BK_ACTION_MSG, IDS_BK_WILL_STOP);
- } else {
- SetWndText(hDlg, IDC_BK_STATUS_MSG, IDS_BK_STOPPED);
- SetWndText(hDlg, IDC_BK_ACTION_MSG, IDS_BK_HOW_TO_RUN);
- }
- }
- }
-
- CheckEnableBak();
-
- // SC Server
- if (bFsOn || bDbOn && !bSccOn) {
- if (bScsOn) {
- if (bScsRunning) {
- SetWndText(hDlg, IDC_SCS_STATUS_MSG, IDS_SCS_RUNNING);
- SetWndText(hDlg, IDC_SCS_ACTION_MSG, IDS_SCS_HOW_TO_STOP);
- } else {
- SetWndText(hDlg, IDC_SCS_STATUS_MSG, IDS_SCS_STOPPED);
- SetWndText(hDlg, IDC_SCS_ACTION_MSG, IDS_SCS_WILL_RUN);
- }
- } else {
- if (bScsRunning) {
- SetWndText(hDlg, IDC_SCS_STATUS_MSG, IDS_SCS_RUNNING);
- SetWndText(hDlg, IDC_SCS_ACTION_MSG, IDS_SCS_WILL_STOP);
- } else {
- SetWndText(hDlg, IDC_SCS_STATUS_MSG, IDS_SCS_STOPPED);
- SetWndText(hDlg, IDC_SCS_ACTION_MSG, IDS_SCS_HOW_TO_RUN);
- }
- }
- }
-
- // SC Client
- if (bFsOn || bDbOn && !bScsOn) {
- if (bSccOn) {
- if (bSccRunning) {
- SetWndText(hDlg, IDC_SCC_STATUS_MSG, IDS_SCC_RUNNING);
- SetWndText(hDlg, IDC_SCC_ACTION_MSG, IDS_SCC_HOW_TO_STOP);
- } else {
- SetWndText(hDlg, IDC_SCC_STATUS_MSG, IDS_SCC_STOPPED);
- SetWndText(hDlg, IDC_SCC_ACTION_MSG, IDS_SCC_WILL_RUN);
- }
- } else {
- if (bSccRunning) {
- SetWndText(hDlg, IDC_SCC_STATUS_MSG, IDS_SCC_RUNNING);
- SetWndText(hDlg, IDC_SCC_ACTION_MSG, IDS_SCC_WILL_STOP);
- } else {
- SetWndText(hDlg, IDC_SCC_STATUS_MSG, IDS_SCC_STOPPED);
- SetWndText(hDlg, IDC_SCC_ACTION_MSG, IDS_SCC_HOW_TO_RUN);
- }
- }
-
-
+ }
}
+ }
- CheckEnableSc();
+ CheckEnableSc();
}
static void OnDbService()
{
- bDbOn = GetButtonState(hDlg, IDC_DB_SERVICE) == BST_CHECKED;
+ bDbOn = GetButtonState(hDlg, IDC_DB_SERVICE) == BST_CHECKED;
- CheckEnableBak();
- CheckEnableSc();
+ CheckEnableBak();
+ CheckEnableSc();
- ShowServiceStates();
-}
+ ShowServiceStates();
+}
static void OnBakService()
{
- bBakOn = !bBakOn;
+ bBakOn = !bBakOn;
- ShowServiceStates();
-}
+ ShowServiceStates();
+}
static void OnFsService()
{
- bFsOn = !bFsOn;
+ bFsOn = !bFsOn;
- CheckEnableSc();
+ CheckEnableSc();
- ShowServiceStates();
-}
+ ShowServiceStates();
+}
static void CheckEnableBak()
{
- // Enable/disable bk service based on db service.
- if (!bDbOn) {
- SetCheck(hDlg, IDC_BK_SERVICE, FALSE);
- SetEnable(hDlg, IDC_BK_SERVICE, ES_DISABLE);
- SetWndText(hDlg, IDC_BK_STATUS_MSG, IDS_BK_DISABLED);
- SetWndText(hDlg, IDC_BK_ACTION_MSG, IDS_BK_ENABLE);
- } else {
- SetCheck(hDlg, IDC_BK_SERVICE, bBakOn);
- SetEnable(hDlg, IDC_BK_SERVICE, ES_ENABLE);
- }
+ // Enable/disable bk service based on db service.
+ if (!bDbOn) {
+ SetCheck(hDlg, IDC_BK_SERVICE, FALSE);
+ SetEnable(hDlg, IDC_BK_SERVICE, ES_DISABLE);
+ SetWndText(hDlg, IDC_BK_STATUS_MSG, IDS_BK_DISABLED);
+ SetWndText(hDlg, IDC_BK_ACTION_MSG, IDS_BK_ENABLE);
+ } else {
+ SetCheck(hDlg, IDC_BK_SERVICE, bBakOn);
+ SetEnable(hDlg, IDC_BK_SERVICE, ES_ENABLE);
+ }
}
static void CheckEnableSc()
{
- BOOL bSccEnable = TRUE;
- UINT uiSccStatusMsg;
- UINT uiSccActionMsg;
- BOOL bScsEnable = TRUE;
- UINT uiScsStatusMsg;
- UINT uiScsActionMsg;
-
- // Disable SCS and SCC?
- if (!bFsOn && !bDbOn) {
- bScsEnable = FALSE;
- uiScsStatusMsg = IDS_SC_DISABLED;
- uiScsActionMsg = IDS_SC_ENABLE;
-
- bSccEnable = FALSE;
- uiSccStatusMsg = IDS_SC_DISABLED;
- uiSccActionMsg = IDS_SC_ENABLE;
- // Disable SCS?
- } else if (bSccOn) {
- bScsEnable = FALSE;
- uiScsStatusMsg = IDS_SC_DISABLED;
- uiScsActionMsg = IDS_SCS_ENABLE;
- // Disable SCC
- } else if (bScsOn) {
- bSccEnable = FALSE;
- uiSccStatusMsg = IDS_SC_DISABLED;
- uiSccActionMsg = IDS_SCC_ENABLE;
- }
-
- // Enable the sc server GUI
- if (bScsEnable) {
- SetEnable(hDlg, IDC_SCS, ES_ENABLE);
- SetCheck(hDlg, IDC_SCS, bScsOn);
- } else { // Disable the sc server gui
- SetEnable(hDlg, IDC_SCS, ES_DISABLE);
- SetCheck(hDlg, IDC_SCS, FALSE);
- SetWndText(hDlg, IDC_SCS_STATUS_MSG, uiScsStatusMsg);
- SetWndText(hDlg, IDC_SCS_ACTION_MSG, uiScsActionMsg);
- }
+ BOOL bSccEnable = TRUE;
+ UINT uiSccStatusMsg;
+ UINT uiSccActionMsg;
+ BOOL bScsEnable = TRUE;
+ UINT uiScsStatusMsg;
+ UINT uiScsActionMsg;
+
+ // Disable SCS and SCC?
+ if (!bFsOn && !bDbOn) {
+ bScsEnable = FALSE;
+ uiScsStatusMsg = IDS_SC_DISABLED;
+ uiScsActionMsg = IDS_SC_ENABLE;
+
+ bSccEnable = FALSE;
+ uiSccStatusMsg = IDS_SC_DISABLED;
+ uiSccActionMsg = IDS_SC_ENABLE;
+ // Disable SCS?
+ } else if (bSccOn) {
+ bScsEnable = FALSE;
+ uiScsStatusMsg = IDS_SC_DISABLED;
+ uiScsActionMsg = IDS_SCS_ENABLE;
+ // Disable SCC
+ } else if (bScsOn) {
+ bSccEnable = FALSE;
+ uiSccStatusMsg = IDS_SC_DISABLED;
+ uiSccActionMsg = IDS_SCC_ENABLE;
+ }
+
+ // Enable the sc server GUI
+ if (bScsEnable) {
+ SetEnable(hDlg, IDC_SCS, ES_ENABLE);
+ SetCheck(hDlg, IDC_SCS, bScsOn);
+ } else { // Disable the sc server gui
+ SetEnable(hDlg, IDC_SCS, ES_DISABLE);
+ SetCheck(hDlg, IDC_SCS, FALSE);
+ SetWndText(hDlg, IDC_SCS_STATUS_MSG, uiScsStatusMsg);
+ SetWndText(hDlg, IDC_SCS_ACTION_MSG, uiScsActionMsg);
+ }
- // Enable the sc client GUI
- if (bSccEnable) {
- SetEnable(hDlg, IDC_SCC, ES_ENABLE);
- SetCheck(hDlg, IDC_SCC, bSccOn);
- EnableScMachine(bSccOn);
- } else { // Disable the sc client gui
- SetEnable(hDlg, IDC_SCC, ES_DISABLE);
- SetCheck(hDlg, IDC_SCC, FALSE);
- SetWndText(hDlg, IDC_SCC_STATUS_MSG, uiSccStatusMsg);
- SetWndText(hDlg, IDC_SCC_ACTION_MSG, uiSccActionMsg);
- EnableScMachine(FALSE);
- }
-}
+ // Enable the sc client GUI
+ if (bSccEnable) {
+ SetEnable(hDlg, IDC_SCC, ES_ENABLE);
+ SetCheck(hDlg, IDC_SCC, bSccOn);
+ EnableScMachine(bSccOn);
+ } else { // Disable the sc client gui
+ SetEnable(hDlg, IDC_SCC, ES_DISABLE);
+ SetCheck(hDlg, IDC_SCC, FALSE);
+ SetWndText(hDlg, IDC_SCC_STATUS_MSG, uiSccStatusMsg);
+ SetWndText(hDlg, IDC_SCC_ACTION_MSG, uiSccActionMsg);
+ EnableScMachine(FALSE);
+ }
+}
static void OnScServer()
{
- bScsOn = !bScsOn;
+ bScsOn = !bScsOn;
- ShowServiceStates();
+ ShowServiceStates();
}
static void OnScClient()
-{
- bSccOn = !bSccOn;
+{
+ bSccOn = !bSccOn;
- ShowServiceStates();
+ ShowServiceStates();
}
static void OnScMachineChange()
-{
- if (!bSettingScMachine && IsButtonChecked(hDlg, IDC_SCC))
- GetWndText(hDlg, IDC_SC_MACHINE, szScMachine, sizeof(szScMachine) / sizeof(szScMachine[0]));
+{
+ if (!bSettingScMachine && IsButtonChecked(hDlg, IDC_SCC))
+ GetWndText(hDlg, IDC_SC_MACHINE, szScMachine, sizeof(szScMachine) / sizeof(szScMachine[0]));
}
static BOOL PrepareToConfig(CONFIG_STATE& state, BOOL bRunning, BOOL bOn, UINT uiCtrlID)
{
- BOOL bEnabled = IsWindowEnabled(GetDlgItem(hDlg, uiCtrlID));
+ BOOL bEnabled = IsWindowEnabled(GetDlgItem(hDlg, uiCtrlID));
- if (bRunning && (!bOn || !bEnabled))
- state = CS_UNCONFIGURE;
- else if (!bRunning && (bOn && bEnabled))
- state = CS_CONFIGURE;
+ if (bRunning && (!bOn || !bEnabled))
+ state = CS_UNCONFIGURE;
+ else if (!bRunning && (bOn && bEnabled))
+ state = CS_CONFIGURE;
return (state == CS_UNCONFIGURE) || (state == CS_CONFIGURE);
}
// or unconfigured. We do this so that if the user cancels for some reason,
// the real config state will still be what the user expects (what was
// previously read from the system plus the user's changes).
- CONFIG_STATE configFS = g_CfgData.configFS; // File server
- CONFIG_STATE configDB = g_CfgData.configDB; // Database server
- CONFIG_STATE configBak = g_CfgData.configBak; // Backup server
- CONFIG_STATE configSCS = g_CfgData.configSCS; // System Control server
- CONFIG_STATE configSCC = g_CfgData.configSCC; // System Control client
+ CONFIG_STATE configFS = g_CfgData.configFS; // File server
+ CONFIG_STATE configDB = g_CfgData.configDB; // Database server
+ CONFIG_STATE configBak = g_CfgData.configBak; // Backup server
+ CONFIG_STATE configSCS = g_CfgData.configSCS; // System Control server
+ CONFIG_STATE configSCC = g_CfgData.configSCC; // System Control client
BOOL bWorkToDo = FALSE;
- bWorkToDo |= PrepareToConfig(configFS, bFsRunning, bFsOn, IDC_FS_SERVICE);
- bWorkToDo |= PrepareToConfig(configDB, bDbRunning, bDbOn, IDC_DB_SERVICE);
+ bWorkToDo |= PrepareToConfig(configFS, bFsRunning, bFsOn, IDC_FS_SERVICE);
+ bWorkToDo |= PrepareToConfig(configDB, bDbRunning, bDbOn, IDC_DB_SERVICE);
bWorkToDo |= PrepareToConfig(configBak, bBakRunning, bBakOn, IDC_BK_SERVICE);
- bWorkToDo |= PrepareToConfig(configSCS, bScsRunning, bScsOn, IDC_SCS);
- bWorkToDo |= PrepareToConfig(configSCC, bSccRunning, bSccOn, IDC_SCC);
+ bWorkToDo |= PrepareToConfig(configSCS, bScsRunning, bScsOn, IDC_SCS);
+ bWorkToDo |= PrepareToConfig(configSCC, bSccRunning, bSccOn, IDC_SCC);
// If there is nothing to do, then just return TRUE.
if (!bWorkToDo)
return TRUE;
- // If we are unconfiguring the last DB server:
- // 1) Warn user and ask for confirmation
- // 2) Unconfigure all other servers that are running on this machine
- // 3) Tell them (after unconfiguring) that they must run the Wizard if they
- // wish to reconfigure the machine, then exit the program.
- if (configDB == CS_UNCONFIGURE) {
- if (g_CfgData.bLastDBServer) {
- int nChoice = MsgBox(hDlg, IDS_LAST_DB_SERVER, GetAppTitleID(), MB_YESNO | MB_ICONEXCLAMATION);
- if (nChoice == IDNO)
- return FALSE;
-
- // Make sure these all get unconfigured as well. If they are not configured, then
- // nothing bad will happen because the config calls are idempotent.
- configFS = CS_UNCONFIGURE;
- configBak = CS_UNCONFIGURE;
- configSCS = CS_UNCONFIGURE;
- configSCC = CS_UNCONFIGURE;
- }
+ // If we are unconfiguring the last DB server:
+ // 1) Warn user and ask for confirmation
+ // 2) Unconfigure all other servers that are running on this machine
+ // 3) Tell them (after unconfiguring) that they must run the Wizard if they
+ // wish to reconfigure the machine, then exit the program.
+ if (configDB == CS_UNCONFIGURE) {
+ if (g_CfgData.bLastDBServer) {
+ int nChoice = MsgBox(hDlg, IDS_LAST_DB_SERVER, GetAppTitleID(), MB_YESNO | MB_ICONEXCLAMATION);
+ if (nChoice == IDNO)
+ return FALSE;
+
+ // Make sure these all get unconfigured as well. If they are not configured, then
+ // nothing bad will happen because the config calls are idempotent.
+ configFS = CS_UNCONFIGURE;
+ configBak = CS_UNCONFIGURE;
+ configSCS = CS_UNCONFIGURE;
+ configSCC = CS_UNCONFIGURE;
}
+ }
- // Get additional needed information from the user
- GET_ADMIN_INFO_OPTIONS eOptions;
- BOOL bDB = (ShouldConfig(configDB) || ShouldUnconfig(configDB));
-
- // Use this as our default
- eOptions = GAIO_LOGIN_ONLY;
-
- // If we already have a sys control machine, then we don't need to ask for it
- if (ShouldConfig(configSCC)) {
- if (szScMachine[0] == 0) {
- ShowWarning(hDlg, IDS_MUST_ENTER_SCS_NAME);
- return FALSE;
- }
- lstrcpy(g_CfgData.szSysControlMachine, szScMachine);
- } else if (bDB && !g_CfgData.bLastDBServer) {
+ // Get additional needed information from the user
+ GET_ADMIN_INFO_OPTIONS eOptions;
+ BOOL bDB = (ShouldConfig(configDB) || ShouldUnconfig(configDB));
+
+ // Use this as our default
+ eOptions = GAIO_LOGIN_ONLY;
+
+ // If we already have a sys control machine, then we don't need to ask for it
+ if (ShouldConfig(configSCC)) {
+ if (szScMachine[0] == 0) {
+ ShowWarning(hDlg, IDS_MUST_ENTER_SCS_NAME);
+ return FALSE;
+ }
+ lstrcpy(g_CfgData.szSysControlMachine, szScMachine);
+ } else if (bDB && !g_CfgData.bLastDBServer) {
// We need to know the name of the SCM machine. Are we the SCM machine?
if (bScsRunning)
lstrcpy(g_CfgData.szSysControlMachine, g_CfgData.szHostname);
- else
- eOptions = GAIO_GET_SCS;
- }
+ else
+ eOptions = GAIO_GET_SCS;
+ }
// If doing a login only and the admin info is reusable
if ((eOptions != GAIO_LOGIN_ONLY) || !g_CfgData.bReuseAdminInfo) {
if (!GetAdminInfo(hDlg, eOptions))
- return FALSE;
+ return FALSE;
// Use the admin info to get new handles
if (!GetHandles(hDlg))
return FALSE;
- }
+ }
// Now that we are ready to configure, copy our local config info
// into the structure that the config engine uses.
- g_CfgData.configFS = configFS;
+ g_CfgData.configFS = configFS;
g_CfgData.configDB = configDB;
- g_CfgData.configBak = configBak;
- g_CfgData.configSCS = configSCS;
- g_CfgData.configSCC = configSCC;
+ g_CfgData.configBak = configBak;
+ g_CfgData.configSCS = configSCS;
+ g_CfgData.configSCC = configSCC;
- // Configure the server
- BOOL bConfigSucceeded = Configure(hDlg, bMustExit);
+ // Configure the server
+ BOOL bConfigSucceeded = Configure(hDlg, bMustExit);
if (bConfigSucceeded) {
if (bMustExit) {
- PostQuitMessage(0);
- return TRUE;
- }
+ PostQuitMessage(0);
+ return TRUE;
+ }
g_CfgData.bReuseAdminInfo = TRUE;
} else
g_CfgData.szAdminPW[0] = 0;
- // Get current config status
- BOOL bCanceled = FALSE;
- DWORD dwStatus = GetCurrentConfig(hDlg, bCanceled);
- if (dwStatus || bCanceled) {
- if (!bCanceled)
- ErrorDialog(dwStatus, IDS_CONFIG_CHECK_FAILED);
- }
+ // Get current config status
+ BOOL bCanceled = FALSE;
+ DWORD dwStatus = GetCurrentConfig(hDlg, bCanceled);
+ if (dwStatus || bCanceled) {
+ if (!bCanceled)
+ ErrorDialog(dwStatus, IDS_CONFIG_CHECK_FAILED);
+ }
- // Show the initial services config
- ShowInitialConfig();
- ShowServiceStates();
+ // Show the initial services config
+ ShowInitialConfig();
+ ShowServiceStates();
- return TRUE;
+ return TRUE;
}
static void CheckEnableApply()
{
- BOOL bEnable = FALSE;
+ BOOL bEnable = FALSE;
- bEnable = (bFsRunning != bFsOn) || (bDbRunning != bDbOn) || (bBakRunning != bBakOn) ||
- (bScsRunning != bScsOn) || (bSccRunning != bSccOn);
+ bEnable = (bFsRunning != bFsOn) || (bDbRunning != bDbOn) || (bBakRunning != bBakOn) ||
+ (bScsRunning != bScsOn) || (bSccRunning != bSccOn);
- if (bEnable)
- PropSheet_Changed(GetParent(hDlg), hDlg);
- else
- PropSheet_UnChanged(GetParent(hDlg), hDlg);
-}
+ if (bEnable)
+ PropSheet_Changed(GetParent(hDlg), hDlg);
+ else
+ PropSheet_UnChanged(GetParent(hDlg), hDlg);
+}
*/
BOOL CALLBACK SysControlPageDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp)
{
- if (WizStep_Common_DlgProc (hwndDlg, msg, wp, lp))
- return FALSE;
-
- switch (msg) {
- case WM_INITDIALOG:
- OnInitDialog(hwndDlg);
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wp)) {
- case IDNEXT:
- g_pWiz->SetState(sidSTEP_TWELVE);
- break;
-
- case IDBACK:
- g_pWiz->SetState(sidSTEP_TEN);
- break;
-
- case IDC_SYS_CONTROL_SERVER:
- g_CfgData.configSCS = CS_CONFIGURE;
- g_CfgData.configSCC = CS_DONT_CONFIGURE;
- EnableSysControlMachine(FALSE);
- break;
-
- case IDC_SYS_CONTROL_CLIENT:
- g_CfgData.configSCS = CS_DONT_CONFIGURE;
- g_CfgData.configSCC = CS_CONFIGURE;
- EnableSysControlMachine(TRUE);
- SetFocus(GetDlgItem(hDlg, IDC_SYS_CONTROL_MACHINE));
- break;
-
- case IDC_DONT_CONFIGURE:
- g_CfgData.configSCS = CS_DONT_CONFIGURE;
- g_CfgData.configSCC = CS_DONT_CONFIGURE;
- EnableSysControlMachine(FALSE);
- break;
-
- case IDC_SYS_CONTROL_MACHINE:
- if (HIWORD(wp) == EN_CHANGE)
- CheckEnableNextButton();
- break;
- }
- break;
+ if (WizStep_Common_DlgProc (hwndDlg, msg, wp, lp))
+ return FALSE;
+ switch (msg) {
+ case WM_INITDIALOG:
+ OnInitDialog(hwndDlg);
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wp)) {
+ case IDNEXT:
+ g_pWiz->SetState(sidSTEP_TWELVE);
+ break;
+
+ case IDBACK:
+ g_pWiz->SetState(sidSTEP_TEN);
+ break;
+
+ case IDC_SYS_CONTROL_SERVER:
+ g_CfgData.configSCS = CS_CONFIGURE;
+ g_CfgData.configSCC = CS_DONT_CONFIGURE;
+ EnableSysControlMachine(FALSE);
+ break;
+
+ case IDC_SYS_CONTROL_CLIENT:
+ g_CfgData.configSCS = CS_DONT_CONFIGURE;
+ g_CfgData.configSCC = CS_CONFIGURE;
+ EnableSysControlMachine(TRUE);
+ SetFocus(GetDlgItem(hDlg, IDC_SYS_CONTROL_MACHINE));
+ break;
+
+ case IDC_DONT_CONFIGURE:
+ g_CfgData.configSCS = CS_DONT_CONFIGURE;
+ g_CfgData.configSCC = CS_DONT_CONFIGURE;
+ EnableSysControlMachine(FALSE);
+ break;
+
+ case IDC_SYS_CONTROL_MACHINE:
+ if (HIWORD(wp) == EN_CHANGE)
+ CheckEnableNextButton();
+ break;
}
+ break;
+ }
- return FALSE;
+ return FALSE;
}
/*
*/
static void OnInitDialog(HWND hwndDlg)
{
- hDlg = hwndDlg;
-
- g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
- g_pWiz->SetButtonText(IDNEXT, IDS_NEXT);
- g_pWiz->SetDefaultControl(IDNEXT);
-
- if (g_CfgData.configSCS == CS_ALREADY_CONFIGURED) {
- CantConfig(IDS_ALREADY_A_SYS_CONTROL_SERVER);
- return;
- } else if (g_CfgData.configSCC == CS_ALREADY_CONFIGURED) {
- CantConfig(IDS_ALREADY_A_SYS_CONTROL_CLIENT);
- return;
- }
-
- // Should this step be disabled? Yes, if this machine
- // is not configured as a database or file server.
- if (!ConfiguredOrConfiguring(g_CfgData.configFS) && !ConfiguredOrConfiguring(g_CfgData.configDB)) {
- CantConfig(IDS_SC_NOT_A_DB_OR_FS_SERVER);
- EnableStep(g_CfgData.configSCS, FALSE);
- EnableStep(g_CfgData.configSCC, FALSE);
- return;
- }
+ hDlg = hwndDlg;
+
+ g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
+ g_pWiz->SetButtonText(IDNEXT, IDS_NEXT);
+ g_pWiz->SetDefaultControl(IDNEXT);
+
+ if (g_CfgData.configSCS == CS_ALREADY_CONFIGURED) {
+ CantConfig(IDS_ALREADY_A_SYS_CONTROL_SERVER);
+ return;
+ } else if (g_CfgData.configSCC == CS_ALREADY_CONFIGURED) {
+ CantConfig(IDS_ALREADY_A_SYS_CONTROL_CLIENT);
+ return;
+ }
+
+ // Should this step be disabled? Yes, if this machine
+ // is not configured as a database or file server.
+ if (!ConfiguredOrConfiguring(g_CfgData.configFS) && !ConfiguredOrConfiguring(g_CfgData.configDB)) {
+ CantConfig(IDS_SC_NOT_A_DB_OR_FS_SERVER);
+ EnableStep(g_CfgData.configSCS, FALSE);
+ EnableStep(g_CfgData.configSCC, FALSE);
+ return;
+ }
+
+ // Do this in case they were disabled on the last run through
+ EnableStep(g_CfgData.configSCS);
+ EnableStep(g_CfgData.configSCC);
+
+ // If this is the first server, then it can't be a SCC
+ if (g_CfgData.bFirstServer) {
+ // Disable the SCC step
+ EnableStep(g_CfgData.configSCC, FALSE);
+
+ // Hide the SCC controls
+ ShowWnd(hDlg, IDC_SYS_CONTROL_CLIENT_DESC, FALSE);
+ ShowWnd(hDlg, IDC_SYS_CONTROL_CLIENT, FALSE);
+ ShowWnd(hDlg, IDC_SYS_CONTROL_MACHINE_LABEL, FALSE);
+ ShowWnd(hDlg, IDC_SYS_CONTROL_MACHINE, FALSE);
- // Do this in case they were disabled on the last run through
- EnableStep(g_CfgData.configSCS);
- EnableStep(g_CfgData.configSCC);
-
- // If this is the first server, then it can't be a SCC
- if (g_CfgData.bFirstServer) {
- // Disable the SCC step
- EnableStep(g_CfgData.configSCC, FALSE);
-
- // Hide the SCC controls
- ShowWnd(hDlg, IDC_SYS_CONTROL_CLIENT_DESC, FALSE);
- ShowWnd(hDlg, IDC_SYS_CONTROL_CLIENT, FALSE);
- ShowWnd(hDlg, IDC_SYS_CONTROL_MACHINE_LABEL, FALSE);
- ShowWnd(hDlg, IDC_SYS_CONTROL_MACHINE, FALSE);
-
- // Move remaining controls to fill the holes left from
- // hiding the SCC controls
+ // Move remaining controls to fill the holes left from
+ // hiding the SCC controls
// Get position of the "Do not configure" option button; we will position
// the other controls relative to this one
nOffset -= nOptionButtonSeparationHeight;
// Move the controls
- MoveWnd(hDlg, IDC_SYS_CONTROL_MACHINE_QUESTION, 0, nOffset);
- MoveWnd(hDlg, IDC_SYS_CONTROL_SERVER, 0, nOffset);
-
- SetWndText(hDlg, IDC_TITLE, IDS_CONFIG_SCS);
- SetWndText(hDlg, IDC_SYS_CONTROL_MACHINE_QUESTION, IDS_SYS_CONTROL_SERVER_ONLY_MSG);
- SetWndText(hDlg, IDC_DONT_CONFIGURE, IDS_DONT_CONFIG_SYS_CONTROL_SERVER_MSG);
- }
-
- if (g_CfgData.configSCS == CS_CONFIGURE)
- SetCheck(hDlg, IDC_SYS_CONTROL_SERVER);
- else if (g_CfgData.configSCC == CS_CONFIGURE) {
- SetCheck(hDlg, IDC_SYS_CONTROL_CLIENT);
- EnableSysControlMachine(TRUE);
- } else
- SetCheck(hDlg, IDC_DONT_CONFIGURE);
-}
+ MoveWnd(hDlg, IDC_SYS_CONTROL_MACHINE_QUESTION, 0, nOffset);
+ MoveWnd(hDlg, IDC_SYS_CONTROL_SERVER, 0, nOffset);
+
+ SetWndText(hDlg, IDC_TITLE, IDS_CONFIG_SCS);
+ SetWndText(hDlg, IDC_SYS_CONTROL_MACHINE_QUESTION, IDS_SYS_CONTROL_SERVER_ONLY_MSG);
+ SetWndText(hDlg, IDC_DONT_CONFIGURE, IDS_DONT_CONFIG_SYS_CONTROL_SERVER_MSG);
+ }
+
+ if (g_CfgData.configSCS == CS_CONFIGURE)
+ SetCheck(hDlg, IDC_SYS_CONTROL_SERVER);
+ else if (g_CfgData.configSCC == CS_CONFIGURE) {
+ SetCheck(hDlg, IDC_SYS_CONTROL_CLIENT);
+ EnableSysControlMachine(TRUE);
+ } else
+ SetCheck(hDlg, IDC_DONT_CONFIGURE);
+}
/*
* Utility Functions _________________________________________________________________
*/
static void CantConfig(UINT nMsgID)
{
- TCHAR szMsg[cchRESOURCE];
+ TCHAR szMsg[cchRESOURCE];
- GetString(szMsg, nMsgID);
+ GetString(szMsg, nMsgID);
- ShowWnd(hDlg, IDC_SYS_CONTROL_MACHINE_QUESTION, FALSE);
- ShowWnd(hDlg, IDC_SYS_CONTROL_SERVER, FALSE);
- ShowWnd(hDlg, IDC_SYS_CONTROL_CLIENT, FALSE);
- ShowWnd(hDlg, IDC_SYS_CONTROL_MACHINE_LABEL, FALSE);
- ShowWnd(hDlg, IDC_SYS_CONTROL_MACHINE, FALSE);
- ShowWnd(hDlg, IDC_DONT_CONFIGURE, FALSE);
+ ShowWnd(hDlg, IDC_SYS_CONTROL_MACHINE_QUESTION, FALSE);
+ ShowWnd(hDlg, IDC_SYS_CONTROL_SERVER, FALSE);
+ ShowWnd(hDlg, IDC_SYS_CONTROL_CLIENT, FALSE);
+ ShowWnd(hDlg, IDC_SYS_CONTROL_MACHINE_LABEL, FALSE);
+ ShowWnd(hDlg, IDC_SYS_CONTROL_MACHINE, FALSE);
+ ShowWnd(hDlg, IDC_DONT_CONFIGURE, FALSE);
- ShowWnd(hDlg, IDC_CANT_CONFIG_MSG);
- SetWndText(hDlg, IDC_CANT_CONFIG_MSG, szMsg);
+ ShowWnd(hDlg, IDC_CANT_CONFIG_MSG);
+ SetWndText(hDlg, IDC_CANT_CONFIG_MSG, szMsg);
}
static void EnableSysControlMachine(BOOL bEnable)
{
- EnableWnd(hDlg, IDC_SYS_CONTROL_MACHINE_LABEL, bEnable);
- EnableWnd(hDlg, IDC_SYS_CONTROL_MACHINE, bEnable);
+ EnableWnd(hDlg, IDC_SYS_CONTROL_MACHINE_LABEL, bEnable);
+ EnableWnd(hDlg, IDC_SYS_CONTROL_MACHINE, bEnable);
- if (bEnable)
- ShowSysControlMachine(g_CfgData.szSysControlMachine);
- else
- ShowSysControlMachine(TEXT(""));
+ if (bEnable)
+ ShowSysControlMachine(g_CfgData.szSysControlMachine);
+ else
+ ShowSysControlMachine(TEXT(""));
- CheckEnableNextButton();
+ CheckEnableNextButton();
}
static void ShowSysControlMachine(TCHAR *pszSysControlMachine)
{
- SetWndText(hDlg, IDC_SYS_CONTROL_MACHINE, pszSysControlMachine);
+ SetWndText(hDlg, IDC_SYS_CONTROL_MACHINE, pszSysControlMachine);
}
static void CheckEnableNextButton()
{
- BOOL bEnable = TRUE;
+ BOOL bEnable = TRUE;
- if (IsButtonChecked(hDlg, IDC_SYS_CONTROL_CLIENT)) {
- GetWndText(hDlg, IDC_SYS_CONTROL_MACHINE, g_CfgData.szSysControlMachine, MAX_MACHINE_NAME_LEN);
+ if (IsButtonChecked(hDlg, IDC_SYS_CONTROL_CLIENT)) {
+ GetWndText(hDlg, IDC_SYS_CONTROL_MACHINE, g_CfgData.szSysControlMachine, MAX_MACHINE_NAME_LEN);
- if (lstrlen(g_CfgData.szSysControlMachine) == 0)
- bEnable = FALSE;
- }
+ if (lstrlen(g_CfgData.szSysControlMachine) == 0)
+ bEnable = FALSE;
+ }
- if (bEnable)
- g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
- else
- g_pWiz->EnableButtons(BACK_BUTTON);
+ if (bEnable)
+ g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
+ else
+ g_pWiz->EnableButtons(BACK_BUTTON);
}
*/
void SetEnable(HWND hDlg, UINT nControl, ENABLE_STATE eState)
{
- HWND hControl = GetDlgItem(hDlg, nControl);
+ HWND hControl = GetDlgItem(hDlg, nControl);
- BOOL bEnable;
+ BOOL bEnable;
- switch (eState) {
- case ES_ENABLE: bEnable = TRUE;
- break;
+ switch (eState) {
+ case ES_ENABLE:
+ bEnable = TRUE;
+ break;
- case ES_DISABLE: bEnable = FALSE;
- break;
+ case ES_DISABLE:
+ bEnable = FALSE;
+ break;
- case ES_TOGGLE: bEnable = !IsWindowEnabled(hControl);
- break;
- }
-
- EnableWindow(hControl, bEnable);
+ case ES_TOGGLE:
+ bEnable = !IsWindowEnabled(hControl);
+ break;
+ }
+
+ EnableWindow(hControl, bEnable);
}
void SetElapsedTime(HWND hwnd, DWORD nCtrlID, ULONG ulMin, ULONG ulMax, ULONG ulTime)
{
- SYSTEMTIME stMin;
- SET_ELAPSED_TIME_FROM_SECONDS (&stMin, ulMin);
+ SYSTEMTIME stMin;
+ SET_ELAPSED_TIME_FROM_SECONDS (&stMin, ulMin);
- SYSTEMTIME stMax;
- SET_ELAPSED_TIME_FROM_SECONDS (&stMax, ulMax);
+ SYSTEMTIME stMax;
+ SET_ELAPSED_TIME_FROM_SECONDS (&stMax, ulMax);
- SYSTEMTIME st;
- SET_ELAPSED_TIME_FROM_SECONDS (&st, ulTime);
+ SYSTEMTIME st;
+ SET_ELAPSED_TIME_FROM_SECONDS (&st, ulTime);
- HWND hElapsed = ::GetDlgItem(hwnd, nCtrlID);
- EL_SetRange (hElapsed, &stMin, &stMax);
- EL_SetTime (hElapsed, &st);
+ HWND hElapsed = ::GetDlgItem(hwnd, nCtrlID);
+ EL_SetRange (hElapsed, &stMin, &stMax);
+ EL_SetTime (hElapsed, &st);
}
void GetElapsedTime(HWND hwnd, DWORD nCtrlID, DWORD& dwTime)
{
- SYSTEMTIME stFinal;
+ SYSTEMTIME stFinal;
- HWND hElapsed = ::GetDlgItem(hwnd, nCtrlID);
- EL_GetTime (hElapsed, &stFinal);
+ HWND hElapsed = ::GetDlgItem(hwnd, nCtrlID);
+ EL_GetTime (hElapsed, &stFinal);
- dwTime = GET_SECONDS_FROM_ELAPSED_TIME(&stFinal);
+ dwTime = GET_SECONDS_FROM_ELAPSED_TIME(&stFinal);
}
LPCTSTR SecondsToElapsedTime(UINT uiNumSeconds)
{
- static TCHAR szTime[64], sz[32];
+ static TCHAR szTime[64], sz[32];
- *szTime = 0;
- *sz = 0;
+ *szTime = 0;
+ *sz = 0;
- int nHours, nMinutes, nSeconds;
+ int nHours, nMinutes, nSeconds;
- nHours = uiNumSeconds / 3600;
- nMinutes = (uiNumSeconds % 3600) / 60;
- nSeconds = (uiNumSeconds % 3600) % 60;
+ nHours = uiNumSeconds / 3600;
+ nMinutes = (uiNumSeconds % 3600) / 60;
+ nSeconds = (uiNumSeconds % 3600) % 60;
+ if (nHours)
+ _stprintf(szTime, TEXT("%d hours"), nHours);
+
+ if (nMinutes) {
if (nHours)
- _stprintf(szTime, TEXT("%d hours"), nHours);
-
- if (nMinutes) {
- if (nHours)
- lstrcat(szTime, TEXT(", "));
- _stprintf(sz, TEXT("%d minutes"), nMinutes);
- lstrcat(szTime, sz);
- }
-
- if (nSeconds) {
- if (nHours || nMinutes)
- lstrcat(szTime, TEXT(", "));
- _stprintf(sz, TEXT("%d seconds"), nSeconds);
- lstrcat(szTime, sz);
- }
-
- return szTime;
+ lstrcat(szTime, TEXT(", "));
+ _stprintf(sz, TEXT("%d minutes"), nMinutes);
+ lstrcat(szTime, sz);
+ }
+
+ if (nSeconds) {
+ if (nHours || nMinutes)
+ lstrcat(szTime, TEXT(", "));
+ _stprintf(sz, TEXT("%d seconds"), nSeconds);
+ lstrcat(szTime, sz);
+ }
+
+ return szTime;
}
BOOL IsButtonChecked(HWND hDlg, UINT uiCtrlID)
{
- return SendMessage(GetDlgItem(hDlg, uiCtrlID), BM_GETCHECK, 0, 0) == BST_CHECKED;
+ return SendMessage(GetDlgItem(hDlg, uiCtrlID), BM_GETCHECK, 0, 0) == BST_CHECKED;
}
int GetButtonState(HWND hDlg, UINT uiCtrlID)
-{
- return SendMessage(GetDlgItem(hDlg, uiCtrlID), BM_GETCHECK, 0, 0);
+{
+ return SendMessage(GetDlgItem(hDlg, uiCtrlID), BM_GETCHECK, 0, 0);
}
void SetCheck(HWND hDlg, UINT uiCtrlID, int nChecked)
{
- SendMessage(GetDlgItem(hDlg, uiCtrlID), BM_SETCHECK, nChecked, 0);
+ SendMessage(GetDlgItem(hDlg, uiCtrlID), BM_SETCHECK, nChecked, 0);
}
TCHAR *GetResString(UINT nMsgID, TCHAR *pszMsg, UINT nLen)
{
- GetString(pszMsg, nMsgID, nLen);
+ GetString(pszMsg, nMsgID, nLen);
- return pszMsg;
+ return pszMsg;
}
void ShowWnd(HWND hDlg, UINT uiCtrlID, BOOL bShow)
{
- ShowWindow(GetDlgItem(hDlg, uiCtrlID), bShow ? SW_SHOW : SW_HIDE);
+ ShowWindow(GetDlgItem(hDlg, uiCtrlID), bShow ? SW_SHOW : SW_HIDE);
}
void EnableWnd(HWND hDlg, UINT uiCtrlID, BOOL bEnable)
{
- EnableWindow(GetDlgItem(hDlg, uiCtrlID), bEnable);
+ EnableWindow(GetDlgItem(hDlg, uiCtrlID), bEnable);
}
void SetWndText(HWND hDlg, UINT uiCtrlID, LPCTSTR pszMsg)
{
- SetWindowText(GetDlgItem(hDlg, uiCtrlID), pszMsg);
+ SetWindowText(GetDlgItem(hDlg, uiCtrlID), pszMsg);
}
void SetWndText(HWND hDlg, UINT uiCtrlID, UINT nMsgID)
{
- TCHAR szMsg[cchRESOURCE];
+ TCHAR szMsg[cchRESOURCE];
- GetString(szMsg, nMsgID);
+ GetString(szMsg, nMsgID);
- SetWndText(hDlg, uiCtrlID, szMsg);
+ SetWndText(hDlg, uiCtrlID, szMsg);
}
TCHAR *GetWndText(HWND hDlg, UINT uiCtrlID, TCHAR *pszTextBuffer, int nTextLen)
{
- GetWindowText(GetDlgItem(hDlg, uiCtrlID), pszTextBuffer, nTextLen);
+ GetWindowText(GetDlgItem(hDlg, uiCtrlID), pszTextBuffer, nTextLen);
- return pszTextBuffer;
+ return pszTextBuffer;
}
void ForceUpdateWindow(HWND hWnd)
{
- InvalidateRect(hWnd, 0, TRUE);
- UpdateWindow(hWnd);
+ InvalidateRect(hWnd, 0, TRUE);
+ UpdateWindow(hWnd);
}
void ForceUpdateWindow(HWND hDlg, UINT uiCtrlID)
{
- ForceUpdateWindow(GetDlgItem(hDlg, uiCtrlID));
+ ForceUpdateWindow(GetDlgItem(hDlg, uiCtrlID));
}
int AddLBString(HWND hDlg, UINT uiCtrlID, LPCTSTR pszString)
{
- return SendMessage(GetDlgItem(hDlg, uiCtrlID), LB_ADDSTRING, 0, (LONG)pszString);
+ return SendMessage(GetDlgItem(hDlg, uiCtrlID), LB_ADDSTRING, 0, (LONG)pszString);
}
int ClearListBox(HWND hDlg, UINT uiCtrlID)
{
- return SendMessage(GetDlgItem(hDlg, uiCtrlID), LB_RESETCONTENT, 0, 0);
+ return SendMessage(GetDlgItem(hDlg, uiCtrlID), LB_RESETCONTENT, 0, 0);
}
void SetUpDownRange(HWND hDlg, UINT uiCtrlID, int nMinVal, int nMaxVal)
{
- SendMessage(GetDlgItem(hDlg, uiCtrlID), UDM_SETRANGE, 0, (LPARAM)MAKELONG((short)nMaxVal, (short)nMinVal));
+ SendMessage(GetDlgItem(hDlg, uiCtrlID), UDM_SETRANGE, 0, (LPARAM)MAKELONG((short)nMaxVal, (short)nMinVal));
}
void MakeBold(HWND hWnd)
{
- HFONT hFont = (HFONT)SendMessage(hWnd, WM_GETFONT, 0, 0);
+ HFONT hFont = (HFONT)SendMessage(hWnd, WM_GETFONT, 0, 0);
- LOGFONT logFont;
-
- GetObject(hFont, sizeof(LOGFONT), &logFont);
+ LOGFONT logFont;
+
+ GetObject(hFont, sizeof(LOGFONT), &logFont);
- logFont.lfWeight = FW_BOLD;
+ logFont.lfWeight = FW_BOLD;
- HFONT hNewFont = CreateFontIndirect(&logFont);
- ASSERT(hNewFont);
+ HFONT hNewFont = CreateFontIndirect(&logFont);
+ ASSERT(hNewFont);
- SendMessage(hWnd, WM_SETFONT, (WPARAM)hNewFont, MAKELPARAM(TRUE, 0));
+ SendMessage(hWnd, WM_SETFONT, (WPARAM)hNewFont, MAKELPARAM(TRUE, 0));
}
int MsgBox(HWND hParent, UINT uiTextID, UINT uiCaptionID, UINT uType)
{
- TCHAR szText[cchRESOURCE];
- TCHAR szCaption[cchRESOURCE];
+ TCHAR szText[cchRESOURCE];
+ TCHAR szCaption[cchRESOURCE];
- GetString(szText, uiTextID);
- GetString(szCaption, uiCaptionID);
+ GetString(szText, uiTextID);
+ GetString(szCaption, uiCaptionID);
- return MessageBox(hParent, szText, szCaption, uType);
+ return MessageBox(hParent, szText, szCaption, uType);
}
void HideAndDisable(HWND hDlg, UINT uiCtrlID)
{
- ShowWnd(hDlg, uiCtrlID, SW_HIDE);
- SetEnable(hDlg, uiCtrlID, ES_DISABLE);
+ ShowWnd(hDlg, uiCtrlID, SW_HIDE);
+ SetEnable(hDlg, uiCtrlID, ES_DISABLE);
}
void ShowAndEnable(HWND hDlg, UINT uiCtrlID, BOOL bShowAndEnable)
{
- int nShow = SW_SHOW;
- ENABLE_STATE es = ES_ENABLE;
+ int nShow = SW_SHOW;
+ ENABLE_STATE es = ES_ENABLE;
- if (!bShowAndEnable) {
- nShow = SW_HIDE;
- es = ES_DISABLE;
- }
+ if (!bShowAndEnable) {
+ nShow = SW_HIDE;
+ es = ES_DISABLE;
+ }
- ShowWnd(hDlg, uiCtrlID, nShow);
- SetEnable(hDlg, uiCtrlID, es);
+ ShowWnd(hDlg, uiCtrlID, nShow);
+ SetEnable(hDlg, uiCtrlID, es);
}
void MoveWnd(HWND hDlg, UINT nCtrlID, int xOffset, int yOffset)
{
- HWND hCtrl = GetDlgItem(hDlg, nCtrlID);
+ HWND hCtrl = GetDlgItem(hDlg, nCtrlID);
- RECT rect;
- GetWindowRect(hCtrl, &rect);
+ RECT rect;
+ GetWindowRect(hCtrl, &rect);
- POINT p1, p2;
- p1.x = rect.left;
- p1.y = rect.top;
- p2.x = rect.right;
- p2.y = rect.bottom;
-
- ScreenToClient(hDlg, &p1);
- ScreenToClient(hDlg, &p2);
+ POINT p1, p2;
+ p1.x = rect.left;
+ p1.y = rect.top;
+ p2.x = rect.right;
+ p2.y = rect.bottom;
+
+ ScreenToClient(hDlg, &p1);
+ ScreenToClient(hDlg, &p2);
- rect.left = p1.x;
- rect.top = p1.y;
- rect.right = p2.x;
- rect.bottom = p2.y;
+ rect.left = p1.x;
+ rect.top = p1.y;
+ rect.right = p2.x;
+ rect.bottom = p2.y;
- MoveWindow(hCtrl, rect.left + xOffset, rect.top + yOffset, rect.right - rect.left, rect.bottom - rect.top, TRUE);
+ MoveWindow(hCtrl, rect.left + xOffset, rect.top + yOffset, rect.right - rect.left, rect.bottom - rect.top, TRUE);
}
BOOL bValid;
int nErrorMsgResID;
- switch (type) {
- case VALID_AFS_PARTITION_NAME: bValid = CheckAfsPartitionName(pszInput, nErrorMsgResID);
- break;
+ switch (type) {
+ case VALID_AFS_PARTITION_NAME:
+ bValid = CheckAfsPartitionName(pszInput, nErrorMsgResID);
+ break;
- case VALID_AFS_CELL_NAME: bValid = CheckAfsCellName(pszInput, nErrorMsgResID);
- break;
+ case VALID_AFS_CELL_NAME:
+ bValid = CheckAfsCellName(pszInput, nErrorMsgResID);
+ break;
- case VALID_AFS_PASSWORD: bValid = CheckAfsPassword(pszInput, nErrorMsgResID);
- break;
+ case VALID_AFS_PASSWORD:
+ bValid = CheckAfsPassword(pszInput, nErrorMsgResID);
+ break;
- case VALID_AFS_UID: bValid = CheckAfsUid(pszInput, nErrorMsgResID);
- break;
+ case VALID_AFS_UID:
+ bValid = CheckAfsUid(pszInput, nErrorMsgResID);
+ break;
- case VALID_AFS_SERVER_NAME: bValid = CheckAfsServerName(pszInput, nErrorMsgResID);
- break;
+ case VALID_AFS_SERVER_NAME:
+ bValid = CheckAfsServerName(pszInput, nErrorMsgResID);
+ break;
- default: nErrorMsgResID = 0;
- ASSERT(FALSE);
- return FALSE;
- }
+ default:
+ nErrorMsgResID = 0;
+ ASSERT(FALSE);
+ return FALSE;
+ }
if (!bValid && bShowError)
ShowError(nErrorMsgResID);
return bValid;
-}
+}
delete pszName;
- return bIsValid;
+ return bIsValid;
}
static BOOL CheckAfsCellName(TCHAR *pszInput, int &nErrorMsgResID)
-{
- nErrorMsgResID = 0;
+{
+ nErrorMsgResID = 0;
- return TRUE;
+ return TRUE;
}
static BOOL CheckAfsPassword(TCHAR *pszInput, int &nErrorMsgResID)
{
- nErrorMsgResID = 0;
+ nErrorMsgResID = 0;
- return TRUE;
-}
+ return TRUE;
+}
static BOOL CheckAfsUid(TCHAR *pszInput, int &nErrorMsgResID)
{
- nErrorMsgResID = 0;
+ nErrorMsgResID = 0;
- return TRUE;
+ return TRUE;
}
static BOOL CheckAfsServerName(TCHAR *pszInput, int &nErrorMsgResID)
{
- nErrorMsgResID = 0;
+ nErrorMsgResID = 0;
- return TRUE;
+ return TRUE;
}
static void ShowError(int nErrorMsgResID)
struct DRIVE_INFO
{
- TCHAR szRootDir[4]; // Drive letter plus colon plus slash, ex: "c:\"
- TCHAR szVolName[256];
- TCHAR szSize[32]; // Drive size in megabytes
- DWORD dwFlags;
- BOOL bDisabled; // Disabled is TRUE if partition not suitable for AFS
- UINT nImage; // Image to show in the FastList
+ TCHAR szRootDir[4]; // Drive letter plus colon plus slash, ex: "c:\"
+ TCHAR szVolName[256];
+ TCHAR szSize[32]; // Drive size in megabytes
+ DWORD dwFlags;
+ BOOL bDisabled; // Disabled is TRUE if partition not suitable for AFS
+ UINT nImage; // Image to show in the FastList
};
*/
LPTSTR GetString(UINT nStrID)
{
- static TCHAR szText[cchRESOURCE];
+ static TCHAR szText[cchRESOURCE];
- GetString(szText, nStrID);
+ GetString(szText, nStrID);
- return szText;
+ return szText;
}
static BOOL SetupImageLists()
{
- HIMAGELIST hiList = ImageList_Create(16, 16, TRUE, 1, 1);
+ HIMAGELIST hiList = ImageList_Create(16, 16, TRUE, 1, 1);
- AfsAppLib_AddToImageList(hiList, IDI_DISK_DRIVE, FALSE);
- AfsAppLib_AddToImageList(hiList, IDI_DISABLED_DISK_DRIVE, FALSE);
- AfsAppLib_AddToImageList(hiList, IDI_DISK_DRIVE_WITH_WARNING, FALSE);
- AfsAppLib_AddToImageList(hiList, IDI_AGGREGATE, FALSE);
+ AfsAppLib_AddToImageList(hiList, IDI_DISK_DRIVE, FALSE);
+ AfsAppLib_AddToImageList(hiList, IDI_DISABLED_DISK_DRIVE, FALSE);
+ AfsAppLib_AddToImageList(hiList, IDI_DISK_DRIVE_WITH_WARNING, FALSE);
+ AfsAppLib_AddToImageList(hiList, IDI_AGGREGATE, FALSE);
- FastList_SetImageLists(m_hDriveList, hiList, 0);
+ FastList_SetImageLists(m_hDriveList, hiList, 0);
- return TRUE;
+ return TRUE;
}
static void AddColumn(int nWidth, LPCTSTR pszTitle)
{
- static int nCol = 1;
- FASTLISTCOLUMN col;
+ static int nCol = 1;
+ FASTLISTCOLUMN col;
- col.dwFlags = FLCF_JUSTIFY_LEFT;
- col.cxWidth = nWidth;
- lstrcpy(col.szText, pszTitle);
+ col.dwFlags = FLCF_JUSTIFY_LEFT;
+ col.cxWidth = nWidth;
+ lstrcpy(col.szText, pszTitle);
- FastList_SetColumn(m_hDriveList, nCol++, &col);
+ FastList_SetColumn(m_hDriveList, nCol++, &col);
}
static void SetupDriveListCols()
{
- // Set width of cols based on width of the list
- RECT rect;
- GetClientRect(m_hDriveList, &rect);
-
- int nWidth = rect.right - rect.left;
-
- // If the width of the list is too small to show all
- // three cols in a reasonable size that will fit without
- // scrolling, then set the width to the ideal size and
- // make the user scroll.
- if (nWidth < 150) // Minimum we will accept
- nWidth = 370; // The ideal size
-
- AddColumn(50, GetString(IDS_DRIVE));
- AddColumn(nWidth - 100, GetString(IDS_NAME_OR_ERROR));
- AddColumn(50, GetString(IDS_SIZE));
-}
+ // Set width of cols based on width of the list
+ RECT rect;
+ GetClientRect(m_hDriveList, &rect);
+
+ int nWidth = rect.right - rect.left;
+
+ // If the width of the list is too small to show all
+ // three cols in a reasonable size that will fit without
+ // scrolling, then set the width to the ideal size and
+ // make the user scroll.
+ if (nWidth < 150) // Minimum we will accept
+ nWidth = 370; // The ideal size
+
+ AddColumn(50, GetString(IDS_DRIVE));
+ AddColumn(nWidth - 100, GetString(IDS_NAME_OR_ERROR));
+ AddColumn(50, GetString(IDS_SIZE));
+}
static LPCTSTR GetDriveSizeAsString(LPCTSTR pszRootDir)
{
- _ASSERTE(pszRootDir != 0);
+ _ASSERTE(pszRootDir != 0);
- ULARGE_INTEGER liDummy;
- ULARGE_INTEGER liSize;
- static TCHAR szSize[64];
+ ULARGE_INTEGER liDummy;
+ ULARGE_INTEGER liSize;
+ static TCHAR szSize[64];
- *szSize = 0;
-
- // Get partition size in bytes
- if (GetDiskFreeSpaceEx(pszRootDir, &liDummy, &liSize, &liDummy)) {
- // Covert to megabytes
- ULONG nSize = (ULONG)(liSize.QuadPart / (1024 * 1024));
- // Convert to a string
- _ultot(nSize, szSize, 10);
- lstrcat(szSize, TEXT(" MB"));
- }
+ *szSize = 0;
- return szSize;
-}
+ // Get partition size in bytes
+ if (GetDiskFreeSpaceEx(pszRootDir, &liDummy, &liSize, &liDummy)) {
+ // Covert to megabytes
+ ULONG nSize = (ULONG)(liSize.QuadPart / (1024 * 1024));
+ // Convert to a string
+ _ultot(nSize, szSize, 10);
+ lstrcat(szSize, TEXT(" MB"));
+ }
+
+ return szSize;
+}
static BOOL DoesDriveContainData(LPCTSTR pszDriveRootDir)
{
- TCHAR szSearchSpec[16];
- WIN32_FIND_DATA findData;
+ TCHAR szSearchSpec[16];
+ WIN32_FIND_DATA findData;
- _stprintf(szSearchSpec, TEXT("%s*.*"), pszDriveRootDir);
+ _stprintf(szSearchSpec, TEXT("%s*.*"), pszDriveRootDir);
- HANDLE hFind = FindFirstFile(szSearchSpec, &findData);
- if (hFind == INVALID_HANDLE_VALUE)
- return FALSE;
+ HANDLE hFind = FindFirstFile(szSearchSpec, &findData);
+ if (hFind == INVALID_HANDLE_VALUE)
+ return FALSE;
- FindClose(hFind);
+ FindClose(hFind);
- return TRUE;
-}
+ return TRUE;
+}
static BOOL OnlyHasFolder(LPCTSTR pszRootDir, LPCTSTR pszFolder)
{
- TCHAR szSearchSpec[MAX_PATH];
- WIN32_FIND_DATA findData;
- BOOL bFound = FALSE;
-
- _stprintf(szSearchSpec, TEXT("%s*.*"), pszRootDir);
-
- // If there is nothing in the root dir, then return FALSE
- HANDLE hFind = FindFirstFile(szSearchSpec, &findData);
- if (hFind == INVALID_HANDLE_VALUE)
- return bFound;
-
- // Is the first thing on the disk the recycle bin? If not
- // the the recycle bin is not the only thing on the disk.
- if (_tcsicmp(findData.cFileName, pszFolder) == 0) {
- // Is anything else on the disk?
- if (!FindNextFile(hFind, &findData))
- bFound = TRUE;
- }
+ TCHAR szSearchSpec[MAX_PATH];
+ WIN32_FIND_DATA findData;
+ BOOL bFound = FALSE;
- FindClose(hFind);
+ _stprintf(szSearchSpec, TEXT("%s*.*"), pszRootDir);
+ // If there is nothing in the root dir, then return FALSE
+ HANDLE hFind = FindFirstFile(szSearchSpec, &findData);
+ if (hFind == INVALID_HANDLE_VALUE)
return bFound;
-}
+
+ // Is the first thing on the disk the recycle bin? If not
+ // the the recycle bin is not the only thing on the disk.
+ if (_tcsicmp(findData.cFileName, pszFolder) == 0) {
+ // Is anything else on the disk?
+ if (!FindNextFile(hFind, &findData))
+ bFound = TRUE;
+ }
+
+ FindClose(hFind);
+
+ return bFound;
+}
static BOOL DriveHasRecycleBin(LPCTSTR pszDriveRootDir)
{
- if (OnlyHasFolder(pszDriveRootDir, TEXT("Recycled")))
- return TRUE;
+ if (OnlyHasFolder(pszDriveRootDir, TEXT("Recycled")))
+ return TRUE;
- if (OnlyHasFolder(pszDriveRootDir, TEXT("Recycle Bin")))
- return TRUE;
+ if (OnlyHasFolder(pszDriveRootDir, TEXT("Recycle Bin")))
+ return TRUE;
- if (OnlyHasFolder(pszDriveRootDir, TEXT("Recycler")))
- return TRUE;
+ if (OnlyHasFolder(pszDriveRootDir, TEXT("Recycler")))
+ return TRUE;
- return FALSE;
+ return FALSE;
}
static BOOL DoesDriveContainNT(LPCTSTR pszDriveRootDir)
{
- UINT nBufSize = MAX_PATH;
- LPTSTR pszWinDir = 0;
+ UINT nBufSize = MAX_PATH;
+ LPTSTR pszWinDir = 0;
- while (!pszWinDir) {
- pszWinDir = new TCHAR[nBufSize];
+ while (!pszWinDir) {
+ pszWinDir = new TCHAR[nBufSize];
- UINT nWinDirLen = GetWindowsDirectory(pszWinDir, nBufSize);
+ UINT nWinDirLen = GetWindowsDirectory(pszWinDir, nBufSize);
- if (nWinDirLen > nBufSize) {
- nBufSize = nWinDirLen;
- delete [] pszWinDir;
- pszWinDir = 0;
- }
+ if (nWinDirLen > nBufSize) {
+ nBufSize = nWinDirLen;
+ delete [] pszWinDir;
+ pszWinDir = 0;
}
+ }
- BOOL bNT = (_tcsncmp(pszDriveRootDir, pszWinDir, 3) == 0);
+ BOOL bNT = (_tcsncmp(pszDriveRootDir, pszWinDir, 3) == 0);
- delete [] pszWinDir;
+ delete [] pszWinDir;
- return bNT;
+ return bNT;
}
static BOOL ValidateDrive(BOOL bInvalid, UINT uiErrorMsgID, LPTSTR pszErrorStr)
{
- if (!bInvalid)
- return FALSE;
+ if (!bInvalid)
+ return FALSE;
- if (*pszErrorStr)
- lstrcat(pszErrorStr, GetString(IDS_ERROR_SEP));
- lstrcat(pszErrorStr, GetString(uiErrorMsgID));
+ if (*pszErrorStr)
+ lstrcat(pszErrorStr, GetString(IDS_ERROR_SEP));
+ lstrcat(pszErrorStr, GetString(uiErrorMsgID));
- return TRUE;
+ return TRUE;
}
static BOOL GetDriveInfo(TCHAR chDrive, DRIVE_INFO& di)
{
- DWORD dwDummy;
- TCHAR szFileSys[64];
- DWORD dwDriveFlags;
+ DWORD dwDummy;
+ TCHAR szFileSys[64];
+ DWORD dwDriveFlags;
- _stprintf(di.szRootDir, TEXT("%c:\\"), chDrive);
+ _stprintf(di.szRootDir, TEXT("%c:\\"), chDrive);
- if (GetDriveType(di.szRootDir) != DRIVE_FIXED)
- return FALSE;
-
- if (!GetVolumeInformation(di.szRootDir, di.szVolName, sizeof(di.szVolName), 0, &dwDummy, &dwDriveFlags, szFileSys, sizeof(szFileSys)))
- return FALSE;
-
- TCHAR szError[256] = TEXT("");
-
- BOOL bInvalid = FALSE, bHasData = FALSE;
- BOOL bIsAfs = ValidateDrive(IsAnAfsPartition(di.szRootDir), IDS_ERROR_DRIVE_ALREADY_HAS_AFS, szError);
- if (!bIsAfs) {
- bInvalid |= ValidateDrive(dwDriveFlags & FS_VOL_IS_COMPRESSED, IDS_ERROR_DRIVE_COMPRESSED, szError);
- bInvalid |= ValidateDrive(lstrcmp(szFileSys, TEXT("NTFS")) != 0, IDS_ERROR_FS_IS_NOT_NTFS, szError);
-
- /*
- * We are no longer going to require that afs drives be empty; we will give a warning instead.
- *
- * bInvalid |= ValidateDrive(DoesDriveContainNT(di.szRootDir), IDS_ERROR_DRIVE_CONTAINS_NT, szError);
- * bRecycle = ValidateDrive(DriveHasRecycleBin(di.szRootDir), IDS_WARNING_DRIVE_HAS_RECYCLE_BIN, szError);
- */
- if (!bInvalid)
- bHasData = ValidateDrive(DoesDriveContainData(di.szRootDir), IDS_ERROR_DRIVE_HAS_DATA, szError);
- }
+ if (GetDriveType(di.szRootDir) != DRIVE_FIXED)
+ return FALSE;
+
+ if (!GetVolumeInformation(di.szRootDir, di.szVolName, sizeof(di.szVolName), 0, &dwDummy, &dwDriveFlags, szFileSys, sizeof(szFileSys)))
+ return FALSE;
+
+ TCHAR szError[256] = TEXT("");
+
+ BOOL bInvalid = FALSE, bHasData = FALSE;
+ BOOL bIsAfs = ValidateDrive(IsAnAfsPartition(di.szRootDir), IDS_ERROR_DRIVE_ALREADY_HAS_AFS, szError);
+ if (!bIsAfs) {
+ bInvalid |= ValidateDrive(dwDriveFlags & FS_VOL_IS_COMPRESSED, IDS_ERROR_DRIVE_COMPRESSED, szError);
+ bInvalid |= ValidateDrive(lstrcmp(szFileSys, TEXT("NTFS")) != 0, IDS_ERROR_FS_IS_NOT_NTFS, szError);
- if (*szError) {
- lstrcpy(di.szVolName, szError);
-
- if (bIsAfs)
- di.nImage = AFS_DISK_DRIVE_IMAGE;
- else if (bHasData)
- di.nImage = DISK_DRIVE_WITH_WARNING_IMAGE; // Treat this as a warning
- else
- di.nImage = DISABLED_DISK_DRIVE_IMAGE;
-
- if (bIsAfs || bInvalid) {
- di.bDisabled = TRUE;
- di.dwFlags |= FLIF_DISALLOW_SELECT;
- }
- } else {
- di.nImage = DISK_DRIVE_IMAGE;
-
- if (lstrlen(di.szVolName) == 0)
- GetString(di.szVolName, IDS_VOLUME_HAS_NO_NAME);
+ /*
+ * We are no longer going to require that afs drives be empty; we will give a warning instead.
+ *
+ * bInvalid |= ValidateDrive(DoesDriveContainNT(di.szRootDir), IDS_ERROR_DRIVE_CONTAINS_NT, szError);
+ * bRecycle = ValidateDrive(DriveHasRecycleBin(di.szRootDir), IDS_WARNING_DRIVE_HAS_RECYCLE_BIN, szError);
+ */
+ if (!bInvalid)
+ bHasData = ValidateDrive(DoesDriveContainData(di.szRootDir), IDS_ERROR_DRIVE_HAS_DATA, szError);
+ }
+
+ if (*szError) {
+ lstrcpy(di.szVolName, szError);
+
+ if (bIsAfs)
+ di.nImage = AFS_DISK_DRIVE_IMAGE;
+ else if (bHasData)
+ di.nImage = DISK_DRIVE_WITH_WARNING_IMAGE; // Treat this as a warning
+ else
+ di.nImage = DISABLED_DISK_DRIVE_IMAGE;
+
+ if (bIsAfs || bInvalid) {
+ di.bDisabled = TRUE;
+ di.dwFlags |= FLIF_DISALLOW_SELECT;
}
+ } else {
+ di.nImage = DISK_DRIVE_IMAGE;
- lstrncpy(di.szSize, GetDriveSizeAsString(di.szRootDir), sizeof(di.szSize));
+ if (lstrlen(di.szVolName) == 0)
+ GetString(di.szVolName, IDS_VOLUME_HAS_NO_NAME);
+ }
- return TRUE;
+ lstrncpy(di.szSize, GetDriveSizeAsString(di.szRootDir), sizeof(di.szSize));
+
+ return TRUE;
}
static BOOL FillDriveList()
{
- DRIVE_INFO di;
-
- TCHAR chDrive = TEXT('A');
- DWORD dwDrives = GetLogicalDrives();
-
- // This failing is not fatal to this function
- // Make sure the partition table is up to date
- afs_status_t nStatus;
- int nResult = ReadPartitionTable(&nStatus);
- ASSERT(nResult);
-
- while (dwDrives) {
- if (dwDrives & 1) {
- memset(&di, 0, sizeof(di));
-
- if (GetDriveInfo(chDrive, di)) {
- FASTLISTADDITEM ai = { 0, di.nImage, IMAGE_NOIMAGE, di.szRootDir, di.bDisabled, di.dwFlags };
- HLISTITEM hItem = FastList_AddItem(m_hDriveList, &ai);
- FastList_SetItemText(m_hDriveList, hItem, 1, di.szVolName);
- FastList_SetItemText(m_hDriveList, hItem, 2, di.szSize);
- }
- }
-
- chDrive++;
- dwDrives >>= 1;
+ DRIVE_INFO di;
+
+ TCHAR chDrive = TEXT('A');
+ DWORD dwDrives = GetLogicalDrives();
+
+ // This failing is not fatal to this function
+ // Make sure the partition table is up to date
+ afs_status_t nStatus;
+ int nResult = ReadPartitionTable(&nStatus);
+ ASSERT(nResult);
+
+ while (dwDrives) {
+ if (dwDrives & 1) {
+ memset(&di, 0, sizeof(di));
+
+ if (GetDriveInfo(chDrive, di)) {
+ FASTLISTADDITEM ai = { 0, di.nImage, IMAGE_NOIMAGE, di.szRootDir, di.bDisabled, di.dwFlags };
+ HLISTITEM hItem = FastList_AddItem(m_hDriveList, &ai);
+ FastList_SetItemText(m_hDriveList, hItem, 1, di.szVolName);
+ FastList_SetItemText(m_hDriveList, hItem, 2, di.szSize);
+ }
}
- return TRUE;
+ chDrive++;
+ dwDrives >>= 1;
+ }
+
+ return TRUE;
}
static int CALLBACK DriveListSortFunc(HWND hList, HLISTITEM hItem1, LPARAM lpItem1, HLISTITEM hItem2, LPARAM lpItem2)
{
- _ASSERTE(hList == m_hDriveList);
+ _ASSERTE(hList == m_hDriveList);
- // Ignore the first call which is only used to initialize static data
- if (!hItem1 && !hItem2)
- return 0;
+ // Ignore the first call which is only used to initialize static data
+ if (!hItem1 && !hItem2)
+ return 0;
- // The lpItem vars contain 1 if the item is disabled, 0 if not
- // Show enabled items before disabled items
- if (lpItem1 != lpItem2)
- return lpItem1 - lpItem2;
+ // The lpItem vars contain 1 if the item is disabled, 0 if not
+ // Show enabled items before disabled items
+ if (lpItem1 != lpItem2)
+ return lpItem1 - lpItem2;
- LPCTSTR pszItem1 = FastList_GetItemText(m_hDriveList, hItem1, 0);
- LPCTSTR pszItem2 = FastList_GetItemText(m_hDriveList, hItem2, 0);
+ LPCTSTR pszItem1 = FastList_GetItemText(m_hDriveList, hItem1, 0);
+ LPCTSTR pszItem2 = FastList_GetItemText(m_hDriveList, hItem2, 0);
- return lstrcmp(pszItem1, pszItem2);
+ return lstrcmp(pszItem1, pszItem2);
}
*/
void SetupDriveList(HWND driveList)
{
- m_hDriveList = driveList;
+ m_hDriveList = driveList;
- SetupImageLists();
+ SetupImageLists();
- SetupDriveListCols();
+ SetupDriveListCols();
- FastList_SetSortFunction(m_hDriveList, DriveListSortFunc);
+ FastList_SetSortFunction(m_hDriveList, DriveListSortFunc);
}
BOOL UpdateDriveList()
{
- FastList_RemoveAll(m_hDriveList);
+ FastList_RemoveAll(m_hDriveList);
- return FillDriveList();
-}
+ return FillDriveList();
+}