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 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 FillGrantedUsers (HWND hwndCtl, LPREVOKEPARAMS lprevoke, int objectToFind) { int hdl, ires, gtype; BOOL bwsystem; char buf [MAXOBJECTNAME]; char buffilter [MAXOBJECTNAME]; char bufwithparent [MAXOBJECTNAME]; LPUCHAR parentstrings [MAXPLEVEL]; LPDOMDATA lpDomData =GetCurLpDomData (); ZEROINIT (buf); ZEROINIT (buffilter); hdl = GetCurMdiNodeHandle (); bwsystem = GetSystemFlag (); if (!lpDomData) return; parentstrings [0] = lprevoke->DBName; // Database name if (lprevoke->ObjectType != OT_VIEW) parentstrings [1] = StringWithOwner ((LPTSTR)Quote4DisplayIfNeeded(lprevoke->PreselectObject), lprevoke->PreselectObjectOwner, bufwithparent); else parentstrings [1] = StringWithOwner ((LPTSTR)Quote4DisplayIfNeeded(lprevoke->PreselectObject), lprevoke->PreselectObjectOwner, bufwithparent); ires = DOMGetFirstObject (hdl, objectToFind, 2, parentstrings, bwsystem, NULL, buf, NULL, NULL); while (ires == RES_SUCCESS) { gtype = DBA_GetObjectType (buf, lpDomData); if (gtype == lprevoke->GranteeType) { CAListBox_AddString (hwndCtl, buf); } ires = DOMGetNextObject (buf, buffilter, NULL); } }
static BOOL ObjectFound (HWND hwnd, int objtype) { int iresulttype, ires; char szFindStr [MAXOBJECTNAME]; UCHAR buf1 [MAXOBJECTNAME], buf2 [MAXOBJECTNAME], buf3 [MAXOBJECTNAME]; LPUCHAR parentstrings [MAXPLEVEL]; HWND hwndDB = GetDlgItem (hwnd, IDC_LOCATE_DATABASE); HWND hwndFind = GetDlgItem (hwnd, IDC_LOCATE_FIND); int hdl = GetCurMdiNodeHandle (); BOOL bwsystem = GetSystemFlag (); if (objtype < 0) return FALSE; else { switch (objtype) { case OT_DATABASE: case OT_USER : case OT_GROUP : case OT_ROLE : case OT_LOCATION: Edit_GetText (hwndFind, szFindStr, sizeof (szFindStr)); if (x_strcmp (szFindStr, String_all) == 0) return TRUE; else { ires = DOMGetObjectLimitedInfo (hdl, szFindStr, // Object name to find "", // Object owner objtype, // Object type 0, // Level NULL, // Parent string bwsystem, &iresulttype, buf1, buf2, buf3); if (ires == RES_SUCCESS) return TRUE; else return FALSE; } case OT_TABLE : case OT_VIEW : case OT_PROCEDURE : case OT_SCHEMAUSER : case OT_SYNONYM : case OT_DBEVENT : case OT_SEQUENCE : Edit_GetText (hwndFind, szFindStr, sizeof (szFindStr)); if (x_strcmp (szFindStr, String_all) == 0) return TRUE; else { char szDbName [MAXOBJECTNAME]; Edit_GetText (hwndDB, szDbName, sizeof (szDbName)); parentstrings [0] = szDbName; ires = DOMGetObjectLimitedInfo (hdl, szFindStr, // Object name to find "", // Object owner objtype, // Object type 1, // Level parentstrings, // Parent string bwsystem, &iresulttype, buf1, buf2, buf3); if (ires == RES_SUCCESS) return TRUE; else return FALSE; } case OT_RULE : case OT_INDEX : case OT_INTEGRITY : { char szDbName [MAXOBJECTNAME]; Edit_GetText (hwndFind, szFindStr, sizeof (szFindStr)); if (x_strcmp (szFindStr, String_all) == 0) return FALSE; Edit_GetText (hwndDB, szDbName, sizeof (szDbName)); parentstrings [0] = szDbName; ires = DOMGetObjectLimitedInfo (hdl, szFindStr, // Object name to find "", // Object owner objtype, // Object type 2, // Level parentstrings, // Parent string bwsystem, &iresulttype, buf1, buf2, buf3); if (ires == RES_SUCCESS) return TRUE; else return FALSE; } default: return FALSE; } } }