Skip to content

Instantly share code, notes, and snippets.

View wqweto's full-sized avatar

Vladimir Vissoultchev wqweto

View GitHub Profile
@wqweto
wqweto / mdCallStack.bas
Created June 6, 2026 10:48
VB6 call-stack capture via dbghelp.dll (32-bit StackWalk + Unicode symbol APIs)
'=== mdCallStack.bas =======================================================
' VB6 call-stack capture via dbghelp.dll (32-bit StackWalk + Unicode symbol APIs).
'
' Requires: Native code compile + "Create Symbolic Debug Info" (Project ->
' Properties -> Compile). The resulting .pdb must sit next to the
' .exe/.dll. Ship a known-good dbghelp.dll alongside the app.
'
' Output mimics the IDE call-stack view, one frame per line:
' Module.ext!Class::Method Line 123 (when source line is known)
' Module.dll!Export + &H1A (no PDB -> symbol + displacement)
@wqweto
wqweto / VB6-TypeLib-Projection-Guide.md
Created June 5, 2026 13:03
VB6-TypeLib-Projection-Guide.md

Emulating VB6: References vs Components, and the Ctl suffix

A guide for language/IDE developers who want to reproduce how VB6 surfaces COM type libraries in its two pickers (References and Components) and decides the control namespace name (and when to append the Ctl suffix).

Everything below was verified against a real working OCX (UniCCtl.ocx, library FLAGS=2, no suffix) and a from-scratch one (FLAGS=0, suffix appears).


@wqweto
wqweto / Find-DanglingOnErrorGoto0.ps1
Created June 2, 2026 19:58
Finds VB6 procedures that have `On Error GoTo 0` but do NOT have a real error handler
# Find-DanglingOnErrorGoto0.ps1
param(
[string]$Path
)
# Finds VB6 procedures that have `On Error GoTo 0` but do NOT have a real
# error handler (neither `On Error GoTo <label>` nor `On Error Resume Next`).
if (-not $Path) {
@wqweto
wqweto / Project1.vbp
Last active May 23, 2026 13:45
Get USB Printers Win32 Device Paths
Type=Exe
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\Windows\SysWOW64\stdole2.tlb#OLE Automation
Module=mdUsbPrinters; mdUsbPrinters.bas
Module=mdStartup; mdStartup.bas
Startup="Sub Main"
ExeName32="UsbPrinters.exe"
Command32=""
Name="Project1"
HelpContextID="0"
CompatibleMode="0"
@wqweto
wqweto / Form1.twin
Last active November 28, 2025 20:54
QuickSort in TB
[Description("")]
[FormDesignerId("70FFB010-72A5-4DC0-8DBC-4F33ED7EE0B0")]
[PredeclaredId]
Class Form1
Private DeclareWide Function StrCmpLogicalW Lib "shlwapi" (ByVal psz1 As String, ByVal psz2 As String) As Boolean
Sub New()
Dim a(0 To 1000000) As String
Dim lIdx As Long
Option Explicit
DefObj A-Z
Private Const MODULE_NAME As String = "mdHookImportedFunctionByName"
'--- will DebugPrint module imports
#Const SHOW_MODULE_IMPORTS = True
'=========================================================================
' API
'=========================================================================
@wqweto
wqweto / mdImageConvert.bas
Created August 23, 2024 14:31
[VB6] Convert PDF and PNG to ZPL
Option Explicit
DefObj A-Z
Private Const MODULE_NAME As String = "mdImageConvert"
'=========================================================================
' API
'=========================================================================
'--- for GdipCreateBitmapFromScan0
Private Const PixelFormat32bppPARGB As Long = &HE200B
@wqweto
wqweto / fn_sys_GetUuidV5.sql
Created June 1, 2024 14:12
Generates a name-based UUID, as described in RFC 4122 section 4.3
IF OBJECT_ID('fn_sys_GetUuidV5') IS NOT NULL DROP FUNCTION fn_sys_GetUuidV5
GO
-- SELECT dbo.fn_sys_GetUuidV5(CONVERT(UNIQUEIDENTIFIER, 'E11EAC0E-4D75-4567-BA60-683D357A9227'), 'Test42'), '73CF5B24-114A-5A5B-837C-64CF22468258'
-- SELECT dbo.fn_sys_GetUuidV5(CONVERT(UNIQUEIDENTIFIER, '6ba7b810-9dad-11d1-80b4-00c04fd430c8'), 'www.terraform.io'), 'A5008FAE-B28C-5BA5-96CD-82B4C53552D6'
-- SELECT dbo.fn_sys_GetUuidV5(CONVERT(UNIQUEIDENTIFIER, '6ba7b810-9dad-11d1-80b4-00c04fd430c8'), 'Проба'), 'E40F6EF0-210D-5F5B-B2B1-CABD47B5CBD9'
CREATE FUNCTION fn_sys_GetUuidV5 (
@Namespace SQL_VARIANT
, @Name SQL_VARIANT
) RETURNS UNIQUEIDENTIFIER
@wqweto
wqweto / mdTea.bas
Created March 17, 2024 10:58
[VB6/VBA] Wheeler & Needham’s Tiny Encryption Algorithm
'--- mdTea.bas -- Wheeler & Needham’s Tiny Encryption Algorithm
Option Explicit
DefObj A-Z
#Const HasPtrSafe = (VBA7 <> 0)
#Const HasOperators = (TWINBASIC <> 0)
#If HasPtrSafe Then
Private Declare PtrSafe Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As LongPtr)
#Else
@wqweto
wqweto / README.md
Last active March 13, 2024 14:08
Signing Web Service

How to use

You can use it from command line with curl like this

c:> curl -sSL -F file=@project1.exe http://localhost:4500/sign -o project1_signed.exe --fail || echo failed