Skip to content

Instantly share code, notes, and snippets.

@Yardanico Yardanico/code.nim
Created Dec 31, 2017

Embed
What would you like to do?
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
You can’t perform that action at this time.