In Netbios(),
authorJuan Lang <juan_lang@yahoo.com>
Thu, 16 Dec 2004 14:34:47 +0000 (14:34 +0000)
committerAlexandre Julliard <julliard@winehq.org>
Thu, 16 Dec 2004 14:34:47 +0000 (14:34 +0000)
- set ncb_retcode and ncb_cmd_cplt for NCB_ADDNAME
- always make sure adapters have been enumerated.

dlls/netapi32/netbios.c

index ff7dc10399ebbfb20fe647b78a6a3c7a51b56e91..a5d6860d01f462d15281717007c62ce6425a25ad 100644 (file)
@@ -793,21 +793,23 @@ UCHAR WINAPI Netbios(PNCB ncb)
 
     if (cmd == NCBENUM)
         ncb->ncb_retcode = ncb->ncb_cmd_cplt = ret = nbEnum(ncb);
+    else if (cmd == NCBADDNAME)
+    {
+        FIXME("NCBADDNAME: stub, returning success");
+        ncb->ncb_retcode = ncb->ncb_cmd_cplt = ret = NRC_GOODRET;
+    }
     else
     {
-        NetBIOSAdapter *adapter = nbGetAdapter(ncb->ncb_lana_num);
+        NetBIOSAdapter *adapter;
 
+        /* Apps not specifically written for WinNT won't do an NCBENUM first,
+         * so make sure the table has been enumerated at least once
+         */
+        if (!gNBTable.enumerated)
+            nbInternalEnum();
+        adapter = nbGetAdapter(ncb->ncb_lana_num);
         if (!adapter)
-        {
-            if (cmd == NCBRESET || cmd == NCBADDNAME)
-            {
-              if (cmd == NCBADDNAME)
-                FIXME("NCBADDNAME: stub, returning success");
-              ret = NRC_GOODRET;
-            }
-            else
-              ret = NRC_BRIDGE;
-       }
+            ret = NRC_BRIDGE;
         else
         {
             if (adapter->shuttingDown)