static void PreCheckItem (HWND hwnd) { LPSECURITYALARMPARAMS lpsecurity = GetDlgProp (hwnd); HWND hwndUsers = GetDlgItem (hwnd, IDC_SALARM_BYUSER ); HWND hwndDB = GetDlgItem (hwnd, IDC_SALARM_ONTABLE); HWND hwndSuccess = GetDlgItem (hwnd, IDC_SALARM_SUCCESS); HWND hwndFailure = GetDlgItem (hwnd, IDC_SALARM_FAILURE); HWND hwndSelect = GetDlgItem (hwnd, IDC_SALARM_SELECT); HWND hwndDelete = GetDlgItem (hwnd, IDC_SALARM_DELETE); HWND hwndInsert = GetDlgItem (hwnd, IDC_SALARM_INSERT); HWND hwndUpdate = GetDlgItem (hwnd, IDC_SALARM_UPDATE); HWND hwndConnect = GetDlgItem (hwnd, IDC_SALARM_CONNECT); HWND hwndDisconnect = GetDlgItem (hwnd, IDC_SALARM_DISCONNECT); Button_SetCheck (hwndSuccess, lpsecurity->bsuccfail [SECALARMSUCCESS]); Button_SetCheck (hwndFailure, lpsecurity->bsuccfail [SECALARMFAILURE]); Button_SetCheck (hwndSelect, lpsecurity->baccesstype [SECALARMSEL]); Button_SetCheck (hwndDelete, lpsecurity->baccesstype [SECALARMDEL]); Button_SetCheck (hwndInsert, lpsecurity->baccesstype [SECALARMINS]); Button_SetCheck (hwndUpdate, lpsecurity->baccesstype [SECALARMUPD]); Button_SetCheck (hwndConnect ,lpsecurity->baccesstype [SECALARMCONNECT]); Button_SetCheck (hwndDisconnect,lpsecurity->baccesstype [SECALARMDISCONN]); if (x_strlen (lpsecurity->PreselectTable) > 0) // DB Name CAListBox_SelectString (hwndDB, -1, lpsecurity->PreselectTable); }
static BOOL FillStructureFromControls (HWND hwnd) { HWND hwndObjectType = GetDlgItem (hwnd, IDC_LOCATE_OBJECTTYPE); HWND hwndDatabase = GetDlgItem (hwnd, IDC_LOCATE_DATABASE); HWND hwndFind = GetDlgItem (hwnd, IDC_LOCATE_FIND); LPLOCATEPARAMS lplocate = GetDlgProp (hwnd); int nSel; char szObjectType [MAXOBJECTNAME]; char szDatabase [MAXOBJECTNAME]; char szFind [MAXOBJECTNAME]; ZEROINIT (szObjectType); ZEROINIT (szDatabase ); ZEROINIT (szFind ); ComboBox_GetText (hwndObjectType, szObjectType, sizeof (szObjectType)); if (IsWindowEnabled (hwndDatabase)) ComboBox_GetText (hwndDatabase , szDatabase , sizeof (szDatabase )); Edit_GetText (hwndFind, szFind, sizeof (szFind)); if ((nSel = ComboBox_GetCurSel (hwndObjectType)) != CB_ERR) lplocate->ObjectType = Obj4locate() [nSel]; else lplocate->ObjectType = -1; x_strcpy (lplocate->DBName, szDatabase); x_strcpy (lplocate->FindString, szFind); if (!ProhibitString_all2 (hwnd)) return FALSE; return TRUE; }
static BOOL OccupyAuditKeyControl(HWND hwnd) { LPTABLEPARAMS lptbl = GetDlgProp(hwnd); HWND hwndCtl = GetDlgItem (hwnd, IDC_SEC_AUDIT_KEY); BOOL bRetVal = TRUE; LPOBJECTLIST lplist = lptbl->lpColumns; while (lplist) { LPCOLUMNPARAMS lpCols = (LPCOLUMNPARAMS)lplist->lpObject; if (lpCols) { int nIdx = ComboBox_AddString(hwndCtl, lpCols->szColumn); if (nIdx == CB_ERR) { bRetVal = FALSE; break; } } lplist = lplist->lpNext; } return bRetVal; }
static void FillAllComboCells(HWND hwnd, int maxLine) { HWND hwndContainer = GetDlgItem (hwnd, IDC_RELOCATE_CONTAINER); LPSTORAGEPARAMS lpstorage = GetDlgProp (hwnd); LPCHECKEDOBJECTS ls, lploc = GetLocations (); int i, maxlen = 0; char* item; char* buffer; char* first; ls = lploc; while (ls) { item = (char*) ls->dbname; maxlen = maxlen + x_strlen (item) +1; ls = ls->pnext; } if (maxlen > 0) { buffer = ESL_AllocMem (maxlen +2); first = buffer; ls = lploc; x_strcpy (buffer, (char*) ls->dbname); ls = ls->pnext; while (ls) { item = (char*) ls->dbname; buffer = buffer + x_strlen (buffer) +1; x_strcpy (buffer, item); ls = ls->pnext; } buffer = buffer + x_strlen (buffer) +1; x_strcpy (buffer, ""); // // Fill all combos // for (i=1; i<maxLine; i++) { ContainerFillComboCell( hwndContainer, i, 1, 0, CONT_ALIGN_LEFT, first); } ESL_FreeMem (first); first = NULL; } lploc = FreeCheckedObjects (lploc); }
static BOOL OccupyLocationControl (HWND hwnd) /* Function: Fills the location drop down box with the location names. Parameters: hwnd - Handle to the dialog window. Returns: TRUE if successful. */ { HWND hwndCtl = GetDlgItem (hwnd, IDC_LOCATIONS); int hNode; int err; BOOL bSystem; char szObject[MAXOBJECTNAME]; char szFilter[MAXOBJECTNAME]; LPUCHAR aparents[MAXPLEVEL]; LPTABLEPARAMS lptbl = GetDlgProp(hwnd); ZEROINIT(aparents); ZEROINIT(szObject); ZEROINIT(szFilter); aparents[0] = lptbl->DBName; hNode = GetCurMdiNodeHandle(); bSystem = GetSystemFlag (); err = DOMGetFirstObject(hNode, OT_LOCATION, 0, aparents, TRUE, NULL, szObject, NULL, NULL); while (err == RES_SUCCESS) { BOOL bOK; if (DOMLocationUsageAccepted(hNode,szObject,LOCATIONDATABASE,&bOK)== RES_SUCCESS && bOK) { CAListBox_AddString(hwndCtl, szObject); } err = DOMGetNextObject (szObject, szFilter, NULL); } return TRUE; }
static BOOL OccupyCddsControl (HWND hwnd) /* Function: Fills the CDDS number in list box. Parameters: hwnd - Handle to the dialog window. Returns: TRUE if successful. */ { int hNode; UCHAR buffilter[MAXOBJECTNAME]; UCHAR CddsName[MAXOBJECTNAME]; LPUCHAR parentstrings [MAXPLEVEL]; BOOL bSystem=FALSE; int ListErr; int err; BOOL bRetVal = TRUE; HWND hwndCtl = GetDlgItem (hwnd, IDC_CDDSNUMBER); LPRECONCILER lpdb = GetDlgProp(hwnd); ZEROINIT (CddsName); hNode = GetCurMdiNodeHandle(); parentstrings [0] = lpdb->DBName; CAListBox_ResetContent(hwndCtl); err = DOMGetFirstObject(hNode, OT_REPLIC_CDDS, 1, parentstrings, bSystem, NULL, CddsName, NULL, NULL ); while (err == RES_SUCCESS) { ListErr=CAListBox_AddString(hwndCtl, CddsName ); if (ListErr == LB_ERR || ListErr == LB_ERRSPACE) bRetVal=FALSE; err = DOMGetNextObject (CddsName, buffilter, NULL); } return bRetVal; }
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { LPLOCATEPARAMS lplocate = GetDlgProp (hwnd); switch (id) { case IDOK: if (FillStructureFromControls (hwnd)) EndDialog (hwnd, TRUE); else { break; } break; case IDCANCEL: EndDialog (hwnd, FALSE); break; case IDC_LOCATE_FIND: if (codeNotify == EN_CHANGE) { //ProhibitString_all (hwnd); EnableDisableOKButton (hwnd); } break; case IDC_LOCATE_OBJECTTYPE: if (codeNotify == CBN_SELCHANGE) { /* Comment on Sept 29'95 ProhibitString_all (hwnd); */ EnableDisableOKButton (hwnd); } break; case IDC_LOCATE_DATABASE: if (codeNotify == CBN_SELCHANGE) { EnableDisableOKButton (hwnd); } break; } }
static void HandleUnknounObject (HWND hwnd) { char message [100]; HWND hwndGrantees = GetDlgItem (hwnd, IDC_REVOKE_TABLE_GRANTEES); LPREVOKEPARAMS lprevoke = GetDlgProp (hwnd); HWND hwndLabel = GetDlgItem (hwnd, IDC_REVOKE_TABLE_LRGDG); ShowWindow (GetDlgItem (hwnd, IDC_REVOKE_TABLE_USER ), SW_HIDE); ShowWindow (GetDlgItem (hwnd, IDC_REVOKE_TABLE_GROUP ), SW_HIDE); ShowWindow (GetDlgItem (hwnd, IDC_REVOKE_TABLE_ROLE ), SW_HIDE); ShowWindow (GetDlgItem (hwnd, IDC_REVOKE_TABLE_PUBLIC), SW_HIDE); LoadString (hResource, (UINT)IDS_I_RG_on_DG, message, sizeof(message)); SetWindowText (hwndLabel, message); ShowWindow (hwndLabel, SW_SHOW); CAListBox_AddString (hwndGrantees, lprevoke->PreselectGrantee); CAListBox_SelectString(hwndGrantees, -1, lprevoke->PreselectGrantee); }
static void AddFile (HWND hwnd, LPTABLExFILE lpFile) { int hdl, ires; BOOL bwsystem; char buf [MAXOBJECTNAME]; char buf2 [MAXOBJECTNAME]; char szOwner [MAXOBJECTNAME]; LPUCHAR parentstrings [MAXPLEVEL]; LPAUDITDBPARAMS lpauditdb = GetDlgProp (hwnd); HWND hwndTables = GetDlgItem (hwnd, IDC_AUDITDBF_TABLE); LPTABLExFILE ls = lpFile, obj; char szFileName[MAXOBJECTNAME]; ZEROINIT (buf); parentstrings [0] = lpauditdb->DBName; parentstrings [1] = NULL; hdl = GetCurMdiNodeHandle (); bwsystem = GetSystemFlag (); ires = DOMGetFirstObject ( hdl, OT_TABLE, 1, parentstrings, bwsystem, NULL, buf, szOwner, NULL); while (ires == RES_SUCCESS) { StringWithOwner (buf, szOwner, buf2); obj = FindStringInListTableAndFile (ls, buf2); if (obj) { wsprintf (szFileName, "%s.trl", RemoveDisplayQuotesIfAny((LPTSTR)StringWithoutOwner(buf))); x_strcpy (obj->FileName, szFileName); } ires = DOMGetNextObject (buf, szOwner, NULL); } }
static void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { switch (id) { case IDOK: { int index; HWND hwndCombo = GetDlgItem (hwnd, IDC_COMBOPAGESIZE); LPTABLEPARAMS lptbl = GetDlgProp(hwnd); HWND hwndLocations = GetDlgItem(hwnd, IDC_LOCATIONS); HWND hwndSecOption = GetDlgItem(hwnd, IDC_SEC_AUDIT_OPTION); HWND hwndLabel = GetDlgItem(hwnd, IDC_LABEL_GRAN); HWND hwndKey = GetDlgItem(hwnd, IDC_SEC_AUDIT_KEY); int nIdx; FreeObjectList (lptbl->lpLocations); // Vut adds lptbl->lpLocations = NULL; // Vut adds lptbl->lpLocations = CreateList4CheckedObjects (hwndLocations); lptbl->bJournaling = IsDlgButtonChecked(hwnd, IDC_JOURNALING); lptbl->bDuplicates = IsDlgButtonChecked(hwnd, IDC_DUPLICATES); index = ComboBox_GetCurSel (hwndCombo); if (index != -1) { lptbl->uPage_size = (LONG)ComboBox_GetItemData (hwndCombo, index); if (lptbl->uPage_size == 2048L) lptbl->uPage_size = 0L; } ComboBox_GetText(hwndKey, lptbl->szSecAuditKey, sizeof(lptbl->szSecAuditKey)); nIdx = ComboBox_GetCurSel(hwndSecOption); lptbl->nSecAudit = (int)ComboBox_GetItemData(hwndSecOption, nIdx); nIdx = ComboBox_GetCurSel(hwndLabel); lptbl->nLabelGran = (int)ComboBox_GetItemData(hwndLabel, nIdx); EndDialog(hwnd, 1); break; } case IDCANCEL: EndDialog(hwnd, 0); break; } }
static void FillAllData (HWND hwnd) { HWND hwndContainer = GetDlgItem (hwnd, IDC_RELOCATE_CONTAINER); LPSTORAGEPARAMS lpstorage = GetDlgProp (hwnd); LPCHECKEDOBJECTS lploc = GetLocations (); LPOBJECTLIST lx; int i = 1; char* item; nLine = ContainerAddCntLine (hwndContainer); ContainerFillTextCell (hwndContainer, 0, 0, CONT_COLTYPE_TITLE, CONT_ALIGN_LEFT, ResourceString ((UINT)IDS_I_OLD_LOCATIONS)); ContainerFillTextCell (hwndContainer, 0, 1, CONT_COLTYPE_TITLE, CONT_ALIGN_LEFT, ResourceString ((UINT)IDS_I_NEW_LOCATIONS)); lx = lpstorage->lpLocations; while (lx) { nLine = ContainerAddCntLine (hwndContainer); lx = lx->lpNext; } ContainerSetColumnWidth (hwndContainer, 0, 26); ContainerSetColumnWidth (hwndContainer, 1, 26); lx = lpstorage->lpLocations; while (lx) { item = (char *)lx->lpObject; ContainerFillTextCell( hwndContainer, i, 0, CONT_COLTYPE_TEXT, CONT_ALIGN_LEFT, item); lx = lx->lpNext; i++; } lploc = FreeCheckedObjects (lploc); FillAllComboCells (hwnd, nLine+1); SelectItemInComboCell (hwnd, nLine); }
// create command line and execute remote command static BOOL SendCommand(HWND hwnd) { //create the command for remote UCHAR buf2[MAXOBJECTNAME*3]; UCHAR buf[MAX_RMCMD_BUFSIZE]; int iReplicVersion; LPRECONCILER lpreconciler = GetDlgProp(hwnd); LPUCHAR vnodeName = GetVirtNodeName(GetCurMdiNodeHandle ()); // Get everything from dd_connections iReplicVersion=GetReplicInstallStatus(GetCurMdiNodeHandle (),lpreconciler->DBName, lpreconciler->DbaName); // Get additionnal information on current CDDS: name,error ,collision if (iReplicVersion == REPLIC_V11) { UCHAR tmpusername[MAXOBJECTNAME]; DBAGetUserName(vnodeName,tmpusername); wsprintf(buf,"reconcil %s %s %s -u%s %s",lpreconciler->DBName, lpreconciler->TarGetDbNumber, lpreconciler->CddsNo, tmpusername, lpreconciler->StarTime); wsprintf(buf2,ResourceString(IDS_REPLIC_REC_1PARM_TITLE), lpreconciler->DBName); } else { wsprintf(buf,"reconcil %s::%s %s %s %s %s", vnodeName, lpreconciler->DBName, lpreconciler->DbaName, lpreconciler->TarGetDbNumber, lpreconciler->CddsNo, lpreconciler->StarTime); wsprintf(buf2,ResourceString(IDS_REPLIC_REC_2PARMS_TITLE), vnodeName, lpreconciler->DBName); } execrmcmd(vnodeName,buf,buf2); return(TRUE); }
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { LPREPLMAILPARAMS lpmail = GetDlgProp (hwnd); HWND hwndMailText = GetDlgItem (hwnd, IDC_MAIL_TEXT); char szText [MAX_MAIL_TEXTLEN]; switch (id) { case IDOK: { int ires; Edit_GetText (hwndMailText, szText, sizeof (szText)); x_strcpy (lpmail->szMailText, szText); ires = DBAAddObject ( GetVirtNodeName ( GetCurMdiNodeHandle ()), OT_REPLIC_MAILUSER, (void *) lpmail); if (ires != RES_SUCCESS) { ErrorMessage ((UINT) IDS_E_REPLMAIL_FAILED, ires); break; } else { EndDialog (hwnd, TRUE); } } break; case IDCANCEL: EndDialog (hwnd, FALSE); break; case IDC_MAIL_TEXT: EnableDisableOKButton (hwnd); break; } }
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { LPGROUPUSERPARAMS lpusr2grp = GetDlgProp (hwnd); switch (id) { case IDOK: { BOOL Success; HWND hwndUser = GetDlgItem (hwnd, IDC_USR2GRP_USERBOX); char szUser [MAXOBJECTNAME]; ComboBox_GetText (hwndUser, szUser, sizeof (szUser)); x_strcpy (lpusr2grp->ObjectName, szUser); Success = CreateObject (hwnd, lpusr2grp); if (!Success) break; else EndDialog (hwnd, TRUE); } break; case IDCANCEL: EndDialog (hwnd, FALSE); break; case IDC_USR2GRP_USERBOX: { switch (codeNotify) { case CBN_SELCHANGE: EnableDisableOKButton (hwnd); } break; } } }
static BOOL FillStructureFromControls (HWND hwnd) { int i; char buffer [MAXOBJECTNAME]; LPOBJECTLIST list = NULL, obj; LPSTORAGEPARAMS lpstorage = GetDlgProp (hwnd); HWND hwndContainer = GetDlgItem (hwnd, IDC_RELOCATE_CONTAINER); // Mandatory in case current cell is a combo ContainerNewSel(hwndContainer); for (i=1; i<= nLine; i++) { ZEROINIT (buffer); ContainerGetComboCellSelection (hwndContainer, i, 1, buffer); obj = AddListObjectTail (&list, x_strlen (buffer) +1); if (obj) { x_strcpy ((UCHAR *)obj->lpObject, buffer); //list = obj; } else { FreeObjectList (list); list = NULL; return FALSE; } } FreeObjectList (lpstorage->lpNewLocations); lpstorage->lpNewLocations = NULL; lpstorage->lpNewLocations = list; return TRUE; }
static void SelectItemInComboCell (HWND hwnd, int nLine) { int i; LPOBJECTLIST lx; char* item; LPSTORAGEPARAMS lpstorage = GetDlgProp (hwnd); HWND hwndContainer = GetDlgItem (hwnd, IDC_RELOCATE_CONTAINER); lx = lpstorage->lpNewLocations; i = 1; while (lx) { item = (char *)lx->lpObject; ContainerSetComboSelection ( hwndContainer, i, 1, item); lx = lx->lpNext; i++; if (i > nLine) break; } }
static void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { switch (id) { case IDOK: { int nIndex; int nCount; int nLast=0; int max; int i; int first=0; UCHAR buf[MAXOBJECTNAME]; HWND hwndCdds = GetDlgItem (hwnd, IDC_CDDSNUMBER); HWND hwndDbNumber = GetDlgItem (hwnd, IDC_DBNUMBER); HWND hwndStartTime= GetDlgItem (hwnd, IDC_STARTTIME); LPRECONCILER lpreconciler = GetDlgProp(hwnd); // fill structure with CDDS values nCount = 0; ZEROINIT (lpreconciler->CddsNo); nCount = CAListBox_GetSelCount(hwndCdds); max = CAListBox_GetCount(hwndCdds); if (nCount != max) { for (i=0;i<max;i++) { if (CAListBox_GetSel (hwndCdds, i)) { char szName[MAX_DBNAME_LEN]; CAListBox_GetText(hwndCdds, i, szName); if (first==0 && nCount>1) { x_strcat(lpreconciler->CddsNo,"'("); first=1; } x_strcat(lpreconciler->CddsNo,szName); nLast++; if ( nLast == nCount && nCount>1 ) x_strcat(lpreconciler->CddsNo,")'"); else { if (nCount>1) x_strcat(lpreconciler->CddsNo,","); } } } } else x_strcat(lpreconciler->CddsNo,"all "); // Fill structure with Targetdbnumber nIndex=ComboBox_GetCurSel(hwndDbNumber); ComboBox_GetLBText(hwndDbNumber, nIndex, buf); GetIntFromStartofString( buf, lpreconciler->TarGetDbNumber); //sscanf (buf,"%s",lpreconciler->TarGetDbNumber ); //Fill structure with the Start time Edit_GetText(hwndStartTime, buf, MAXOBJECTNAME ); x_strcpy (lpreconciler->StarTime,buf); if (SendCommand(hwnd)==TRUE) EndDialog(hwnd, TRUE); break; } case IDCANCEL: EndDialog(hwnd, FALSE); break; case IDC_DBNUMBER: if ( codeNotify == CBN_SELCHANGE) EnableDisableOKButton (hwnd); break; case IDC_CDDSNUMBER: if ( codeNotify == CALBN_CHECKCHANGE || codeNotify == CALBN_SELCHANGE || codeNotify == CALBN_KILLFOCUS ) EnableDisableOKButton (hwnd); break; case IDC_STARTTIME: if (codeNotify == EN_CHANGE) EnableDisableOKButton (hwnd); break; } }
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { LPSECURITYALARMPARAMS lpsecurity = GetDlgProp (hwnd); HWND hwndUsers = GetDlgItem (hwnd, IDC_SALARM_BYUSER ); HWND hwndTables = GetDlgItem (hwnd, IDC_SALARM_ONTABLE ); HWND hwndName = GetDlgItem (hwnd, IDC_SALARM_NAME ); int idu; int i, n, idt; int ires; char szName [MAXOBJECTNAME]; switch (id) { case IDOK: if (!FillStructureFromControls (hwnd, lpsecurity)) break; // // Call the low level function to write data on disk // ires = DBAAddObject (GetVirtNodeName (GetCurMdiNodeHandle ()), OTLL_SECURITYALARM, (void *) lpsecurity ); if (ires != RES_SUCCESS) { FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM); ErrorMessage ((UINT)IDS_E_CREATE_SECURITY_FAILED, ires); break; } else EndDialog (hwnd, TRUE); FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM); break; case IDCANCEL: EndDialog (hwnd, FALSE); FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM); break; case IDC_SALARM_BYUSER: if (Edit_GetText (hwndName, szName, sizeof (szName)) != 0 && CAListBox_GetSelCount (hwndUsers) > 1) { idu=CAListBox_GetCurSel (hwndUsers); n = CAListBox_GetCount (hwndUsers); for (i=0; i<n; i++) CAListBox_SetSel (hwndUsers, FALSE, i); CAListBox_SetCurSel (hwndUsers, idu); CAListBox_SetSel (hwndUsers, TRUE, idu); //"Multiple auth-id is not allowed if the security alarm has a name." MessageBox(hwnd, ResourceString(IDS_ERR_USING_CHECKPOINT), NULL, MB_OK | MB_ICONEXCLAMATION | MB_TASKMODAL); EnableDisableOKButton (hwnd); } else if (CAListBox_GetSelCount (hwndUsers) > 1) Edit_Enable(hwndName,FALSE); else Edit_Enable(hwndName,TRUE); EnableDisableOKButton (hwnd); break; case IDC_SALARM_ONTABLE: if (codeNotify == CALBN_CHECKCHANGE) { idt = CAListBox_GetCurSel (hwndTables); n = CAListBox_GetCount (hwndTables); for (i=0; i<n; i++) CAListBox_SetSel (hwndTables, FALSE, i); CAListBox_SetCurSel (hwndTables, idt); CAListBox_SetSel (hwndTables, TRUE, idt); if (bNoDisplayMessageDB == FALSE) { int iret; //"Only one database can be checked. Previous database, if any, was unchecked.\nDon't display this message any more?" iret = MessageBox(hwnd, ResourceString(IDS_ERR_DATABASE_BE_CHECKED), NULL, MB_OKCANCEL | MB_ICONEXCLAMATION | MB_TASKMODAL); if (iret == IDOK) bNoDisplayMessageDB=TRUE; } } EnableDisableOKButton (hwnd); break; case IDC_SALARM_SUCCESS: case IDC_SALARM_FAILURE: case IDC_SALARM_SUCCESSFAILURE: case IDC_SALARM_SELECT: case IDC_SALARM_DELETE: case IDC_SALARM_INSERT: case IDC_SALARM_UPDATE: case IDC_SALARM_CONNECT: case IDC_SALARM_DISCONNECT: EnableDisableOKButton (hwnd); break; case IDC_SALARM_USER: if (Button_GetCheck (hwndCtl)) { CAListBox_ResetContent (hwndUsers); CAListBoxFillUsers (hwndUsers); EnableDisableOKButton (hwnd); } break; case IDC_SALARM_GROUP: if (Button_GetCheck (hwndCtl)) { CAListBox_ResetContent (hwndUsers); CAListBoxFillGroups (hwndUsers); EnableDisableOKButton (hwnd); } break; case IDC_SALARM_ROLE: if (Button_GetCheck (hwndCtl)) { CAListBox_ResetContent (hwndUsers); CAListBoxFillRoles (hwndUsers); EnableDisableOKButton (hwnd); } break; case IDC_SALARM_PUBLIC: if (Button_GetCheck (hwndCtl)) { CAListBox_ResetContent (hwndUsers); EnableDisableOKButton (hwnd); } break; case IDC_SALARM_DBEVENT: if (codeNotify == CBN_SELCHANGE) { char szItem [MAXOBJECTNAME]; ZEROINIT (szItem); ComboBox_GetText (hwndCtl, szItem, sizeof (szItem)); if (x_strcmp (szItem, szSecurityDBEvent) == 0) { lpsecurity->bDBEvent = FALSE; EnableControl (hwnd, FALSE); } else EnableControl (hwnd, TRUE); } break; } }
static BOOL OccupyDbnumberControl (HWND hwnd) /* Function: Fills the Database Number . Parameters: hwnd - Handle to the dialog window. Returns: TRUE if successful. */ { int hNode; UCHAR buffilter[MAXOBJECTNAME]; UCHAR szObject[MAXOBJECTNAME]; UCHAR szLocalDatabase[MAXOBJECTNAME]; char * lpTemp; LPUCHAR parentstrings [MAXPLEVEL]; int ListErr; int err,iReplicVersion; BOOL bSystem = TRUE; BOOL bRetVal = TRUE; LPUCHAR vnodeName = GetVirtNodeName(GetCurMdiNodeHandle ()); HWND hwndCtl = GetDlgItem (hwnd, IDC_DBNUMBER); LPRECONCILER lpdb = GetDlgProp(hwnd); hNode = GetCurMdiNodeHandle(); parentstrings [0] = lpdb->DBName; wsprintf(szLocalDatabase," %s::%s",vnodeName,lpdb->DBName); ComboBox_ResetContent(hwndCtl); // Get everything from dd_connections iReplicVersion=GetReplicInstallStatus(GetCurMdiNodeHandle (),lpdb->DBName, lpdb->DbaName); // Get additionnal information on current CDDS: name,error ,collision err = DOMGetFirstObject(hNode, OT_REPLIC_CONNECTION, 1, parentstrings, bSystem, NULL, szObject, NULL, NULL); while (err == RES_SUCCESS) { if (iReplicVersion == REPLIC_V11) { ListErr=ComboBox_AddString(hwndCtl, szObject ); if (ListErr == CB_ERR || ListErr == CB_ERRSPACE) bRetVal=FALSE; } else { lpTemp=x_stristr(szObject,szLocalDatabase); if (lpTemp) { if (x_stricmp(lpTemp,szLocalDatabase) != 0) { ListErr=ComboBox_AddString(hwndCtl, szObject ); if (ListErr == CB_ERR || ListErr == CB_ERRSPACE) bRetVal=FALSE; } } } err = DOMGetNextObject (szObject, buffilter, NULL); } ComboBox_SetCurSel(hwndCtl,0); return bRetVal; }
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { LPREVOKEPARAMS lprevoke = GetDlgProp (hwnd); HWND hwndGrantees = GetDlgItem (hwnd, IDC_REVOKE_TABLE_GRANTEES); switch (id) { case IDOK: { TCHAR tchNameObject[MAXOBJECTNAME]; int ires; int max_item_number; max_item_number = CAListBox_GetSelCount (hwndGrantees); if (max_item_number >= 1) { lprevoke->lpgrantee = AddItemToListQuoted (hwndGrantees); if (!lprevoke->lpgrantee) { ErrorMessage ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR); break; } } if (Button_GetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_USER))) lprevoke->GranteeType = OT_USER; else if (Button_GetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_GROUP))) lprevoke->GranteeType = OT_GROUP; else if (Button_GetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_ROLE))) lprevoke->GranteeType = OT_ROLE; else if (Button_GetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_PUBLIC))) { lprevoke->GranteeType = OT_PUBLIC; // Public FreeObjectList (lprevoke->lpgrantee); lprevoke->lpgrantee = NULL; lprevoke->lpgrantee = APublicUser (); if (!lprevoke->lpgrantee) { ErrorMessage ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR); break; } } lprevoke->grant_option = Button_GetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_GRANT_OPTION)); lprevoke->cascade = Button_GetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_CASCADE)); wsprintf(tchNameObject,"%s.%s",QuoteIfNeeded(lprevoke->PreselectObjectOwner),QuoteIfNeeded(lprevoke->PreselectObject)); lprevoke->lpobject = InsertTableName (tchNameObject); if (!lprevoke->lpobject) { FreeObjectList (lprevoke->lpobject); lprevoke->lpobject = NULL; ErrorMessage ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR); break; } ires = DBADropObject ( GetVirtNodeName ( GetCurMdiNodeHandle ()), OTLL_GRANT, (void *) lprevoke); if (ires != RES_SUCCESS) { FreeObjectList (lprevoke->lpgrantee); FreeObjectList (lprevoke->lpobject); lprevoke->lpobject = NULL; lprevoke->lpgrantee= NULL; switch (lprevoke->ObjectType) { case OT_TABLE: ErrorMessage ((UINT)IDS_E_REVOKE_TABLE_FAILED, ires); break; case OT_PROCEDURE: ErrorMessage ((UINT)IDS_E_REVOKE_PROCEDURE_FAILED, ires); break; case OT_DBEVENT: ErrorMessage ((UINT)IDS_E_REVOKE_DBEVENT_FAILED, ires); break; case OT_SEQUENCE: ErrorMessage ((UINT)IDS_E_REVOKE_SEQUENCE_FAILED, ires); break; } break; } else { EndDialog (hwnd, TRUE); } FreeObjectList (lprevoke->lpgrantee); FreeObjectList (lprevoke->lpobject); lprevoke->lpobject = NULL; lprevoke->lpgrantee= NULL; } break; case IDCANCEL: FreeObjectList (lprevoke->lpgrantee); FreeObjectList (lprevoke->lpobject); lprevoke->lpobject = NULL; lprevoke->lpgrantee= NULL; EndDialog (hwnd, FALSE); break; case IDC_REVOKE_TABLE_USER: CAListBox_ResetContent (hwndGrantees); lprevoke->GranteeType = OT_USER; FillGrantedUsers (hwndGrantees, lprevoke, HaveBeenGranted); EnableDisableOKButton (hwnd); break; case IDC_REVOKE_TABLE_GROUP: CAListBox_ResetContent (hwndGrantees); lprevoke->GranteeType = OT_GROUP; FillGrantedUsers (hwndGrantees, lprevoke, HaveBeenGranted); EnableDisableOKButton (hwnd); break; case IDC_REVOKE_TABLE_ROLE: CAListBox_ResetContent (hwndGrantees); lprevoke->GranteeType = OT_ROLE; FillGrantedUsers (hwndGrantees, lprevoke, HaveBeenGranted); EnableDisableOKButton (hwnd); break; case IDC_REVOKE_TABLE_PUBLIC: CAListBox_ResetContent (hwndGrantees); EnableDisableOKButton (hwnd); break; case IDC_REVOKE_TABLE_GRANTEES: if (lprevoke->GranteeType != OT_UNKNOWN) EnableDisableOKButton (hwnd); else EnableDisableOKButton2 (hwnd); break; } }
static BOOL FillStructureFromControls (HWND hwnd) { char szGreatBuffer [MAX_RMCMD_BUFSIZE]; char szBufferT [MAX_RMCMD_BUFSIZE]; char szBufferF [MAX_RMCMD_BUFSIZE]; char szSyscat [22]; char szBefore [22]; char szAfter [22]; char szCn [10]; char szActUser [MAXOBJECTNAME]; char szUserName [MAXOBJECTNAME]; char buftemp[200]; HWND hwndSyscat = GetDlgItem (hwnd, IDC_AUDITDB_SYSCAT); HWND hwndBefore = GetDlgItem (hwnd, IDC_AUDITDB_BEFORE); HWND hwndAfter = GetDlgItem (hwnd, IDC_AUDITDB_AFTER); HWND hwndCn = GetDlgItem (hwnd, IDC_AUDITDB_CKP_NUMBER); HWND hwndActUser = GetDlgItem (hwnd, IDC_AUDITDB_ACTION_USER); HWND hwndWait = GetDlgItem (hwnd, IDC_AUDITDB_WAIT); HWND hwndInconsistent = GetDlgItem (hwnd, IDC_AUDITDB_INCONSISTENT); HWND hwndTable = GetDlgItem (hwnd, IDC_AUDITDB_TABLES); HWND hwndFile = GetDlgItem (hwnd, IDC_AUDITDB_FILES); LPUCHAR vnodeName = GetVirtNodeName (GetCurMdiNodeHandle ()); LPAUDITDBPARAMS lpauditdb = GetDlgProp (hwnd); LPTABLExFILE ls = lpfile; ZEROINIT (szGreatBuffer); ZEROINIT (szBufferT); ZEROINIT (szBufferF); ZEROINIT (szSyscat); ZEROINIT (szBefore); ZEROINIT (szAfter); ZEROINIT (szCn); ZEROINIT (szActUser); // Verify if the length of the remote command do not exceed MAX_LINE_COMMAND. if (!VerifyBufferLen(hwnd)) { ErrorMessage ((UINT) IDS_E_TOO_MANY_TABLES_SELECTED, RES_ERR); return FALSE; } if (Button_GetCheck (hwndFile)) x_strcpy (szBufferF, " -file"); if (Button_GetCheck (hwndTable)) { char* aTable; LPOBJECTLIST list = table.lpTable; if (list) { aTable = (LPTSTR)RemoveDisplayQuotesIfAny((LPTSTR)StringWithoutOwner(list->lpObject)); x_strcpy (szBufferT, " -table="); x_strcat (szBufferT, aTable); list = list->lpNext; } while (list) { x_strcat (szBufferT, ","); aTable = (LPTSTR)RemoveDisplayQuotesIfAny((LPTSTR)StringWithoutOwner(list->lpObject)); x_strcat (szBufferT, aTable); list = list->lpNext; } } if (Button_GetCheck (hwndFile) && ls && Modify (ls)) { x_strcpy (szBufferF, " -file="); x_strcat (szBufferF, ls->FileName); ls = ls->next; while (ls) { x_strcat (szBufferF, ","); x_strcat (szBufferF, ls->FileName); ls = ls->next; } } if (Button_GetCheck (hwndSyscat)) x_strcpy (szSyscat, "-a"); else x_strcpy (szSyscat, ""); wsprintf (szGreatBuffer, "auditdb %s %s %s %s", szSyscat, lpauditdb->DBName, szBufferT, szBufferF); Edit_GetText (hwndAfter, szAfter, sizeof (szAfter )); Edit_GetText (hwndBefore, szBefore, sizeof (szBefore)); Edit_GetText (hwndCn, szCn, sizeof (szCn)); ComboBox_GetText (hwndActUser, szActUser, sizeof (szActUser)); if (x_strlen (szAfter) > 0) { x_strcat (szGreatBuffer, " -b"); x_strcat (szGreatBuffer, szAfter); } if (x_strlen (szBefore) > 0) { x_strcat (szGreatBuffer, " -e"); x_strcat (szGreatBuffer, szBefore); } if (Button_GetCheck (GetDlgItem (hwnd, IDC_AUDITDB_CKP))) { x_strcat (szGreatBuffer, " #c"); if (x_strlen (szCn) > 0) x_strcat (szGreatBuffer, szCn); } if (x_strlen (szActUser) > 0) { x_strcat (szGreatBuffer, " -i"); x_strcat (szGreatBuffer, szActUser); } if (Button_GetCheck (hwndWait)) x_strcat (szGreatBuffer, " -wait"); if (Button_GetCheck (hwndInconsistent)) x_strcat (szGreatBuffer, " -inconsistent"); ZEROINIT (szUserName); DBAGetUserName (vnodeName, szUserName); x_strcat (szGreatBuffer, " -u"); x_strcat (szGreatBuffer, szUserName); wsprintf(buftemp, ResourceString ((UINT)IDS_T_RMCMD_AUDITDB), //"auditing database %s::%s", vnodeName, lpauditdb->DBName); execrmcmd(vnodeName,szGreatBuffer,buftemp); return TRUE; }
static BOOL VerifyBufferLen(HWND hwnd) { char szSyscat [22]; char szBefore [22]; char szAfter [22]; char szCn [10]; char szActUser [MAXOBJECTNAME]; char szUserName [MAXOBJECTNAME]; int nTotalLen = 0; HWND hwndSyscat = GetDlgItem (hwnd, IDC_AUDITDB_SYSCAT); HWND hwndBefore = GetDlgItem (hwnd, IDC_AUDITDB_BEFORE); HWND hwndAfter = GetDlgItem (hwnd, IDC_AUDITDB_AFTER); HWND hwndCn = GetDlgItem (hwnd, IDC_AUDITDB_CKP_NUMBER); HWND hwndActUser = GetDlgItem (hwnd, IDC_AUDITDB_ACTION_USER); HWND hwndWait = GetDlgItem (hwnd, IDC_AUDITDB_WAIT); HWND hwndInconsistent = GetDlgItem (hwnd, IDC_AUDITDB_INCONSISTENT); HWND hwndTable = GetDlgItem (hwnd, IDC_AUDITDB_TABLES); HWND hwndFile = GetDlgItem (hwnd, IDC_AUDITDB_FILES); LPAUDITDBPARAMS lpauditdb = GetDlgProp (hwnd); LPTABLExFILE ls = lpfile; ZEROINIT (szSyscat); ZEROINIT (szBefore); ZEROINIT (szAfter); ZEROINIT (szCn); ZEROINIT (szActUser); if (Button_GetCheck (hwndFile) && !ls) nTotalLen = x_strlen (" -file"); if (Button_GetCheck (hwndTable)) { char* aTable; LPOBJECTLIST list = table.lpTable; if (list) { aTable = (LPTSTR)RemoveDisplayQuotesIfAny((LPTSTR)StringWithoutOwner(list->lpObject)); nTotalLen += x_strlen (" -table="); nTotalLen += x_strlen (aTable); list = list->lpNext; } while (list) { nTotalLen += x_strlen (","); aTable = (LPTSTR)RemoveDisplayQuotesIfAny((LPTSTR)StringWithoutOwner(list->lpObject)); nTotalLen += x_strlen ( aTable); list = list->lpNext; } } if (Button_GetCheck (hwndFile) && ls && Modify (ls)) { if (ls) { nTotalLen += x_strlen (" -file="); nTotalLen += x_strlen (ls->FileName); ls = ls->next; } while (ls) { nTotalLen += x_strlen(","); nTotalLen += x_strlen (ls->FileName); ls = ls->next; } } if (Button_GetCheck (hwndSyscat)) nTotalLen += x_strlen ("-a"); nTotalLen += x_strlen ("auditdb "); nTotalLen += x_strlen (lpauditdb->DBName); Edit_GetText (hwndAfter, szAfter, sizeof (szAfter )); Edit_GetText (hwndBefore, szBefore, sizeof (szBefore)); Edit_GetText (hwndCn, szCn, sizeof (szCn)); ComboBox_GetText (hwndActUser, szActUser, sizeof (szActUser)); if (x_strlen (szAfter) > 0) { nTotalLen += x_strlen (" -b"); nTotalLen += x_strlen (szAfter); } if (x_strlen (szBefore) > 0) { nTotalLen += x_strlen (" -e"); nTotalLen += x_strlen (szBefore); } if (Button_GetCheck (GetDlgItem (hwnd, IDC_AUDITDB_CKP))) { nTotalLen += x_strlen (" #c"); if (x_strlen (szCn) > 0) nTotalLen += x_strlen (szCn); } if (x_strlen (szActUser) > 0) { nTotalLen += x_strlen (" -i"); nTotalLen += x_strlen (szActUser); } if (Button_GetCheck (hwndWait)) nTotalLen += x_strlen (" -wait"); if (Button_GetCheck (hwndInconsistent)) nTotalLen += x_strlen (" -inconsistent"); ZEROINIT (szUserName); DBAGetUserName (GetVirtNodeName ( GetCurMdiNodeHandle ()), szUserName); nTotalLen += x_strlen (" -u"); nTotalLen += x_strlen (szUserName); if (nTotalLen<MAX_LINE_COMMAND) return TRUE; else return FALSE; }
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { LPAUDITDBPARAMS lpauditdb = GetDlgProp (hwnd); BOOL Success; switch (id) { case IDOK: if (lpauditdb->bStartSinceTable) { char szTblOwner[MAXOBJECTNAME]; OwnerFromString(table.lpTable->lpObject, szTblOwner); if ( IsTheSameOwner(GetCurMdiNodeHandle(),szTblOwner) == FALSE ) break; if ( table.bRefuseTblWithDupName && IsTableNameUnique(GetCurMdiNodeHandle(),lpauditdb->DBName,table.lpTable->lpObject) == FALSE) break; } Success = FillStructureFromControls (hwnd); if (!Success) break; else { FreeObjectList (table.lpTable); table.lpTable = NULL; lpfile = FreeTableAndFile (lpfile); EndDialog (hwnd, TRUE); } break; case IDCANCEL: FreeObjectList (table.lpTable); table.lpTable = NULL; lpfile = FreeTableAndFile (lpfile); EndDialog (hwnd, FALSE); break; case IDC_AUDITDB_CKP: EnableDisableControls (hwnd); break; case IDC_AUDITDB_CKP_BUTTON: { char szCurChkPtNum[MAXOBJECTNAME]; char szUserName [MAXOBJECTNAME]; int ires; LPUCHAR vnodeName = GetVirtNodeName (GetCurMdiNodeHandle ()); DBAGetUserName (GetVirtNodeName ( GetCurMdiNodeHandle ()), szUserName); ires = MfcDlgCheckPointLst(lpauditdb->DBName ,szUserName, vnodeName, szCurChkPtNum); if (ires != IDCANCEL) Edit_SetText (GetDlgItem (hwnd, IDC_AUDITDB_CKP_NUMBER), szCurChkPtNum); break; } case IDC_AUDITDB_IDTABLE: { int iret; char* aString; char szTable [MAXOBJECTNAME]; LPOBJECTLIST ls; LPTABLExFILE lf; x_strcpy (table.DBName, lpauditdb->DBName); table.bRefuseTblWithDupName = TRUE; iret = DlgAuditDBTable (hwnd, &table); ls = table.lpTable; EnableDisableControls (hwnd); while (ls) { aString = (char *)ls->lpObject; if (!FindStringInListTableAndFile (lpfile, aString)) { // // Add table into TABLExFILE // lpfile = AddElement (lpfile, aString); } ls = ls->lpNext; } AddFile (hwnd, lpfile); lf = lpfile; while (lf) { if (!FindStringInListObject (table.lpTable, lf->TableName)) { // // Delete table from TABLExFILE // x_strcpy (szTable, lf->TableName); lf = lf->next; lpfile = RemoveElement (lpfile, szTable); } else lf = lf->next; } } break; case IDC_AUDITDB_IDFILE: { int iret; AUDITDBFPARAMS file; ZEROINIT (file); x_strcpy (file.DBName, lpauditdb->DBName); file.lpTableAndFile = lpfile; iret = DlgAuditDBFile (hwnd, &file); if (iret) lpfile = file.lpTableAndFile; } break; case IDC_AUDITDB_TABLES: EnableDisableControls (hwnd); break; case IDC_AUDITDB_FILES: EnableDisableControls (hwnd); break; } }
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { LPGRANTPARAMS lpgrant = GetDlgProp (hwnd); HWND hwndGrantees = GetDlgItem (hwnd, IDC_GRANT_DBEVENT_GRANTEES); HWND hwndDBevents = GetDlgItem (hwnd, IDC_GRANT_DBEVENT_DBEVENT); int ires; switch (id) { case IDOK: if (!FillStructureFromControls (hwnd, lpgrant)) break; ires = DBAAddObject (GetVirtNodeName (GetCurMdiNodeHandle ()), OTLL_GRANT, (void *) lpgrant); if (ires != RES_SUCCESS) { FreeAttachedPointers (lpgrant, OTLL_GRANT); ErrorMessage ((UINT)IDS_E_GRANT_DBEVENT_FAILED, RES_ERR); break; } else EndDialog (hwnd, TRUE); FreeAttachedPointers (lpgrant, OTLL_GRANT); break; case IDCANCEL: EndDialog (hwnd, FALSE); break; case IDC_GRANT_DBEVENT_RAISE: case IDC_GRANT_DBEVENT_REGISTER: EnableDisableOKButton (hwnd); break; case IDC_GRANT_DBEVENT_GRANTEES: case IDC_GRANT_DBEVENT_DBEVENT: EnableDisableOKButton (hwnd); break; case IDC_GRANT_DBEVENT_USER: CAListBox_ResetContent (hwndGrantees); FillGrantees (hwndGrantees, OT_USER); EnableDisableOKButton (hwnd); break; case IDC_GRANT_DBEVENT_GROUP: CAListBox_ResetContent (hwndGrantees); FillGrantees (hwndGrantees, OT_GROUP); EnableDisableOKButton (hwnd); break; case IDC_GRANT_DBEVENT_ROLE: CAListBox_ResetContent (hwndGrantees); FillGrantees (hwndGrantees, OT_ROLE); EnableDisableOKButton (hwnd); break; case IDC_GRANT_DBEVENT_PUBLIC: CAListBox_ResetContent (hwndGrantees); EnableDisableOKButton (hwnd); break; } }
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { LPGRANTPARAMS lpgrant = GetDlgProp (hwnd); HWND hwndDatabases = GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_DATABASES); HWND hwndGrantees = GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_GRANTEES); HWND hwndProcedures = GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_PROCEDURES); int ires; switch (id) { case IDOK: if (!FillStructureFromControls (hwnd, lpgrant)) break; ires = DBAAddObject (GetVirtNodeName ( GetCurMdiNodeHandle ()), OTLL_GRANT, (void *) lpgrant); if (ires != RES_SUCCESS) { FreeAttachedPointers (lpgrant, OTLL_GRANT); ErrorMessage ((UINT)IDS_E_GRANT_PROCEDURE_FAILED, ires); break; } else EndDialog (hwnd, TRUE); FreeAttachedPointers (lpgrant, OTLL_GRANT); break; case IDCANCEL: FreeAttachedPointers (lpgrant, OTLL_GRANT); EndDialog (hwnd, FALSE); break; case IDC_GNREF_PROCEDURE_PROCEDURES: case IDC_GNREF_PROCEDURE_GRANTEES: EnableDisableOKButton (hwnd); break; case IDC_GNREF_PROCEDURE_USER: CAListBox_ResetContent (hwndGrantees); FillGrantees (hwndGrantees, OT_USER); EnableDisableOKButton (hwnd); break; case IDC_GNREF_PROCEDURE_GROUP: CAListBox_ResetContent (hwndGrantees); FillGrantees (hwndGrantees, OT_GROUP); EnableDisableOKButton (hwnd); break; case IDC_GNREF_PROCEDURE_ROLE: CAListBox_ResetContent (hwndGrantees); FillGrantees (hwndGrantees, OT_ROLE); EnableDisableOKButton (hwnd); break; case IDC_GNREF_PROCEDURE_PUBLIC: CAListBox_ResetContent (hwndGrantees); EnableDisableOKButton (hwnd); break; case IDC_GNREF_PROCEDURE_DATABASES: { char selString [MAXOBJECTNAME+1]; if (codeNotify == CBN_SELCHANGE) { CAListBoxDestroyItemData (hwndProcedures); CAListBox_ResetContent (hwndProcedures); ComboBox_GetText (hwndDatabases, selString, sizeof (selString)); x_strcpy (lpgrant->DBName, selString); if (lpgrant->ObjectType == OT_PROCEDURE) { if (!CAListBoxFillProcedures (hwndProcedures, selString)) CAListBoxDestroyItemData (hwndProcedures); } else { if (!CAListBoxFillSequences (hwndProcedures, lpgrant->DBName)) CAListBoxDestroyItemData (hwndProcedures); } } EnableDisableOKButton (hwnd); } break; } }
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { LPSECURITYALARMPARAMS lpsecurity = GetDlgProp (hwnd); int ires; switch (id) { case IDOK: if (!FillStructureFromControls (hwnd, lpsecurity)) break; // // Call the low level function to write data on disk // ires = DBAAddObject ( GetVirtNodeName ( GetCurMdiNodeHandle ()), OTLL_SECURITYALARM, (void *) lpsecurity ); if (ires != RES_SUCCESS) { FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM); ErrorMessage ((UINT)IDS_E_CREATE_SECURITY_FAILED, ires); break; } else EndDialog (hwnd, TRUE); FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM); break; case IDCANCEL: FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM); EndDialog (hwnd, FALSE); break; case IDC_REFALARM_BYUSER: EnableDisableOKButton (hwnd); break; case IDC_REFALARM_DATABASE: { char szDatabaseName [MAXOBJECTNAME]; HWND hwndDatabase = GetDlgItem (hwnd, IDC_REFALARM_DATABASE); HWND hwndTables = GetDlgItem (hwnd, IDC_REFALARM_ONTABLE); switch (codeNotify) { case CBN_SELCHANGE: ComboBox_GetText (hwndDatabase, szDatabaseName, sizeof (szDatabaseName)); if (x_strlen (szDatabaseName) > 0) { x_strcpy (lpsecurity->DBName, szDatabaseName); CAListBoxDestroyItemData (hwndTables); CAListBox_ResetContent (hwndTables); if (!CAListBoxFillTables (hwndTables, lpsecurity->DBName, FALSE)) CAListBoxDestroyItemData (hwndTables); } break; } EnableDisableOKButton (hwnd); } break; case IDC_REFALARM_ONTABLE: EnableDisableOKButton (hwnd); break; case IDC_REFALARM_SUCCESS: case IDC_REFALARM_FAILURE: case IDC_REFALARM_SELECT: case IDC_REFALARM_DELETE: case IDC_REFALARM_INSERT: case IDC_REFALARM_UPDATE: EnableDisableOKButton (hwnd); break; } }