If you’re into programming, compile the following, put the result to same directory as winbox.exe, associate anyextensionyoulike with it and it’s done.
wblaunch.c:
#define _WIN32_WINNT 0x0500
#define _UNICODE
#define UNICODE
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <shellapi.h>
#pragma comment(lib, "shell32.lib")
#pragma comment(lib, "user32.lib")
#define MAX_PARAMS 1024
#define MAX_BUFFER 256
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow)
{
LPWSTR *szArglist;
int nArgs;
STARTUPINFO si;
PROCESS_INFORMATION pi;
WCHAR config[MAX_PATH];
WCHAR params[MAX_PARAMS];
WCHAR buffer[MAX_BUFFER];
WCHAR msg_title[] = L"WinBox Launcher";
szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
if(szArglist == NULL) {
MessageBox(HWND_DESKTOP, L"CommandLineToArgvW failed.", msg_title, MB_ICONERROR);
return 0;
} else if(nArgs != 2) {
MessageBox(HWND_DESKTOP, L"Usage: wblaunch.exe <config file>", msg_title, MB_ICONINFORMATION);
return 0;
}
GetFullPathName(szArglist[1], MAX_PATH, config, NULL);
LocalFree(szArglist);
wcscpy(params, L"\"");
GetPrivateProfileString(L"WinBox", L"Password", L"", buffer, MAX_BUFFER, config);
wcscat(params, buffer);
wcscat(params, L"\" ");
GetPrivateProfileString(L"WinBox", L"Host", L"", buffer, MAX_BUFFER, config);
wcscat(params, buffer);
wcscat(params, L" ");
GetPrivateProfileString(L"WinBox", L"User", L"", buffer, MAX_BUFFER, config);
wcscat(params, buffer);
if(wcscmp(params, L"\"\" ") == 0) {
MessageBox(HWND_DESKTOP, L"Error reading config file.", msg_title, MB_ICONERROR);
return 0;
}
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));
if(CreateProcess(L"winbox.exe", params, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi) == 0) {
MessageBox(HWND_DESKTOP, L"Unable to launch winbox.exe.", msg_title, MB_ICONERROR);
}
return 0;
}
demo.anyextensionyoulike:
[WinBox]
Host=demo2.mt.lv
User=demo
Password=