All pastes #191194 Raw Edit

pilgrim

public text v1 · immutable
·published 2006-10-04 19:24 UTC
rendered paste body
$ZMWSDll = "ZazouMiniWebServer.dll"

; la fonction magique qui recoit un pointeur sur une chaine et qui renvoit cette chaine
Func Ptr2Str( $ptr )
    $chr = DllStructCreate("char[255]", $ptr);
    $result = DllStructGetData($chr, 1)
    Return $result
EndFunc

; chargement de la DLL
$dll = DllOpen($ZMWSDll)

; démarrage du serveur   
DllCall($ZMWSDll, "int", "zmws_start", "int", 0, "str", 0)
;DllCall($ZMWSDll, "byte", "zmws_configure")

; création de la structure servant au stockage de la configuration
$base_config = DllStructCreate("int;int;ptr;ptr;ptr;ptr;ptr;ptr;ptr;ptr;ptr;ptr;dword;byte;byte;byte;byte;byte;byte;byte;byte;byte;byte")

; récupération de la configuration
DllCall($dll, "none", "zmws_get_config", "ptr", DllStructGetPtr($base_config))

; affichage des résultats
MsgBox(0, "Résultat du serveur... ", "" & _
    @CRLF & "port : " & DllStructGetData($base_config, 1) & _ 
    @CRLF & "sport : " & DllStructGetData($base_config, 2) & _ 
    @CRLF & "BindAddr : " & Ptr2Str(DllStructGetData($base_config, 3)) & _ 
    @CRLF & "documentRoot : " & Ptr2Str(DllStructGetData($base_config, 4)) & _ 
    @CRLF & "serverRoot : " & Ptr2Str(DllStructGetData($base_config, 5)) & _ 
    @CRLF & "logsDir : " & Ptr2Str(DllStructGetData($base_config, 6)) & _ 
    @CRLF & "pathToConfigFile : " & Ptr2Str(DllStructGetData($base_config, 7)) & _ 
    @CRLF & "pathToPHP : " & Ptr2Str(DllStructGetData($base_config, 8)) & _ 
    @CRLF & "defCharSet : " & Ptr2Str(DllStructGetData($base_config, 9)) & _ 
    @CRLF & "startPages : " & Ptr2Str(DllStructGetData($base_config, 10)) & _ 
    @CRLF & "allowFrom : " & Ptr2Str(DllStructGetData($base_config, 11)) & _    
    @CRLF & "pbtoken : " & DllStructGetData($base_config, 12) & _    
    @CRLF & "maxClients : " & DllStructGetData($base_config, 13) & _    
    @CRLF & "hideConsole : " & DllStructGetData($base_config, 14) & _    
    @CRLF & "try808xPorts : " & DllStructGetData($base_config, 15) & _    
    @CRLF & "canIndex : " & DllStructGetData($base_config, 16) & _    
    @CRLF & "beQuiet : " & DllStructGetData($base_config, 17) & _    
    @CRLF & "canStop : " & DllStructGetData($base_config, 18) & _    
    @CRLF & "closeBrowser : " & DllStructGetData($base_config, 19) & _    
    @CRLF & "reverseDNS : " & DllStructGetData($base_config, 20) & _    
    @CRLF & "writeLogs : " & DllStructGetData($base_config, 21) & _    
    @CRLF & "browseNow : " & DllStructGetData($base_config, 22) & _    
    @CRLF & "dropClients : " & DllStructGetData($base_config, 23) _    
    )

; arrêt du serveur
DllCall($ZMWSDll, "int", "zmws_stop")

; fermeture de la DLL
DllClose($dll)