www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2022/08/12/08:02:45

X-Recipient: archive-cygwin AT delorie DOT com
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 64DE43858CDA
Authentication-Results: sourceware.org;
dmarc=pass (p=none dis=none) header.from=163.com
Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=163.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com;
s=s110527; h=Date:From:Subject:MIME-Version:Message-ID; bh=wX5ZO
nLwZ7Fgswu67K6FJ8E7AMwOY6g9n+TsP8g+iD8=; b=YHlvLk1XB1UzKgV9MjHij
eY1TdPJNoWoBj1Ycrk2+BKjJTMsLcS2x4KheUVhooD4dLxJOpSZNRkdmSg6jr0pz
M+DxbMeebBcTsNfE3O++uGEK40o+oxHJL8ENsinXP9sob1gUpXWK4gHinr5ju1dD
N6riYzw76tFSvvWhfolccE=
X-Originating-IP: [106.120.127.5]
Date: Fri, 12 Aug 2022 20:01:37 +0800 (CST)
From: dragon <malongfei1230 AT 163 DOT com>
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
Subject: Failed to get interface list while using ioctl (WSAIoctl) compiled
by cygwin
X-Priority: 3
X-Mailer: Coremail Webmail Server Version XT5.0.13 build 20220113(9671e152)
Copyright (c) 2002-2022 www.mailtech.cn 163com
MIME-Version: 1.0
Message-ID: <40af4ac5.6664.18291ee6a7f.Coremail.malongfei1230@163.com>
X-Coremail-Locale: zh_CN
X-CM-TRANSID: M8GowADH1p4hQfZi+Is9AA--.9711W
X-CM-SenderInfo: ppdo005jihxiqstqqiywtou0bp/1tbi8BFDzluohm9OYgACsY
X-Coremail-Antispam: 1U5529EdanIXcx71UUUUU7vcSsGvfC2KfnxnUU==
X-Spam-Status: No, score=3.8 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT,
FREEMAIL_FROM, HTML_MESSAGE, MIME_CHARSET_FARAWAY, RCVD_IN_BARRACUDACENTRAL,
RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP,
T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6
X-Spam-Level: ***
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-Content-Filtered-By: Mailman/MimeDel 2.1.29
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 27CC2QF5029279

Hi, 

    Thans for your attention.

    I had a problem doing porting the network part¡£I want to get a list of network devices that can be implemented on Linux with an ioctl interface. A set of ioctl interfaces is also provided on Windows called WSAIoctl with cmd SIO_GET_INTERFACE_LIST¡£The WSAIoctl interface is also encapsulated in cygwin and placed in /usr/include/w32api/, libs place in /usr/lib/w32api/ws2_32 . 

   The code implemented by this interface can work correctly after compilation in MinGW and MSVC environments. But the error code of 10045 is returned after cygwin compiles. I have tested on different win10 hosts with different cygwin1.dll£¬ but it still returned 10045£¨not supported£©.

Cygwin winsup/cygwin/fhandler/socket_inet.cc also called WSAIoctl£¬it should workable, I don't understand why return error. 

I am new to cygwin£¬locating the issue was a bit difficult for me and hope to be able to get your help and response. 

   Thank you very much




The system environment and test code is as follows:

      host:  windows 10  (17134)

      cygwin version:   3.3.5

      gcc version:       11.3.0

gcc cmd:  gcc -C test.c -o test.exe -lws2_32

minGw cmd:  x86_64-w64-mingw32-gcc  test.c -o test.exe -lws2_32




test code is very simple, just like this:




#include <winsock2.h>

#include <ws2tcpip.h>




int main (int argc, char *argv[]){

    int s = SOCKET_ERROR;

    INTERFACE_INFO IOInfo[16];

    int ByteRet = 0;

    WSADATA wsa;

    int err = 0;

    

    if (WSAStartup (MAKEWORD(2,2), &wsa) != 0) {

        return -1;

    }

    s = WSASocket (AF_INET, SOCK_DGRAM, IPPROTO_IP, 0, 0, 0);

    if (s == SOCKET_ERROR){

        return -1;

    }

    err = WSAIoctl (s, SIO_GET_INTERFACE_LIST, 0 ,0 ,&IOInfo, sizeof (IOInfo), &ByteRet, 0 ,0);

   if (err != 0) {

      err = WSAGetLastError ();

       printf ("err:%d\r\n", err);

       return -err;

  }

    return 0;

}



-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019