C and assembly/symbols and debugging, question and a discussion

  • Be sure to checkout “Tips & Tricks”
    Dear Guest Visitor → Once you register and log-in:

    This forum does not automatically send notices of new content. So if, for example, you would like to be notified by mail when Steve posts an update to his blog (or of any other specific activity anywhere else), you need to tell the system what to “Watch” for you. Please checkout the “Tips & Tricks” page for details about that... and other tips!

    /Steve.

Jul 19, 2021
6
0
Hello All,


I have been a junior level C# developer since 2016. I programmed in qbasic and a little bit of c plus plus in high school and I will be 37 this year so I am starting assembler a little late. I had a math teacher in high school who introduced me to assembly, I think it was a 68000 cpu and called a heath kit that’s all I remember. This last week, I’ve been using Windows System Programming by Johnson M. Hart to understand windows better. I’ve also found archive.org is good for “Win32” programming, most books being 9x/NT4 and Win2000, but they seem to run fine on my killer Win10 machine with Visual Studio 2015. While learning the “Win32” api I am sticking with C mostly as I am wanting to cover the API directly and QUICKLY. I keep making mess after mess. Those messes seem like a no in coding and certainly assembly coding. Thinking about that, tonight I took a break to see if I could get OllyDbg to pick up the C source and disassembly of a very poorly written Win32 C program. It is actually the first Win32 program I have ever successfully written after a few failed attempts in MASM32. Does anyone know if Visual Studio or Hutch’s MASM32 can or will, with 32 bit assembly, produce the PDB files necessary to debug x86 assembly rather than the C shown here? Part of my original barrier to learning assembly was that I didn’t understand how to get a debugger working well and didn’t have much time to figure it out. Based on this screen shot I might have more success with OllyDbg for debugging. I guess I could use MASM32 or ml.exe with the different Visual Studio versions. I could google debugging symbols from MASM32 or something. For clarity in understanding my story, I also figured out that I could use VS for debugging in masm style assembler. I did this by telling VS that I wanted to build MASM as a build target and by changing the include and library files to point to the \masm32\include and \masm32\lib folders directly rather than (or in addition to) the typical C and C++ libraries and headers in the VS project settings. Then just add a ASM file and code. Well I hope people find this as exciting as I do. I am wanting to give up on the C#/Angular life and switch to C, Win32 and very likely masm assembler. I find been impressed with what Security Now and Steve brings for years. Also, I learned some of the win32 api by using a API monitor, I reversed sysinternals desktop.exe program and if worked, I’ve got the same multiple desktop functionality in my poorly written application. I did most of that in a XP VM and it worked, the crap code in the screen shot is where started that project with my main OS, Win10. Feel free to reply, I would be happy to make friends.
 

Attachments

  • GoodDebuggerBadCode.png
    GoodDebuggerBadCode.png
    109.9 KB · Views: 26
Jul 19, 2021
6
0
Hello,

I have been trying to recode the Bounce1 program written in C to masm assembler for Petzold's Programming Windows, chapter 14. I have ran into a few problems and am asking for help. Where the ball will not appear, video explains more. Code attached. Thanks.

Chad Botting
coffeeprog

"
"

PS I am still waiting for my MASM32 forum activation email to ask for help there.
 

Attachments

  • Petzold5_c14Bounce1_masm32.zip
    4 KB · Views: 5
Last edited:
Jul 19, 2021
6
0
The needs of the many…



Yes, I am not surprised that Steve is too busy for the likes of me. In fact I’d say there might be better people to help me as Steve has decades of windows programming on me. I know a small handful of the Win32 API and not that well. I am sure I could learn more in C than assembly, but this is just a hobby today. I have not given up in the higher level world of C#. I would be only too happy to switch to assembler when the time is right if ever. With Windows 11 right around the corner sometimes assembler seems a little out of touch. Where I would like to have Steve’s concern is to see his code someday. I bet I am not the only one. I think that only makes sense however after I have pushed my self as much as I can without much expert help. He has provided the Small is Beautiful code which I have yet to examine closely. It includes some cool custom macros I seen in the windows.inc file and I wondered if he uses masm32 from Hutch or if he is just using masm. That is the ml.exe and link.exe included with visual studio and somehow creating the libraries needed from like the windows sdk or something. I remember he once said he was on VS6 with WinXP and VS2008 with Win7. I think that it is possible to use masm assembler without masm32 by Hutch, but Hutchs’ does include some good example code. So yes, this is a coding forum and I am not only asking for help, there is also stackoverflow and masm32 forums for that. If I get really good at it, it will generate interest and I can share my code. Most of what turns up in google for masm is very superficial, simple console code type things. I am just looking for everyday people for friends and ideas even if assembler is not your primary language. Coding forums should include code I think, and this is a Gibson Research coding forum. I see people in these forums have started threads on php, python and powershell. I have coded in Python, Java, C++, Visual Basic .NET, and mostly C#. Some of the memories from C++ from my Data Structures and Algorithms cource include linked list, balancing trees, an open shortest path first algorithm, and a text parser I made in C++. That was in 2015 I think and I don’t think I remember where the code is. Alot of Java algorithms too in school.

I would like to continue posting here and someday I would like to author a video tutorial or maybe a book on Windows Assembler, but I am still very much a novice. I have a few editions of the Windows Internals books and Windows via C/C++ as well as a Windows 10 System Programming by Pavel Yosifovich, a pdf I bought. If Steve wants to offer advice he is welcome, but that is likely overkill for me these days. Hopefully he writes a book in his spare time. :). All are welcome. Anyhow, I did get some of the problems solved on the bouncing ball program and learned along the way. Not 100% yet, but something. I will share when I get it 100% working even if the code still looks sub par.



PS I also have "The Assembly Programming Master Book", by Vlad Pirogov but I bought it before the price skyrocketed on amazon.



Thanks,

Chad Botting