First cut at NetWkstaTransportEnum

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Changelog:
	dlls/netapi32/netapi32.c
	Separate "Enumerate Hardware Addresses" as function, as
	other netapi32 function need it
	dlls/netapi32/wksta.c:
	Implement level 0 of NetWkstaTransportEnum

This is needed by Altera Quartus
-- 
Uwe Bonnes                bon@elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: wine/dlls/netapi32/netapi32.c
===================================================================
RCS file: /home/wine/wine/dlls/netapi32/netapi32.c,v
retrieving revision 1.8
diff -u -r1.8 netapi32.c
--- wine/dlls/netapi32/netapi32.c	4 Nov 2002 23:53:44 -0000	1.8
+++ wine/dlls/netapi32/netapi32.c	12 Jan 2003 20:13:37 -0000
@@ -99,22 +99,15 @@
 #  endif /* SIOCGENADDR */
 # endif /* SIOCGIFHWADDR */
 
-static UCHAR NETBIOS_Enum(PNCB ncb)
+int enum_hw(void)
 {
+    int ret = 0;
 #ifdef HAVE_NET_IF_H
     int             sd;
     struct ifreq    ifr, *ifrp;
     struct ifconf   ifc;
     unsigned char   buf[1024];
     int             i, ofs;
-#endif
-    LANA_ENUM *lanas = (PLANA_ENUM) ncb->ncb_buffer;
-
-    TRACE("NCBENUM\n");
-
-    lanas->length = 0;
-
-#ifdef HAVE_NET_IF_H
     /* BSD 4.4 defines the size of an ifreq to be
      * max(sizeof(ifreq), sizeof(ifreq.ifr_name)+ifreq.ifr_addr.sa_len
      * However, under earlier systems, sa_len isn't present, so
@@ -156,13 +149,45 @@
                         a[0],a[1],a[2],a[3],a[4],a[5]);
 
             NETBIOS_Adapter[i].valid = TRUE;
-            lanas->lana[lanas->length] = i;
-            lanas->length++;
+	    ret++;
         }
         ofs += ifreq_size(ifr);
     }
     close(sd);
+    TRACE("found %d adapters\n",ret);
 #endif /* HAVE_NET_IF_H */
+    return ret;
+}
+
+void wprint_mac(WCHAR* buffer, int index)
+{
+  buffer[0]=(WCHAR)NETBIOS_Adapter[index].address[5]>>4;
+  buffer[1]=(WCHAR)NETBIOS_Adapter[index].address[5]&& 0xf;
+  buffer[2]=(WCHAR)NETBIOS_Adapter[index].address[4]>>4;
+  buffer[3]=(WCHAR)NETBIOS_Adapter[index].address[4]&& 0xf;
+  buffer[4]=(WCHAR)NETBIOS_Adapter[index].address[3]>>4;
+  buffer[5]=(WCHAR)NETBIOS_Adapter[index].address[3]&& 0xf;
+  buffer[6]=(WCHAR)NETBIOS_Adapter[index].address[2]>>4;
+  buffer[7]=(WCHAR)NETBIOS_Adapter[index].address[2]&& 0xf;
+  buffer[8]=(WCHAR)NETBIOS_Adapter[index].address[1]>>4;
+  buffer[9]=(WCHAR)NETBIOS_Adapter[index].address[1]&& 0xf;
+  buffer[10]=(WCHAR)NETBIOS_Adapter[index].address[0]>>4;
+  buffer[11]=(WCHAR)NETBIOS_Adapter[index].address[0]&& 0xf;
+  buffer[12]=(WCHAR)0;
+}
+static UCHAR NETBIOS_Enum(PNCB ncb)
+{
+    int             i;
+    LANA_ENUM *lanas = (PLANA_ENUM) ncb->ncb_buffer;
+
+    TRACE("NCBENUM\n");
+
+    lanas->length = 0;
+    for (i = 0; i < enum_hw(); i++)
+    {
+         lanas->lana[lanas->length] = i;
+	 lanas->length++;
+    }
     return NRC_GOODRET;
 }
 
Index: wine/include/lmwksta.h
===================================================================
RCS file: /home/wine/wine/include/lmwksta.h,v
retrieving revision 1.1
diff -u -r1.1 lmwksta.h
--- wine/include/lmwksta.h	11 Sep 2002 02:35:18 -0000	1.1
+++ wine/include/lmwksta.h	12 Jan 2003 20:13:37 -0000
@@ -28,6 +28,14 @@
 /* NetBIOS */
 UCHAR WINAPI Netbios(PNCB pncb);
 
+typedef struct _WKSTA_TRANSPORT_INFO_0 {
+  DWORD wkti0_quality_of_service;
+  DWORD wkti0_number_of_vcs;
+  LPWSTR wkti0_transport_name;
+  LPWSTR wkti0_transport_address;
+  BOOL wkti0_wan_ish;
+} WKSTA_TRANSPORT_INFO_0, *PWKSTA_TRANSPORT_INFO_0, *LPWKSTA_TRANSPORT_INFO_0;
+
 typedef struct _WKSTA_USER_INFO_0 {
     LPWSTR  wkui0_username;
 } WKSTA_USER_INFO_0, *PWKSTA_USER_INFO_0, *LPWKSTA_USER_INFO_0;
Index: wine/dlls/netapi32/netapi32.spec
===================================================================
RCS file: /home/wine/wine/dlls/netapi32/netapi32.spec,v
retrieving revision 1.8
diff -u -w -r1.8 netapi32.spec
--- wine/dlls/netapi32/netapi32.spec	13 Dec 2002 20:28:03 -0000	1.8
+++ wine/dlls/netapi32/netapi32.spec	7 Feb 2003 19:31:06 -0000
@@ -198,7 +198,7 @@
 @ stub NetWkstaSetInfo
 @ stub NetWkstaTransportAdd
 @ stub NetWkstaTransportDel
-@ stub NetWkstaTransportEnum
+@ stdcall NetWkstaTransportEnum (wstr long ptr long ptr ptr ptr) NetWkstaTransportEnum
 @ stub NetWkstaUserEnum
 @ stdcall NetWkstaUserGetInfo(wstr long ptr) NetWkstaUserGetInfo
 @ stub NetWkstaUserSetInfo
Index: wine/dlls/netapi32/wksta.c
===================================================================
RCS file: /home/wine/wine/dlls/netapi32/wksta.c,v
retrieving revision 1.4
diff -u -w -r1.4 wksta.c
--- wine/dlls/netapi32/wksta.c	24 Sep 2002 18:29:39 -0000	1.4
+++ wine/dlls/netapi32/wksta.c	7 Feb 2003 19:55:42 -0000
@@ -59,6 +59,76 @@
     }
 }
 
+int enum_hw(void);
+void wprint_mac(WCHAR* buffer, int index);
+
+NET_API_STATUS WINAPI 
+NetWkstaTransportEnum(LPCWSTR ServerName, DWORD level, LPBYTE* pbuf,
+		      DWORD prefmaxlen, LPDWORD read_entries,
+		      LPDWORD total_entries, LPDWORD hresume)
+{
+  FIXME(":%s, 0x%08lx, %p, 0x%08lx, %p, %p, %p\n", debugstr_w(ServerName), 
+	level, pbuf, prefmaxlen, read_entries, total_entries,hresume);
+  if (!NETAPI_IsLocalComputer(ServerName))
+    {
+      FIXME(":not implemented for non-local computers\n");
+      return ERROR_INVALID_LEVEL;
+    }
+  else
+    {
+      if (hresume && *hresume)
+	{
+	  FIXME(":resume handle not implemented\n");
+	  return ERROR_INVALID_LEVEL;
+	}
+	
+      switch (level)
+	{
+	case 0: /* transport info */
+	  {
+	    PWKSTA_TRANSPORT_INFO_0 ti;
+	    int i,size_needed,n_adapt  = enum_hw();
+	    
+	    size_needed = n_adapt * (sizeof(WKSTA_TRANSPORT_INFO_0) 
+				     * 13 * sizeof (WCHAR));
+	    if (prefmaxlen == MAX_PREFERRED_LENGTH)
+	      NetApiBufferAllocate( size_needed, (LPVOID *) pbuf);
+	    else
+	      {
+		if (size_needed > prefmaxlen)
+		  return ERROR_MORE_DATA;
+		NetApiBufferAllocate(prefmaxlen,
+				     (LPVOID *) pbuf);
+	      }
+	    for (i = 0; i <n_adapt; i++)
+	      {
+		ti = (PWKSTA_TRANSPORT_INFO_0) 
+		  ((PBYTE) *pbuf + i * sizeof(WKSTA_TRANSPORT_INFO_0));
+		ti->wkti0_quality_of_service=0;
+		ti->wkti0_number_of_vcs=0;
+		ti->wkti0_transport_name=NULL;
+		ti->wkti0_transport_address= (LPWSTR)
+		  ((PBYTE )*pbuf + n_adapt* sizeof(WKSTA_TRANSPORT_INFO_0) 
+		   + i * 13 * sizeof (WCHAR));
+		ti->wkti0_wan_ish=TRUE; /*TCPIP/NETBIOS Protocoll*/
+		wprint_mac(ti->wkti0_transport_address,i);
+		TRACE("BON:%d of %d:ti at %p transport_address at %p %s\n",i,n_adapt,
+		      ti, ti->wkti0_transport_address, debugstr_w(ti->wkti0_transport_address));
+	      }
+	    if(read_entries)*read_entries = n_adapt;
+	    if(total_entries)*total_entries = n_adapt;
+	    if(hresume) *hresume= 0;
+	    break;
+	  }
+	default:
+	  ERR("Invalid level %ld is specified\n", level);
+	  return ERROR_INVALID_LEVEL;
+	}
+      return NERR_Success;
+    }
+}
+					    
+
 /************************************************************
  *                NetWkstaUserGetInfo  (NETAPI32.@)
  */


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux