static BOOL FillStructureFromControls (HWND hwnd, LPGRANTPARAMS lpgrant) { HWND hwndGrantees = GetDlgItem (hwnd, IDC_GRANT_DBEVENT_GRANTEES); HWND hwndDBevents = GetDlgItem (hwnd, IDC_GRANT_DBEVENT_DBEVENT); int max_item_number = CAListBox_GetSelCount (hwndDBevents); if (max_item_number >= 1) { lpgrant->lpobject = AddItemToListWithOwner (hwndDBevents); if (!lpgrant->lpobject) { FreeAttachedPointers (lpgrant, OTLL_GRANT); ErrorMessage ((UINT) IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR); return FALSE; } } max_item_number = CAListBox_GetSelCount (hwndGrantees); if (max_item_number >= 1) { lpgrant->lpgrantee = AddItemToListQuoted (hwndGrantees); if (!lpgrant->lpgrantee) { FreeAttachedPointers (lpgrant, OTLL_GRANT); ErrorMessage ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR); EndDialog (hwnd, FALSE); return FALSE; } } if (Button_GetCheck (GetDlgItem (hwnd, IDC_GRANT_DBEVENT_USER))) lpgrant->GranteeType = OT_USER; else if (Button_GetCheck (GetDlgItem (hwnd, IDC_GRANT_DBEVENT_GROUP))) lpgrant->GranteeType = OT_GROUP; else if (Button_GetCheck (GetDlgItem (hwnd, IDC_GRANT_DBEVENT_ROLE))) lpgrant->GranteeType = OT_ROLE; else if (Button_GetCheck (GetDlgItem (hwnd, IDC_GRANT_DBEVENT_PUBLIC))) { lpgrant->GranteeType = OT_PUBLIC; // Public FreeObjectList (lpgrant->lpgrantee); lpgrant->lpgrantee= NULL; lpgrant->lpgrantee = APublicUser (); if (!lpgrant->lpgrantee) { FreeAttachedPointers (lpgrant, OTLL_GRANT); ErrorMessage ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR); return FALSE; } } lpgrant->Privileges [GRANT_RAISE] = Button_GetCheck (GetDlgItem (hwnd, IDC_GRANT_DBEVENT_RAISE)); lpgrant->Privileges [GRANT_REGISTER] = Button_GetCheck (GetDlgItem (hwnd, IDC_GRANT_DBEVENT_REGISTER)); lpgrant->grant_option = Button_GetCheck (GetDlgItem (hwnd, IDC_GRANT_DBEVENT_OPTION)); return TRUE; }
void CxDlgUserMod::OnDestroy() { CDialog::OnDestroy(); if (m_lpTblParam.lpTable) { FreeObjectList(m_lpTblParam.lpTable); m_lpTblParam.lpTable = NULL; } PopHelpId(); }
void CxDlgObjectComment::OnDestroy() { CDialog::OnDestroy(); ObjectColumn_Done(); FreeObjectList(m_ListColumn); m_ListColumn = NULL; if (m_tcObjComment) ESL_FreeMem(m_tcObjComment); m_ImageList.DeleteImageList(); PopHelpId(); }
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; }
void FreeAll() { ResetUndo(); demo.scene.clear(); for(int i=0; i<256; i++) demo.FreePrimitive(i); FreeSceneList(); FreeSceneObjectList(); FreeObjectList(); FreeCloneWindow(); FreeSynthWindow(); FreeSoundWindow(); //RefreshAllView(); }
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; } }
TinselEngine::~TinselEngine() { if (MoviePlaying()) FinishBMV(); AudioCD.stop(); delete _sound; delete _midiMusic; delete _pcmMusic; delete _console; delete _driver; _screenSurface.free(); FreeSaveScenes(); FreeTextBuffer(); FreeHandleTable(); FreeActors(); FreeObjectList(); FreeGlobalProcesses(); FreeGlobals(); delete _scheduler; }
TinselEngine::~TinselEngine() { if (_bmv->MoviePlaying()) _bmv->FinishBMV(); _system->getAudioCDManager()->stop(); delete _bmv; delete _sound; delete _midiMusic; delete _pcmMusic; delete _console; _screenSurface.free(); FreeSaveScenes(); FreeTextBuffer(); FreeHandleTable(); FreeActors(); FreeObjectList(); FreeGlobalProcesses(); FreeGlobals(); delete _config; MemoryDeinit(); }
static void EnableDisableControls (HWND hwnd) { if (Button_GetCheck (GetDlgItem (hwnd, IDC_AUDITDB_TABLES))) EnableWindow (GetDlgItem (hwnd, IDC_AUDITDB_IDTABLE), TRUE); else { EnableWindow (GetDlgItem (hwnd, IDC_AUDITDB_IDTABLE), FALSE); FreeObjectList (table.lpTable); table.lpTable = NULL; lpfile = FreeTableAndFile (lpfile); } if (table.lpTable) { EnableWindow (GetDlgItem (hwnd, IDC_AUDITDB_FILES), TRUE); if (Button_GetCheck (GetDlgItem (hwnd, IDC_AUDITDB_FILES))) EnableWindow (GetDlgItem (hwnd, IDC_AUDITDB_IDFILE), TRUE); else EnableWindow (GetDlgItem (hwnd, IDC_AUDITDB_IDFILE), FALSE); } else { Button_SetCheck (GetDlgItem (hwnd, IDC_AUDITDB_FILES), FALSE); EnableWindow (GetDlgItem (hwnd, IDC_AUDITDB_FILES), FALSE); EnableWindow (GetDlgItem (hwnd, IDC_AUDITDB_IDFILE), FALSE); } if (Button_GetCheck (GetDlgItem (hwnd, IDC_AUDITDB_CKP))) { EnableWindow (GetDlgItem (hwnd, IDC_AUDITDB_CKP_BUTTON), TRUE); EnableWindow (GetDlgItem (hwnd, IDC_AUDITDB_CKP_NUMBER), TRUE); } else { EnableWindow (GetDlgItem (hwnd, IDC_AUDITDB_CKP_BUTTON), FALSE); EnableWindow (GetDlgItem (hwnd, IDC_AUDITDB_CKP_NUMBER), FALSE); } }
static BOOL FillStructureFromControls (HWND hwnd, LPGRANTPARAMS lpgrant) { int max_item_number; HWND hwndDatabases = GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_DATABASES); HWND hwndGrantees = GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_GRANTEES); HWND hwndProcedures= GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_PROCEDURES); max_item_number = CAListBox_GetSelCount (hwndProcedures); if (max_item_number >= 1) { lpgrant->lpobject = AddItemToList (hwndProcedures); if (!lpgrant->lpobject) { FreeAttachedPointers (lpgrant, OTLL_GRANT); ErrorMessage ((UINT) IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR); return FALSE; } } max_item_number = CAListBox_GetSelCount (hwndGrantees); if (max_item_number >= 1) { lpgrant->lpgrantee = AddItemToList (hwndGrantees); if (!lpgrant->lpgrantee) { FreeAttachedPointers (lpgrant, OTLL_GRANT); ErrorMessage ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR); return FALSE; } } if (Button_GetCheck (GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_USER))) lpgrant->GranteeType = OT_USER; else if (Button_GetCheck (GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_GROUP))) lpgrant->GranteeType = OT_GROUP; else if (Button_GetCheck (GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_ROLE))) lpgrant->GranteeType = OT_ROLE; else if (Button_GetCheck (GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_PUBLIC))) { lpgrant->GranteeType = OT_PUBLIC; // Public FreeObjectList (lpgrant->lpgrantee); lpgrant->lpgrantee = APublicUser (); if (!lpgrant->lpgrantee) { FreeAttachedPointers (lpgrant, OTLL_GRANT); ErrorMessage ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR); return FALSE; } } if (lpgrant->ObjectType == OT_SEQUENCE) { lpgrant->grant_option = FALSE; lpgrant->Privileges[GRANT_NEXT_SEQUENCE] = TRUE; return TRUE; } lpgrant->grant_option = Button_GetCheck (GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_OPTION)); return TRUE; }
// This function allocates a BM Object and assign a space in the global // cache buffer. // A BM Object can be any block of data. It has to be sector aligned BOOL AllocateObjectList(DWORD dwSecPos, DWORD dwSectors, PDISK_CACHE pCache, PBLKMOVER_DATA pBlkMoverData, DWORD dwObjSize, PYG_LIST pBMObjList) { PYG_LIST pCacheObjList; PCACHE_OBJECT pFirstObj; PCACHE_OBJECT pObj; PCACHE_OBJECT pCacheObj; DWORD dwRdLeft; DWORD dwRdRight; DWORD dwObjLeft; DWORD dwObjRight; DWORD dwEnd; BOOL bSucc; bSucc = TRUE; pFirstObj = NULL; pCacheObjList = pCache->pObjList; ASSERT(pCacheObjList); ASSERT(dwSectors > 0); dwRdLeft = dwSecPos; dwRdRight = dwSecPos+dwSectors; // loop through the allocated objects to process all overlapping regions for (pCacheObj = (PCACHE_OBJECT)YG_List_Get_First(pCacheObjList); pCacheObj && dwRdLeft < dwRdRight && bSucc; pCacheObj = (PCACHE_OBJECT)YG_List_Get_Next(pCacheObjList,(PVOID)pCacheObj)) { dwObjLeft = pCacheObj->DiskRange.dwSecAddr; dwObjRight = pCacheObj->DiskRange.dwSecAddr+pCacheObj->DiskRange.dwSectors; // Skip NULL objects. if (dwObjRight > dwObjLeft) { // Regions overlap if (dwRdLeft < dwObjLeft && bSucc) { dwRdLeft = MIN(dwRdRight,dwObjLeft); } if (dwRdLeft == dwObjLeft && dwRdLeft < dwRdRight && bSucc) { if (dwRdRight < dwObjRight && bSucc) { // Split the obj ProcessAllocatedRegionRight(pCache,pCacheObj,dwObjRight-dwRdRight); dwObjRight = pCacheObj->DiskRange.dwSecAddr+pCacheObj->DiskRange.dwSectors; } if (dwRdRight >= dwObjRight && bSucc) { // increase the use cnt and adjust the LRU list ProcessOverlappedRegion(pCache,pCacheObj,&dwRdLeft); } } if (dwRdLeft > dwObjLeft && dwRdLeft < dwObjRight && dwRdLeft < dwRdRight && bSucc) { // Split object ProcessAllocatedRegionLeft(pCache,pCacheObj,dwRdLeft-dwObjLeft); } } } // loop through the allocated objects to allocate unoverlapped regions dwRdLeft = dwSecPos; dwRdRight = dwSecPos+dwSectors; for (pCacheObj = (PCACHE_OBJECT)YG_List_Get_First(pCacheObjList); pCacheObj && dwRdLeft < dwRdRight && bSucc; pCacheObj = (PCACHE_OBJECT)YG_List_Get_Next(pCacheObjList,(PVOID)pCacheObj)) { dwObjLeft = pCacheObj->DiskRange.dwSecAddr; dwObjRight = pCacheObj->DiskRange.dwSecAddr+pCacheObj->DiskRange.dwSectors; // Skip NULL objects. if (dwObjRight > dwObjLeft) { // Regions overlap if (dwRdLeft < dwObjLeft && bSucc) { // At least part of the region is not in the cache must create a new object if (!CreateObjUnAllocatedRegion(pCache,pBlkMoverData,&pCacheObj,&dwRdLeft,dwRdRight,dwObjSize,pBMObjList)) { FreeObjectList(pBMObjList,pCache); return FALSE; } if (pCacheObj) { dwObjLeft = pCacheObj->DiskRange.dwSecAddr; dwObjRight = pCacheObj->DiskRange.dwSecAddr+pCacheObj->DiskRange.dwSectors; } else break; } // Skip object if (dwRdLeft == dwObjLeft && dwRdRight > dwRdLeft && bSucc) { CreateObjOverlappedRegion(pCache,pCacheObj,&dwRdLeft,dwObjSize,pBMObjList); } } } if (dwRdLeft < dwRdRight) { // un processed region found. Create a new object and add it to the tail if (!CreateObjUnAllocatedRegion(pCache,pBlkMoverData,&pCacheObj,&dwRdLeft,dwRdRight,dwObjSize,pBMObjList)) { FreeObjectList(pBMObjList,pCache); return FALSE; } } return bSucc; }
LONG CuDlgDomPropTableColumns::OnUpdateData (WPARAM wParam, LPARAM lParam) { // cast received parameters int nNodeHandle = (int)wParam; LPIPMUPDATEPARAMS pUps = (LPIPMUPDATEPARAMS)lParam; ASSERT (nNodeHandle != -1); ASSERT (pUps); // ignore selected actions on filters switch (pUps->nIpmHint) { case 0: //case FILTER_DOM_SYSTEMOBJECTS: //case FILTER_DOM_BASEOWNER: //case FILTER_DOM_OTHEROWNER: break; case FILTER_DOM_BKREFRESH_DETAIL: if (m_Data.m_refreshParams.MustRefresh(pUps->pSFilter->bOnLoad, pUps->pSFilter->refreshtime)) break; // need to update else return 0; // no need to update break; case FILTER_SETTING_CHANGE: VDBA_OnGeneralSettingChange(&m_cListColumns); return 0L; default: return 0L; // nothing to change on the display } // Get info on the object TABLEPARAMS tableparams; memset (&tableparams, 0, sizeof (tableparams)); LPTREERECORD lpRecord = (LPTREERECORD)pUps->pStruct; ASSERT (lpRecord); ResetDisplay(); x_strcpy ((char *)tableparams.DBName, (const char *)lpRecord->extra); x_strcpy ((char *)tableparams.objectname, RemoveDisplayQuotesIfAny((LPCTSTR)StringWithoutOwner(lpRecord->objName))); x_strcpy ((char *)tableparams.szSchema, (const char *)lpRecord->ownerName); tableparams.detailSubset = TABLE_SUBSET_COLUMNSONLY; // minimize query duration int dummySesHndl; int iResult = GetDetailInfo ((LPUCHAR)GetVirtNodeName(nNodeHandle), OT_TABLE, &tableparams, FALSE, &dummySesHndl); if (iResult != RES_SUCCESS) { // Table may not exist if propagate too fast if (iResult != RES_ENDOFDATA) ASSERT (FALSE); // Reset m_Data CuDomPropDataTableColumns tempData; tempData.m_refreshParams = m_Data.m_refreshParams; m_Data = tempData; // Create error item and that's it! /* "<Data Unavailable>" */ CuTblColumn tblColumn1(VDBA_MfcResourceString (IDS_DATA_UNAVAILABLE)); m_Data.m_uaColumns.Add(tblColumn1); // Refresh display RefreshDisplay(); return 0L; } // Update refresh info m_Data.m_refreshParams.UpdateRefreshParams(); TCHAR *lpObjComment = NULL; int iret = RES_SUCCESS; LPOBJECTLIST ls ,lpColTemp,lpObjCol = NULL; LPCOMMENTCOLUMN lpCommentCol; ls = tableparams.lpColumns; while (ls) { lpColTemp = AddListObjectTail(&lpObjCol, sizeof(COMMENTCOLUMN)); if (!lpColTemp) { // Need to free previously allocated objects. FreeObjectList(lpObjCol); lpObjCol = NULL; break; } LPCOLUMNPARAMS lstbl=(LPCOLUMNPARAMS)ls->lpObject; lpCommentCol = (LPCOMMENTCOLUMN)lpColTemp->lpObject; lstrcpy((LPTSTR)lpCommentCol->szColumnName,(LPCTSTR)(LPUCHAR)lstbl->szColumn); lpCommentCol->lpszComment = NULL; ls=(LPOBJECTLIST)ls->lpNext; } if (lpObjCol) iret = VDBAGetCommentInfo ( (LPTSTR)(LPUCHAR)GetVirtNodeName(nNodeHandle), (LPTSTR)tableparams.DBName, (LPTSTR)tableparams.objectname, (LPTSTR)tableparams.szSchema, &lpObjComment, lpObjCol); else ASSERT (FALSE); // update member variables, for display/load/save purpose // list of columns m_Data.m_uaColumns.RemoveAll(); ls = tableparams.lpColumns; ASSERT (ls); // No columns is unacceptable while (ls) { LPCOLUMNPARAMS lpCol = (LPCOLUMNPARAMS)ls->lpObject; ASSERT (lpCol); // Column name CString csName = lpCol->szColumn; // Format "column type" CString csType = ""; if (lstrcmpi(lpCol->tchszInternalDataType, lpCol->tchszDataType) != 0) { ASSERT (lpCol->tchszInternalDataType[0]); csType = lpCol->tchszInternalDataType; // UDTs if (lstrcmpi(lpCol->tchszInternalDataType,VDBA_MfcResourceString(IDS_OBJECT_KEY)) == 0 || lstrcmpi(lpCol->tchszInternalDataType,VDBA_MfcResourceString(IDS_TABLE_KEY) ) == 0) { if (lpCol->bSystemMaintained) csType += VDBA_MfcResourceString(IDS_SYSTEM_MAINTAINED); else csType += VDBA_MfcResourceString(IDS_NO_SYSTEM_MAINTAINED); } } else { LPUCHAR lpType; lpType = GetColTypeStr(lpCol); if (lpType) { csType = lpType; ESL_FreeMem(lpType); } else { // Unknown type: put type name "as is" - length will not be displayed csType = lpCol->tchszDataType; } } // Format "default specification" CString csDefSpec = ""; if (lpCol->lpszDefSpec) csDefSpec = lpCol->lpszDefSpec; // Format "Comment" CString csTblComment = ""; LPOBJECTLIST LsObj = lpObjCol; LPCOMMENTCOLUMN lpCommentCol; while (LsObj) { lpCommentCol = (LPCOMMENTCOLUMN)LsObj->lpObject; if (strcmp((LPTSTR)lpCommentCol->szColumnName,(LPTSTR)lpCol->szColumn) == 0) { if (iret!=RES_SUCCESS && !lpCommentCol->lpszComment) csTblComment.LoadString(IDS_NOT_AVAILABLE); else { if (lpCommentCol->lpszComment) csTblComment = lpCommentCol->lpszComment; } } LsObj = (LPOBJECTLIST)LsObj->lpNext; } // item on the stack CuTblColumn tblColumn(csName, // LPCTSTR name, csType, // LPCTSTR type, ??? Code complexe lpCol->nKeySequence,// int primKeyRank, lpCol->bNullable, // BOOL bNullable, lpCol->bDefault, // BOOL bWithDefault, csDefSpec, // LPCTSTR defSpec csTblComment ); // LPCTSTR comment on column CuMultFlag *pRefCol = m_Data.m_uaColumns.Find(&tblColumn); ASSERT (!pRefCol); m_Data.m_uaColumns.Add(tblColumn); // Loop on next column ls = (LPOBJECTLIST)ls->lpNext; } // liberate detail structure FreeAttachedPointers (&tableparams, OT_TABLE); // liberate column comment ls = lpObjCol; while (ls) { lpCommentCol = (LPCOMMENTCOLUMN)ls->lpObject; if (lpCommentCol->lpszComment) ESL_FreeMem (lpCommentCol->lpszComment); ls = (LPOBJECTLIST)ls->lpNext; } FreeObjectList(lpObjCol); if (lpObjComment) ESL_FreeMem (lpObjComment); // Refresh display RefreshDisplay(); return 0L; }
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 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; } }
BOOL CxDlgObjectComment::InitializeObjectColumns() { TCHAR tblNameWithOwner[MAXOBJECTNAME]; int ires, nLevel = 2; LPUCHAR aparents [MAXPLEVEL]; TCHAR tchszBuf [MAXOBJECTNAME]; TCHAR tchszOwner [MAXOBJECTNAME]; TCHAR tchszBufComplim[MAXOBJECTNAME]; LPTSTR lpszOwner = NULL; BOOL bSystem = FALSE; if (m_iCurObjType != OT_TABLE && m_iCurObjType != OT_VIEW) return FALSE; StringWithOwner((LPUCHAR)Quote4DisplayIfNeeded((LPTSTR)(LPCTSTR)m_csObjectName), (LPUCHAR)(LPTSTR)(LPCTSTR) m_csObjectOwner, (LPUCHAR)tblNameWithOwner); aparents[0] = (LPUCHAR)(LPCTSTR)m_csDBName; aparents[1] = (LPUCHAR)tblNameWithOwner; aparents[2] = NULL; nLevel = 2; tchszBuf[0] = 0; tchszOwner[0] = 0; tchszBufComplim[0] = 0; LPOBJECTLIST lpColTemp; LPCOMMENTCOLUMN lpCommentCol; ires = DOMGetFirstObject( m_nNodeHandle, (m_iCurObjType == OT_TABLE)? OT_COLUMN: OT_VIEWCOLUMN, nLevel, aparents, bSystem, NULL, (LPUCHAR)tchszBuf, (LPUCHAR)tchszOwner, (LPUCHAR)tchszBufComplim); if (ires != RES_SUCCESS && ires != RES_ENDOFDATA) { CString csMsg; csMsg.LoadString(IDS_E_COMMENTS_FAILED); MessageWithHistoryButton(m_hWnd,csMsg); return FALSE; } while (ires == RES_SUCCESS) { lpColTemp = AddListObjectTail(&m_ListColumn, sizeof(COMMENTCOLUMN)); if (!lpColTemp) { // Need to free previously allocated objects. ErrorMessage ( (UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR); FreeObjectList(m_ListColumn); m_ListColumn = NULL; return FALSE; } lpCommentCol = (LPCOMMENTCOLUMN)lpColTemp->lpObject; lstrcpy((LPTSTR)lpCommentCol->szColumnName,tchszBuf); lpCommentCol->lpszComment = NULL; tchszBuf[0] = 0; tchszOwner[0] = 0; tchszBufComplim[0] = 0; ires = DOMGetNextObject ((LPUCHAR)tchszBuf, (LPUCHAR)tchszOwner, (LPUCHAR)tchszBufComplim); } return TRUE; }