Skip to content

Instantly share code, notes, and snippets.

@Yardanico
Created December 31, 2017 22:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Yardanico/a0d8c91bd5fcc6279f5f8288bbf085f3 to your computer and use it in GitHub Desktop.
Save Yardanico/a0d8c91bd5fcc6279f5f8288bbf085f3 to your computer and use it in GitHub Desktop.
const routerdll = "librouter.dll"
const
stEnableDebug = 0
stDebugVerbosity = 1
stWriteLogCallback = 2
stSetTableDataCallback = 3
stUserAgent = 4
stUseCustomPage = 5
stCustomPage = 6
stDualAuthCheck = 7
stPairsBasic = 8
stPairsDigest = 9
stProxyType = 10
stProxyIP = 11
stProxyPort = 12
stUseCredentials = 13
stCredentialsUsername = 14
stCredentialsPassword = 15
stPairsForm = 16
stFilterRules = 17
stProxyUseAuth = 18
stProxyUser = 19
stProxyPass = 20
const
stcStatus = "Status"
stcAuth = "Auth"
stcType = "Type"
stcRadioOff = "RadioOff"
stcHidden = "Hidden"
stcCheckX = "[X]"
stcMinus = "-"
stcBSSID = "BSSID"
stcNoWireless = "<no wireless>"
stcSSID = "SSID"
stcSec = "Sec"
stcKey = "Key"
stcPin = "WPS"
stcLANIP = "LANIP"
stcLANMask = "LANMask"
stcBridge = "<bridge>"
stcWANIP = "WANIP"
stcWANMask = "WANMask"
stcWANGate = "WANGate"
stcDNS = "DNS"
type
# Callback procedures
pfWriteLog = proc(str: cstring, verbosity: byte) {.stdcall.}
pfSetTableData = proc(row: uint32, name, value: cstring) {.stdcall.}
ModuleDesc = object
enabled: bool
name: array[15, char]
desc: array[31, char]
ModuleDescPtr = ptr ModuleDesc
{.push stdcall, importc, dynlib: routerdll.}
proc Initialize: bool
proc GetModuleCount(count: var uint32): bool
proc GetModuleInfoW(index: uint32, info: ModuleDescPtr): bool
proc SwitchModule(index: uint32, enabled: bool): bool
proc GetParamW(st: uint32, value: var uint32, size: uint32,
outLength: var uint32): bool
proc GetParamW(st: uint32, value: ptr, size: uint32,
outLength: var uint32): bool
proc GetParamW(st: uint32, value: var bool, size: uint32,
outLength: var uint32): bool
proc SetParamW(st: uint32, value: uint): bool
proc SetParamW(st: uint32, value: ptr)
proc PrepareRouter(row, ip: uint32, port: uint16, hRouter: var ptr): bool
proc ScanRouter(hRouter: ptr): bool
proc StopRouter(hRouter: ptr): bool
proc IsRouterStopping(hRouter: ptr): bool
proc FreeRouter(hRouter: ptr): bool
{.pop.}
proc SetParam(st: uint32, value: bool): bool =
result = SetParamW(st, uint(value))
let a = Initialize()
if not a:
echo "bad :("
quit()
echo "initialized lol!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment