Пример #1
0
/* concatenate two path components, returning a newly malloced string */
char *
blossom_path_new (const char * path1, const char * path2)
{
  int l1, l2, len;
  char * new_path, * s;

  l1 = x_strlen (path1);
  l2 = x_strlen (path2);
  len = l1 + l2 + 2;

  s = new_path = (char *) malloc (len);

  if (path1 && l1>0) {
    strncpy (s, path1, l1);
    s += l1;

    /* Backtrack s if path1 ends in '/' */
    if (*(s-1) == '/') s--;
  }

  /* Only insert the slash if it wouldn't appear otherwise */
  if ((path1 && !path2) || *path2 != '/') {
    *s = '/';
    s++;
  }

  if (path2 && l2>0) {
    strncpy (s, path2, l2);
    s += l2;
  }

  *s = '\0';

  return new_path;
}
Пример #2
0
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);
}
Пример #3
0
static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
   LPSECURITYALARMPARAMS lpsecurity   = (LPSECURITYALARMPARAMS)lParam;
   HWND    hwndUsers    = GetDlgItem (hwnd, IDC_REFALARM_BYUSER  );
   HWND    hwndDatabase = GetDlgItem (hwnd, IDC_REFALARM_DATABASE);
   HWND    hwndTables   = GetDlgItem (hwnd, IDC_REFALARM_ONTABLE );
   char    szTitle  [MAX_TITLEBAR_LEN];
   char    szFormat [100];
   char    szDatabaseName [MAXOBJECTNAME];

   if (!AllocDlgProp (hwnd, lpsecurity))
       return FALSE;
   //
   // force catolist.dll to load
   //
   CATOListDummy();

   LoadString (hResource, (UINT)IDS_T_CREATE_SECURITY, szFormat, sizeof (szFormat));

   wsprintf (szTitle, szFormat,
       GetVirtNodeName ( GetCurMdiNodeHandle ()),
       lpsecurity->DBName);
   SetWindowText (hwnd, szTitle);
   lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_REFALARM));

   //
   // Get the available database names and insert them into the combo box
   //
   ComboBoxFillDatabases (hwndDatabase);
   ComboBoxSelectFirstStr(hwndDatabase);
   ComboBox_GetText (hwndDatabase, szDatabaseName, sizeof (szDatabaseName));
   if (x_strlen (szDatabaseName) > 0)
       x_strcpy (lpsecurity->DBName, szDatabaseName);

   //
   // Get the available table names and insert them into the table list 
   //
   if (x_strlen (lpsecurity->DBName) > 0)
   {
       if (!CAListBoxFillTables (hwndTables, lpsecurity->DBName, FALSE))
       {
           CAListBoxDestroyItemData (hwndTables);
           return FALSE;
       }
   }
   //
   // Get the available users names and insert them into the CA list box 
   // 

   CAListBoxFillUsersP (hwndUsers);
   PreCheckItem (hwnd);
   EnableDisableOKButton (hwnd);

   richCenterDialog (hwnd);
   return TRUE;
}
Пример #4
0
bool string_ends_with_ignore_case(const dnx::char_t* s, const dnx::char_t* suffix)
{
    auto str_len = x_strlen(s);
    auto suffix_len = x_strlen(suffix);

    if (suffix_len > str_len)
    {
        return false;
    }

    return dnx::utils::strings_equal_ignore_case(s + str_len - suffix_len, suffix);
}
Пример #5
0
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);
}
Пример #6
0
mem_pool_t *mem_pool_create(u_char *name, size_t size, logger_t *logger)
{
    mem_pool_t *pool;

    pool = (mem_pool_t *) malloc(size);
    if (pool == NULL) {
        log_error(logger, 0, "\"create_mem_pool\" failed.");
        return NULL;
    }

    pool->name.data = name;
    pool->name.len = x_strlen(name);

    pool->chunk.end = (u_char *) pool + size;
    pool->chunk.last = (u_char *) pool + sizeof(mem_pool_t);
    pool->chunk.fail = 0;
    pool->chunk.next = NULL;

    pool->total = size;
    pool->max = size < MAX_SIZE_OF_CHUNK ? size : MAX_SIZE_OF_CHUNK;
    pool->current = &pool->chunk;
    pool->large = NULL;
    pool->logger = logger;

    return pool;
}
Пример #7
0
// Query the current selection in a combobox type cell
// the received buffer must be of size MAXOBJECTNAME+1
BOOL ContainerGetComboCellSelection(HWND hwndCnt, int linenum, int colnum, char *buf)
{
  LPFIELDINFO     lpFld;
  GENCNTR_COLUMN  column;
  int             cpt;
  char           *pItem;
  LPRECORDCORE    hLine;

  hLine = MakeHLineFromLineNum(hwndCnt, linenum);

  // query lpFld from hline and colnum
  lpFld = QueryLpFld(hwndCnt, hLine, colnum);
  if (!lpFld)
    return FALSE;

  // extract data from cell
  if (!CntFldDataGet(hLine, lpFld, 0, (LPVOID)&column))
    return FALSE;

  // check the cell is a combo
  if (column.type != CONT_COLTYPE_COMBO)
    return FALSE;

  // return the nth string
  pItem = column.ucol.sCombo.pItems;  // first item
  for (cpt=0; cpt<column.ucol.sCombo.selection; cpt++)
    pItem += x_strlen(pItem) + 1;
  x_strcpy(buf, pItem);
  return TRUE;
}
Пример #8
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);
}
Пример #9
0
static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
   LPGRANTPARAMS lpgrant = (LPGRANTPARAMS)lParam;
   HWND hwndGrantees  = GetDlgItem (hwnd, IDC_GRANT_DBEVENT_GRANTEES);
   HWND hwndDBevents  = GetDlgItem (hwnd, IDC_GRANT_DBEVENT_DBEVENT);
   char szTitle [MAX_TITLEBAR_LEN];
   char szFormat[100];
   //
   // force catolist.dll to load
   //
   CATOListDummy();

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

   LoadString (hResource, (UINT)IDS_T_GRANT_DBEVENT, szFormat, sizeof (szFormat));
   wsprintf (szTitle,
       szFormat,
       GetVirtNodeName (GetCurMdiNodeHandle ()),
       lpgrant->DBName);
   SetWindowText (hwnd, szTitle);
   lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_GRANT_DBEVENT));

   Button_SetCheck (GetDlgItem (hwnd, IDC_GRANT_DBEVENT_USER), TRUE);
   FillGrantees (hwndGrantees, OT_USER);

   if (!CAListBoxFillDBevents (hwndDBevents, lpgrant->DBName))
       CAListBoxDestroyItemData (hwndDBevents);

   if (lpgrant->PreselectPrivileges [GRANT_RAISE])
       Button_SetCheck (GetDlgItem (hwnd, IDC_GRANT_DBEVENT_RAISE),    TRUE);
   if (lpgrant->PreselectPrivileges [GRANT_REGISTER])
       Button_SetCheck (GetDlgItem (hwnd, IDC_GRANT_DBEVENT_REGISTER), TRUE);

   if (x_strlen (lpgrant->PreselectGrantee) > 0)
       CAListBox_SelectString (hwndGrantees, -1, lpgrant->PreselectGrantee);
   if (x_strlen (lpgrant->PreselectObject) > 0)
       CAListBoxSelectStringWithOwner (hwndDBevents, lpgrant->PreselectObject, lpgrant->PreselectObjectOwner);
   EnableDisableOKButton  (hwnd);
   
   richCenterDialog(hwnd);
   return TRUE;
}
Пример #10
0
// Sets the current selection in a combobox type cell
// Does not change the selection if item not found
BOOL ContainerSetComboSelection(HWND hwndCnt, int linenum, int  colnum, char *selection)
{
  LPFIELDINFO     lpFld;
  GENCNTR_COLUMN  column;
  int             cpt;
  char           *pItem;
  LPRECORDCORE    hLine;
  LPGENCNTRDATA   lpGenCntrData;

  lpGenCntrData = GetGenericCntrData(hwndCnt);
  if (!lpGenCntrData)
    return FALSE;

  hLine = MakeHLineFromLineNum(hwndCnt, linenum);
  if (!hLine)
    return FALSE;

  // query lpFld from hline and colnum
  lpFld = QueryLpFld(hwndCnt, hLine, colnum);
  if (!lpFld)
    return FALSE;

  // extract data from cell
  if (!CntFldDataGet(hLine, lpFld, 0, (LPVOID)&column))
    return FALSE;

  // check the cell is a combo
  if (column.type != CONT_COLTYPE_COMBO)
    return FALSE;

  // search the string in the list
  pItem = column.ucol.sCombo.pItems;  // first item
  for (cpt=0; *pItem; cpt++) {
    if (lstrcmp(pItem, selection) == 0) {
      // item found : update the numeric selection
      column.ucol.sCombo.selection = cpt;

      // Store back data into the record.
      if (!CntFldDataSet(hLine, lpFld, 0, (LPVOID)&column))
          return FALSE;

      // item found : update selection in combo if currently displayed
      // on the item
      if (lpGenCntrData->lastLpRec == hLine)
        if (GetFocus() == lpGenCntrData->hWndCombo)
            ComboBox_SetCurSel(lpGenCntrData->hWndCombo, column.ucol.sCombo.selection);

      // item found : return TRUE
      return TRUE;
    }
    pItem += x_strlen(pItem) + 1;
  }
  return FALSE;
}
Пример #11
0
static void EnableDisableOKButton (HWND hwnd)
{
    HWND hwndUser = GetDlgItem (hwnd, IDC_USR2GRP_USERBOX);
    char szUser [MAXOBJECTNAME];

    ComboBox_GetText (hwndUser, szUser, sizeof (szUser));

    if (x_strlen (szUser) == 0)
        EnableWindow (GetDlgItem (hwnd, IDOK), FALSE);
    else
        EnableWindow (GetDlgItem (hwnd, IDOK), TRUE);
}
Пример #12
0
static void EnableDisableOKButton (HWND hwnd)
{
   HWND hwndMailTaxt = GetDlgItem (hwnd, IDC_MAIL_TEXT);
   char szText [MAX_MAIL_TEXTLEN];

   Edit_GetText (hwndMailTaxt, szText, sizeof (szText));

   if (x_strlen (szText) == 0)
       EnableWindow (GetDlgItem (hwnd, IDOK), FALSE);
   else
       EnableWindow (GetDlgItem (hwnd, IDOK), TRUE);
}
Пример #13
0
int split_path(const dnx::char_t* path)
{
    for (auto i = static_cast<int>(x_strlen(path)) - 1; i >= 0; i--)
    {
        if (path[i] == _X('\\') || path[i] == _X('/'))
        {
            return i;
        }
    }

    return -1;
}
Пример #14
0
//
//  Define the fields (columns) of the container
//
static VOID NEAR DefineContainerColumns(HWND hwndCnt, LPGENCNTRDATA lpGenCntrData, int colnum)
{
  LPFIELDINFO lpFI;
  int         cpt;
  char        buf[BUFSIZE];

  for (cpt = 0; cpt < colnum; cpt++) {

    // Alloc a new field node
    lpFI = CntNewFldInfo( );

    // Set the default visual field width in characters units
    if (cpt < colnum-1)
      lpFI->cxWidth = MAXOBJECTNAME;
    else
      lpFI->cxWidth = 150;   // we won't want a white zone on the right

    // Set the field data alignment, type, length, and offset
    // to default values which are "Good for us"
    lpFI->flFDataAlign = CA_TA_LEFT | CA_TA_VCENTER;
    lpFI->wColType     = CFT_STRING;
    lpFI->wDataBytes   = sizeof(GENCNTR_COLUMN);
    lpFI->wOffStruct   = offsetof(GENCNTR_RECORD, cont_col2) * cpt;

    // Ownerdraw attribute - Mandatory for us!
    lpFI->flColAttr    = CFA_FLDREADONLY | CFA_OWNERDRAW;
    CntFldDrwProcSet(lpFI, lpGenCntrData->lpfnDrawProc);

    // Set field title and alignment
    //wsprintf(buf, "Column %d Title", cpt);
    buf[0] = '\0';
    CntFldTtlSet( hwndCnt, lpFI, buf, x_strlen(buf) + 1);
    lpFI->flFTitleAlign = CA_TA_LEFT | CA_TA_VCENTER;

    // Set magenta text - masqued
    //CntFldColorSet( hwndCnt, lpFI, CNTCOLOR_TEXT,    RGB(127,0,127) );

    // Set cyan background - masqued
    //CntFldColorSet( hwndCnt, lpFI, CNTCOLOR_FLDBKGD, RGB(0,127,127) );

    // Add this field to the container field list.
    CntAddFldTail( hwndCnt, lpFI );

    // Set the draw proc for the field ???
    // ??? CntFldDrwProcSet(lpFI,(DRAWPROC)FieldDrawProc);
  }
}
Пример #15
0
static x_object *
bind_on_assign(x_object *this__, x_obj_attr_t *attrs)
{
  int id;
  x_string_t val;
  x_object *msg;
  x_object *tmp;
  struct x_bus *bus = (struct x_bus *) this__->bus;
  ENTER;

//  val = (int) ht_get("bind", &bus->wall[0], &id);
  val = _AGET(this__,"$bind_state");
  if (val && EQ(val,"BIND_SENT"))
    {

    }
  else if (val && EQ(val,"BIND_OK"))
    {

    }
  else
    {
      msg = _GNEW("bind",NULL);
      _ASET(msg, "xmlns", "urn:ietf:params:xml:ns:xmpp-bind");

      tmp = _GNEW("resource",NULL);
      x_string_write(&tmp->content, _ENV(this__,"resource"),
          x_strlen(_ENV(this__,"resource")));

      _INS(msg, tmp);

      tmp = _GNEW("iq",NULL);
      _ASET(tmp, "type", "set");
      _ASET(tmp, "id", "bind_1");
      _INS(tmp, msg);

//      ht_set("bind", (VAL) BIND_SENT, &bus->wall[0]);
      _ASET(this__, "$bind_state", "BIND_SENT");
      x_object_send_down(X_OBJECT(bus), tmp, NULL);
      _REFPUT(tmp, NULL);
    }

  EXIT;
  return this__;
}
Пример #16
0
static LPOBJECTLIST InsertTableName (LPUCHAR tableName)
{
   LPOBJECTLIST list = NULL;
   LPOBJECTLIST obj;

   obj = AddListObject (list, x_strlen (tableName) +1);
   if (obj)
   {
       x_strcpy ((UCHAR *)obj->lpObject, tableName);
       list = obj;
   }
   else
   {
       //
       // Cannot allocate memory
       //
       list = NULL;
   }
   return (list);
}
Пример #17
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;
}
Пример #18
0
int CALLBACK GenericContainerCellDraw( HWND hCntWnd, LPFIELDINFO lpFld, LPRECORDCORE lpRec, LPVOID lpData, HDC hDC, int nXstart, int nYstart, UINT fuOptions, LPRECT lpRect, LPSTR lpszOut, UINT uLenOut)
{
  COLORREF  crOldText = 0;
  COLORREF  crOldBk   = 0;
  BOOL      bChgedTxtColor = FALSE;
  BOOL      bChgedBkColor  = FALSE;

  // Custom management
  GENCNTR_COLUMN  cont_col;
  char            buf[BUFSIZE];

  // combo downarrow bitmap paint
  HDC     hMemDC;
  HBITMAP hBitmap, hOldBitmap;
  RECT    rcClient;
  int     x, y;
  HBRUSH  hBrush;

  // text alignment
  SIZE  size;
  int   remainder;
  int   availwidth;
  int   margin;

  // Decorations for title type cell
  HPEN  hOldPen, hWhitePen, hDkGrayPen;

  // Combo selection paint
  int   cpt;
  char *pItem;

  CntFldDataGet(lpRec, lpFld, 0, &cont_col);

  // Clear whole rectangle (old decorations cleanup) for combo type cell
  if (cont_col.type == CONT_COLTYPE_COMBO) {
    rcClient.left   = lpRect->left;
    rcClient.top    = lpRect->top;
    rcClient.right  = lpRect->right;
    rcClient.bottom = lpRect->bottom;
    hBrush = GetStockObject(WHITE_BRUSH);
    FillRect(hDC, &rcClient, hBrush);
  }

  switch (cont_col.type) {
    case CONT_COLTYPE_TITLE:
      fuOptions |= ETO_OPAQUE;
      crOldBk = SetBkColor(hDC, RGB(192,192,192));  // Light gray background
      bChgedBkColor = TRUE;
      crOldText = SetTextColor(hDC, RGB(255, 0, 0) ); // Red text
      bChgedTxtColor = TRUE;
      x_strcpy(buf, cont_col.ucol.s);
      //wsprintf(buf, "Title : %s", cont_col.ucol.s);
      break;
    case CONT_COLTYPE_TEXT:
      x_strcpy(buf, cont_col.ucol.s);
      //wsprintf(buf, "Text : %s", cont_col.ucol.s);
      break;
    case CONT_COLTYPE_COMBO:
      pItem = cont_col.ucol.sCombo.pItems;  // first item
      for (cpt=0; cpt<cont_col.ucol.sCombo.selection; cpt++)
        pItem += x_strlen(pItem) + 1;
      x_strcpy(buf, pItem);           // Show the 'nth' item
      //wsprintf(buf, "Combo : %s", cont_col.ucol.s);
      break;
    case CONT_COLTYPE_INT:
      wsprintf(buf, "%ld", cont_col.ucol.i);
      //wsprintf(buf, "Int : %ld", cont_col.ucol.i);
      break;
    case CONT_COLTYPE_FLOAT:
      // NOTE : wsprintf is not aware of the floating format...
      sprintf(buf, "%.*f", cont_col.precision, cont_col.ucol.f);
      //sprintf(buf, "Float : %.2f", cont_col.ucol.f);
      break;
    case CONT_COLTYPE_EMPTY:
      buf[0] = '\0';    // empty cell
      break;
    default:
      x_strcpy(buf, "Unknown type!");
      break;
  }

  // manage the horizontal positioning of the text
  if (cont_col.align != CONT_ALIGN_LEFT) {
    availwidth = lpRect->right - lpRect->left;
    margin = nXstart - lpRect->left;
#ifdef WIN32
    GetTextExtentPoint32(hDC, buf, x_strlen(buf), &size);
#else
    GetTextExtentPoint(hDC, buf, x_strlen(buf), &size);
#endif

    remainder = availwidth - 2*margin - size.cx;

    if (remainder > 0)
      switch (cont_col.align) {
        case CONT_ALIGN_CENTER:
          nXstart += remainder/2;
          break;
        case CONT_ALIGN_RIGHT:
          nXstart += remainder;
          break;
      }
  }

  // Draw the field data.
  ExtTextOut( hDC, nXstart, nYstart, fuOptions, lpRect,
              buf, x_strlen(buf), (LPINT)NULL);

  // Restore colors
  if (bChgedTxtColor)
    SetTextColor(hDC, crOldText);
  if (bChgedBkColor)
    SetBkColor(hDC, crOldBk);

  // Draw decorations for title type cell
  if (cont_col.type == CONT_COLTYPE_TITLE) {
    hWhitePen  = GetStockObject(WHITE_PEN);
    hDkGrayPen = CreatePen(PS_SOLID, 2, RGB(128, 128, 128));  // Dark gray

    hOldPen = SelectObject(hDC, hWhitePen);
    MoveToEx(hDC, lpRect->left,     lpRect->bottom, NULL);
    LineTo(hDC, lpRect->left,     lpRect->top);
    LineTo(hDC, lpRect->right-1,  lpRect->top);

    SelectObject(hDC, hDkGrayPen);
    MoveToEx(hDC, lpRect->left+2,  lpRect->bottom-2, NULL);
    LineTo(hDC, lpRect->right-2, lpRect->bottom-2);
    LineTo(hDC, lpRect->right-2, lpRect->top+1);

    SelectObject(hDC, hOldPen);
    DeleteObject(hDkGrayPen);
  }

  // Draw decorations for combo type cell
  if (cont_col.type == CONT_COLTYPE_COMBO) {
    hMemDC = CreateCompatibleDC(hDC);
    if (hMemDC) {
      hBitmap = LoadBitmap(0, (LPCSTR)OBM_DNARROW);
      if (hBitmap) {
        hOldBitmap = (HBITMAP)SelectObject(hMemDC,hBitmap);

        y = lpRect->top + 1;
        // 1 parent needed when in the CellDraw function!
        if (IsLastColumn(GetParent(hCntWnd), cont_col.colnum)) {
          GetClientRect(hCntWnd, &rcClient);
          x = rcClient.right;
          //x -= GetSystemMetrics(SM_CXVSCROLL);
          x -= 1;
        }
        else
          x = lpRect->right - 1;
        x -= GetSystemMetrics(SM_CXVSCROLL);
        BitBlt(hDC, x, y, BITMAPS_WIDTH, BITMAPS_HEIGHT,
               hMemDC, 0, 0, SRCCOPY);
        SelectObject(hMemDC,hOldBitmap);
        DeleteObject(hBitmap);
      }
      DeleteDC(hMemDC);
    }
  }

  // Finished
  return 0;

}
Пример #19
0
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;
   }
}
Пример #20
0
// Fill a cell with a combobox
// returns TRUE if operation successful
BOOL ContainerFillComboCell(HWND hwndCnt, int linenum, int colnum, int selection, int align, char *txt)
{
  LPFIELDINFO     lpFld;
  GENCNTR_COLUMN  column;
  LPRECORDCORE    hLine;

  //First column management
  DWORD           dwAlign;

  // Combo fill management
  char   *pItems;
  char   *p;
  UINT    len;
  int     count;

  hLine = MakeHLineFromLineNum(hwndCnt, linenum);

  // query lpFld from hline and colnum
  lpFld = QueryLpFld(hwndCnt, hLine, colnum);
  if (!lpFld)
    return FALSE;

  // special management for caption line
  if (hLine == CONT_FIRSTLINE_HANDLE) {

    // prepare align parameter
    switch (align) {
      case CONT_ALIGN_LEFT:
        dwAlign = CA_TA_LEFT;
        break;
      case CONT_ALIGN_RIGHT:
        dwAlign = CA_TA_RIGHT;
        break;
      default:
        dwAlign = CA_TA_HCENTER;
        break;
    }
    if (IsLastColumn(hwndCnt, colnum))
      dwAlign = CA_TA_LEFT;   //Force to left if last column
    CntFldTtlAlnSet(hwndCnt, lpFld, dwAlign);
    CntFldTtlSet(hwndCnt, lpFld, txt, x_strlen(txt)+1);
    return TRUE;
  }

  // extract data from cell
  if (!CntFldDataGet(hLine, lpFld, 0, (LPVOID)&column))
    return FALSE;

  // Update the data
  column.type = CONT_COLTYPE_COMBO;
  if (IsLastColumn(hwndCnt, colnum))
    column.align = CONT_ALIGN_LEFT;   //Force to left if last column
  else
    column.align = align;

  // First loop to get the number of items and the length to allocate
  p = txt;
  count = 0;
  while (*p) {
    count++;
    len = x_strlen(p) + 1;
    p += len;
  }
  len = p-txt + 1;

  // allocate and fill using previous data
  pItems = ESL_AllocMem(len);
  if (!pItems)
    return FALSE;
  memcpy(pItems, txt, len);

  // store info in the column structure
  column.ucol.sCombo.itemCount  = count;
  column.ucol.sCombo.charCount  = len;
  column.ucol.sCombo.pItems     = pItems;
  column.ucol.sCombo.selection  = selection;

  // Load back data into the record.
  if (!CntFldDataSet(hLine, lpFld, 0, (LPVOID)&column))
    return FALSE;

  // Make the record being dispayed again
  // TO BE FINISHED

  return TRUE;
}
Пример #21
0
// Fill a cell with text - coltype can be title, text or combo
// returns TRUE if operation successful
BOOL ContainerFillTextCell(HWND hwndCnt, int linenum, int colnum, int type, int align, char *txt)
{
  LPFIELDINFO     lpFld;
  GENCNTR_COLUMN  column;
  LPRECORDCORE    hLine;

  //First column management
  DWORD           dwAlign;

  hLine = MakeHLineFromLineNum(hwndCnt, linenum);

  // check parameters
  if (type != CONT_COLTYPE_TEXT && type != CONT_COLTYPE_TITLE)
    return FALSE;

  // query lpFld from hline and colnum
  lpFld = QueryLpFld(hwndCnt, hLine, colnum);
  if (!lpFld)
    return FALSE;

  // special management for caption line
  if (hLine == CONT_FIRSTLINE_HANDLE) {

    // prepare align parameter
    switch (align) {
      case CONT_ALIGN_LEFT:
        dwAlign = CA_TA_LEFT;
        break;
      case CONT_ALIGN_RIGHT:
        dwAlign = CA_TA_RIGHT;
        break;
      default:
        dwAlign = CA_TA_HCENTER;
        break;
    }
    if (IsLastColumn(hwndCnt, colnum))
      dwAlign = CA_TA_LEFT;   //Force to left if last column
    CntFldTtlAlnSet(hwndCnt, lpFld, dwAlign);
    CntFldTtlSet(hwndCnt, lpFld, txt, x_strlen(txt)+1);
    return TRUE;
  }

  // extract data from cell
  if (!CntFldDataGet(hLine, lpFld, 0, (LPVOID)&column))
    return FALSE;

  // Update the data
  column.type = type;
  if (IsLastColumn(hwndCnt, colnum))
    column.align = CONT_ALIGN_LEFT;   //Force to left if last column
  else
    column.align = align;

  fstrncpy(column.ucol.s, txt, sizeof(column.ucol.s));

  // Load back data into the record.
  if (!CntFldDataSet(hLine, lpFld, 0, (LPVOID)&column))
    return FALSE;

  // Make the record being dispayed again
  // TO BE FINISHED

  return TRUE;
}
Пример #22
0
//
//  Manage the newly selected cell
//
BOOL ContainerNewSel(HWND hwndCnt)
{
  GENCNTR_COLUMN  column;
  LPRECORDCORE    lpRec;
  RECT            rc;
  DWORD           dwOrg;
  DWORD           dwExt;
  char           *p;
  int             cpt;
  LPGENCNTRDATA   lpGenCntrData;

  lpGenCntrData = GetGenericCntrData(hwndCnt);
  if (!lpGenCntrData)
    return FALSE;

  if (lpGenCntrData->lastSel)
    ContainerOldSel(hwndCnt, lpGenCntrData);

  lpGenCntrData->lastSel = CntFocusFldGet(hwndCnt);
  if (lpGenCntrData->lastSel) {
    // Get Record
    lpRec = CntFocusRecGet(hwndCnt);
    lpGenCntrData->lastLpRec = lpRec;

    // extract data from cell
    if (!CntFldDataGet(lpRec, lpGenCntrData->lastSel, 0, (LPVOID)&column))
      return FALSE;

    // Manage combo type item
    if (column.type == CONT_COLTYPE_COMBO) {

      // Get rectangle
      dwOrg     = CntFocusOrgGet(hwndCnt, FALSE);   // Top left corner
      dwExt     = CntFocusExtGet(hwndCnt);          // width/height

      rc.left   = LOWORD(dwOrg) - 1;
      if (IsLastColumn(hwndCnt, column.colnum)) {
        RECT rcClient;
        GetClientRect(hwndCnt, &rcClient);
        rc.right = rcClient.right;
        // TO BE FINISHED : ONLY IF SCROLLBAR IS CURRENTLY VISIBLE
        //rc.right -= GetSystemMetrics(SM_CXVSCROLL);
        rc.right +=2;
      }
      else
        rc.right  = rc.left + LOWORD(dwExt) + 1;

      rc.top    = HIWORD(dwOrg);
      rc.bottom = rc.top + HIWORD(dwExt);

      // create combobox
      lpGenCntrData->hWndCombo =
                   CreateWindow("combobox",
                                0,
                                CBS_DROPDOWNLIST | WS_VISIBLE |
                                WS_CLIPSIBLINGS | WS_CHILD |WS_VSCROLL,
                                rc.left,
                                rc.top,
                                rc.right-rc.left,
                                (rc.bottom-rc.top)*5,
                                hwndCnt,
                                0,
                                hInst,
                                0);
      if (lpGenCntrData->hWndCombo) {
        int iSel =0;

        //SubClassBegin();
        //SendMessage(lpGenCntrData->hWndCombo, WM_SETFONT,
        //            (WPARAM) GetStockObject(ANSI_VAR_FONT), TRUE );
        SetWindowFont(lpGenCntrData->hWndCombo, CntFontGet(hwndCnt, CF_GENERAL), TRUE);

        // Fill the combo
        p = column.ucol.sCombo.pItems;
        for (cpt=0; cpt<column.ucol.sCombo.itemCount; cpt++) {
            ComboBox_AddString(lpGenCntrData->hWndCombo, p);
            p += x_strlen(p)+1; // advance to next item
        }
        ComboBox_SetCurSel(lpGenCntrData->hWndCombo, column.ucol.sCombo.selection);
        ComboBox_ShowDropdown(lpGenCntrData->hWndCombo, TRUE);
        BringWindowToTop(lpGenCntrData->hWndCombo);
        SetFocus(lpGenCntrData->hWndCombo); // Emb June 8, 95
      }
    }
  }
  return TRUE;
}
Пример #23
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;
}
Пример #24
0
static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
   LPGRANTPARAMS lpgrant = (LPGRANTPARAMS)lParam;
   HWND    hwndDatabases = GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_DATABASES);
   HWND    hwndGrantees  = GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_GRANTEES);
   HWND    hwndProcedures= GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_PROCEDURES);
   UCHAR   szDatabaseName[MAXOBJECTNAME];
   char    szTitle [MAX_TITLEBAR_LEN];
   char    szFormat[100];

   if (!AllocDlgProp (hwnd, lpgrant))
       return FALSE;
   //
   // force catolist.dll to load
   //
   CATOListDummy();
   if (lpgrant->ObjectType == OT_PROCEDURE)
      LoadString (hResource, (UINT)IDS_T_GNREF_PROCEDURE, szFormat, sizeof (szFormat));
   else
      LoadString (hResource, (UINT)IDS_T_GNREF_SEQUENCE, szFormat, sizeof (szFormat));

   wsprintf (
       szTitle,
       szFormat,
       GetVirtNodeName (GetCurMdiNodeHandle ()));

   SetWindowText (hwnd, szTitle);
   if (lpgrant->ObjectType == OT_PROCEDURE)
      lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_GNREF_PROCEDURE));
   else
      lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)ID_HELPID_GNREF_SEQUENCE));


   if (lpgrant->GranteeType == OT_GROUP)
   {
       Button_SetCheck (GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_GROUP), TRUE);
       FillGrantees (hwndGrantees, lpgrant->GranteeType);
   }
   else
   if (lpgrant->GranteeType == OT_ROLE)
   {
       Button_SetCheck (GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_ROLE),  TRUE);
       FillGrantees (hwndGrantees, lpgrant->GranteeType);
   }
   else
   {
       if  (x_strcmp (lpgrant->PreselectGrantee, lppublicdispstring()) == 0)
           Button_SetCheck (GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_PUBLIC), TRUE);
       else
       {
           Button_SetCheck (GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_USER),   TRUE);
           lpgrant->GranteeType = OT_USER;
           FillGrantees (hwndGrantees, lpgrant->GranteeType);
       }
   }

   ComboBoxFillDatabases  (hwndDatabases);
   ComboBoxSelectFirstStr (hwndDatabases);
   ComboBox_GetText (hwndDatabases, szDatabaseName, sizeof (szDatabaseName));
   x_strcpy (lpgrant->DBName, szDatabaseName);
   
   if (lpgrant->ObjectType == OT_PROCEDURE) {
      if (!CAListBoxFillProcedures (hwndProcedures, szDatabaseName))
         CAListBoxDestroyItemData (hwndProcedures);
   }
   else {
       ShowWindow( GetDlgItem (hwnd,IDC_GNREF_PROCEDURE_OPTION) ,SW_HIDE);// Hided "With grant Option" control
       LoadString (hResource, (UINT)IDS_STATIC_SEQUENCE, szFormat, sizeof (szFormat));
       SetDlgItemText(  hwnd, IDC_STATIC_GNREF_PROCEDURE, szFormat ); 

       if (!CAListBoxFillSequences (hwndProcedures, lpgrant->DBName))
           CAListBoxDestroyItemData (hwndProcedures);
   }

   if (x_strlen (lpgrant->PreselectGrantee) > 1)
      PreselectGrantee (hwndGrantees, lpgrant->PreselectGrantee);
   if (x_strlen (lpgrant->PreselectObject) > 1)
      CAListBoxSelectStringWithOwner (hwndProcedures, lpgrant->PreselectObject, lpgrant->PreselectObjectOwner);
   EnableDisableOKButton (hwnd);

   richCenterDialog(hwnd);
   return TRUE;
}
Пример #25
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;
}
Пример #26
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;
}
Пример #27
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;
}
Пример #28
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;
}
Пример #29
0
static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
   LPREVOKEPARAMS lprevoke = (LPREVOKEPARAMS)lParam;
   HWND hwndGrantees    = GetDlgItem (hwnd, IDC_REVOKE_TABLE_GRANTEES);
   char szTitle [90];
   char szStr   [MAX_TITLEBAR_LEN];
   int  i, positive_privilege;
   BOOL bGrantAll = FALSE;
   char buffer  [MAXOBJECTNAME];
   LPUCHAR parentstrings [MAXPLEVEL];

   if (!AllocDlgProp (hwnd, lprevoke))
       return FALSE;
   //
   // force catolist.dll to load
   //
   CATOListDummy();


   for (i = 0; i < GRANT_MAX_PRIVILEGES; i++)
   {
       if (lprevoke->PreselectPrivileges [i])
       {
           positive_privilege = i;
           break;
       }
   }

   switch (lprevoke->ObjectType)
   {
       case OT_TABLE:
           lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_REVOKE_TABLE));
           break;
       case OT_VIEW:
           lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_REVOKE_VIEW));
           break;
       case OT_DBEVENT:
           lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_REVOKE_DBEVENT));
           break;
       case OT_PROCEDURE:
           lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_RVKGPROC));
           break;
       case OT_SEQUENCE:
           lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_RVKGSEQUENCE));
           break;
   }

   switch (positive_privilege)
   {
       case GRANT_SELECT    :
           LoadString (hResource, (UINT)IDS_T_REVOKE_SELECT_ON, szTitle, sizeof (szTitle));
           lprevoke->Privileges [GRANT_SELECT] = TRUE;
           if (lprevoke->ObjectType == OT_TABLE)
               HaveBeenGranted = OT_TABLEGRANT_SEL_USER;
           else
               HaveBeenGranted = OT_VIEWGRANT_SEL_USER;
           break;
       case GRANT_INSERT    :
           LoadString (hResource, (UINT)IDS_T_REVOKE_INSERT_ON, szTitle, sizeof (szTitle));
           lprevoke->Privileges [GRANT_INSERT] = TRUE;
           if (lprevoke->ObjectType == OT_TABLE)
               HaveBeenGranted = OT_TABLEGRANT_INS_USER;
           else
               HaveBeenGranted = OT_VIEWGRANT_INS_USER;
           break;
       case GRANT_UPDATE    :
           LoadString (hResource, (UINT)IDS_T_REVOKE_UPDATE_ON, szTitle, sizeof (szTitle));
           lprevoke->Privileges [GRANT_UPDATE] = TRUE;
           if (lprevoke->ObjectType == OT_TABLE)
               HaveBeenGranted = OT_TABLEGRANT_UPD_USER;
           else
               HaveBeenGranted = OT_VIEWGRANT_UPD_USER;
           break;
       case GRANT_DELETE    :
           LoadString (hResource, (UINT)IDS_T_REVOKE_DELETE_ON, szTitle, sizeof (szTitle));
           lprevoke->Privileges [GRANT_DELETE] = TRUE;
           if (lprevoke->ObjectType == OT_TABLE)
               HaveBeenGranted = OT_TABLEGRANT_DEL_USER;
           else
               HaveBeenGranted = OT_VIEWGRANT_DEL_USER;
           break;
       case GRANT_COPY_INTO :
           LoadString (hResource, (UINT)IDS_T_REVOKE_COPYINTO_ON, szTitle, sizeof (szTitle));
           lprevoke->Privileges [GRANT_COPY_INTO] = TRUE;
           HaveBeenGranted = OT_TABLEGRANT_CPI_USER;
           break;
       case GRANT_COPY_FROM :
           LoadString (hResource, (UINT)IDS_T_REVOKE_COPYFROM_ON, szTitle, sizeof (szTitle));
           lprevoke->Privileges [GRANT_COPY_FROM] = TRUE; 
           HaveBeenGranted = OT_TABLEGRANT_CPF_USER;
           break;
       case GRANT_REFERENCE :
           LoadString (hResource, (UINT)IDS_T_REVOKE_REFERENCE_ON, szTitle, sizeof (szTitle));
           lprevoke->Privileges [GRANT_REFERENCE] = TRUE;
           HaveBeenGranted = OT_TABLEGRANT_REF_USER;
           break;
       case GRANT_RAISE     :
           LoadString (hResource, (UINT)IDS_T_REVOKE_RAISE_ON, szTitle, sizeof (szTitle));
           lprevoke->Privileges [GRANT_RAISE] = TRUE;
           HaveBeenGranted = OT_DBEGRANT_RAISE_USER;
           break;
       case GRANT_REGISTER  :
           LoadString (hResource, (UINT)IDS_T_REVOKE_REGISTER_ON, szTitle, sizeof (szTitle));
           lprevoke->Privileges [GRANT_REGISTER] = TRUE;
           HaveBeenGranted = OT_DBEGRANT_REGTR_USER;
           break;
       case GRANT_EXECUTE   :
           LoadString (hResource, (UINT)IDS_T_REVOKE_EXECUTE_ON, szTitle, sizeof (szTitle));
           lprevoke->Privileges [GRANT_EXECUTE] = TRUE;
           HaveBeenGranted = OT_PROCGRANT_EXEC_USER;
           break;
       case GRANT_NEXT_SEQUENCE   :
           LoadString (hResource, (UINT)IDS_T_REVOKE_NEXT_SEQUENCE_ON, szTitle, sizeof (szTitle));
           lprevoke->Privileges [GRANT_NEXT_SEQUENCE] = TRUE;
           HaveBeenGranted = OT_SEQUGRANT_NEXT_USER;
           break;
       case GRANT_ALL       :
           LoadString (hResource, (UINT)IDS_T_REVOKE_ALL_ON, szTitle, sizeof (szTitle));
           lprevoke->Privileges [GRANT_ALL] = TRUE;
           bGrantAll = TRUE;
           switch (lprevoke->ObjectType)
           {
               case OT_TABLE:
                   break;
               case OT_PROCEDURE:
                   break;
               case OT_DBEVENT:
                   break;

           }
           HaveBeenGranted = -1;
           break;
   }

   parentstrings [0] = lprevoke->DBName;
   GetExactDisplayString (
       lprevoke->PreselectObject,
       lprevoke->PreselectObjectOwner,
       lprevoke->ObjectType,
       parentstrings,
       buffer);

   wsprintf (
       szStr,
       szTitle,
       GetVirtNodeName ( GetCurMdiNodeHandle ()),
       lprevoke->DBName,
       buffer);
   SetWindowText (hwnd, szStr);

   if ( lprevoke->ObjectType == OT_SEQUENCE)
   {
      //Hide control the controls not used for sequences
      ShowWindow( GetDlgItem (hwnd,IDC_REVOKE_TABLE_GRANT_OPTION) ,SW_HIDE); // Hided "With grant Option" control
      ShowWindow( GetDlgItem (hwnd,IDC_REVOKE_TABLE_PRIVILEGE)    ,SW_HIDE); 
      ShowWindow( GetDlgItem (hwnd,102)                           ,SW_HIDE);
      ShowWindow( GetDlgItem (hwnd,5020)                          ,SW_HIDE);
      // Unchecked the controls not used
      Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_PRIVILEGE),    FALSE);
      Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_CASCADE),      TRUE);
      Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_RESTRICT),     FALSE);
      Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_GRANT_OPTION), FALSE);
   }
   else
   {
      Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_PRIVILEGE),TRUE);
      Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_CASCADE),  TRUE);
   }

   if (lprevoke->GranteeType == OT_UNKNOWN)
   {
       HandleUnknounObject (hwnd);
   }
   else   
   if (lprevoke->GranteeType == OT_GROUP)
   {
       Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_GROUP), TRUE);
       FillGrantedUsers(hwndGrantees, lprevoke, HaveBeenGranted);
   }
   else
   if (lprevoke->GranteeType == OT_ROLE)
   {
       Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_ROLE),  TRUE);
       FillGrantedUsers(hwndGrantees, lprevoke, HaveBeenGranted);
   }
   else
   {
       if  (x_strcmp (lprevoke->PreselectGrantee, lppublicdispstring()) == 0)
           Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_PUBLIC),  TRUE);
       else
       {
           lprevoke->GranteeType = OT_USER;
           Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_USER),  TRUE);
           FillGrantedUsers(hwndGrantees, lprevoke, HaveBeenGranted);
       }
   }

   if (x_strlen (lprevoke->PreselectGrantee) > 0)
   {
       CAListBox_SelectString (hwndGrantees, -1, lprevoke->PreselectGrantee);
   }

   if (lprevoke->GranteeType != OT_UNKNOWN)
       EnableDisableOKButton  (hwnd);
   
   richCenterDialog(hwnd);
   return TRUE;
}
Пример #30
0
const dnx::char_t* allocate_and_copy(const dnx::char_t* value)
{
    return allocate_and_copy(value, x_strlen(value));
}