A TLS 1.3 stack written in Visual Basic 6
github.com
github.com
VB6 was part of my Year 10, 11 & 12 software design and development class at school similarly was my first start as a programmer. I remember one of my first major projects was a sudoku solver :)
In fact, I still have the 1300 page 'Mastering Visual Basic 6' book on my bookshelf as a reminder some 15 years later.
Games are an amazing mechanism for learning because they can cover a gamut of computing issues in an interesting and motivating environment. The key to learning how to program (or, honestly, most anything) is to have a problem you're keenly interested in and trying to solve it. The "learning" becomes secondary to the problem solving.
My Dad learned programming (badly, wow was his stuff horrible!) through solving financial analysis questions. Kids, however, tend to not have "problems". But games are filled with them, and, done right, in a quick turnaround environment, they can be really fun, and quickly rewarding, to solve.
But, Back In They Day, LOTS of games were crummy, character or text based games. So most of the problem solving was not spent on assets, but just on the logic behind the game. As a student in high school with access to a PET computer, all I did was write games. When all you have is the, albeit robust, PETSCII graphic character set and a 40x24 display, you run into limits quickly (you should have seen my first forays into 3D programming).
But at the same time, the cosmetics cost "nothing". A few characters laid out on the screen. I had a submarine game with ships traveling across "rolling waves water", that, honestly, probably took 10m of coding to make it work.
Today, however, if you look out at most any game, well, the graphics are the graphics. 2D, 3D, etc. They're very involved. Even a web page today is (can be) a time consuming process of making it "look good" beyond simply generating the content for the page.
And I just wonder if that's acting as a barrier to entry for folks even wanting to try their hand at it. This "Alphabet" game, I can see that being very quick, even for a novice to make progress on with Visual Basic. A window is trivial, painting characters is straightforward, adding colors, etc. No worries about frame rates, double buffering, animated sprites, etc. Just clear the screen and stamp a letter (or letters) on it, and watch for a keystroke.
I know there are some child friendly environments that perhaps make this easier, but for teens that want to use a "real programming language", the step up can be quite steep. When your "Star Trek" game looks much like any other, its easy to focus on game play, logic, and "learn programming". When your "Star Trek" is made from E's, K's, and *'s and The Other One is full motion 3D models blasting glittering photons, you can see how for some, that can take the wind out of their sails to even start trying.
VB6 is how I learned to speak to the computer and make it do anything I wanted it to do.
I was in high school when I built a simple, yet funny, game in VB6. I was a novice, but the game was working like a charm. The concept was basic, the alphabet letters, randomly falling down the screen from top to bottom, and you had to press the corresponding key on the keyboard before the letter totally disappeared at the bottom of the screen. When you hit the letter, it would explode with a nice animation while playing an "explosion.wav" sound file. When missed, the screen would get a red flash with an alert sound. I then took a step further by introducing "levels", which were basically a mix of falling speed and adding extra characters, like UPPERCASE letters, where you should hold the SHIFT key when pressing the letters, numbers on the keypad, and even special characters that have a special combination on the keyboard.
Sometime later, one of my elder brothers was studying at a broad university (in Europe to be precise), and as a final project of his studies, he was required to build something using programming — anything that runs on a computer! He reached out for help, and I told him I'd built a game, He asked me to send it over, and when he pressed the F5 key on his keyboard and ran it, he was amazed at how funny it was. He had a tiny challenge, though, he was obliged to explain how he built it in presentation. I can’t forget how I explained the code to him and what each function meant. I was in a public park, and the people were staring at me like I was not OK! I was yielding on the phone: "read that IsPressedLetterOnScreen function", "check that class", "go to line 99", "make a break point here", "press CTRL+F5".. you know..
In the end, he fully understood how it was working, presented the game, wowed the evaluators/teachers and, per his claims, got the highest score among all of his colleagues. Hearing that his (I mean, my) game was the best project presented that year made me the happiest person living on the planet that day..
That's my story with VB6.. in a nutshell, and that's why I felt the haptic feedback in my heart!
I sincerely hope your nick is not PII though or you might have incriminated your brother.
Do notice Option Explicit. That is like disabling 90% of the magic that causes unmaintainable code.
You monster!
I had to convert everything to "Option Base 0" before I could start fixing the reported bugs, it was far too confusing following the arrays passed between modules being indexed starting at 0, then 1, then 0 etc.
The existing code was written with 0 or 1 as required (except where there were bugs), and frankly I think it's was better anyway to use 0 everywhere rather than LBound(x).
Any open source ones?
After working on vba for MSAccess for a few years I came to both appreciate and hate it.
It’s fast, small in features compared to modern languages, but a pleasure to hack around and find ways to expand its capabilities.
I made simple ORM with it, autogenerating classes from a database, went into the rabbit hole of modernising the dialog box to properly display unicode and make it richer, extended it with string classes taken from .Net, played with COM, the ribbon, etc
Maddening at time but so satisfying to play with. And it was for a useful purpose.
Especially Twin Basic looks good IMHO. Looking forward to testing it on my old applications!
None of these were open source, like the two you mentioned, which if history is any indication it means that they will be eventually lost too.
That was probably Jabaco[0]. Shame it wasn't open sourced. I played with it back in 2014-ish.
See https://www.vbforums.com/showthread.php?898205-Can-Visual-St...
I don't think Microsoft will come after you for doing it even if you use a pirate copy.
I remember, fondly, my VB6 days in back office of a power company during my internship. I don’t think I’ve ever developed and delivered software faster than back then. It’s too bad the whole “RAD” thing isn’t a thing anymore.
I once worked with a guy who was a VB savant. He had reverse-engineered the DOC and PST formats in Visual Basic and was comfortable bit-bashing stuff in that environment. His higher-level code was really not good, that wasn't important to him, so he pasted stuff everywhere. Lost track, but hope he found his niche.
https://files.johno.uk/habbo/h4bbo.net/archive/HabboStuff/Mo...
https://www.vbforums.com/showthread.php?788179-VB6-Kernel-mo...
Inspired by that, I made a similar 'hello world' type kernel mode driver and in addition to the VB6 version, made a twinBASIC version, which can compile to x64 and run on current Windows. twinBASIC has no runtime dependency, so you can use far more of the language features, supports cdecl for calling dbgprint, and it has native support for putting APIs into the IAT so no TLB dependency and overriding the entry point so no special hack for that.
https://github.com/fafalone/HelloWorldDriver
I'm not nearly as brilliant as The trick or wqweto to figure these things out to begin with, but it's so much fun taking the techniques of these legends and running with them. Although I did claim the title of first to create a realtime kernel ETW event tracer, a notoriously unfriendly API that requires multithreading (possible in VB6 thanks to The trick et al, natively supported in tB via API for now, language syntax soon).
To be fair, though, in C, those would just be hidden inside a header file, so you wouldn't notice them as much.
DER parsing here: https://github.com/mateuszb/tls1.3/blob/master/der.lisp
Elliptic curves here: https://github.com/mateuszb/tls1.3/blob/master/elliptic-curv...
Protocol records: https://github.com/mateuszb/tls1.3/blob/master/record.lisp
At the time I implemented TLS1.3 there was very little support for it and it seemed like a fun project. The parsing wasn’t the difficult part
try { doSomething(); } catch(e) {}
these days. :)Not really:
https://www.codeproject.com/Articles/19239/Compilers-Demysti...
COM interfaces might count, but that's more of a reference to a COM object which can have many member methods besides a single function (though the concept of using only interface-types to pass around function-pointers is Java's chosen approach, and I don't know anyone who still maintains this was a good idea...)
I was a huge asshole back then but it was a lot of fun.
We mostly gave up on 2D grids as device resolutions evolved. We made HTML, then made HTML5 as if everything was a blog or newspaper with a navigation bar, semantically (and you still have to learn that the nav contains a bulleted list?)
Unfortunately, it became a 3-hour or 3-year or 30-year process for someone to learn “how do I add a button at the bottom-right of my app?!”
I feel, of the three ways of designing guis, the most explored is the declarative way, and there seems to be an assumption by everyone that this is the best way...
But, there is absolutely no data that I could find that supports this view.
I made a small js library to make it easier to quickly write the widgets and layout of widgets in code only.
So fa I'm preferring my code components to react components.
A bit part of it feels like a dedication to highly polished developer tooling. A strong GUI editor that works with (mostly) zero configuration is a big feature of VB6 to me.
It’s not, but with the decadal upgrades in hardware… there should be things that load instantly. Everywhere!
(Deep breath on my end. Ok.) It’s like how games went from a few kilobytes at most, to megabytes disk or dialup… to blue CDs, to 4.7gb, to blu-ray, to 0.5 TB downloads, to second mortgages.
And most of them suck anyway! We will always max out our tech, even if it doesn’t get us much. I mean… we bought that hardware for reasons.
IMO even Delphi 1 had a better GUI form designer. The "Align" property that many controls had, including containers, allowed for visually creating resizable layouts easily since that placed a control to one of the left, right, top and bottom edges of its parent (multiple controls could be stacked) or at the "client" area which basically covered the remaining area. VB had a similar property but IIRC only the picture control supported it (the picture control was also used as a container) and could only place controls to the edges but not the client area. This meant that pretty much any non-trivial UI that needed a resizable window had custom code for the resizing event to handle that instead of being done visually.
Delphi later added a simple "anchor" property to allow custom placed controls to be resized too (the default setting was to anchor to the left and top edge which behaved like before anchors were introduced, but e.g. anchoring a control to the right edge in addition to the left caused the control to be resized horizontally when its parent was resized and anchoring it only on the right caused it instead to move horizontally).
Nowadays Lazarus provides a more advanced anchoring system (e.g. you can have a label control be aligned vertically at the middle of a combo box control and the combo box's left edge to be aligned with the label's right edge with a margin of 5 pixels) which is set up using a visual editor (no code needed) but it also provides the Delphi-like anchors and align properties as well as a bunch of other properties that can be edited visually, like min/max sizes, child control placement, etc all of which make it IMO by far the best WYSIWYG form designer for desktop GUIs (though the anchor editor's own UX could be improved).
The language is much better and the editor has more modern controls. Win32 calls are available relatively easily and the whole program runs quite a bit faster than VB6.
It's a shame that this is so often overlooked. At some point everyone seemed to have switched to WPF and that's when .NET cross platform GUIs seem to have died. There's a new tool out there right now but that doesn't work on Linux so I can't say I really care when WinForms will work perfectly on any operating system Mono has ever been ported to.
VB.net is pretty good, but at that point I just used C#. I go back and make C# guis every now and then with winforms. It always makes me think “how is everything else including QT and WPF and CSS worse decades later?” ;)
And how about that experiment with Electron? That ultimately ended up with me typing `atom foo.py` a few times a month and then being sad (50% of the time because it takes forever to load, the other 50% because it died like 3 years ago and isn’t installed).
I'm still using it although I'm not sure it's a great idea anchoring yourself in the past like that. Also the high dpi stuff has been improving but isn't really very good.
For all the criticism Apple gets on backwards compatibility I think they have a much better story than Microsoft when it comes to UI frameworks.
Whenever I work with a WYSIWYG GUI designer I ask myself a different set of questions instead:
Is this button really in the bottom right, or does it just happen to look that way at the current window size?
Is the spacing on all sides actually equal, or are the pixel coordinates just close enough that I can't see the error?
If I click the button to find out, will I accidentally move it and introduce the error I was trying to detect? (And the version control system can't do much to help with blobs of generated layout code/data.)
To be fair, that would mean you're not using a WYSIWYG GUI designer. With VB6, you could resize the window, in the editor, and watch the elements move around.
And now your carefully set window size has changed, just because you were trying to find out the layout parameters of the button. So you have to go and poke at the properties of the window, if you can remember what size it was supposed to have, And hope you don't accidentally change anything else in the process, because "git diff" isn't going to be much use.
Well, maybe it's just me. I prefer writing a specification (e.g. source code), which can be reviewed and diffed, and then compiling/executing it.
> instead of knowing that it's in the bottom right because that's what you specified.
You did specify the anchors, in the properties window. If you wanted, you could easily verify you had everything correct by resizing the window.
> And now your carefully set window size has changed
If you thought that exact size was important, then you would just have it set to that special size at startup, by setting the "width" and "height" property of the window, or whatever other thing.
> because "git diff" isn't going to be much use.
> I prefer writing a specification (e.g. source code)
You could define the whole interface programmatically, if you wanted, and many did. Sometimes, there was some hybrid, where you would draw up the main window, then throw programatic stuff in a frame/whatever container, because sometimes that makes sense.
The purpose of all of this was to make things easy and take less time. In some, going the programmatic route is a great way to increase billable hours, sometimes it a great way to decrease them. Sticking with one method over the other doesn't make sense to me, because that would be an emotional decision rather than a practical/efficiency one, right tool for the right GUI/window/dialog box, and all.
More complex business logic was solved with VB than with Haskell. Same for JS, PHP, Python and all the other "poor" languages.
Super cool to see this amazing tool getting love in 2023!
The downside to the OS provided libraries is that you are at the mercy of what the OS provides. You need Server 2022 or a relatively new Windows 10 build to have TLS 1.3 available.
I'd argue that the Windows crypto system and openssl really aren't all that different, concept wise. In theory you can ship Linux without openssl but in theory you can remove the Windows cryptography library too if you remove all of its dependencies. In both cases you'll be left with a barebones system where only statically compiled tools can talk to the modern web.
Hey, VB6 is ~~free real-estate~~ Turing complete, although maybe just barely.
If a quine transpiler between JS and PHP and VB6 existed, all things have happened, AI has won, and we can go back to typewriters and candles.