{"id":28239176,"url":"https://github.com/quackster/mythos","last_synced_at":"2026-02-26T18:02:37.038Z","repository":{"id":239265621,"uuid":"689212154","full_name":"Quackster/Mythos","owner":"Quackster","description":"Experimental DLL calling for VL64/B64 encoding for the Habbo Hotel protocol from within Visual Basic 6.0.","archived":false,"fork":false,"pushed_at":"2024-05-12T00:30:19.000Z","size":1012,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-19T02:11:47.834Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Visual Basic 6.0","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Quackster.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-09T05:27:38.000Z","updated_at":"2024-05-11T23:19:54.000Z","dependencies_parsed_at":"2024-05-11T05:24:34.386Z","dependency_job_id":"f821d2d2-7896-49f1-80b0-247a17a7053e","html_url":"https://github.com/Quackster/Mythos","commit_stats":null,"previous_names":["quackster/mythos"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quackster%2FMythos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quackster%2FMythos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quackster%2FMythos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quackster%2FMythos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Quackster","download_url":"https://codeload.github.com/Quackster/Mythos/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quackster%2FMythos/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259221939,"owners_count":22823988,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-19T02:11:49.093Z","updated_at":"2026-02-26T18:02:31.993Z","avatar_url":"https://github.com/Quackster.png","language":"Visual Basic 6.0","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Mythos\n\nExperimental DLL calling for VL64/B64 encoding for the Habbo Hotel protocol from within Visual Basic 6.0\n\n## Screenshot\n\n![](https://i.imgur.com/Imu4loJ.png)\n\n## Code Snippets\n\n```vb\nPrivate Sub MainServer_DataArrival(Index As Integer, ByVal bytesTotal As Long)\n    Dim incomingMessage As String\n    Dim incomingMessageLength As Long\n    \n    Dim pointer As Long\n    pointer = 1\n    \n    Dim packetLength As Long\n    Dim packetHeader As String\n    Dim packetData As String\n           \n    ' Check if there are at least 5 bytes available to read the packet length and the first character of data\n    If MainServer(Index).BytesReceived \u003e= 5 Then\n    \n        ' Read the buffer\n        MainServer(Index).GetData incomingMessage\n        incomingMessageLength = MainServer(Index).BytesReceived\n        \n        Do\n            ' Harvest packet length\n            packetLength = DecodeB64(Mid(incomingMessage, pointer, 3))\n            pointer = pointer + 3\n                    \n            If packetLength \u003c= 0 Or packetLength \u003e 1000 Then\n                ' Invalid packet length\n                Exit Sub\n            End If\n            \n            ' Check if there are enough bytes available to read the entire packet\n            If bytesTotal \u003c packetLength Then Exit Do\n            \n            ' Harvest packet header\n            packetHeader = Mid(incomingMessage, pointer, 2)\n            pointer = pointer + 2\n            \n            ' Harvest packet data\n            packetData = Mid(incomingMessage, pointer, packetLength - 2)\n            pointer = pointer + packetLength - 2\n            \n            ' Create request class\n            Dim requestMessage As New clsRequestMessage\n            requestMessage.Buffer = packetData\n            requestMessage.Header = packetHeader\n            \n            ' Create data handler class\n            Dim dataHandler As New clsDataHandler\n            dataHandler.Index = Index\n            Set dataHandler.Buffer = requestMessage\n            \n            ' Handle packets\n            Call dataHandler.Parse\n        Loop While Len(Mid(incomingMessage, pointer)) \u003e 0\n    End If\nEnd Sub\n```\n\n## Requirements\n\n- Visual Basic 6.0 IDE\n- Your project is compiling under 'native' and **not** P-code, the DLL calls will not work otherwise\n- [tdm-gcc 32-bit](https://jmeubank.github.io/tdm-gcc/) for Windows; or\n- Packages ``g++ gcc oleaut32`` for Linux/Unix systems \n\n### How it works\n\n*C++ Code*\n\nCopying strings back to the memory allocated Visual Basic 6.0 string, this is probably very evil, but it works!\n\n```c\nvoid copystr(LPSTR destination, long destinationLength, std::string output) {\n    int j = 0;\n    for (int i = 0; i \u003c= destinationLength; i += 2) {\n        char ch = *(destination + i);\n        \n        if (ch == '\\0' || output[j] == '\\0')\n          break;\n\n        *(destination + i) = output[j];\n        \n        j++;\n        \n        if (j \u003e= output.length())\n          break;\n    }\n}\n```\n\nThe actual 'EncodeInt32' function\n\n```c\nvoid encodeVL64(/*LPSTR*/char *destination, long destinationLength, int *outputLength, int i) {\n    int numBytes = 0;\n    char* wf = (char*)malloc(6);\n    int pos = 0;\n    numBytes = 1;\n    int startPos = pos;\n    int negativeMask = i \u003e= 0 ? 0 : 4;\n    i = abs(i);\n    wf[pos++] = (char)(64 + (i \u0026 3));\n    for (i \u003e\u003e= 2; i != 0; i \u003e\u003e= 6) {\n        numBytes++;\n        wf[pos++] = (char)(64 + (i \u0026 0x3F));\n    }\n    wf[startPos] = (char)(wf[startPos] | (numBytes \u003c\u003c 3) | negativeMask);\n\n    // Skip the null bytes in the result\n    char* bzData = (char*)malloc(numBytes + 1);\n    for (int x = 0; x \u003c numBytes; x++) {\n        bzData[x] = wf[x];\n    }\n\n    bzData[numBytes] = '\\0';\n    \n    // Copy to allocated VB6 string\n    std::string allocated(bzData);\n    copystr(destination, destinationLength, allocated);\n    \n    // Free memory\n    free(wf);\n    free(bzData);\n    \n    *outputLength = numBytes;\n}\n```\n\n*Visual Basic 6.0 code*\n\nRun ``dumpbin.exe /exports shared_lib.dll`` on our shared DLL file.\n\nYou will see:\n\n```\nDump of file shared_lib.dll\n\nFile Type: DLL\n\n  Section contains the following exports for shared_lib.dll\n\n           0 characteristics\n    663EC498 time date stamp Sat May 11 11:06:32 2024\n        0.00 version\n           1 ordinal base\n           4 number of functions\n           4 number of names\n\n    ordinal hint RVA      name\n\n          1    0 000015B9 decodeB64@4\n          2    1 00001526 decodeVL64@8\n          3    2 00001627 encodeB64@12\n          4    3 00001278 encodeVL64@16\n```\n\nThe 'EncodeInt32@16' is the exported function name we'll use.\n\n```vb\nOption Explicit\n\nPrivate Declare Sub DllEncodeVL64 Lib \"shared_lib.dll\" _\n    Alias \"encodeVL64@16\" ( _\n    ByVal inputPtr As Long, _\n    ByVal inputLength As Long, _\n    ByRef outputLength As Integer, _\n    ByVal i As Long _\n)\n\nPrivate Declare Function DllDecodeVL64 Lib \"shared_lib.dll\" _\n    Alias \"decodeVL64@8\" ( _\n    ByVal bzData As String, _\n    ByRef totalBytes As Long _\n) As Long\n\n\nPublic Function EncodeVL64(ByVal i As Long) As String\n    Dim encodedVal As String\n    Dim outputLength As Integer\n    \n    encodedVal = Space(6)\n    outputLength = 0\n    \n    Call DllEncodeVL64(StrPtr(encodedVal), LenB(encodedVal), outputLength, i)\n    \n    If (outputLength = 0) Then\n        EncodeVL64 = vbNullString\n    Else\n        EncodeVL64 = Mid(encodedVal, 1, outputLength)\n    End If\nEnd Function\n\nPublic Function DecodeVL64(ByVal encodedValue As String, ByRef totalBytes As Long) As Long\n    DecodeVL64 = DllDecodeVL64(encodedValue, totalBytes)\nEnd Function\n```\n\n## Building the DLL\n\n*Windows*\n\n```\nC:\\TDM-GCC-32\\bin\\g++.exe -std=c++11 -U__STRICT_ANSI__  -c -DBUILD_MY_DLL shared_lib.cpp\nC:\\TDM-GCC-32\\bin\\g++.exe -L. -loleaut32 -shared -o shared_lib.dll shared_lib.o -Wl,--out-implib,libshared_lib.a,--enable-stdcall-fixup\n```\n\n*Linux/Unix*\n\n```\ng++ -std=c++11 -U__STRICT_ANSI__  -c -DBUILD_MY_DLL shared_lib.cpp  \ng++ -L. -loleaut32 -shared -o shared_lib.dll shared_lib.o -Wl,--out-implib,libshared_lib.a,--enable-stdcall-fixup\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquackster%2Fmythos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquackster%2Fmythos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquackster%2Fmythos/lists"}