2 * Copyright 2001 Mike McCormack
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(netbios);
41 HMODULE NETAPI32_hModule = 0;
43 static UCHAR NETBIOS_Enum(PNCB ncb)
46 LANA_ENUM *lanas = (PLANA_ENUM) ncb->ncb_buffer;
47 DWORD apiReturn, size = 0;
53 apiReturn = GetIfTable(NULL, &size, FALSE);
54 if (apiReturn != NO_ERROR)
56 table = (PMIB_IFTABLE)malloc(size);
59 apiReturn = GetIfTable(table, &size, FALSE);
60 if (apiReturn == NO_ERROR)
63 for (i = 0; i < table->dwNumEntries && lanas->length < MAX_LANA;
66 if (table->table[i].dwType != MIB_IF_TYPE_LOOPBACK)
68 lanas->lana[lanas->length] = table->table[i].dwIndex;
79 ret = NRC_NORESOURCES;
87 static UCHAR NETBIOS_Astat(PNCB ncb)
89 PADAPTER_STATUS astat = (PADAPTER_STATUS) ncb->ncb_buffer;
92 TRACE("NCBASTAT (Adapter %d)\n", ncb->ncb_lana_num);
94 memset(astat, 0, sizeof astat);
96 row.dwIndex = ncb->ncb_lana_num;
97 if (GetIfEntry(&row) != NO_ERROR)
98 return NRC_INVADDRESS;
99 /* doubt anyone cares, but why not.. */
100 if (row.dwType == MIB_IF_TYPE_TOKENRING)
101 astat->adapter_type = 0xff;
103 astat->adapter_type = 0xfe; /* for Ethernet */
107 BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
109 TRACE("%p,%lx,%p\n", hinstDLL, fdwReason, lpvReserved);
112 case DLL_PROCESS_ATTACH:
113 NETAPI32_hModule = hinstDLL;
115 case DLL_PROCESS_DETACH:
122 BOOL WINAPI Netbios(PNCB pncb)
124 UCHAR ret = NRC_ILLCMD;
126 TRACE("ncb = %p\n",pncb);
129 return NRC_INVADDRESS;
131 switch(pncb->ncb_command&0x7f)
134 FIXME("NCBRESET adapter %d\n",pncb->ncb_lana_num);
135 if(pncb->ncb_lana_num < MAX_LANA )
139 row.dwIndex = pncb->ncb_lana_num;
140 if (GetIfEntry(&row) != NO_ERROR)
143 ret = NRC_ILLCMD; /* NetBIOS emulator not found */
146 ret = NRC_ILLCMD; /* NetBIOS emulator not found */
150 FIXME("NCBADDNAME\n");
154 FIXME("NCBADDGRNAME\n");
158 FIXME("NCBDELNAME\n");
170 FIXME("NCBHANGUP\n");
174 FIXME("NCBCANCEL\n");
178 FIXME("NCBLISTEN\n");
182 ret = NETBIOS_Astat(pncb);
186 ret = NETBIOS_Enum(pncb);
190 FIXME("(%p): command code %02x\n", pncb, pncb->ncb_command);
192 ret = NRC_ILLCMD; /* NetBIOS emulator not found */
194 pncb->ncb_retcode = ret;
198 NET_API_STATUS WINAPI NetServerEnum(
204 LPDWORD totalentries,
207 LPDWORD resume_handle
210 FIXME("Stub (%p, %ld %p %ld %p %p %ld %s %p)\n",servername, level, bufptr,
211 prefmaxlen, entriesread, totalentries, servertype, debugstr_w(domain), resume_handle);
213 return ERROR_NO_BROWSER_SERVERS_FOUND;