- Sync netapi32 with Wine head
authorDmitry Chapyshev <dmitry@reactos.org>
Sun, 11 Jan 2009 15:59:49 +0000 (15:59 +0000)
committerDmitry Chapyshev <dmitry@reactos.org>
Sun, 11 Jan 2009 15:59:49 +0000 (15:59 +0000)
svn path=/trunk/; revision=38701

reactos/dll/win32/netapi32/access.c
reactos/dll/win32/netapi32/nbt.c
reactos/dll/win32/netapi32/netapi32.spec
reactos/dll/win32/netapi32/netbios.c
reactos/dll/win32/netapi32/share.c
reactos/dll/win32/netapi32/wksta.c

index 4fdf60a..84d280b 100644 (file)
@@ -417,6 +417,10 @@ NetUserGetLocalGroups(LPCWSTR servername, LPCWSTR username, DWORD level,
                       LPDWORD entriesread, LPDWORD totalentries)
 {
     NET_API_STATUS status;
+    const WCHAR admins[] = {'A','d','m','i','n','i','s','t','r','a','t','o','r','s',0};
+    LPWSTR currentuser;
+    LOCALGROUP_USERS_INFO_0* info;
+    DWORD size;
 
     FIXME("(%s, %s, %d, %08x, %p %d, %p, %p) stub!\n",
           debugstr_w(servername), debugstr_w(username), level, flags, bufptr,
@@ -426,12 +430,37 @@ NetUserGetLocalGroups(LPCWSTR servername, LPCWSTR username, DWORD level,
     if (status != NERR_Success)
         return status;
 
-    if (!NETAPI_FindUser(username))
+    size = UNLEN + 1;
+    NetApiBufferAllocate(size, (LPVOID*)&currentuser);
+    GetUserNameW(currentuser, &size);
+
+    if (lstrcmpiW(username, currentuser) && NETAPI_FindUser(username))
+    {
+        NetApiBufferFree(currentuser);
         return NERR_UserNotFound;
+    }
+
+    NetApiBufferFree(currentuser);
+    *totalentries = 1;
+    size = sizeof(*info) + sizeof(admins);
+
+    if(prefmaxlen < size)
+        status = ERROR_MORE_DATA;
+    else
+        status = NetApiBufferAllocate(size, (LPVOID*)&info);
+
+    if(status != NERR_Success)
+    {
+        *bufptr = NULL;
+        *entriesread = 0;
+        return status;
+    }
+
+    info->lgrui0_name = (LPWSTR)((LPBYTE)info + sizeof(*info));
+    lstrcpyW(info->lgrui0_name, admins);
 
-    if (bufptr) *bufptr = NULL;
-    if (entriesread) *entriesread = 0;
-    if (totalentries) *totalentries = 0;
+    *bufptr = (LPBYTE)info;
+    *entriesread = 1;
 
     return NERR_Success;
 }
@@ -485,7 +514,7 @@ static void ACCESS_QueryAdminDisplayInformation(PNET_DISPLAY_USER *buf, PDWORD p
     usr->usri1_comment[0] = 0;
     usr->usri1_flags = UF_SCRIPT | UF_NORMAL_ACCOUNT | UF_DONT_EXPIRE_PASSWD;
     usr->usri1_full_name[0] = 0;
-    usr->usri1_user_id = 500;
+    usr->usri1_user_id = DOMAIN_USER_RID_ADMIN;
     usr->usri1_next_index = 0;
 }
 
@@ -525,7 +554,7 @@ static void ACCESS_QueryGuestDisplayInformation(PNET_DISPLAY_USER *buf, PDWORD p
     usr->usri1_flags = UF_ACCOUNTDISABLE | UF_SCRIPT | UF_NORMAL_ACCOUNT |
         UF_DONT_EXPIRE_PASSWD;
     usr->usri1_full_name[0] = 0;
-    usr->usri1_user_id = 500;
+    usr->usri1_user_id = DOMAIN_USER_RID_GUEST;
     usr->usri1_next_index = 0;
 }
 
@@ -689,6 +718,18 @@ NetGetDCName(LPCWSTR servername, LPCWSTR domainname, LPBYTE *bufptr)
   return NERR_DCNotFound; /* say we can't find a domain controller */  
 }
 
+/************************************************************
+ *                NetGroupEnum  (NETAPI32.@)
+ *
+ */
+NET_API_STATUS WINAPI
+NetGroupEnum(LPCWSTR servername, DWORD level, LPBYTE *bufptr, DWORD prefmaxlen,
+             LPDWORD entriesread, LPDWORD totalentries, LPDWORD resume_handle)
+{
+    FIXME("(%s, %d, %p, %d, %p, %p, %p) stub!\n", debugstr_w(servername),
+          level, bufptr, prefmaxlen, entriesread, totalentries, resume_handle);
+    return ERROR_ACCESS_DENIED;
+}
 
 /******************************************************************************
  * NetUserModalsGet  (NETAPI32.@)
index a47229c..8db87b4 100644 (file)
@@ -415,10 +415,7 @@ static BOOL NetBTFindNameAnswerCallback(void *pVoid, WORD answerCount,
             if (queryData->cacheEntry)
                 queryData->cacheEntry->numAddresses = 0;
             else
-            {
-                ret = FALSE;
                 queryData->ret = NRC_OSRESNOTAV;
-            }
         }
         if (rLen == 6 && queryData->cacheEntry &&
          queryData->cacheEntry->numAddresses < answerCount)
@@ -850,8 +847,8 @@ static UCHAR NetBTAstat(void *adapt, PNCB ncb)
             astat->max_sess_pkt_size = 0xffff;
             astat->xmit_success = adapter->xmit_success;
             astat->recv_success = adapter->recv_success;
+            ret = NRC_GOODRET;
         }
-        ret = NRC_GOODRET;
     }
     else
         ret = NetBTAstatRemote(adapter, ncb);
@@ -1183,6 +1180,7 @@ static UCHAR NetBTRecv(void *adapt, void *sess, PNCB ncb)
                  * message header. */
                 NetBIOSHangupSession(ncb);
                 ret = NRC_SABORT;
+                goto error;
             }
             else if (buffer[0] != NBSS_MSG)
             {
@@ -1190,6 +1188,7 @@ static UCHAR NetBTRecv(void *adapt, void *sess, PNCB ncb)
                 FIXME("Received unexpected session msg type %d\n", buffer[0]);
                 NetBIOSHangupSession(ncb);
                 ret = NRC_SABORT;
+                goto error;
             }
             else
             {
@@ -1199,6 +1198,7 @@ static UCHAR NetBTRecv(void *adapt, void *sess, PNCB ncb)
                     FIXME("Received a message that's too long for my taste\n");
                     NetBIOSHangupSession(ncb);
                     ret = NRC_SABORT;
+                    goto error;
                 }
                 else
                 {
@@ -1226,6 +1226,7 @@ static UCHAR NetBTRecv(void *adapt, void *sess, PNCB ncb)
             adapter->recv_success++;
         }
     }
+error:
     TRACE("returning 0x%02x\n", ret);
     return ret;
 }
index 2750497..9a80252 100644 (file)
@@ -98,7 +98,7 @@
 @ stub NetGroupAddUser
 @ stub NetGroupDel
 @ stub NetGroupDelUser
-@ stub NetGroupEnum
+@ stdcall NetGroupEnum(wstr long ptr long ptr ptr ptr)
 @ stub NetGroupGetInfo
 @ stub NetGroupGetUsers
 @ stub NetGroupSetInfo
 @ stub NetSessionDel
 @ stdcall NetSessionEnum(wstr wstr wstr long ptr long ptr ptr ptr)
 @ stub NetSessionGetInfo
-@ stub NetShareAdd
+@ stdcall NetShareAdd(wstr long ptr ptr)
 @ stub NetShareCheck
 @ stdcall NetShareDel(wstr wstr long)
 @ stub NetShareDelSticky
 @ stdcall NetShareEnum(wstr long ptr long ptr ptr ptr)
 @ stub NetShareEnumSticky
-@ stub NetShareGetInfo
+@ stdcall NetShareGetInfo(wstr wstr long ptr)
 @ stub NetShareSetInfo
 @ stdcall NetStatisticsGet(wstr wstr long long ptr)
 @ stdcall NetUseAdd(wstr long ptr ptr)
 @ stub NetWkstaTransportAdd
 @ stub NetWkstaTransportDel
 @ stdcall NetWkstaTransportEnum (wstr long ptr long ptr ptr ptr)
-@ stub NetWkstaUserEnum
+@ stdcall NetWkstaUserEnum(wstr long ptr long ptr ptr ptr)
 @ stdcall NetWkstaUserGetInfo(wstr long ptr)
 @ stub NetWkstaUserSetInfo
 @ stdcall NetapipBufferAllocate(long ptr) NetApiBufferAllocate
index a55f556..8d0de1f 100644 (file)
@@ -637,7 +637,7 @@ static UCHAR nbInternalHangup(NetBIOSAdapter *adapter, NetBIOSSession *session)
     EnterCriticalSection(&adapter->cs);
     memset(session, 0, sizeof(NetBIOSSession));
     LeaveCriticalSection(&adapter->cs);
-    return NRC_GOODRET;
+    return ret;
 }
 
 static UCHAR nbHangup(NetBIOSAdapter *adapter, const NCB *ncb)
index 54f13cf..f19f732 100644 (file)
@@ -92,3 +92,24 @@ NET_API_STATUS WINAPI NetShareDel(LMSTR servername, LMSTR netname, DWORD reserve
     FIXME("Stub (%s %s %d)\n", debugstr_w(servername), debugstr_w(netname), reserved);
     return NERR_Success;
 }
+
+/************************************************************
+ * NetShareGetInfo  (NETAPI32.@)
+ */
+NET_API_STATUS WINAPI NetShareGetInfo(LMSTR servername, LMSTR netname,
+    DWORD level, LPBYTE *bufptr)
+{
+    FIXME("Stub (%s %s %d %p)\n", debugstr_w(servername),
+        debugstr_w(netname),level, bufptr);
+    return NERR_NetNameNotFound;
+}
+
+/************************************************************
+ * NetShareAdd  (NETAPI32.@)
+ */
+NET_API_STATUS WINAPI NetShareAdd(LMSTR servername,
+    DWORD level, LPBYTE buf, LPDWORD parm_err)
+{
+    FIXME("Stub (%s %d %p %p)\n", debugstr_w(servername), level, buf, parm_err);
+    return ERROR_NOT_SUPPORTED;
+}
index 6914d02..7b39fd9 100644 (file)
@@ -98,7 +98,7 @@ static void wprint_mac(WCHAR* buffer, int len, const MIB_IFROW *ifRow)
         else
             buffer[2*i+1] = (WCHAR)((val & 0xf) + '0');
     }
-    buffer[2*i]=(WCHAR)0;
+    buffer[2*i]=0;
 }
 
 /* Theoretically this could be too short, except that MS defines
@@ -443,6 +443,19 @@ NET_API_STATUS WINAPI NetWkstaUserGetInfo(LMSTR reserved, DWORD level,
     return NERR_Success;
 }
 
+/************************************************************
+ *                NetWkstaUserEnum  (NETAPI32.@)
+ */
+NET_API_STATUS WINAPI
+NetWkstaUserEnum(LMSTR servername, DWORD level, LPBYTE* bufptr,
+                 DWORD prefmaxlen, LPDWORD entriesread,
+                 LPDWORD totalentries, LPDWORD resumehandle)
+{
+    FIXME("(%s, %d, %p, %d, %p, %p, %p): stub!\n", debugstr_w(servername),
+          level, bufptr, prefmaxlen, entriesread, totalentries, resumehandle);
+    return ERROR_INVALID_PARAMETER;
+}
+
 /************************************************************
  *                NetpGetComputerName  (NETAPI32.@)
  */