Ver Mensaje Individual
  #1  
Antiguo 04-04-2017
Snaked Snaked is offline
Baneado
NULL
 
Registrado: sep 2016
Posts: 102
Reputación: 0
Snaked Va por buen camino
Si alguien tiene tiempo y puede convertir estas funciones a C++ Builder

Tengo estas 2 funciones que me gustaria probar pero estan en Delphi y yo estoy con C++ Builder

solo si alguien tiene algo de tiempo y me las podria convertir para probarlas a ver si son mejores que las que estoy usando

un saludo y gracias por el interes

Código PHP:
    type
      TWifiData 
record
        InterfaceInfo
String;
        
ProfileString;
        
SSIDString;
        
Signalinteger;
        
AuthString;
        
ConectedBOOL;
      
end;
     
     
    function 
WifiScan(var List: array of TWifiData): integer;
    const
      
AuthStr: array [1..9]of String = ('Open','Shared Key','WPA','WPA-PSK','WPA NONE','RSNA','RSNA-PSK','IHV Start','IHV End');
    var
      
hClientTHandle;
      
dwVersionDWORD;
      
pInterfaceInfoListPWLAN_INTERFACE_INFO_LIST;
      
pInterfaceGuidPGUID;
      
pNetworkListPWLAN_AVAILABLE_NETWORK_LIST;
      
ijinteger;
    
begin
      Result
:= 0;
      if 
ERROR_SUCCESS WlanOpenHandle(1nil, @dwVersion, @hClientthen
      begin
        
if ERROR_SUCCESS WlanEnumInterfaces(hClientnil, @pInterfaceInfoListthen
        begin
          
for := 0 to pInterfaceInfoList^.dwNumberOfItems do
          
begin
            pInterfaceGuid
:= @pInterfaceInfoList^.InterfaceInfo[pInterfaceInfoList^.dwIndex].InterfaceGuid;
            if 
ERROR_SUCCESS WlanGetAvailableNetworkList(hClientpInterfaceGuid1nilpNetworkListthen
            begin
              
for := 0 to pNetworkList^.dwNumberOfItems do
              
begin
                Result
:= pNetworkList^.dwNumberOfItems;
                
with List[j] do
                
begin
                  InterfaceInfo
:= pInterfaceInfoList^.InterfaceInfo[0].strInterfaceDescription;
                  
Profile:= WideCharToString(pNetworkList^.Network[j].strProfileName);
                  
SSID:= PChar(@pNetworkList^.Network[j].dot11Ssid.ucSSID);
                  
Signal:= pNetworkList^.Network[j].wlanSignalQuality;
                  
Auth:= AuthStr[pNetworkList^.Network[j].dot11DefaultAuthAlgorithm];
                  
Conected:= (pNetworkList^.Network[j].dwFlags and WLAN_AVAILABLE_NETWORK_CONNECTED) <> 0;
                
end;
              
end;
              
WlanFreeMemory(pNetworkList);
            
end;
          
end;
          
WlanFreeMemory(pInterfaceInfoList);
        
end;
        
WlanCloseHandle(hClientnil);
      
end;
    
end;
     
    function 
WifiConect(SSIDWideString): BOOL;
    var
      
hClientTHandle;
      
dwVersionDWORD;
      
pInterfaceInfoListPWLAN_INTERFACE_INFO_LIST;
      
pInterfaceGuidPGUID;
      
iinteger;
      
pWLCPPWLAN_CONNECTION_PARAMETERS;
    
begin
      Result
:= false;
      if 
ERROR_SUCCESS WlanOpenHandle(1nil, @dwVersion, @hClientthen
      begin
        
if ERROR_SUCCESS WlanEnumInterfaces(hClientnil, @pInterfaceInfoListthen
        begin
          
for i:= 0 to pInterfaceInfoList^.dwNumberOfItems do
          
begin
            pInterfaceGuid
:= @pInterfaceInfoList^.InterfaceInfo[pInterfaceInfoList^.dwIndex].InterfaceGuid;
            
pWLCP:= WlanAllocateMemory(sizeof(TWLAN_CONNECTION_PARAMETERS));
            
pWLCP.strProfile:= PWCHAR(SSID);
            
pWLCP.wlanConnectionMode:= 0;
            
pWLCP.pDot11Ssid:= nil//pDot11_DDSI;
            
pWLCP.pDesiredBssidList:= nil;
            
pWLCP.dot11BssType:= 1;
            
pWLCP.dwFlags:= 0;//$F;
            
Result:= (ERROR_SUCCESS WlanConnect(hClientpInterfaceGuidpWLCPnil));
            
WlanFreeMemory(pWLCP);
          
end;
          
WlanFreeMemory(pInterfaceInfoList);
        
end;
        
WlanCloseHandle(hClientnil);
      
end;
    
end;
     
    function 
WifiDisConectBOOL;
    var
      
hClientTHandle;
      
dwVersionDWORD;
      
pInterfaceInfoListPWLAN_INTERFACE_INFO_LIST;
      
pInterfaceGuidPGUID;
      
iinteger;
    
begin
      Result
:= false;
      if 
ERROR_SUCCESS WlanOpenHandle(1nil, @dwVersion, @hClientthen
      begin
        
if ERROR_SUCCESS WlanEnumInterfaces(hClientnil, @pInterfaceInfoListthen
        begin
          
for i:= 0 to pInterfaceInfoList^.dwNumberOfItems do
          
begin
            pInterfaceGuid
:= @pInterfaceInfoList^.InterfaceInfo[pInterfaceInfoList^.dwIndex].InterfaceGuid;
            
WlanDisconnect(hClientpInterfaceGuidnil);
          
end;
          
WlanFreeMemory(pInterfaceInfoList);
        
end;
        
WlanCloseHandle(hClientnil);
      
end;
    
end
Responder Con Cita