Thought / question about ASM

  • Release Candidate 6
    Guest:
    We are at a “proposed final” true release candidate with nothing known remaining to be changed or fixed. For the full story, please see this page in the "Pre-Release Announcements & Feedback" forum.
    /Steve.
  • 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.

coffeeprogrammer

Well-known member
Jul 19, 2021
116
11
The other day I was coding a web api in C# and using curl to view the responses, I had a problem with the JSON and XML being all pressed together, so I needed to find out the exact class and namespace of both for their formatting options to get it to pretty print in the console. As I was looking thought the C# class library I realized I had another assembler thought and question, which I already did a search and did not find much. Does Steve (or anyone that writes in asm) use namespaces in their code?. I don’t recall seeing anything in masm for that. He did say he writes OO. I have not programmed in assembler lately as a large amount of job listings want C# and rest apis so I have been focusing on that as well as writing design patterns in C#, but I hope some time to get back to ultra geek assembler. :) Thanks.



Chad
 
Well I have made some pretty significant progress on my journey. Between saturday and sunday I stay up all night reading Windows 10 System Programming part 1, and I think I have a good idea about kernel objects and the handles that indirectly access them. I stopped at chapter 4 but I took side trips in other books about COM. The source code in the book uses two libraries “Windows Implementation Library” and “windows template library”. I had quite a time figuring out how windows messages get mapped to events in ALT, but that seems to be what the windows template library uses. Its a macro thing. I think I know understand IUKnown and the factories and vtables that create server objects in com. And I got a little bit on connection points. Archive.org is a good resource. And as a C# developer I think that is what the binary NuGet (C#) packages are based on, after all they are binary DLLs and not source code. And that cleared up enough for me to understand the windows template library gui somewhat, the next part with the handles was c++ smart pointers in Windows Implementation Library, I have programmed in C++ in school, but I was unsure of what a smart pointer was, I get it now, unique and shared any way.

I have been sticking to C++ and not assembly, because my lack of knowledge with x86 instructions and windows inner workings is too much at once. I’ve decided that C++ and maybe at some point, C is what I will use for Windows for a time. I still need to understand Com I think that is still used in some areas of windows, like firewall rules for example.

Any way this original post was asking about namespaces in assembly, I wrote a simple c++ sample with two defined namespaces and disassembled it in VS. Still can’t tell, but my guess is that there are no namespaces and that if one where to follow windows.h and it’s includes and removing any namespaces, if there are any, you could basically program windows without namespaces. Thats my guess. C does not have namespaces.



I did copy windows.h to my sync drive and I am going to copy all of its includes and go over them carefully. I already found the old “win32 lean and mean” conditional include. It is Vs2022 and I also seen some includes for api sets, do I don’t know if that will complicate things. I just wanted to say thanks to Steve, I am not sure I would be willing to put in extra time for low levels if I have never found him online. Cool stuff Steve and can wait to hear about SpinRite 7 development on RTOS.
 
Well thank you very much, I've not read the link yet but I did consult Wikipedia so I guess simply put it just adds different characters to overlapping identifier names. I am guessing this is one of the concepts covered in the compilers area. I've been looking for a good video series on compilers, hopefully based on C++, but I can't find anything that is super-great. I've checked youtube of course and coursea for something free or cheap, I can't think of too many more services, if anyone knows of any, that’s great. I just don't feel like reading about compilers at the moment that is why I am looking for a video course. I have Pluralsight and they do have an advanced JavaScript that is from the perspective of the JS compiler, but I want something more based on C++. After reviewing .cpp header files from Vs and the Windows SDK, Steve's SIB project, and the files and files from fasm I think I have a better idea of how some of the compilers and assemblers call an API like the Windows API. I also figured out __declspec at least in the dllimport and dllexport context. I figure out what I believe to understand lib files are just function prototypes pointing to the actual dlls. And of course a possibility of def files for creating lib files. At my current level of understanding I am believing that an export from a DLL can happen by way of a __declspec(dllexport) or a def file. Not 100% but that is correct, but that is what I am believing. I also figured out __stdcall by tracing back the headers files and what that tells the programmer what needs to happen when using the stack and calling procedures with arguments. I've wondered what the WINAPI and similar are for a while, I am not sure why people don't just use __stdcall in it's place, WINAPI and the others must add a little more information than __stdcall would. I couldn’t think of a way to generate LIB file with just a DLL and nothing else. There is DUMPBIN, but I didn't notice parameters or return types with that, too my thinking thinking one what have to make using of the c/cpp header files to make MASM type includes and likely the LIB files are already compatible. Well thanks again, I like posting what I am up to, I don't think I will catch up to Steve any time soon, but it is worth while. Thanks everyone.