Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

OllyDbg2 Issue - Table Window with Sorted Data

Featured Replies

Posted

I'm developing another plugin for OllyDbg2 and for some reason, after I populate my table with the sorted data (anywhere from 1,500 to 4,00 records or so), I can't use the scroll bar on the side of that window to scroll through all of the data. When I drag the scroll bar down, I can view through a small portion of the data (140 records); as soon as I release the left mouse button the scroll bar immediately returns to the top, but the view doesn't change. When I click to drag the scroll bar again, the view of the data automatically displays the first record at the top of the window and I can scroll through those first 140 records. Now if I use the Page Up/Down or Arrow Up/Down keys, I can look through all of the data, but the scroll bar still doesn't move, so no matter where I am in the list as soon as I click the scroll bar, the view goes back to the first entry and I can only scroll the first 140 records. This issue happens no matter the size of the table window or whether it's maximized or restored.


 


Anyone seen this issue before?


 


First I create my sorted data:



Createsorteddata(&logtable.sorted, sizeof(LOGDATA), 1, (SORTFUNC *)log_window_sort_proc, NULL, SDM_NOSIZE) 

Then I prepare the t_table struct:



void create_log_window(void)
{
StrcopyW(logtable.name, SHORTNAME, OLLYRESREFS_NAME);
logtable.mode = TABLE_SAVEPOS|TABLE_AUTOUPD;
logtable.bar.visible = 1; logtable.bar.name[0] = L"Address";
logtable.bar.expl[0] = L"";
logtable.bar.mode[0] = BAR_SORT;
logtable.bar.defdx[0] = 9; logtable.bar.name[1] = L"Command";
logtable.bar.expl[1] = L"";
logtable.bar.mode[1] = BAR_SORT;
logtable.bar.defdx[1] = 10; logtable.bar.name[2] = L"Item Text";
logtable.bar.expl[2] = L"";
logtable.bar.mode[2] = BAR_SORT;
logtable.bar.defdx[2] = 80; logtable.bar.name[3] = L"Resource Type";
logtable.bar.expl[3] = L"";
logtable.bar.mode[3] = BAR_SORT;
logtable.bar.defdx[3] = 34; logtable.bar.nbar = 4;
logtable.tabfunc = (TABFUNC*)log_window_proc;
logtable.custommode = 0;
logtable.customdata = NULL;
logtable.updatefunc = NULL;
logtable.drawfunc = (DRAWFUNC*)log_window_draw;
logtable.tableselfunc = NULL;
logtable.menu = (t_menu*)log_window_popup_menu;
}

Then create the window (before filling it with the data):



Createtablewindow(&logtable, 0, logtable.bar.nbar, NULL, L"ICO_PLUGIN", OLLYRESREFS_NAME)

What am I missing?


 


Cheers


  • 3 weeks later...

Can you post your log_window_proc & log_window_draw function? Because I think the problem occurs there.


  • Author

Here are the procedures.


 


Processing window messages:



LRESULT CALLBACK log_window_proc(t_table *pTable, HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
LPLOGDATA pLogData;
switch (uMsg)
{
case WM_USER_DBLCLK:
pLogData = (LPLOGDATA)Getsortedbyselection(&pTable->sorted, pTable->sorted.selected);
if (pLogData != NULL) {
Setcpu(0, pLogData->address, 0, 0, 0, CPU_ASMHIST|CPU_ASMCENTER|CPU_ASMFOCUS);
}
Activatetablewindow(&logtable);
return 1;
default:
break;
}
return 0;
}

and for the draw procedure:



long log_window_draw(wchar_t *pszBuffer, uchar *pMask, int *pSelect, t_table *pTable, t_drawheader *pHeader, int iColumn, void *pCache)
{
int str_len = 0;
LPLOGDATA pLogData = (LPLOGDATA)pHeader; switch (iColumn)
{
case 0: /* address of reference */
str_len = Simpleaddress(pszBuffer, pLogData->address, pMask, pSelect);
break;
case 1: /* command that references resource */
                str_len = swprintf(pszBuffer, L"%ls", pLogData->command);
break;
case 2: /* text of resource item */
str_len = swprintf(pszBuffer, L"%ls", pLogData->item_text);
break;
case 3: /* type of resource */
                str_len = swprintf(pszBuffer, L"%ls", pLogData->resource_type);
break;
default:
break;
}
return str_len;
}

  • 1 month later...
  • Author

This is rather embarrassing on my part, but I wanted to let everyone know the fix in case you ever run into this problem.
 
the log_window_proc is specified as (TABFUNC*) which is TYPEDEF long in the OllyDbg PDK.
 
I had the function return type as LRESULT CALLBACK as if it was a windows API procedure routine
 

LRESULT CALLBACK log_window_proc(t_table* pTable, HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

 
Once I changed my return type to long, as it should be, everything worked fine.
 

long log_window_proc(t_table* pTable, HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.