3 ms·
I'm teaching myself the Win32 API for a future RE project, thinking that knowing it helps with the reverse engineering effort. I have just achieved creating a w
by markus_zhang 2y ago
I'm teaching myself the Win32 API for a future RE project, thinking that knowing it helps with the reverse engineering effort. I have just achieved creating a window, loading a text file and printing it on the main window. Scrollbars are there but don't work yet.
It actually take s a lot of work. The boilerplate code is OK but I never realized that showing strings on Windows is such a PIA. I have deep respect for anyone who wrote Windows GUI apps back in the late 80s -> early 90s before RAD is a thing.
As a side note. I recently got a book about WinG game programming on Windows 3.X/95. I remember back in the day the game Fury3, a fascinating 3d flight shooter game, was developed in WinG. It could be an interesting archeology project to develop something serious with WinG, the predecessor of DirectX.
- bonzini 2y agoIIRC WinG was basically a way to set up a GDI device context that corresponded to a frame buffer, so you could take your DOS SuperVGA code and run it under Windows, only redoing sound and input. It's been almost 30 years though. :)
- markus_zhang 2y agoYeah that's probably what it was back in the day. I recalled games run pretty slowly on Windows before WinG came out. Fury3 looked pretty slick, even in today.
- Jare 2y agoThat's what it was, mostly. You could do pretty decent games using GDI as long as you just wanted to blit some sprites and were very much adhering to what GDI would give you. If I remember correctly, all the examples in the "GameSDK sampler CD-ROM" (the original name of DirectX 1.0) were in fact not done with GameSDK or even with WinG, but straight GDI.
- bonzini 2y agoI think it was better and easier to set up a DIB, treat it as a double buffer of sorts and only use GDI to BitBlt it to screen. Don't ask me how you do that, though it probably would not take me too much to page that stuff back into my brain by looking at the Microsoft Win32 manuals. Maybe CreateDIBSection? I still remember my kernel32.dll, but not GDI or User. Anyway, what WinG did (and all it did) was speeding up the blitting part.
- markus_zhang 2y agoI don't know much about the performance, but I guess non-action games should be fine?
- Jare 2y agoThe GameSDK samples included scrolling backgrounds and that kind of stuff.
- userbinator 2y agoI have just achieved creating a window, loading a text file and printing it on the main window. Scrollbars are there but don't work yet. You could just use the standard Edit control for that. If you really want to do it manually, which I have done, it's less than ~300 lines of code for the whole app (including working scrollbars). The binary is less than 4k. but I never realized that showing strings on Windows is such a PIA. Are ExtTextOut and related functions all that hard to use? How much simpler do you think it could be?
- markus_zhang 2y agoThanks, I don't know about that yet, so it's going to be while. For the string it's mostly the wchar and char stuffs. I think I'm getting a hang of it.
- qingcharles 2y agoI'm amazed Fury3 worked under WinG. I used WinG for some simple 2D games, but I don't think I would have tried texture-mapped 3D! We wrote this game on DirectX 1.0. It was a pig because the game was designed to be all 2D sprites, but early in the project it became clear there wasn't enough RAM, so I wrote a 3D engine that integrated with the 2D backgrounds. The video cards of the day didn't like that shit, and there was no acceleration at the time. https://www.youtube.com/watch?v=9UOYps_3eM0 https://www.youtube.com/watch?v=9UOYps_3eM0 All the DirectX code itself felt sluggish as games were coming from highly optimized bare-metal C/x86 to running on a multi-tasking OS through an API that was written in (probably) pretty unoptimized C++.
- markus_zhang 2y agoWow that looks pretty slick. Now I know why early Windows don't have competitive games and why things like WinG and DirectX are pretty big. I think Carmack did not jump on the DirectX wagon until much later.
- pjmlp 2y agoYes, he and Id pushing miniGL are pretty much why Glide lost and everyone was into MS-DOS and OpenGL graphics for a while. However by DirectX 10, he was also not happy with OpenGL mess, and changed his mind on DirectX. https://www.bit-tech.net/news/gaming/pc/carmack-directx-better-opengl/1/ https://www.bit-tech.net/news/gaming/pc/carmack-directx-bett...
- pjc50 2y ago> I have just achieved creating a window, loading a text file and printing it on the main window. Scrollbars are there but don't work yet. > It actually take s a lot of work. The boilerplate code is OK but I never realized that showing strings on Windows is such a PIA. I have deep respect for anyone who wrote Windows GUI apps back in the late 80s -> early 90s before RAD is a thing. The late 90s experience with VBA and the Visual Studio designer is, on the other hand, really good. As was the proprietary Borland Delphi experience. You could do worse than try building an MFC app in VS to get something working and then reverse engineer the details out of that. Strings are not a pain provided you remember -DUNICODE and use wchar for everything (and the related functions).
- pjmlp 2y agoThat book is worth gold from Windows game development archeology point of view, it is quite hard to find anything related to WinG online.
- markus_zhang 2y agoIt's called "Dungeons of Discovery". The book includes a CD with resources to build a mini yet full blobber game. The CD also contains WinG.dll conveniently.
- abareplace 2y agoCheck out the Scrollbars series from Raymond Chen: https://devblogs.microsoft.com/oldnewthing/20030731-00/?p=43003 https://devblogs.microsoft.com/oldnewthing/20030731-00/?p=43... https://github.com/mity/old-new-win32api?tab=readme-ov-file#scrollbars https://github.com/mity/old-new-win32api?tab=readme-ov-file#...