ollydbg - how to keep debugged program window open - debugging

Any way to keep debugged program window open while stepping the code in ollydbg? The program displays buttons in a loop in a dialog box. But its window stays minimized so I can't observe what effect each command has on visual display.
source: https://legend.octopuslabs.io/sample-page.html (tutorial 16A)

Since you are debugging this program, the program will be "stuck" before GUI components initialized and enter the main loop of GUI thread. You can just keep all window away of "hovering" the program's window, for example don't maximize your OllyDbg window.

Related

Program behaves differently when run from C:\Program Files vs outside of that folder?

Have a strange issue using Win10 x64 Pro. My program main window hides itself, opens another window for an action, then closes that and the main window shows itself again and set as the foreground Window. All that works fine, but when the program is run from C:\Program Files the behavior of Windows is not as expected.
If I click on a window of a different process that is behind the main window, it gets the focus but is still visually behind my programs main window. I can click on another window then things start working as expected. I can also just click back on my main window then the one in the background and works (but only if I first click on the background window then my main window then the background window again). However, if I move the same .exe to say d:\test and run it, the problem doesn't occur (I can click on the background window and it shows over the top of my main window like expected).
I tried disabling norton auto-protect, it didn't make any difference.
What could this be, is there some trick I could use get Windows to give the expected results?
Thanks.

Showing Standard Out in Lazarus IDE when running program?

I am just trying out Lazarus IDE out of curiosity, with the simplest Pascal program possible:
program project1;
begin
WriteLn('Hi there');
end.
When I run it with F9 in the IDE, I thought I would see the standard output in some window, but I cannot find it.
Does Lazarus provide a standard out view?
Yes, it does and console apps work fine in Lazarus. Probably all you need to do is to add a Readln() statement at the very end of your program so that the console window stays open long enough to be visible, otherwise the console window will close automatically as soon as the program completes execution.
program project1;
begin
WriteLn('Hi there');
ReadLn();
end.
However, it seems that Lazarus behaves somewhat differently: in Windows, the terminal window (aka console) displays automatically when the app starts execution, but may require a final ReadLn as above for it to stay on-screen long enough to be visible. On Ubuntu v.1704, to display the console window, I need to go to View | Debug windows | Terminal Output to get it to display (this is what Ctrl-Alt-O does, of course); once I've done that, the console window stays on-screen even after I close and re-open Lazarus. I imagine that somewhere in Lazarus there is a setting that makes the console window visible by default in new projects.
ISTR that somewhere in Lazarus there is an option to not display the console window, but I can't find at at the moment, so try what I have suggested and see if that works for you.
Of course, if you put a debugger breakpoint somewhere before the end of your program code, you should find that the console window is on-screen when the breakpoint trips.

Check, if dialog window "locks" main window

I'm doing Surface Automation of an application. The Automation is asynchron. Sometimes, a Dialog window occures and locks the mainwindow for further Access.
I'm using C++ / Win32API, C# or VB. I can get the main window by the processID and want to find (or write) a function, giving me true or false if the main window is locked by an unexpected Dialog window.
Modal windows disable their owner windows. So you need to call IsWindowEnabled on the main window.

Step-through in VS without VS having focus

I find myself working with GUI code where the GUI program needs input focus and remain the topmost window, but whenever I'm debugging with VS stepping-through with F5/F10/F11 requires that VS has focus.
Is it possible to have VS intercept the F-keys whilst the debugee has focus? If VS doesn't have this functionality I imagine it should be possible to write a simple program or VS add-in that has a keyboard book and commands the debugger accordingly - has anyone developed such a program?
I'm working with a GUI test automation framework that sends mouse-clicks and other events by moving the cursor. When the debugee program is out of focus any click on its surface brings the main window forward but does not activate any controls, but the automation framework assumes that its focus of the application will never be interrupted. So if I set a breakpoint before a click that is meant to open the File menu then the click that is sent will only restore the debugee's focus and not open the File menu (if that makes sense).
I've done some searching but couldn't find anything immediately.
Why do you need to maintain focus? Have you specific hooks in the GotFocus/LostFocus?
I've had problems before with the Paint event being called as soon as F5 was hit causing the debugger to show again and therefore requiring another repaint. I got around these simply by arranging my windows so they didn't overlap. I'm pretty sure the LostFocus/GotFocus pair also don't fire when the windows are arranged this way too.

Program window not viewable during debug pause

When my program is paused in Visual Studios 2010 during debugging, like from reaching a break point and me doing a manual step through, the program window becomes impossible to view.
It is a GUI window not a console window, which I run simultaneously with my program and am still able to view. The window seems to be open it's just that when I click its icon on the taskbar it doesn't come to the front of all the other windows. When I minimize all the windows in front of it, I see the outline of the window but it is either blacked out or showing the remnants of previously expanded windows.
I've noticed this with using Visual Studio's before (various versions of it), and after trying other IDE's that didn't have this behavior I notice it more. It would be really helpful to view the program's change's as I step through the program. Anyone know how I can do this?
I searched a long while and couldn't find a single reference to this matter.
The reason the window doesn't display is that the window paint message won't be processed if the main thread has been paused. Which other IDEs let you do this? I haven't come across any native code debuggers that do this on Windows.
If you are stepping through code that is run by the main thread, then the main thread can't simultaniously poll the message pump, which is needed for the GUI to work.
If you debug a different thread, the GUI will work while you are debugging.

Resources