8 ms·
A TLS 1.3 stack written in Visual Basic 6
- sposeray 3y ago[dead]
- WirelessGigabit 3y agoThis is probably the cleanest VB 6 I've seen. Do notice Option Explicit. That is like disabling 90% of the magic that causes unmaintainable code.
- starik36 3y agoThe IDE has a setting to always turn it on for new projects. That was a setting I always enabled on new installs. Along with a switch to use SDI instead of MDI.
- fps_doug 3y ago> Along with a switch to use SDI instead of MDI. You monster!
- dark-star 3y agoWait till you find the assembly code hidden in a list of hex numbers that gets copied to a function and then called as a thunk ;-)
- rbanffy 3y agoI remember the feeling when you see a module and it has an "On Error Resume Next" at the start.
- layer8 3y agoThat’s basically how shell scripts behave by default. At least in VB it’s not the default.
- rbanffy 3y agoYes, but shell scripts are written on that assumption. VB code usually wasn’t.
- Symbiote 3y agoIn my first job, I was given a VB6 project to maintain which had a mixture of "Option Base 1" and "Option Base 0" (or unspecified, this being the default), with occasional "On Error Resume Next". This specifies the index value for the first item in an array, i.e. you could choose the default European building floors (ground floor is 0) or American floors (ground floor is 1) -- per module! 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.
- stormdennis 3y agoWould not the UBound and LBound functions not solved those issues?
- Symbiote 3y agoYes, though I didn't know they existed. 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).
- 29athrowaway 3y agoI wish I had known this back in the day.
- userbinator 3y agoIt's less than 8kLoC, including what seems to be a bunch of tests at the end, although much of the actual crypto appears to be done using the native advapi32/crypt32/ncrypt libraries. (For those used to OpenSSL, I suppose this could be compared to the libssl part of it.)
- flomo 3y agoYep, one of the features of VB was you could call into Win32 fairly easily. 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.
- userbinator 3y agoI think we all have similar stories of tools like VB being pushed far beyond their original purpose by someone with enough motivation, and creating perfectly functional, yet extremely unconventional code. Here's another example I found in my links of old interesting web stuff --- a server for the MMO Habbo Hotel, written by (at the time) a teenager: https://files.johno.uk/habbo/h4bbo.net/archive/HabboStuff/Module1.bas https://files.johno.uk/habbo/h4bbo.net/archive/HabboStuff/Mo...
- Operyl 3y agoOh boy, I remember when this came around. That was incredible to see come together.
- Paul-Craft 3y agoWow, TIL Habbo still exists: https://en.wikipedia.org/wiki/Habbo https://en.wikipedia.org/wiki/Habbo
- fafalone 3y agoThe most impressive 'pushed beyond it's limits' code I've seen is The trick's VB6 kernel mode driver. Yep, really. VB6. Kernel mode. You have to strip out the MSVBVM60.dll dependency, which dramatically limits what language features you can use, but it's possible, albeit for 32bit Windows only, of course. https://www.vbforums.com/showthread.php?788179-VB6-Kernel-mode-driver 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 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).
- nomel 3y agoI still can’t comprehend that VB6 had time travel debugging 20 years ago, and we still don’t have that with most other IDEs.
- b33j0r 3y agoDon’t tell anyone, but I still think we’ve been terrible at UIs since VB6 and Hypercard. 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?!”
- Krutonium 3y agoAnd this is why I absolutely refuse to do the whole HTML and Co. method of doing GUI's to this day. (XAML etc). I use tools like ETO instead where possible, where I define my UI in code, and it's built to the native UI toolkit whereever relevant. At no point am I writing fucking XML (why does anyone think this is a good idea?!) for a UI. I'm saying I want a title bar with these elements, directly in code. It's fantastic, and should be how it happened in the first place.
- lelanthran 3y agoYou may like my project, once I get around to open sourcing it. 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.
- Krutonium 3y agoI'd love to see it, but alas, C# developer!
- ejnz 3y agowqweto is a genius. Check out his twinbasic project, 99% similar to VB6 with a bunch of extras, modernising the language. Shout out to all the VB6 legends still going at it and extending the language, wqweto, the trick, olaf, retailcoder.
- artificial 3y agoNeat, thanks for sharing!
- stormdennis 3y agoTwinbasic isn't wqweto's, it's Wayne Phillips.
- 1letterunixname 3y agoI fell out of my chair into a fit side-splitting chuckling. 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.
- quickthrower2 3y agoIt exists: https://esoteric.codes/blog/the-128-language-quine-relay https://esoteric.codes/blog/the-128-language-quine-relay
- LispSporks22 3y agoThis is glorious. 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.
- gumballindie 3y agoIt would have been cool to have a rad tool but for react and js as a whole. Writing it by hand is such a waste of time, at least for backoffice tools.
- rzimmerman 3y agoKids today will never know the joy of "On Error Resume Next"
- bjoli 3y agoMan, you made me think of this old gem: https://m.youtube.com/watch?v=Ts96J7HhO28 https://m.youtube.com/watch?v=Ts96J7HhO28
- pcblues 3y agoMy greatest shame as a young developer was wrapping a Delphi application in an exception handler and re-running itself when it crashed.
- rvense 3y agoNono, this is called "let it crash" philosophy, you just reinvented Erlang and you're actually a genius!
- kijin 3y agoIt's called try { doSomething(); } catch(e) {} these days. :)
- pieter_mj 3y agoI'm still programming in VBA today. I name the error handling labels try: and catch: and finally: :). My attempt to introduce some modernity into the language (the'try:'-label is obviously obsolete and is a mere indicator).
- orthoxerox 3y agoI've always preferred On Error GoTo Hell
- layer8 3y agoThat’s what shell scripts do by default, so I would argue that kids today actually do know.
- alex_lav 3y agoVB6 was my first programming language. I started using it in 2001. I loved it, and it is the reason I am a programmer today. Seeing stuff like this is really cool.
- endorphine 3y agoSame here! I remember carrying a VB6 book with me in the beach as a teen!
- robertlagrant 3y agoMy first paid programming job (summer 2001 after first year at uni) was a VB6 project for a friend's family member's company, to update their website easily. I think they might still be using it!
- nneonneo 3y agoI’m seeing in-line x86 assembly encoded as floating-point constants, implementing what looks like indirect function calls (function pointers?). Is this…normal for advanced VB code? Does VB6 not have any other mechanism for function pointers?
- DaiPlusPlus 3y ago> Does VB6 not have any other mechanism for function pointers? Not really: https://www.codeproject.com/Articles/19239/Compilers-Demystified-Function-Pointers-in-Visual 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...)
- _glass 3y agoI used to pass functions by just creating a class making a noun of a verb, i.e. I passed objects.
- electroly 3y agoYou can use the "AddressOf" operator to get a function pointer, but it can only be used to pass to native (Win32) functions. This is how you do things like implementing your own WndProc function. VB itself can't call through the resulting function pointer.
- int_19h 3y agoThe trick was to use some Win32 API function that is guaranteed to invoke the callback right away with the arguments that you specify explicitly. CallWindowProc was the usual go-to for that.
- throwawaaarrgh 3y agoWould be great if operating systems implemented this stuff so every application doesn't need to. Every other internet protocol is built into the OS.
- jborean93 3y agoWindows and Apple does. Linux is typically exposed through OpenSSL or an OpenSSL equivalent library. 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.
- jeroenhd 3y agoThe Linux kernel exposes TLS but very few people actually use it. On some hardware it can make TLS significantly faster, but on beefier hardware I doubt you'll notice the improvement much. At the cost of rewriting your entire network stack, I don't think it makes sense for many tools to switch to it. 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.
- aaronmdjones 3y agoThe Linux kernel only handles the TLS record layer. It's enough to use sendfile(2) on a TLS socket and that's all -- that's why it was added. Userland is still responsible for the TLS session negotiation and handing off the cryptographic keying material and parameters to the kernel; you still need a userland TLS library like OpenSSL.
- Renaud 3y agoAre there still working and available ide and compilers for vb6? 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.
- rlv-dan 3y agoThere are (at least) two project in development aiming to make a modern VB6 with full backwards compatibility: https://twinbasic.com/ https://twinbasic.com/ https://www.radbasic.dev/ https://www.radbasic.dev/ Especially Twin Basic looks good IMHO. Looking forward to testing it on my old applications!
- badsectoracula 3y agoThere was also another one written in Java which was (supposedly) very compatible too and had a full working IDE, etc, but it was abandoned long ago and has been lost in the mists of time. Actually there was a much older project that was compatible with VB4 (i think) and IIRC it was made when Microsoft still worked on classic VB, but again, abandoned and lost. 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.
- ronsor 3y ago> There was also another one written in Java which was (supposedly) very compatible too and had a full working IDE, etc, but it was abandoned long ago and has been lost in the mists of time. That was probably Jabaco[0]. Shame it wasn't open sourced. I played with it back in 2014-ish. [0] http://jabaco.com http://jabaco.com
- aspaviento 3y ago
- stef-13013 3y agoReally nice work which prove, once again, that there is no "bad" langage !!
- gmac 3y agoSee also my experimental TLS 1.3 library in JS/SubtleCrypto, which you can see running live in the browser: https://news.ycombinator.com/item?id=35884437 https://news.ycombinator.com/item?id=35884437
- _joel 3y agoFond memories of my earliest 'programming' experiences with VB6. I remember making a currency convertor in it when I was about 10 and thought it was the coolest thing ever. Either that or GORILLA.BAS ;)
- fafalone 3y agoI was a little later so my memories are things like dos32.bas, VB6 code to make pr0ggi3s for AOL. 12-14, making punters to boot people off, making l33t phaders for your chat room text (gradient color)... i made a scrambler that got pretty popular-- a chat room game where you competed to unscramble words the fastest. Even made it so it avoided the esay csae of smae fisrt and lsat. I was a huge asshole back then but it was a lot of fun.
- gambiting 3y agoAh,VB6 - that's how I started programming. There was a book literally called "Visual Basic for Kids" and I got it when I was....12? I think? Anyway it got me into making all kinds of basic games, then I started reading books about C and C++, started programming for the Playstation Portable, went to university to study CS and got a job in the games industry after that. I 100% credit Visual Basic 6 for me being a programmer today.
- a10c 3y ago+1 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.
- iKlsR 3y agoClose enough, I found a free pdf on Windows Vista ~2008 and there was a chapter with VBScript. You could write these and just double click them to run, spent many hours in notepad making dialogs and small calculator apps etc. Was pretty shocked when I picked up cpp shortly after and the tutorial told me I needed something called a compiler.
- whartung 3y agoI wonder how much the fidelity of modern games hinders young people from breaking into computer programming. 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.
- rbanffy 3y agoVB 6 paid for my first home. But yes, this is insanely brave. VB is not the most expressive language out there.
- lelanthran 3y agoYeah, but it's a humiliating lesson that good enough beats best. More complex business logic was solved with VB than with Haskell. Same for JS, PHP, Python and all the other "poor" languages.
- pcdoodle 3y agoNice! I had to migrate a project using VB6 because I couldn't call an API year back that needed TLS 1.2. Super cool to see this amazing tool getting love in 2023!
- ianhawes 3y agoWhat is impressive (or hilarious) is that someone opened an issue because it wasn't compatible with VB5[0]. The maintainer added a VB5 branch which apparently fixed the issues. [0] https://github.com/wqweto/VbAsyncSocket/issues/4 https://github.com/wqweto/VbAsyncSocket/issues/4
- redbell 3y agoScanning "Visual Basic 6" in the title instantly triggered a strong haptic feedback in my heart! 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!
- ptsneves 3y agoLove the story! It almost makes me feel good about academic fraud, no sarcasm intended. I sincerely hope your nick is not PII though or you might have incriminated your brother.
- Anti-Thony 3y agoFor what it's worth. I started my company with a B2B solution developed in VB6. Now 20 years later I moved to Cloud/SAAS long time ago. But wouldn't you know, about half of my clients still run mission critical processes with the desktop client that received it's last update in 2018. Another one is scheduled for this year.
- cjhowarddev 3y agoSomething about VB6 felt so pure when I wrote it. it's not fancy and is missing a lot of stuff we take for granted today (pretty sure there is no built in map structure lol) but solving problems in VB6 due to language quirks was always fun.
- WorldMaker 3y agoI can verify that there is no built-in map data structure. Also its "classes" don't support constructor parameters nor inheritance. (Wrestling some debugging issues in a legacy codebase so these frustrations are much closer to hand than I would like.)