Beispiel #1
0
static LPCHECKEDOBJECTS GetLocations ()
{
   int  hdl, ires;
   BOOL bwsystem;
   char buf [MAXOBJECTNAME];
   char buffilter [MAXOBJECTNAME];
   LPCHECKEDOBJECTS obj, list = NULL;  
   ZEROINIT (buf);
   ZEROINIT (buffilter);

   hdl      = GetCurMdiNodeHandle ();
   // Force to TRUE so as II_DATABASE is picked up.
   bwsystem = TRUE;
       
   ires     = DOMGetFirstObject (hdl, OT_LOCATION, 0, NULL, bwsystem, NULL, buf, NULL, NULL);
   while (ires == RES_SUCCESS)
   {
      BOOL bOK;
      if (DOMLocationUsageAccepted(hdl,buf,LOCATIONDATABASE,&bOK)==
          RES_SUCCESS && bOK) {
          obj = ESL_AllocMem (sizeof (CHECKEDOBJECTS));
          if (obj)
          {
             x_strcpy (obj->dbname, buf);
             obj->pnext = NULL;
             list = AddCheckedObject (list, obj);
          }
      }
      ires  = DOMGetNextObject (buf, buffilter, NULL);
   }
   return list;
}
Beispiel #2
0
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;
}
Beispiel #3
0
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;
}
Beispiel #4
0
void emitter_setup(struct commands* cmds, plist_t plist, drawer_t drawer) {
    ZEROINIT(&emitter);
    emitter.commands = cmds;
    emitter.particles = plist;
    emitter.drawer = drawer;
    for (ftype_id i = (ftype_id)0; i < VIS_MAX_FTYPE; ++i) {
        emitter.frame_counts[i] = 0;
    }
}
Beispiel #5
0
void ErrorMessage (UINT message_id, int reason)
{
   char MessageString [200];
   char Reason [80];
   char Message[200];
   HWND CurrentFocus;

   switch (reason)
   {
       case RES_ERR:
           x_strcpy (Reason, "");

           // Trial EMB
           #ifdef DISPLAY_SQLERR_MSG
           // Note : under debugger, we see that sqlcode has been reset
           // in the ReleaseSession/Rollback call
           // Also, the error text can be truncated - need full length
           if (sqlca.sqlcode < 0)
           wsprintf ( Reason, "error %ld : %s",
                      sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
           #endif
           break;
       case RES_TIMEOUT:
           LoadString (hResource, (UINT)IDS_I_TIMEOUT, (LPSTR)Reason, sizeof (Reason));
           break;
       case RES_NOGRANT:
           LoadString (hResource, (UINT)IDS_I_NOGRANT, (LPSTR)Reason, sizeof (Reason));
           break;
       case RES_ALREADYEXIST:
           LoadString (hResource, (UINT)IDS_I_OBJECT_ALREADY_EXIST, (LPSTR)Reason, sizeof (Reason));
           break;
       default:
           x_strcpy (Reason, "");
           break;
   }

   ZEROINIT (MessageString);
   if (message_id == (UINT)IDS_E_CANNOT_ALLOCATE_MEMORY)
       x_strcpy (MessageString, "Cannot allocate memory.");
   else
       LoadString (hResource, (UINT)message_id, MessageString, sizeof (MessageString));

   if (x_strlen (Reason) > 0)
       wsprintf (Message, "%s\n%s", Reason, MessageString);
   else
       wsprintf (Message, "%s", MessageString);

   CurrentFocus = GetFocus ();
   if (message_id == (UINT)IDS_E_CANNOT_ALLOCATE_MEMORY)
       MessageBox (NULL, Message, NULL, MB_ICONHAND|MB_SYSTEMMODAL|MB_OK);
   else {
       // MessageBox (NULL, Message, NULL, MB_ICONEXCLAMATION | MB_OK | MB_TASKMODAL);
       MessageWithHistoryButton(CurrentFocus, Message);
   }
   SetFocus   (CurrentFocus);
}
/*----------------------------------------------------------------------------
 * PEC_Init
 */
PEC_Status_t
PEC_Init(
        const PEC_InitBlock_t * const InitBlock_p)
{
    // ensure we init only once
    if (PEC_IsInitialized == false)
    {
        // dynamic SA is not support in DHM mode
        if (InitBlock_p->fUseDynamicSA)
            return PEC_ERROR_BAD_PARAMETER;

        ZEROINIT(Adapter_DHM_PEC_Notify);
        ZEROINIT(Adapter_DHM_Work);

        if (!Adapter_EIP93_SetMode_DHM())
            return PEC_ERROR_INTERNAL;      // ## RETURN ##
    }

    PEC_IsInitialized = true;

    return PEC_STATUS_OK;
}
Beispiel #7
0
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);
   }
}
Beispiel #8
0
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;
}
Beispiel #9
0
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);
   }
}
Beispiel #10
0
static BOOL OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
   int  nProd = 0;
   char Title[200];
   HWND hwndProducts   = GetDlgItem(hwnd, IDC_PRODUCTS);
   HWND hwndTables     = GetDlgItem(hwnd, IDC_TABLES);
   HWND hwndtableall   = GetDlgItem(hwnd, IDC_TABLE_ALL);
   HWND hwndproductall = GetDlgItem(hwnd, IDC_PRODUCT_ALL);
   
   LPRECONCILER lpmod = (LPRECONCILER)lParam;
   
   ZEROINIT (Title);

   if (!AllocDlgProp(hwnd, lpmod))
      return FALSE;
   lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_RECONCILER));
   
   //Fill the windows title bar
   GetWindowText(hwnd,Title,GetWindowTextLength(hwnd)+1);
   x_strcat(Title, " ");
   x_strcat(Title, GetVirtNodeName ( GetCurMdiNodeHandle ()));
   x_strcat(Title, "::");
   x_strcat(Title,lpmod->DBName);

   SetWindowText(hwnd,Title);

   if (!OccupyDbnumberControl(hwnd)
    || !OccupyCddsControl(hwnd))
   {
     ASSERT(NULL);
     EndDialog(hwnd, FALSE);
     return TRUE;
   }
	
   InitialiseEditControls(hwnd);
   EnableDisableOKButton (hwnd);
   richCenterDialog(hwnd);
   return TRUE;
}
Beispiel #11
0
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;
}
Beispiel #12
0
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;
   }
}
Beispiel #13
0
static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
{

   LPSECURITYALARMPARAMS lpsecurity   = (LPSECURITYALARMPARAMS)lParam;
   HWND hwndUsers    = GetDlgItem (hwnd, IDC_SALARM_BYUSER );
   HWND hwndDB       = GetDlgItem (hwnd, IDC_SALARM_ONTABLE);
   HWND hwndDBE      = GetDlgItem (hwnd, IDC_SALARM_DBEVENT);
   HWND hwndCaptionDB= GetDlgItem (hwnd, IDC_SALARM_STATIC_DB);

   char szFormat [100];
   char szTitle  [180];

   if (!AllocDlgProp (hwnd, lpsecurity))
       return FALSE;

   bNoDisplayMessageDB = FALSE;
   //
   // force catolist.dll to load
   //
   CATOListDummy();

   if (lpsecurity->bInstallLevel) {
      SetWindowText (hwndCaptionDB, "On:");
      //"Create Security Alarm on Current Installation on %s"
      wsprintf (szTitle, ResourceString(IDS_F_CREATE_SECURITY),
                GetVirtNodeName ( GetCurMdiNodeHandle ()));
   }
   else {
      LoadString (hResource, (UINT)IDS_T_CREATE_SECURITY, szFormat, sizeof (szFormat));
      wsprintf (szTitle, szFormat,
                GetVirtNodeName ( GetCurMdiNodeHandle ()),
                lpsecurity->DBName);

   }


   
   SetWindowText (hwnd, szTitle);

   Edit_LimitText (GetDlgItem (hwnd, IDC_SALARM_DBEVENT_TEXT), MAXOBJECTNAME-1);
   ZEROINIT (szSecurityDBEvent);
   LoadString (hResource, (UINT)IDS_I_NODBEVENT, szSecurityDBEvent, sizeof (szSecurityDBEvent));

   //
   // Set the default to user
   //
   Button_SetCheck (GetDlgItem (hwnd, IDC_SALARM_USER), TRUE);

   //
   // Get the available users names and insert them into the CA list box 
   // 

   CAListBoxFillUsers (hwndUsers);

   //
   // Get the available DB names and insert them into the table list 
   // 
   if (lpsecurity->bInstallLevel) {
       char * pcurinst = ResourceString(IDS_CURRENT_INSTALLATION);
       CAListBox_AddString   (hwndDB,pcurinst);
       CAListBox_SelectString(hwndDB,-1,pcurinst);
       lpsecurity->iObjectType = OT_VIRTNODE;
       EnableWindow(hwndDB,FALSE);
       EnableWindow(hwndDBE,FALSE);
   }
   else  {
       CAListBoxFillDatabases (hwndDB);
       lpsecurity->iObjectType = OT_DATABASE;
   }

   if (!lpsecurity->bInstallLevel &&
       !ComboBoxFillDBevents (hwndDBE, "iidbdb"))
   {
       ComboBoxDestroyItemData (hwndDBE);
       return FALSE;
   }

   {
       int   k;
       char* buffowner;

       k = ComboBox_AddString (hwndDBE, szSecurityDBEvent);
       buffowner = ESL_AllocMem (x_strlen (szSecurityDBEvent) +1);
       x_strcpy (buffowner, szSecurityDBEvent);
       ComboBox_SetItemData (hwndDBE, k, buffowner);
       ComboBox_SelectString(hwndDBE, -1, szSecurityDBEvent);
       EnableControl (hwnd, FALSE);
   }

   PreCheckItem (hwnd);
   EnableDisableOKButton (hwnd);
   //
   // The value 9039 is defined in MAINMFC.H but is not accessible from this file:
   lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT (lpsecurity->bInstallLevel? 9039: (UINT)IDD_SECURITY_ALARM2));

   richCenterDialog (hwnd);
   return TRUE;
}
Beispiel #14
0
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;
}
Beispiel #15
0
static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
   HWND hwndActionUser = GetDlgItem (hwnd, IDC_AUDITDB_ACTION_USER);
   LPAUDITDBPARAMS lpauditdb  = (LPAUDITDBPARAMS)lParam;
   char szFormat [100];
   char szTitle  [MAX_TITLEBAR_LEN];

   if (!AllocDlgProp (hwnd, lpauditdb))
       return FALSE;

   ZEROINIT (table);
   table.bRefuseTblWithDupName = TRUE;
   table.lpTable = NULL;
   lpfile        = NULL;

   LoadString (hResource, (UINT)IDS_T_AUDITDB, szFormat, sizeof (szFormat));
   wsprintf (szTitle, szFormat,
       GetVirtNodeName ( GetCurMdiNodeHandle ()),
       lpauditdb->DBName);
   lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_AUDITDB));

   if (lpauditdb->bStartSinceTable)
   {
     LPOBJECTLIST obj;
     char sztemp[MAXOBJECTNAME];
     // Title
     wsprintf( sztemp ," , table %s",lpauditdb->szDisplayTableName);
     lstrcat(szTitle,sztemp);
     // Fill Object List
     obj = AddListObject (table.lpTable, x_strlen (lpauditdb->szCurrentTableName) +1);
     if (obj)
     {
       lstrcpy ((UCHAR *)obj->lpObject,lpauditdb->szCurrentTableName );
       table.lpTable = obj;
     }
     else
     {
       ErrorMessage   ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR);
       table.lpTable = NULL;
     }
     lpfile = AddElement (lpfile,lpauditdb->szCurrentTableName );
     AddFile (hwnd, lpfile);

     ShowWindow      (GetDlgItem (hwnd, IDC_EDIT_TABLE_NAME)  ,SW_SHOW);
     ShowWindow      (GetDlgItem (hwnd, IDC_STATIC_TABLE_NAME),SW_SHOW);
     ShowWindow      (GetDlgItem (hwnd, IDC_AUDITDB_IDTABLE)  ,SW_HIDE);
     SetWindowText   (GetDlgItem (hwnd, IDC_EDIT_TABLE_NAME)  ,lpauditdb->szDisplayTableName );
     EnableWindow    (GetDlgItem (hwnd, IDC_EDIT_TABLE_NAME)  ,FALSE );
     Button_SetCheck (GetDlgItem (hwnd, IDC_AUDITDB_TABLES)   ,BST_CHECKED);
     EnableWindow    (GetDlgItem (hwnd, IDC_AUDITDB_TABLES)   ,FALSE );
   }
   SetWindowText (hwnd, szTitle);

   InitializeControls     (hwnd);

   ComboBoxFillUsers (hwndActionUser);
   EnableDisableOKButton (hwnd);
   EnableDisableControls (hwnd);

   richCenterDialog(hwnd);
   return TRUE;
}
Beispiel #16
0
/*----------------------------------------------------------------------------
 * Adapter_EIP93_SetMode_ARM
 *
 * Return Value
 *     true  Success
 *     false Failed
 */
bool
Adapter_EIP93_SetMode_ARM(
        const bool fEnableDynamicSA)
{
#ifndef ADAPTER_EIP93_PE_MODE_ARM
    IDENTIFIER_NOT_USED(fEnableDynamicSA);
    return false;
#else
    EIP93_ARM_Settings_t Settings = {0};
    EIP93_ARM_RingMemory_t RingMemory = {0};
    EIP93_Status_t res93;

    if (Adapter_EIP93_Mode != ADAPTER_EIP93_MODE_IDLE)
    {
        LOG_CRIT("Adapter_EIP93_SetMode_ARM: Not possible in mode %d\n",
            Adapter_EIP93_Mode);
        return false;
    }

/**** allocate memory for the ring ****/

    ZEROINIT(RingMemory);
    // bytes to words conversion from ADAPTER_EIP93_RINGSIZE_BYTES
    RingMemory.RingSizeInWords = Adapter_EIP93_RingProps.Size >> 2;

    {
        DMABuf_Status_t dmares;
        DMABuf_HostAddress_t HostAddr;

        dmares = DMABuf_Alloc(
                        Adapter_EIP93_RingProps,
                        &HostAddr,
                        &Adapter_EIP93_CmdRing_Handle);

        if (dmares != DMABUF_STATUS_OK)
        {
            LOG_CRIT(
                "Adapter_EIP93_Init: "
                "DMABuf_Alloc (Command Ring) returned %d\n",
                dmares);

            return false;
        }

        LOG_INFO(
            "Adapter_EIP93_Init: "
            "CmdRing_Handle=%p\n",
            Adapter_EIP93_CmdRing_Handle.p);

        Adapter_GetEIP93PhysAddr(
                Adapter_EIP93_CmdRing_Handle,
                &RingMemory.CommandRingHandle,
                &RingMemory.CommandRingAddr);

        if (RingMemory.CommandRingAddr.Addr == 0)
        {
            LOG_CRIT(
                "Adapter_EIP93_Init: "
                "Failed to get command ring physical address\n");

            // free the command ring memory
            DMABuf_Release(Adapter_EIP93_CmdRing_Handle);

            return false;       // ## RETURN ##
        }
    }

#ifndef ADAPTER_EIP93_SEPARATE_RINGS
    // not separate rings
    RingMemory.fSeparateRings = false;
#else
    // separat rings
    RingMemory.fSeparateRings = true;

    {
        DMABuf_Status_t dmares;
        DMABuf_HostAddress_t HostAddr;

        dmares = DMABuf_Alloc(
                        Adapter_EIP93_RingProps,
                        &HostAddr,
                        &Adapter_EIP93_ResRing_Handle);

        if (dmares != DMABUF_STATUS_OK)
        {
            LOG_CRIT(
                    "Adapter_EIP93_Init: "
                    "DMABuf_Alloc (Result Ring) returned %d\n",
                    dmares);

            // free the command ring memory
            DMABuf_Release(Adapter_EIP93_CmdRing_Handle);

            return false;
        }

        LOG_INFO(
            "Adapter_EIP93_Init: "
            "ResRing_Handle=%p\n",
            Adapter_EIP93_ResRing_Handle.p);

        Adapter_GetEIP93PhysAddr(
                Adapter_EIP93_ResRing_Handle,
                &RingMemory.ResultRingHandle,
                &RingMemory.ResultRingAddr);
 
        if (RingMemory.ResultRingAddr.Addr == 0)
        {
            LOG_CRIT(
                "Adapter_EIP93_Init: "
                "Failed to get result ring physical address\n");

            // free the ring memories
            DMABuf_Release(Adapter_EIP93_CmdRing_Handle);
            DMABuf_Release(Adapter_EIP93_ResRing_Handle);

            return false;
        }
    }
#endif /* ADAPTER_EIP93_SEPARATE_RINGS */

    // create the engine settings block
    Settings.nPEInputThreshold = ADAPTER_EIP93_DMATHRESHOLD_INPUT;
    Settings.nPEOutputThreshold = ADAPTER_EIP93_DMATHRESHOLD_OUTPUT;
    Settings.nDescriptorDoneCount = ADAPTER_EIP93_DESCRIPTORDONECOUNT;
    Settings.nDescriptorDoneTimeout = ADAPTER_EIP93_DESCRIPTORDONETIMEOUT;
    Settings.nDescriptorPendingCount= ADAPTER_EIP93_DESCRIPTORPENDINGCOUNT;
    Settings.nDescriptorSize = 8 ;
//    Settings.nRingPollDivisor = ADAPTER_EIP93_RINGPOLLDIVISOR;

    Adapter_EIP93_MaxDescriptorsInRing =
            RingMemory.RingSizeInWords /
            EIP93_ARM_DESCRIPTOR_SIZE();

    res93 = EIP93_ARM_Activate(
                &Adapter_EIP93_IOArea,
                &Settings,
                &RingMemory);

    if (res93 != EIP93_STATUS_OK)
    {
        LOG_CRIT(
            "Adapter_EIP93_Init: "
            "EIP93_ARM_Activate returned %d\n",
            res93);

        // free the ring memory blocks
        DMABuf_Release(Adapter_EIP93_CmdRing_Handle);
#ifdef ADAPTER_EIP93_SEPARATE_RINGS
        DMABuf_Release(Adapter_EIP93_ResRing_Handle);
#endif
        return false;
    }

    Adapter_EIP93_Mode = ADAPTER_EIP93_MODE_ARM;

    LOG_INFO("Adapter: Successfully initialized EIP93v2 in ARM mode\n");

    return true;
#endif /* ADAPTER_EIP93_PE_MODE_ARM */
}
Beispiel #17
0
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;

   }
}
Beispiel #18
0
static BOOL FillStructureFromControls (HWND hwnd, LPSECURITYALARMPARAMS lpsecurity)
{
   char buf        [MAXOBJECTNAME];
//   char buffowner  [MAXOBJECTNAME];
//   char bufftable  [MAXOBJECTNAME];
   char szDBE      [MAXOBJECTNAME];
   char szName     [MAXOBJECTNAME];

   LPCHECKEDOBJECTS  obj;
   LPCHECKEDOBJECTS  list = NULL;
   int i, max_database_number, checked;

   HWND hwndDB         = GetDlgItem (hwnd, IDC_SALARM_ONTABLE);
   HWND hwndUsers      = GetDlgItem (hwnd, IDC_SALARM_BYUSER );
   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);
   HWND hwndDBE        = GetDlgItem (hwnd, IDC_SALARM_DBEVENT);
   HWND hwndDBEText    = GetDlgItem (hwnd, IDC_SALARM_DBEVENT_TEXT);
   HWND hwndName       = GetDlgItem (hwnd, IDC_SALARM_NAME);

   x_strcpy (lpsecurity->DBName, "iidbdb");
   ZEROINIT (szName);
   Edit_GetText (hwndName, szName, sizeof (szName));
   x_strcpy (lpsecurity->ObjectName, szName);

   lpsecurity->bsuccfail [SECALARMSUCCESS] = Button_GetCheck (hwndSuccess);
   lpsecurity->bsuccfail [SECALARMFAILURE] = Button_GetCheck (hwndFailure);
   //
   // Get selection from
   // toggle buttons (Select, Delete, Insert, Update)
   //
   lpsecurity->baccesstype [SECALARMSEL]       = Button_GetCheck (hwndSelect);
   lpsecurity->baccesstype [SECALARMDEL]       = Button_GetCheck (hwndDelete);
   lpsecurity->baccesstype [SECALARMINS]       = Button_GetCheck (hwndInsert);
   lpsecurity->baccesstype [SECALARMUPD]       = Button_GetCheck (hwndUpdate);
   lpsecurity->baccesstype [SECALARMCONNECT]   = Button_GetCheck (hwndConnect   );
   lpsecurity->baccesstype [SECALARMDISCONN]   = Button_GetCheck (hwndDisconnect);
   
   //
   // Get the names of users that have been checked and
   // insert into the list
   //
  
   if (Button_GetCheck (GetDlgItem (hwnd, IDC_SALARM_USER)))
       lpsecurity->iAuthIdType = OT_USER;
   else
   if (Button_GetCheck (GetDlgItem (hwnd, IDC_SALARM_GROUP)))
       lpsecurity->iAuthIdType = OT_GROUP;
   else
   if (Button_GetCheck (GetDlgItem (hwnd, IDC_SALARM_ROLE)))
       lpsecurity->iAuthIdType = OT_ROLE;
   else
   if (Button_GetCheck (GetDlgItem (hwnd, IDC_SALARM_PUBLIC)))
       lpsecurity->iAuthIdType = OT_PUBLIC;
   else
       lpsecurity->iAuthIdType = OT_USER;

   max_database_number = CAListBox_GetCount (hwndUsers);
   
   
   if (Button_GetCheck (GetDlgItem (hwnd, IDC_SALARM_PUBLIC)))
   {
       obj = ESL_AllocMem (sizeof (CHECKEDOBJECTS));
       if (!obj)
       {
           FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM);
           ErrorMessage   ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR);
           return FALSE;
       }
       else
       {
           x_strcpy (obj->dbname, lppublicsysstring());
           obj->bchecked = TRUE;
           list = AddCheckedObject (list, obj);
       }
   }

   for (i = 0; i < max_database_number; i++)
   {
       checked = CAListBox_GetSel (hwndUsers, i);
       if (checked == 1)
       {
           CAListBox_GetText (hwndUsers, i, buf);
           obj = ESL_AllocMem (sizeof (CHECKEDOBJECTS));
           if (!obj)
           {
               FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM);
               ErrorMessage   ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR);
               return FALSE;
           }
           else
           {
               if (x_strcmp (buf, lppublicdispstring()) == 0)
                   x_strcpy (obj->dbname, lppublicsysstring());
               else
                   x_strcpy (obj->dbname, QuoteIfNeeded(buf));
               obj->bchecked = TRUE;
               list = AddCheckedObject (list, obj);
           }
       }
   }
   lpsecurity->lpfirstUser = list;

   //
   // Get the names of Database that have been checked and
   // insert into the list
   //
   
   max_database_number = CAListBox_GetCount (hwndDB);
   list = NULL;
   
   for (i=0; i<max_database_number; i++)
   {
       checked = CAListBox_GetSel (hwndDB, i);
       if (checked)
       {
           CAListBox_GetText (hwndDB, i, buf);

           obj = ESL_AllocMem (sizeof (CHECKEDOBJECTS));
           if (!obj)
           {
               FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM);
               ErrorMessage   ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR);
               return FALSE;
           }
           else
           {
               x_strcpy (obj->dbname, buf);
               obj->bchecked = TRUE;
               list = AddCheckedObject (list, obj);
           }
       }
   }
   lpsecurity->lpfirstTable = list;

   ComboBox_GetText (hwndDBE, szDBE, sizeof (szDBE));
   if ((x_strlen (szDBE) > 0 ) && (x_strcmp (szDBE, szSecurityDBEvent) != 0))
   {
       char szOwner [MAXOBJECTNAME];
       char szAll   [MAXOBJECTNAME];
       int  len, nSel;

       nSel = ComboBox_GetCurSel (hwndDBE);
       x_strcpy (szOwner, (char *) ComboBox_GetItemData (hwndDBE, nSel));
       StringWithOwner  (szDBE, szOwner, szAll);
       x_strcpy (lpsecurity->DBEvent, szAll);
       len = Edit_GetTextLength (hwndDBEText);
       if (len > 0)
       {
           lpsecurity->lpDBEventText = ESL_AllocMem ((len*sizeof(TCHAR)) + sizeof(TCHAR));
           if (lpsecurity->lpDBEventText)
           {
             Edit_GetText (hwndDBEText, lpsecurity->lpDBEventText, len+1); // Emb 26/06/97: +1 was missing --> lost character
             if (EscapedSimpleQuote(&lpsecurity->lpDBEventText) == RES_ERR) {
               FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM);
               ErrorMessage   ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR);
               return FALSE;
             }
           }
           else
           {
               FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM);
               ErrorMessage   ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR);
               return FALSE;
           }
       }
       lpsecurity->bDBEvent = TRUE;
   }
   else if (lpsecurity->lpDBEventText)
   {
       ESL_FreeMem (lpsecurity->lpDBEventText);
       lpsecurity->lpDBEventText = NULL;
   }

   return TRUE;
}
Beispiel #19
0
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;
   }
}
Beispiel #20
0
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;
}