Condbreakpoint

int Condbreakpoint(HWND hparent,ulong *addr,int naddr,wchar_t *title,int x,int y,int fi);

Displays dialog window asking user to set or modify parameters of simple conditional INT3 breakpoints at one or more addresses addr[naddr] in the memory of the debugged process. Simple conditional breakpoint pauses execution if condition estimates to non-zero value:

Condbreakpoint()


Parameters:

hparent
(in) Hande of the window that owns dialog
addr
(in) Pointer to the array of naddr unsigned long addresses where breakpoints should be set
naddr
(in) Number of addresses in addr
title
(in) Pointer to the UNICODE string that specifies the title of the dialog. If title is NULL, the title is set to "Set breakpoint at xxx" or "Edit breakpoint at xxx"
x
(in) Suggested X screen coordinate of the bottom left corner of the dialog, pixels. If both x and y are negative, dialog will use default position. Use Gettableselectionxy() if dialog is displayed by the table window. Note that dialogs are multimonitor-aware
y
(in) Suggested Y screen coordinate of the bottom left corner of the dialog, pixels
fi
(in) Index of the font used by the parent table, or -1 for default. This font may be reused by the dialog


Return values:

Returns -1 on error (even partial), 0 if no action is necessary and 1 if breakpoint parameters are changed and breakpoints are applied, updated or removed


Example:

This is the slightly adapted menu function that processes INT3 breakpoint-related commands "Toggle breakpoint" (index=0), "Conditional breakpoint" (index=1) and "Conditional log breakpoint" (index=2) in the dump window:

static t_dump    *menudump;            // Descriptor of dump that calls menu
static int       menuselvalid;         // Whether selection is valid

static int Mbreakpoint(t_table *pt,wchar *name,ulong index,int mode) {
  int answer;
  t_bpoint *pbrk;
  POINT coord;
  menudump=(t_dump *)pt->customdata;
  menuselvalid=(menudump->size!=0 &&
    menudump->sel0<menudump->sel1 &&
    menudump->sel0<menudump->base+menudump->size &&
    menudump->sel1>menudump->base);
  if (menuselvalid==0 || menudump->filecopy!=NULL ||
    (menudump->dumptype & DU_BACKUP)!=0 || menutype!=DU_DISASM)
    return MENU_ABSENT;
  if (mode==MENU_VERIFY)
    return MENU_NORMAL;
  else if (mode==MENU_EXECUTE) {
    // Removing or editing of existing breakpoint is always safe. To set new
    // breakpoint, check whether this is a (possible) command.
    pbrk=(t_bpoint *)Findsorteddata(&(bpoint.sorted),menudump->sel0,0);
    if (pbrk==NULL) {
      if (Confirmint3breakpoint(menudump->sel0)!=0) return MENU_NOREDRAW; };
    if (index==0) {
      // Toggle unconditional breakpoint.
      if (pbrk!=NULL && pbrk->type & BP_MANUAL)
        Removeint3breakpoint(menudump->sel0,BP_MANUAL);
      else {
        answer=Setint3breakpoint(menudump->sel0,BP_MANUAL|BP_BREAK,
          0,0,0,0,L"",L"",L"");
        if (answer!=0) {
          Flash(T(L"Unable to set breakpoint"));
          return MENU_NOREDRAW;
        };
      }; }
    else {
      // Set conditional breakpoint (simple and full forms).
      if (Gettableselectionxy(&(menudump->table),2,&coord)<0)
        coord.x=coord.y=-1;            // Unknown coordinates, use defaults
      if (index==1) answer=Condbreakpoint(pt->hw,&(menudump->sel0),1,NULL,
        coord.x,coord.y,menudump->table.font);
      else answer=Condlogbreakpoint(pt->hw,&(menudump->sel0),1,0,NULL,
        coord.x,coord.y,menudump->table.font);
      if (answer<0) Flash(T(L"Unable to set breakpoint"));
      if (answer<=0) return MENU_NOREDRAW; };
    return MENU_REDRAW; };
  return MENU_ABSENT;
};


See also:
Dialogs, breakpoints, Condlogbreakpoint(), Gettableselectionxy(), Hardbreakpoint(), Hardlogbreakpoint(), Membreakpoint(), Memlogbreakpoint()