[ros-diffs] [winesync] 27911: Autosyncing with Wine HEAD

winesync at svn.reactos.org winesync at svn.reactos.org
Fri Jul 27 11:46:29 CEST 2007


Author: winesync
Date: Fri Jul 27 13:46:28 2007
New Revision: 27911

URL: http://svn.reactos.org/svn/reactos?rev=27911&view=rev
Log:
Autosyncing with Wine HEAD

Added:
    trunk/reactos/dll/win32/netapi32/local_group.c   (with props)
    trunk/reactos/dll/win32/netapi32/share.c   (with props)
Removed:
    trunk/reactos/dll/win32/netapi32/netapi32_misc.h
Modified:
    trunk/reactos/dll/win32/netapi32/access.c
    trunk/reactos/dll/win32/netapi32/apibuf.c
    trunk/reactos/dll/win32/netapi32/browsr.c
    trunk/reactos/dll/win32/netapi32/ds.c
    trunk/reactos/dll/win32/netapi32/nbcmdqueue.c
    trunk/reactos/dll/win32/netapi32/nbcmdqueue.h
    trunk/reactos/dll/win32/netapi32/nbnamecache.c
    trunk/reactos/dll/win32/netapi32/nbnamecache.h
    trunk/reactos/dll/win32/netapi32/nbt.c
    trunk/reactos/dll/win32/netapi32/netapi32.c
    trunk/reactos/dll/win32/netapi32/netapi32.rbuild
    trunk/reactos/dll/win32/netapi32/netapi32.spec
    trunk/reactos/dll/win32/netapi32/netbios.c
    trunk/reactos/dll/win32/netapi32/netbios.h
    trunk/reactos/dll/win32/netapi32/wksta.c

Modified: trunk/reactos/dll/win32/netapi32/access.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/access.c?rev=27911&r1=27910&r2=27911&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netapi32/access.c (original)
+++ trunk/reactos/dll/win32/netapi32/access.c Fri Jul 27 13:46:28 2007
@@ -15,11 +15,13 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
 #include <stdarg.h>
 
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
 #include "windef.h"
 #include "winbase.h"
 #include "winerror.h"
@@ -27,15 +29,41 @@
 #include "lmaccess.h"
 #include "lmapibuf.h"
 #include "lmerr.h"
-#include "netapi32_misc.h"
+#include "ntsecapi.h"
 #include "wine/debug.h"
 #include "wine/unicode.h"
+#include "wine/list.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
+
+/* NOTE: So far, this is implemented to support tests that require user logins,
+ *       but not designed to handle real user databases. Those should probably
+ *       be synced with either the host's user database or with Samba.
+ *
+ * FIXME: The user database should hold all the information the USER_INFO_4 struct
+ * needs, but for the first try, I will just implement the USER_INFO_1 fields.
+ */
+
+struct sam_user
+{
+    struct list entry;
+    WCHAR user_name[LM20_UNLEN+1];
+    WCHAR user_password[PWLEN + 1];
+    DWORD sec_since_passwd_change;
+    DWORD user_priv;
+    LPWSTR home_dir;
+    LPWSTR user_comment;
+    DWORD user_flags;
+    LPWSTR user_logon_script_path;
+};
 
 static const WCHAR sAdminUserName[] = {'A','d','m','i','n','i','s','t','r','a','t',
                                 'o','r',0};
 static const WCHAR sGuestUserName[] = {'G','u','e','s','t',0};
+
+static struct list user_list = LIST_INIT( user_list );
+
+BOOL NETAPI_IsLocalComputer(LPCWSTR ServerName);
 
 /************************************************************
  *                NETAPI_ValidateServername
@@ -62,35 +90,23 @@
 }
 
 /************************************************************
- *                NETAPI_IsKnownUser
- *
- * Checks whether the user name indicates current user.
- */
-static BOOL NETAPI_IsKnownUser(LPCWSTR UserName)
-{
-    DWORD dwSize = UNLEN + 1;
-    BOOL Result;
-    LPWSTR buf;
-
-    if (!lstrcmpW(UserName, sAdminUserName) ||
-        !lstrcmpW(UserName, sGuestUserName))
-        return TRUE;
-    NetApiBufferAllocate(dwSize * sizeof(WCHAR), (LPVOID *) &buf);
-    Result = GetUserNameW(buf, &dwSize);
-
-    Result = Result && !lstrcmpW(UserName, buf);
-    NetApiBufferFree(buf);
-
-    return Result;
-}
-
-#define NETAPI_ForceKnownUser(UserName, FailureCode) \
-    if (!NETAPI_IsKnownUser(UserName)) \
-    { \
-        FIXME("Can't find information for user %s\n", \
-              debugstr_w(UserName)); \
-        return FailureCode; \
-    }
+ *                NETAPI_FindUser
+ *
+ * Looks for a user in the user database.
+ * Returns a pointer to the entry in the user list when the user
+ * is found, NULL otherwise.
+ */
+static struct sam_user* NETAPI_FindUser(LPCWSTR UserName)
+{
+    struct sam_user *user;
+
+    LIST_FOR_EACH_ENTRY(user, &user_list, struct sam_user, entry)
+    {
+        if(lstrcmpW(user->user_name, UserName) == 0)
+            return user;
+    }
+    return NULL;
+}
 
 /************************************************************
  *                NetUserAdd (NETAPI32.@)
@@ -99,18 +115,74 @@
                   DWORD level, LPBYTE bufptr, LPDWORD parm_err)
 {
     NET_API_STATUS status;
-    FIXME("(%s, %ld, %p, %p) stub!\n", debugstr_w(servername), level, bufptr, parm_err);
-
-    status = NETAPI_ValidateServername(servername);
-    if (status != NERR_Success)
+    struct sam_user * su = NULL;
+
+    FIXME("(%s, %d, %p, %p) stub!\n", debugstr_w(servername), level, bufptr, parm_err);
+
+    if((status = NETAPI_ValidateServername(servername)) != NERR_Success)
         return status;
-    
-    if ((bufptr != NULL) && (level > 0) && (level <= 4))
+
+    switch(level)
+    {
+    /* Level 3 and 4 are identical for the purposes of NetUserAdd */
+    case 4:
+    case 3:
+        FIXME("Level 3 and 4 not implemented.\n");
+        /* Fall through */
+    case 2:
+        FIXME("Level 2 not implemented.\n");
+        /* Fall throught */
+    case 1:
     {
         PUSER_INFO_1 ui = (PUSER_INFO_1) bufptr;
-        TRACE("usri%ld_name: %s\n", level, debugstr_w(ui->usri1_name));
-        TRACE("usri%ld_password: %s\n", level, debugstr_w(ui->usri1_password));
-        TRACE("usri%ld_comment: %s\n", level, debugstr_w(ui->usri1_comment));
+        su = HeapAlloc(GetProcessHeap(), 0, sizeof(struct sam_user));
+        if(!su)
+        {
+            status = NERR_InternalError;
+            break;
+        }
+
+        if(lstrlenW(ui->usri1_name) > LM20_UNLEN)
+        {
+            status = NERR_BadUsername;
+            break;
+        }
+
+        /*FIXME: do other checks for a valid username */
+        lstrcpyW(su->user_name, ui->usri1_name);
+
+        if(lstrlenW(ui->usri1_password) > PWLEN)
+        {
+            /* Always return PasswordTooShort on invalid passwords. */
+            status = NERR_PasswordTooShort;
+            break;
+        }
+        lstrcpyW(su->user_password, ui->usri1_password);
+
+        su->sec_since_passwd_change = ui->usri1_password_age;
+        su->user_priv = ui->usri1_priv;
+        su->user_flags = ui->usri1_flags;
+
+        /*FIXME: set the other LPWSTRs to NULL for now */
+        su->home_dir = NULL;
+        su->user_comment = NULL;
+        su->user_logon_script_path = NULL;
+
+        list_add_head(&user_list, &su->entry);
+        return NERR_Success;
+    }
+    default:
+        TRACE("Invalid level %d specified.\n", level);
+        status = ERROR_INVALID_LEVEL;
+        break;
+    }
+
+    if(su)
+    {
+        HeapFree(GetProcessHeap(), 0, su->home_dir);
+        HeapFree(GetProcessHeap(), 0, su->user_comment);
+        HeapFree(GetProcessHeap(), 0, su->user_logon_script_path);
+        HeapFree(GetProcessHeap(), 0, su);
     }
     return status;
 }
@@ -121,17 +193,24 @@
 NET_API_STATUS WINAPI NetUserDel(LPCWSTR servername, LPCWSTR username)
 {
     NET_API_STATUS status;
-    FIXME("(%s, %s) stub!\n", debugstr_w(servername), debugstr_w(username));
-
-    status = NETAPI_ValidateServername(servername);
-    if (status != NERR_Success)
+    struct sam_user *user;
+
+    TRACE("(%s, %s)\n", debugstr_w(servername), debugstr_w(username));
+
+    if((status = NETAPI_ValidateServername(servername))!= NERR_Success)
         return status;
 
-    if (!NETAPI_IsKnownUser(username))
+    if ((user = NETAPI_FindUser(username)) == NULL)
         return NERR_UserNotFound;
 
-    /* Delete the user here */
-    return status;
+    list_remove(&user->entry);
+
+    HeapFree(GetProcessHeap(), 0, user->home_dir);
+    HeapFree(GetProcessHeap(), 0, user->user_comment);
+    HeapFree(GetProcessHeap(), 0, user->user_logon_script_path);
+    HeapFree(GetProcessHeap(), 0, user);
+
+    return NERR_Success;
 }
 
 /************************************************************
@@ -142,13 +221,24 @@
                LPBYTE* bufptr)
 {
     NET_API_STATUS status;
-    TRACE("(%s, %s, %ld, %p)\n", debugstr_w(servername), debugstr_w(username),
+    TRACE("(%s, %s, %d, %p)\n", debugstr_w(servername), debugstr_w(username),
           level, bufptr);
     status = NETAPI_ValidateServername(servername);
     if (status != NERR_Success)
         return status;
-    NETAPI_ForceLocalComputer(servername, NERR_InvalidComputer);
-    NETAPI_ForceKnownUser(username, NERR_UserNotFound);
+
+    if(!NETAPI_IsLocalComputer(servername))
+    {
+        FIXME("Only implemented for local computer, but remote server"
+              "%s was requested.\n", debugstr_w(servername));
+        return NERR_InvalidComputer;
+    }
+
+    if(!NETAPI_FindUser(username))
+    {
+        TRACE("User %s is unknown.\n", debugstr_w(username));
+        return NERR_UserNotFound;
+    }
 
     switch (level)
     {
@@ -288,17 +378,43 @@
     case 1052:
     case 1053:
     {
-        FIXME("Level %ld is not implemented\n", level);
-        break;
+        FIXME("Level %d is not implemented\n", level);
+        return NERR_InternalError;
     }
     default:
-        ERR("Invalid level %ld is specified\n", level);
+        TRACE("Invalid level %d is specified\n", level);
         return ERROR_INVALID_LEVEL;
     }
     return NERR_Success;
 }
 
-
+/************************************************************
+ *                NetUserGetLocalGroups  (NETAPI32.@)
+ */
+NET_API_STATUS WINAPI
+NetUserGetLocalGroups(LPCWSTR servername, LPCWSTR username, DWORD level,
+                      DWORD flags, LPBYTE* bufptr, DWORD prefmaxlen,
+                      LPDWORD entriesread, LPDWORD totalentries)
+{
+    NET_API_STATUS status;
+
+    FIXME("(%s, %s, %d, %08x, %p %d, %p, %p) stub!\n",
+          debugstr_w(servername), debugstr_w(username), level, flags, bufptr,
+          prefmaxlen, entriesread, totalentries);
+
+    status = NETAPI_ValidateServername(servername);
+    if (status != NERR_Success)
+        return status;
+
+    if (!NETAPI_FindUser(username))
+        return NERR_UserNotFound;
+
+    if (bufptr) *bufptr = NULL;
+    if (entriesread) *entriesread = 0;
+    if (totalentries) *totalentries = 0;
+
+    return NERR_Success;
+}
 
 /************************************************************
  *                NetUserEnum  (NETAPI32.@)
@@ -308,7 +424,7 @@
 	    DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries,
 	    LPDWORD resume_handle)
 {
-  FIXME("(%s,%ld, 0x%ld,%p,%ld,%p,%p,%p) stub!\n", debugstr_w(servername), level,
+  FIXME("(%s,%d, 0x%d,%p,%d,%p,%p,%p) stub!\n", debugstr_w(servername), level,
         filter, bufptr, prefmaxlen, entriesread, totalentries, resume_handle);
 
   return ERROR_ACCESS_DENIED;
@@ -394,10 +510,9 @@
 }
 
 /************************************************************
- *                NetQueryDisplayInformation  (NETAPI32.@)
  * Copies NET_DISPLAY_USER record.
  */
-static void ACCESS_CopyDisplayUser(PNET_DISPLAY_USER dest, LPWSTR *dest_buf,
+static void ACCESS_CopyDisplayUser(const NET_DISPLAY_USER *dest, LPWSTR *dest_buf,
                             PNET_DISPLAY_USER src)
 {
     LPWSTR str = *dest_buf;
@@ -437,10 +552,17 @@
     DWORD PreferredMaximumLength, LPDWORD ReturnedEntryCount,
     PVOID *SortedBuffer)
 {
-    TRACE("(%s, %ld, %ld, %ld, %ld, %p, %p)\n", debugstr_w(ServerName),
+    TRACE("(%s, %d, %d, %d, %d, %p, %p)\n", debugstr_w(ServerName),
           Level, Index, EntriesRequested, PreferredMaximumLength,
           ReturnedEntryCount, SortedBuffer);
-    NETAPI_ForceLocalComputer(ServerName, ERROR_ACCESS_DENIED);
+
+    if(!NETAPI_IsLocalComputer(ServerName))
+    {
+        FIXME("Only implemented on local computer, but requested for "
+              "remote server %s\n", debugstr_w(ServerName));
+        return ERROR_ACCESS_DENIED;
+    }
+
     switch (Level)
     {
     case 1:
@@ -462,7 +584,7 @@
          */
         int records = 3;
 
-        FIXME("Level %ld partially implemented\n", Level);
+        FIXME("Level %d partially implemented\n", Level);
         *ReturnedEntryCount = records;
         comment_sz = 1;
         full_name_sz = 1;
@@ -522,12 +644,12 @@
     case 2:
     case 3:
     {
-        FIXME("Level %ld is not implemented\n", Level);
+        FIXME("Level %d is not implemented\n", Level);
         break;
     }
 
     default:
-        ERR("Invalid level %ld is specified\n", Level);
+        TRACE("Invalid level %d is specified\n", Level);
         return ERROR_INVALID_LEVEL;
     }
     return NERR_Success;
@@ -548,48 +670,171 @@
 }
 
 
-/************************************************************
- *                NetUserModalsGet  (NETAPI32.@)
- */
-NET_API_STATUS WINAPI NetUserModalsGet(LPCWSTR szServer, DWORD level, LPBYTE *pbuffer)
-{
-    FIXME("(%s %ld %p) stub!\n", debugstr_w(szServer), level, pbuffer);
-    return NERR_InternalError;
-}
-
-/************************************************************
- *                NetLocalGroupAdd  (NETAPI32.@)
- */
-NET_API_STATUS WINAPI NetLocalGroupAdd(LPCWSTR servername, DWORD level,
-                 LPBYTE buf, LPDWORD parm_err)
-{
-    FIXME("(%s %ld %p %p) stub!\n", debugstr_w(servername), level, buf, parm_err);
+/******************************************************************************
+ * NetUserModalsGet  (NETAPI32.@)
+ *
+ * Retrieves global information for all users and global groups in the security
+ * database.
+ *
+ * PARAMS
+ *  szServer   [I] Specifies the DNS or the NetBIOS name of the remote server
+ *                 on which the function is to execute.
+ *  level      [I] Information level of the data.
+ *     0   Return global passwords parameters. bufptr points to a
+ *         USER_MODALS_INFO_0 struct.
+ *     1   Return logon server and domain controller information. bufptr
+ *         points to a USER_MODALS_INFO_1 struct.
+ *     2   Return domain name and identifier. bufptr points to a 
+ *         USER_MODALS_INFO_2 struct.
+ *     3   Return lockout information. bufptr points to a USER_MODALS_INFO_3
+ *         struct.
+ *  pbuffer    [I] Buffer that receives the data.
+ *
+ * RETURNS
+ *  Success: NERR_Success.
+ *  Failure: 
+ *     ERROR_ACCESS_DENIED - the user does not have access to the info.
+ *     NERR_InvalidComputer - computer name is invalid.
+ */
+NET_API_STATUS WINAPI NetUserModalsGet(
+    LPCWSTR szServer, DWORD level, LPBYTE *pbuffer)
+{
+    TRACE("(%s %d %p)\n", debugstr_w(szServer), level, pbuffer);
+    
+    switch (level)
+    {
+        case 0:
+            /* return global passwords parameters */
+            FIXME("level 0 not implemented!\n");
+            *pbuffer = NULL;
+            return NERR_InternalError;
+        case 1:
+            /* return logon server and domain controller info */
+            FIXME("level 1 not implemented!\n");
+            *pbuffer = NULL;
+            return NERR_InternalError;
+        case 2:
+        {
+            /* return domain name and identifier */
+            PUSER_MODALS_INFO_2 umi;
+            LSA_HANDLE policyHandle;
+            LSA_OBJECT_ATTRIBUTES objectAttributes;
+            PPOLICY_ACCOUNT_DOMAIN_INFO domainInfo;
+            NTSTATUS ntStatus;
+            PSID domainIdentifier = NULL;
+            int domainNameLen;
+
+            ZeroMemory(&objectAttributes, sizeof(objectAttributes));
+            objectAttributes.Length = sizeof(objectAttributes);
+
+            ntStatus = LsaOpenPolicy(NULL, &objectAttributes,
+                                     POLICY_VIEW_LOCAL_INFORMATION,
+                                     &policyHandle);
+            if (ntStatus != STATUS_SUCCESS)
+            {
+                WARN("LsaOpenPolicy failed with NT status %x\n",
+                     LsaNtStatusToWinError(ntStatus));
+                return ntStatus;
+            }
+
+            ntStatus = LsaQueryInformationPolicy(policyHandle,
+                                                 PolicyAccountDomainInformation,
+                                                 (PVOID *)&domainInfo);
+            if (ntStatus != STATUS_SUCCESS)
+            {
+                WARN("LsaQueryInformationPolicy failed with NT status %x\n",
+                     LsaNtStatusToWinError(ntStatus));
+                LsaClose(policyHandle);
+                return ntStatus;
+            }
+
+            domainIdentifier = domainInfo->DomainSid;
+            domainNameLen = lstrlenW(domainInfo->DomainName.Buffer) + 1;
+            LsaClose(policyHandle);
+
+            ntStatus = NetApiBufferAllocate(sizeof(USER_MODALS_INFO_2) +
+                                            GetLengthSid(domainIdentifier) +
+                                            domainNameLen * sizeof(WCHAR),
+                                            (LPVOID *)pbuffer);
+
+            if (ntStatus != NERR_Success)
+            {
+                WARN("NetApiBufferAllocate() failed\n");
+                LsaFreeMemory(domainInfo);
+                return ntStatus;
+            }
+
+            umi = (USER_MODALS_INFO_2 *) *pbuffer;
+            umi->usrmod2_domain_id = (PSID)(*pbuffer +
+                sizeof(USER_MODALS_INFO_2));
+            umi->usrmod2_domain_name = (LPWSTR)(*pbuffer +
+                sizeof(USER_MODALS_INFO_2) + GetLengthSid(domainIdentifier));
+
+            lstrcpynW(umi->usrmod2_domain_name,
+                      domainInfo->DomainName.Buffer,
+                      domainNameLen);
+            CopySid(GetLengthSid(domainIdentifier), umi->usrmod2_domain_id,
+                    domainIdentifier);
+
+            LsaFreeMemory(domainInfo);
+
+            break;
+        } 
+        case 3:
+            /* return lockout information */
+            FIXME("level 3 not implemented!\n");
+            *pbuffer = NULL;
+            return NERR_InternalError;
+        default:
+            TRACE("Invalid level %d is specified\n", level);
+            *pbuffer = NULL;
+            return ERROR_INVALID_LEVEL;
+    }
+
     return NERR_Success;
 }
 
-/************************************************************
- *                NetLocalGroupEnum  (NETAPI32.@)
- */
-NET_API_STATUS WINAPI NetLocalGroupEnum(LPCWSTR servername, DWORD level,
-        LPBYTE *bufptr, DWORD prefmaxlen, PDWORD entriesread,
-        PDWORD totalentries, PDWORD resumehandle)
-{
-    FIXME("(%s %ld %p %u %p %p %p) stub!\n", debugstr_w(servername),
-          level, bufptr, entriesread, totalentries, resumehandle);
-    *entriesread = 0;
-    *totalentries = 0;
-    *resumehandle = 0;
+/******************************************************************************
+ *                NetUserChangePassword  (NETAPI32.@)
+ * PARAMS
+ *  domainname  [I] Optional. Domain on which the user resides or the logon
+ *                  domain of the current user if NULL.
+ *  username    [I] Optional. Username to change the password for or the name
+ *                  of the current user if NULL.
+ *  oldpassword [I] The user's current password.
+ *  newpassword [I] The password that the user will be changed to using.
+ *
+ * RETURNS
+ *  Success: NERR_Success.
+ *  Failure: NERR_* failure code or win error code.
+ *
+ */
+NET_API_STATUS WINAPI NetUserChangePassword(LPCWSTR domainname, LPCWSTR username,
+    LPCWSTR oldpassword, LPCWSTR newpassword)
+{
+    struct sam_user *user;
+
+    TRACE("(%s, %s, ..., ...)\n", debugstr_w(domainname), debugstr_w(username));
+
+    if(domainname)
+        FIXME("Ignoring domainname %s.\n", debugstr_w(domainname));
+
+    if((user = NETAPI_FindUser(username)) == NULL)
+        return NERR_UserNotFound;
+
+    if(lstrcmpW(user->user_password, oldpassword) != 0)
+        return ERROR_INVALID_PASSWORD;
+
+    if(lstrlenW(newpassword) > PWLEN)
+        return ERROR_PASSWORD_RESTRICTION;
+
+    lstrcpyW(user->user_password, newpassword);
+
     return NERR_Success;
 }
 
-/************************************************************
- *                NetLocalGroupSetMember (NETAPI32.@)
- */
-
-NET_API_STATUS WINAPI NetLocalGroupSetMembers(LPCWSTR servername,
-             LPCWSTR groupname, DWORD level, LPBYTE buf, DWORD totalentries)
-{
-    FIXME("(%s %s %ld %p %ld) stub!\n", debugstr_w(servername), 
-            debugstr_w(groupname),level, buf, totalentries);
+NET_API_STATUS NetUseAdd(LMSTR servername, DWORD level, LPBYTE bufptr, LPDWORD parm_err)
+{
+    FIXME("%s %d %p %p stub\n", debugstr_w(servername), level, bufptr, parm_err);
     return NERR_Success;
 }

Modified: trunk/reactos/dll/win32/netapi32/apibuf.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/apibuf.c?rev=27911&r1=27910&r2=27911&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netapi32/apibuf.c (original)
+++ trunk/reactos/dll/win32/netapi32/apibuf.c Fri Jul 27 13:46:28 2007
@@ -15,7 +15,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
 #include <stdarg.h>
@@ -35,7 +35,9 @@
  */
 NET_API_STATUS WINAPI NetApiBufferAllocate(DWORD ByteCount, LPVOID* Buffer)
 {
-    TRACE("(%ld, %p)\n", ByteCount, Buffer);
+    TRACE("(%d, %p)\n", ByteCount, Buffer);
+
+    if (Buffer == NULL) return ERROR_INVALID_PARAMETER;
     *Buffer = HeapAlloc(GetProcessHeap(), 0, ByteCount);
     if (*Buffer)
         return NERR_Success;
@@ -59,7 +61,7 @@
 NET_API_STATUS WINAPI NetApiBufferReallocate(LPVOID OldBuffer, DWORD NewByteCount,
                                              LPVOID* NewBuffer)
 {
-    TRACE("(%p, %ld, %p)\n", OldBuffer, NewByteCount, NewBuffer);
+    TRACE("(%p, %d, %p)\n", OldBuffer, NewByteCount, NewBuffer);
     if (NewByteCount) 
     {
         if (OldBuffer)
@@ -87,7 +89,7 @@
     if (Buffer == NULL)
         return ERROR_INVALID_PARAMETER;
     dw = HeapSize(GetProcessHeap(), 0, Buffer);
-    TRACE("size: %ld\n", dw);
+    TRACE("size: %d\n", dw);
     if (dw != 0xFFFFFFFF)
         *ByteCount = dw;
     else

Modified: trunk/reactos/dll/win32/netapi32/browsr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/browsr.c?rev=27911&r1=27910&r2=27911&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netapi32/browsr.c (original)
+++ trunk/reactos/dll/win32/netapi32/browsr.c Fri Jul 27 13:46:28 2007
@@ -15,7 +15,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
 #include <stdarg.h>
@@ -26,9 +26,6 @@
 #include "lmcons.h"
 #include "lmbrowsr.h"
 #include "lmshare.h"
-#include "wine/debug.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
 
 /************************************************************
  *                I_BrowserSetNetlogonState  (NETAPI32.@)
@@ -49,14 +46,3 @@
 {
     return ERROR_NOT_SUPPORTED;
 }
-
-/************************************************************
- *                NetShareEnum  (NETAPI32.@)
- */
-NET_API_STATUS WINAPI NetShareEnum( LPWSTR servername, DWORD level, LPBYTE* bufptr,
-  DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries, LPDWORD resume_handle)
-{
-    FIXME("%s %ld %p %ld %p %p %p\n", debugstr_w(servername), level, bufptr,
-          prefmaxlen, entriesread, totalentries, resume_handle);
-    return ERROR_NOT_SUPPORTED;
-}

Modified: trunk/reactos/dll/win32/netapi32/ds.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/ds.c?rev=27911&r1=27910&r2=27911&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netapi32/ds.c (original)
+++ trunk/reactos/dll/win32/netapi32/ds.c Fri Jul 27 13:46:28 2007
@@ -15,18 +15,48 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
 #include <stdarg.h>
 
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
 #include "windef.h"
 #include "winbase.h"
 #include "winerror.h"
+#include "ntsecapi.h"
 #include "wine/debug.h"
 #include "dsrole.h"
+#include "dsgetdc.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(ds);
+
+DWORD WINAPI DsGetDcNameW(LPCWSTR ComputerName, LPCWSTR AvoidDCName,
+ GUID* DomainGuid, LPCWSTR SiteName, ULONG Flags,
+ PDOMAIN_CONTROLLER_INFOW *DomainControllerInfo)
+{
+    FIXME("(%s, %s, %s, %s, %08x, %p): stub\n", debugstr_w(ComputerName),
+     debugstr_w(AvoidDCName), debugstr_guid(DomainGuid),
+     debugstr_w(SiteName), Flags, DomainControllerInfo);
+    return ERROR_CALL_NOT_IMPLEMENTED;
+}
+
+DWORD WINAPI DsGetDcNameA(LPCSTR ComputerName, LPCSTR AvoidDCName,
+ GUID* DomainGuid, LPCSTR SiteName, ULONG Flags,
+ PDOMAIN_CONTROLLER_INFOA *DomainControllerInfo)
+{
+    FIXME("(%s, %s, %s, %s, %08x, %p): stub\n", debugstr_a(ComputerName),
+     debugstr_a(AvoidDCName), debugstr_guid(DomainGuid),
+     debugstr_a(SiteName), Flags, DomainControllerInfo);
+    return ERROR_CALL_NOT_IMPLEMENTED;
+}
+
+DWORD WINAPI DsGetSiteNameW(LPCWSTR ComputerName, LPWSTR *SiteName)
+{
+    FIXME("(%s, %p): stub\n", debugstr_w(ComputerName), SiteName);
+    return ERROR_CALL_NOT_IMPLEMENTED;
+}
 
 /************************************************************
  *  DsRoleFreeMemory (NETAPI32.@)
@@ -39,7 +69,8 @@
  */
 VOID WINAPI DsRoleFreeMemory(PVOID Buffer)
 {
-    FIXME("(%p) stub\n", Buffer);
+    TRACE("(%p)\n", Buffer);
+    HeapFree(GetProcessHeap(), 0, Buffer);
 }
 
 /************************************************************
@@ -59,6 +90,8 @@
     LPCWSTR lpServer, DSROLE_PRIMARY_DOMAIN_INFO_LEVEL InfoLevel,
     PBYTE* Buffer)
 {
+    DWORD ret;
+
     FIXME("(%p, %d, %p) stub\n", lpServer, InfoLevel, Buffer);
 
     /* Check some input parameters */
@@ -66,5 +99,51 @@
     if (!Buffer) return ERROR_INVALID_PARAMETER;
     if ((InfoLevel < DsRolePrimaryDomainInfoBasic) || (InfoLevel > DsRoleOperationState)) return ERROR_INVALID_PARAMETER;
 
-    return E_NOTIMPL;
+    switch (InfoLevel)
+    {
+        case DsRolePrimaryDomainInfoBasic:
+        {
+            LSA_OBJECT_ATTRIBUTES ObjectAttributes;
+            LSA_HANDLE PolicyHandle;
+            PPOLICY_ACCOUNT_DOMAIN_INFO DomainInfo;
+            NTSTATUS NtStatus;
+            int logon_domain_sz;
+            DWORD size;
+            PDSROLE_PRIMARY_DOMAIN_INFO_BASIC basic;
+
+            ZeroMemory(&ObjectAttributes, sizeof(ObjectAttributes));
+            NtStatus = LsaOpenPolicy(NULL, &ObjectAttributes,
+             POLICY_VIEW_LOCAL_INFORMATION, &PolicyHandle);
+            if (NtStatus != STATUS_SUCCESS)
+            {
+                TRACE("LsaOpenPolicyFailed with NT status %x\n",
+                    LsaNtStatusToWinError(NtStatus));
+                return ERROR_OUTOFMEMORY;
+            }
+            LsaQueryInformationPolicy(PolicyHandle,
+             PolicyAccountDomainInformation, (PVOID*)&DomainInfo);
+            logon_domain_sz = lstrlenW(DomainInfo->DomainName.Buffer) + 1;
+            LsaClose(PolicyHandle);
+
+            size = sizeof(DSROLE_PRIMARY_DOMAIN_INFO_BASIC) +
+             logon_domain_sz * sizeof(WCHAR);
+            basic = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
+            if (basic)
+            {
+                basic->MachineRole = DsRole_RoleStandaloneWorkstation;
+                basic->DomainNameFlat = (LPWSTR)((LPBYTE)basic +
+                 sizeof(DSROLE_PRIMARY_DOMAIN_INFO_BASIC));
+                lstrcpyW(basic->DomainNameFlat, DomainInfo->DomainName.Buffer);
+                ret = ERROR_SUCCESS;
+            }
+            else
+                ret = ERROR_OUTOFMEMORY;
+            *Buffer = (PBYTE)basic;
+            LsaFreeMemory(DomainInfo);
+        }
+        break;
+    default:
+        ret = ERROR_CALL_NOT_IMPLEMENTED;
+    }
+    return ret;
 }

Added: trunk/reactos/dll/win32/netapi32/local_group.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/local_group.c?rev=27911&view=auto
==============================================================================
--- trunk/reactos/dll/win32/netapi32/local_group.c (added)
+++ trunk/reactos/dll/win32/netapi32/local_group.c Fri Jul 27 13:46:28 2007
@@ -1,0 +1,200 @@
+/*
+ * Copyright 2006 Robert Reif
+ *
+ * netapi32 local group functions
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
+#include "windef.h"
+#include "winbase.h"
+#include "winerror.h"
+#include "lmcons.h"
+#include "lmaccess.h"
+#include "lmapibuf.h"
+#include "lmerr.h"
+#include "winreg.h"
+#include "ntsecapi.h"
+#include "wine/debug.h"
+#include "wine/unicode.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
+
+/************************************************************
+ *                NetLocalGroupAdd  (NETAPI32.@)
+ */
+NET_API_STATUS WINAPI NetLocalGroupAdd(
+    LPCWSTR servername,
+    DWORD level,
+    LPBYTE buf,
+    LPDWORD parm_err)
+{
+    FIXME("(%s %d %p %p) stub!\n", debugstr_w(servername), level, buf,
+          parm_err);
+    return NERR_Success;
+}
+
+/************************************************************
+ *                NetLocalGroupAddMember  (NETAPI32.@)
+ */
+NET_API_STATUS WINAPI NetLocalGroupAddMember(
+    LPCWSTR servername,
+    LPCWSTR groupname,
+    PSID membersid)
+{
+    FIXME("(%s %s %p) stub!\n", debugstr_w(servername),
+          debugstr_w(groupname), membersid);
+    return NERR_Success;
+}
+
+/************************************************************
+ *                NetLocalGroupAddMembers  (NETAPI32.@)
+ */
+NET_API_STATUS WINAPI NetLocalGroupAddMembers(
+    LPCWSTR servername,
+    LPCWSTR groupname,
+    DWORD level,
+    LPBYTE buf,
+    DWORD totalentries)
+{
+    FIXME("(%s %s %d %p %d) stub!\n", debugstr_w(servername),
+          debugstr_w(groupname), level, buf, totalentries);
+    return NERR_Success;
+}
+
+/************************************************************
+ *                NetLocalGroupDel  (NETAPI32.@)
+ */
+NET_API_STATUS WINAPI NetLocalGroupDel(
+    LPCWSTR servername,
+    LPCWSTR groupname)
+{
+    FIXME("(%s %s) stub!\n", debugstr_w(servername), debugstr_w(groupname));
+    return NERR_Success;
+}
+
+/************************************************************
+ *                NetLocalGroupDelMember  (NETAPI32.@)
+ */
+NET_API_STATUS WINAPI NetLocalGroupDelMember(
+    LPCWSTR servername,
+    LPCWSTR groupname,
+    PSID membersid)
+{
+    FIXME("(%s %s %p) stub!\n", debugstr_w(servername),
+          debugstr_w(groupname), membersid);
+    return NERR_Success;
+}
+
+/************************************************************
+ *                NetLocalGroupDelMembers  (NETAPI32.@)
+ */
+NET_API_STATUS WINAPI NetLocalGroupDelMembers(
+    LPCWSTR servername,
+    LPCWSTR groupname,
+    DWORD level,
+    LPBYTE buf,
+    DWORD totalentries)
+{
+    FIXME("(%s %s %d %p %d) stub!\n", debugstr_w(servername),
+          debugstr_w(groupname), level, buf, totalentries);
+    return NERR_Success;
+}
+
+/************************************************************
+ *                NetLocalGroupEnum  (NETAPI32.@)
+ */
+NET_API_STATUS WINAPI NetLocalGroupEnum(
+    LPCWSTR servername,
+    DWORD level,
+    LPBYTE* bufptr,
+    DWORD prefmaxlen,
+    LPDWORD entriesread,
+    LPDWORD totalentries,
+    PDWORD_PTR resumehandle)
+{
+    FIXME("(%s %d %p %d %p %p %p) stub!\n", debugstr_w(servername),
+          level, bufptr, prefmaxlen, entriesread, totalentries, resumehandle);
+    *entriesread = 0;
+    *totalentries = 0;
+    return NERR_Success;
+}
+
+/************************************************************
+ *                NetLocalGroupGetInfo  (NETAPI32.@)
+ */
+NET_API_STATUS WINAPI NetLocalGroupGetInfo(
+    LPCWSTR servername,
+    LPCWSTR groupname,
+    DWORD level,
+    LPBYTE* bufptr)
+{
+    FIXME("(%s %s %d %p) stub!\n", debugstr_w(servername),
+          debugstr_w(groupname), level, bufptr);
+    return NERR_Success;
+}
+
+/************************************************************
+ *                NetLocalGroupGetMembers  (NETAPI32.@)
+ */
+NET_API_STATUS WINAPI NetLocalGroupGetMembers(
+    LPCWSTR servername,
+    LPCWSTR localgroupname,
+    DWORD level,
+    LPBYTE* bufptr,
+    DWORD prefmaxlen,
+    LPDWORD entriesread,
+    LPDWORD totalentries,
+    PDWORD_PTR resumehandle)
+{
+    FIXME("(%s %s %d %p %d, %p %p %p) stub!\n", debugstr_w(servername),
+          debugstr_w(localgroupname), level, bufptr, prefmaxlen, entriesread,
+          totalentries, resumehandle);
+    return NERR_Success;
+}
+
+/************************************************************
+ *                NetLocalGroupSetInfo  (NETAPI32.@)
+ */
+NET_API_STATUS WINAPI NetLocalGroupSetInfo(
+    LPCWSTR servername,
+    LPCWSTR groupname,
+    DWORD level,
+    LPBYTE buf,
+    LPDWORD parm_err)
+{
+    FIXME("(%s %s %d %p %p) stub!\n", debugstr_w(servername),
+          debugstr_w(groupname), level, buf, parm_err);
+    return NERR_Success;
+}
+
+/************************************************************
+ *                NetLocalGroupSetMember (NETAPI32.@)
+ */
+NET_API_STATUS WINAPI NetLocalGroupSetMembers(
+    LPCWSTR servername,
+    LPCWSTR groupname,
+    DWORD level,
+    LPBYTE buf,
+    DWORD totalentries)
+{
+    FIXME("(%s %s %d %p %d) stub!\n", debugstr_w(servername),
+            debugstr_w(groupname), level, buf, totalentries);
+    return NERR_Success;
+}

Propchange: trunk/reactos/dll/win32/netapi32/local_group.c
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: trunk/reactos/dll/win32/netapi32/nbcmdqueue.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/nbcmdqueue.c?rev=27911&r1=27910&r2=27911&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netapi32/nbcmdqueue.c (original)
+++ trunk/reactos/dll/win32/netapi32/nbcmdqueue.c Fri Jul 27 13:46:28 2007
@@ -12,7 +12,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 #include "config.h"
 #include "wine/debug.h"
@@ -62,6 +62,7 @@
     {
         queue->heap = heap;
         InitializeCriticalSection(&queue->cs);
+        queue->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": NBCmdQueue.cs");
         queue->head = NULL;
     }
     return queue;
@@ -193,6 +194,7 @@
     if (queue)
     {
         NBCmdQueueCancelAll(queue);
+        queue->cs.DebugInfo->Spare[0] = 0;
         DeleteCriticalSection(&queue->cs);
         HeapFree(queue->heap, 0, queue);
     }

Modified: trunk/reactos/dll/win32/netapi32/nbcmdqueue.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/nbcmdqueue.h?rev=27911&r1=27910&r2=27911&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netapi32/nbcmdqueue.h (original)
+++ trunk/reactos/dll/win32/netapi32/nbcmdqueue.h Fri Jul 27 13:46:28 2007
@@ -12,7 +12,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 #ifndef __NBCMDQUEUE_H__
 #define __NBCMDQUEUE_H__

Modified: trunk/reactos/dll/win32/netapi32/nbnamecache.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/nbnamecache.c?rev=27911&r1=27910&r2=27911&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netapi32/nbnamecache.c (original)
+++ trunk/reactos/dll/win32/netapi32/nbnamecache.c Fri Jul 27 13:46:28 2007
@@ -12,7 +12,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  *
  * This implementation uses a linked list, because I don't have a decent
  * hash table implementation handy.  This is somewhat inefficient, but it's
@@ -21,11 +21,8 @@
 
 #include "config.h"
 #include "wine/port.h"
-#include "wine/debug.h"
 
 #include "nbnamecache.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(netbios);
 
 typedef struct _NBNameCacheNode
 {
@@ -107,6 +104,7 @@
     {
         cache->heap = heap;
         InitializeCriticalSection(&cache->cs);
+        cache->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": NBNameCache.cs");
         cache->entryExpireTimeMS = entryExpireTimeMS;
         cache->head = NULL;
     }
@@ -166,7 +164,7 @@
         NBNameCacheNode **node;
 
         EnterCriticalSection(&cache->cs);
-        node = NBNameCacheWalk(cache, (char*)name);
+        node = NBNameCacheWalk(cache, (const char *)name);
         if (node)
             ret = (*node)->entry;
         else
@@ -188,7 +186,7 @@
         NBNameCacheNode **node;
 
         EnterCriticalSection(&cache->cs);
-        node = NBNameCacheWalk(cache, (char*)name);
+        node = NBNameCacheWalk(cache, (const char *)name);
         if (node && *node && (*node)->entry)
         {
             memcpy((*node)->entry->nbname, nbname, NCBNAMSZ);
@@ -207,6 +205,7 @@
 {
     if (cache)
     {
+        cache->cs.DebugInfo->Spare[0] = 0;
         DeleteCriticalSection(&cache->cs);
         while (cache->head)
             NBNameCacheUnlinkNode(cache, &cache->head);

Modified: trunk/reactos/dll/win32/netapi32/nbnamecache.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/nbnamecache.h?rev=27911&r1=27910&r2=27911&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netapi32/nbnamecache.h (original)
+++ trunk/reactos/dll/win32/netapi32/nbnamecache.h Fri Jul 27 13:46:28 2007
@@ -12,7 +12,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 #ifndef __WINE_NBNAMECACHE_H
 #define __WINE_NBNAMECACHE_H

Modified: trunk/reactos/dll/win32/netapi32/nbt.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/nbt.c?rev=27911&r1=27910&r2=27911&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netapi32/nbt.c (original)
+++ trunk/reactos/dll/win32/netapi32/nbt.c Fri Jul 27 13:46:28 2007
@@ -12,7 +12,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  *
  * I am heavily indebted to Chris Hertel's excellent Implementing CIFS,
  * http://ubiqx.org/cifs/ , for whatever understanding I have of NBT.
@@ -288,7 +288,7 @@
  * Returns NRC_GOODRET on timeout or a valid response received, something else
  * on error.
  */
-static UCHAR NetBTWaitForNameResponse(NetBTAdapter *adapter, SOCKET fd,
+static UCHAR NetBTWaitForNameResponse(const NetBTAdapter *adapter, SOCKET fd,
  DWORD waitUntil, NetBTAnswerCallback answerCallback, void *data)
 {
     BOOL found = FALSE;
@@ -424,7 +424,7 @@
          queryData->cacheEntry->numAddresses < answerCount)
         {
             queryData->cacheEntry->addresses[queryData->cacheEntry->
-             numAddresses++] = *(PDWORD)(rData + 2);
+             numAddresses++] = *(const DWORD *)(rData + 2);
             ret = queryData->cacheEntry->numAddresses < answerCount;
         }
         else
@@ -444,7 +444,7 @@
  * Returns NRC_GOODRET on success, though this may not mean the name was
  * resolved--check whether *cacheEntry is NULL.
  */
-static UCHAR NetBTNameWaitLoop(NetBTAdapter *adapter, SOCKET fd, PNCB ncb,
+static UCHAR NetBTNameWaitLoop(const NetBTAdapter *adapter, SOCKET fd, const NCB *ncb,
  DWORD sendTo, BOOL broadcast, DWORD timeout, DWORD maxQueries,
  NBNameCacheEntry **cacheEntry)
 {
@@ -1028,7 +1028,7 @@
                     ret = NRC_CMDTMO;
                 else
                 {
-                    static UCHAR fakedCalledName[] = "*SMBSERVER";
+                    static const UCHAR fakedCalledName[] = "*SMBSERVER";
                     const UCHAR *calledParty = cacheEntry->nbname[0] == '*'
                      ? fakedCalledName : cacheEntry->nbname;
 
@@ -1050,6 +1050,7 @@
                     {
                         session->fd = fd;
                         InitializeCriticalSection(&session->cs);
+                        session->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": NetBTSession.cs");
                         *sess = session;
                     }
                     else
@@ -1111,7 +1112,7 @@
     }
     else if (bytesSent < NBSS_HDRSIZE + ncb->ncb_length)
     {
-        FIXME("Only sent %ld bytes (of %d), hanging up session\n", bytesSent,
+        FIXME("Only sent %d bytes (of %d), hanging up session\n", bytesSent,
          NBSS_HDRSIZE + ncb->ncb_length);
         NetBIOSHangupSession(ncb);
         ret = NRC_SABORT;
@@ -1243,6 +1244,7 @@
     closesocket(session->fd);
     session->fd = INVALID_SOCKET;
     session->bytesPending = 0;
+    session->cs.DebugInfo->Spare[0] = 0;
     DeleteCriticalSection(&session->cs);
     HeapFree(GetProcessHeap(), 0, session);
 
@@ -1272,7 +1274,7 @@
     }
 }
 
-static UCHAR NetBTRegisterAdapter(PMIB_IPADDRROW ipRow)
+static UCHAR NetBTRegisterAdapter(const MIB_IPADDRROW *ipRow)
 {
     UCHAR ret;
     NetBTAdapter *adapter;

Modified: trunk/reactos/dll/win32/netapi32/netapi32.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/netapi32.c?rev=27911&r1=27910&r2=27911&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netapi32/netapi32.c (original)
+++ trunk/reactos/dll/win32/netapi32/netapi32.c Fri Jul 27 13:46:28 2007
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
 #include "config.h"
@@ -24,11 +24,11 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(netbios);
 
-HMODULE NETAPI32_hModule = 0;
+static HMODULE NETAPI32_hModule;
 
 BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
 {
-    TRACE("%p,%lx,%p\n", hinstDLL, fdwReason, lpvReserved);
+    TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved);
 
     switch (fdwReason) {
         case DLL_PROCESS_ATTACH:
@@ -49,6 +49,9 @@
     return TRUE;
 }
 
+/************************************************************
+ *                NetServerEnum (NETAPI32.@)
+ */
 NET_API_STATUS  WINAPI NetServerEnum(
   LPCWSTR servername,
   DWORD level,
@@ -61,20 +64,40 @@
   LPDWORD resume_handle
 )
 {
-    FIXME("Stub (%s %ld %p %ld %p %p %ld %s %p)\n", debugstr_w(servername),
+    FIXME("Stub (%s %d %p %d %p %p %d %s %p)\n", debugstr_w(servername),
      level, bufptr, prefmaxlen, entriesread, totalentries, servertype,
      debugstr_w(domain), resume_handle);
 
     return ERROR_NO_BROWSER_SERVERS_FOUND;
 }
 
+/************************************************************
+ *                NetServerEnumEx (NETAPI32.@)
+ */
+NET_API_STATUS WINAPI NetServerEnumEx(
+    LPCWSTR ServerName,
+    DWORD Level,
+    LPBYTE *Bufptr,
+    DWORD PrefMaxlen,
+    LPDWORD EntriesRead,
+    LPDWORD totalentries,
+    DWORD servertype,
+    LPCWSTR domain,
+    LPCWSTR FirstNameToReturn)
+{
+    FIXME("Stub (%s %d %p %d %p %p %d %s %p)\n", debugstr_w(ServerName),
+     Level, Bufptr, PrefMaxlen, EntriesRead, totalentries, servertype,
+     debugstr_w(domain), debugstr_w(FirstNameToReturn));
+                                                                                
+    return ERROR_NO_BROWSER_SERVERS_FOUND;
+}
 
 /************************************************************
  *                NetServerGetInfo  (NETAPI32.@)
  */
 NET_API_STATUS WINAPI NetServerGetInfo(LMSTR servername, DWORD level, LPBYTE* bufptr)
 {
-    FIXME("stub (%p, %ld, %p)\n", servername, level, bufptr);
+    FIXME("stub (%p, %d, %p)\n", servername, level, bufptr);
     return ERROR_ACCESS_DENIED;
 }
 
@@ -86,7 +109,7 @@
                                        DWORD level, DWORD options,
                                        LPBYTE *bufptr)
 {
-    TRACE("(%p, %p, %ld, %ld, %p)\n", server, service, level, options, bufptr);
+    TRACE("(%p, %p, %d, %d, %p)\n", server, service, level, options, bufptr);
     return NERR_InternalError;
 }
 

Modified: trunk/reactos/dll/win32/netapi32/netapi32.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/netapi32.rbuild?rev=27911&r1=27910&r2=27911&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netapi32/netapi32.rbuild (original)
+++ trunk/reactos/dll/win32/netapi32/netapi32.rbuild Fri Jul 27 13:46:28 2007
@@ -3,26 +3,28 @@
 	<include base="netapi32">.</include>
 	<include base="ReactOS">include/reactos/wine</include>
 	<define name="__REACTOS__" />
+	<define name="__WINESRC__" />
 	<define name="__USE_W32API" />
 	<define name="_WIN32_IE">0x600</define>
 	<define name="_WIN32_WINNT">0x501</define>
 	<define name="WINVER">0x501</define>
-	<define name="_SVRAPI_" />
 	<library>wine</library>
+	<library>iphlpapi</library>
+	<library>ws2_32</library>
+	<library>advapi32</library>
+	<library>kernel32</library>
 	<library>ntdll</library>
-	<library>kernel32</library>
-	<library>advapi32</library>
-	<library>ws2_32</library>
-	<library>iphlpapi</library>
 	<file>access.c</file>
 	<file>apibuf.c</file>
 	<file>browsr.c</file>
 	<file>ds.c</file>
+	<file>local_group.c</file>
 	<file>nbcmdqueue.c</file>
 	<file>nbnamecache.c</file>
 	<file>nbt.c</file>
 	<file>netapi32.c</file>
 	<file>netbios.c</file>
+	<file>share.c</file>
 	<file>wksta.c</file>
 	<file>netapi32.spec</file>
 </module>

Modified: trunk/reactos/dll/win32/netapi32/netapi32.spec
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/netapi32.spec?rev=27911&r1=27910&r2=27911&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netapi32/netapi32.spec (original)
+++ trunk/reactos/dll/win32/netapi32/netapi32.spec Fri Jul 27 13:46:28 2007
@@ -3,12 +3,14 @@
 @ stub DsDeregisterDnsHostRecords
 @ stub DsEnumerateDomainTrusts
 @ stub DsGetDcClose
-@ stub DsGetDcName
+@ stdcall DsGetDcNameA(str str ptr str long ptr)
+@ stdcall DsGetDcNameW(wstr wstr ptr wstr long ptr)
 @ stub DsGetDcNext
 @ stub DsGetDcOpen
 @ stub DsGetDcSiteCoverage
 @ stub DsGetForestTrustInformationW
-@ stub DsGetSiteName
+@ stub DsGetSiteNameA # (str str)
+@ stdcall DsGetSiteNameW(wstr wstr)
 @ stub DsMergeForestTrustInformationW
 @ stdcall DsRoleFreeMemory(ptr)
 @ stdcall DsRoleGetPrimaryDomainInformation(wstr long ptr)
@@ -102,16 +104,16 @@
 @ stub NetGroupSetInfo
 @ stub NetGroupSetUsers
 @ stdcall NetLocalGroupAdd(wstr long ptr ptr)
-@ stub NetLocalGroupAddMember
-@ stub NetLocalGroupAddMembers
-@ stub NetLocalGroupDel
-@ stub NetLocalGroupDelMember
-@ stub NetLocalGroupDelMembers
+@ stdcall NetLocalGroupAddMember(wstr wstr ptr)
+@ stdcall NetLocalGroupAddMembers(wstr wstr long ptr long)
+@ stdcall NetLocalGroupDel(wstr wstr)
+@ stdcall NetLocalGroupDelMember(wstr wstr ptr)
+@ stdcall NetLocalGroupDelMembers(wstr wstr long ptr long)
 @ stdcall NetLocalGroupEnum(wstr long ptr long ptr ptr ptr)
-@ stub NetLocalGroupGetInfo
-@ stub NetLocalGroupGetMembers
-@ stub NetLocalGroupSetInfo
-@ stdcall NetLocalGroupSetMembers(wstr wstr long ptr ptr)
+@ stdcall NetLocalGroupGetInfo(wstr wstr long ptr)
+@ stdcall NetLocalGroupGetMembers(wstr wstr long ptr long ptr ptr ptr)
+@ stdcall NetLocalGroupSetInfo(wstr wstr long ptr ptr)
+@ stdcall NetLocalGroupSetMembers(wstr wstr long ptr long)
 @ stub NetMessageBufferSend
 @ stub NetMessageNameAdd
 @ stub NetMessageNameDel
@@ -172,7 +174,7 @@
 @ stub NetServerComputerNameDel
 @ stub NetServerDiskEnum
 @ stdcall NetServerEnum(wstr long ptr long ptr ptr long wstr ptr)
-@ stub NetServerEnumEx
+@ stdcall NetServerEnumEx(wstr long ptr long ptr ptr long wstr wstr)
 @ stdcall NetServerGetInfo(wstr long ptr)
 @ stub NetServerSetInfo
 @ stub NetServerTransportAdd
@@ -184,28 +186,28 @@
 @ stub NetServiceGetInfo
 @ stub NetServiceInstall
 @ stub NetSessionDel
-@ stub NetSessionEnum
+@ stdcall NetSessionEnum(wstr wstr wstr long ptr long ptr ptr ptr)
 @ stub NetSessionGetInfo
 @ stub NetShareAdd
 @ stub NetShareCheck
-@ stub NetShareDel
+@ stdcall NetShareDel(wstr wstr long)
 @ stub NetShareDelSticky
 @ stdcall NetShareEnum(wstr long ptr long ptr ptr ptr)
 @ stub NetShareEnumSticky
 @ stub NetShareGetInfo
 @ stub NetShareSetInfo
 @ stdcall NetStatisticsGet(wstr wstr long long ptr)
-@ stub NetUseAdd
+@ stdcall NetUseAdd(wstr long ptr ptr)
 @ stub NetUseDel
 @ stub NetUseEnum
 @ stub NetUseGetInfo
 @ stdcall NetUserAdd(wstr long ptr ptr)
-@ stub NetUserChangePassword
+@ stdcall NetUserChangePassword(wstr wstr wstr wstr)
 @ stdcall NetUserDel(wstr wstr)
 @ stdcall NetUserEnum(wstr long long ptr long ptr ptr ptr)
 @ stub NetUserGetGroups
 @ stdcall NetUserGetInfo(wstr wstr long ptr)
-@ stub NetUserGetLocalGroups
+@ stdcall NetUserGetLocalGroups(wstr wstr long long ptr long ptr ptr)
 @ stdcall NetUserModalsGet(wstr long ptr)
 @ stub NetUserModalsSet
 @ stub NetUserSetGroups

Removed: trunk/reactos/dll/win32/netapi32/netapi32_misc.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/netapi32_misc.h?rev=27910&view=auto
==============================================================================
--- trunk/reactos/dll/win32/netapi32/netapi32_misc.h (original)
+++ trunk/reactos/dll/win32/netapi32/netapi32_misc.h (removed)
@@ -1,35 +1,0 @@
-/*
- * Copyright 2002 Andriy Palamarchuk
- *
- * netapi32 internal functions.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, writ
-e to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef __WINE_NETAPI32_MISC_H
-#define __WINE_NETAPI32_MISC_H
-
-extern BOOL NETAPI_IsLocalComputer(LPCWSTR ServerName);
-
-#define NETAPI_ForceLocalComputer(ServerName, FailureCode) \
-    if (!NETAPI_IsLocalComputer(ServerName)) \
-    { \
-        FIXME("Action Implemented for local computer only. " \
-              "Requested for server %s\n", debugstr_w(ServerName)); \
-        return FailureCode; \
-    }
-
-#endif

Modified: trunk/reactos/dll/win32/netapi32/netbios.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/netbios.c?rev=27911&r1=27910&r2=27911&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netapi32/netbios.c (original)
+++ trunk/reactos/dll/win32/netapi32/netbios.c Fri Jul 27 13:46:28 2007
@@ -12,7 +12,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 #include "config.h"
 #include "wine/debug.h"
@@ -104,6 +104,7 @@
 {
     memset(&gNBTable, 0, sizeof(gNBTable));
     InitializeCriticalSection(&gNBTable.cs);
+    gNBTable.cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": NetBIOSAdapterTable.cs");
 }
 
 void NetBIOSShutdown(void)
@@ -122,6 +123,7 @@
         if (gTransports[i].transport.cleanup)
             gTransports[i].transport.cleanup();
     LeaveCriticalSection(&gNBTable.cs);
+    gNBTable.cs.DebugInfo->Spare[0] = 0;
     DeleteCriticalSection(&gNBTable.cs);
     HeapFree(GetProcessHeap(), 0, gNBTable.table);
 }
@@ -130,13 +132,12 @@
 {
     BOOL ret;
 
-    TRACE(": transport 0x%08lx, p %p\n", id, transport);
+    TRACE(": transport 0x%08x, p %p\n", id, transport);
     if (!transport)
         ret = FALSE;
     else if (gNumTransports >= sizeof(gTransports) / sizeof(gTransports[0]))
     {
-        FIXME("You tried to add %d transports, but I only have space for %d\n",
-         gNumTransports + 1, sizeof(gTransports) / sizeof(gTransports[0]));
+        FIXME("Too many transports %d\n", gNumTransports + 1);
         ret = FALSE;
     }
     else
@@ -148,7 +149,7 @@
         {
             if (gTransports[i].id == id)
             {
-                WARN("Replacing NetBIOS transport ID %ld\n", id);
+                WARN("Replacing NetBIOS transport ID %d\n", id);
                 memcpy(&gTransports[i].transport, transport,
                  sizeof(NetBIOSTransport));
                 ret = TRUE;
@@ -176,15 +177,15 @@
     BOOL ret;
     UCHAR i;
 
-    TRACE(": transport 0x%08lx, ifIndex 0x%08lx, data %p\n", transport, ifIndex,
+    TRACE(": transport 0x%08x, ifIndex 0x%08x, data %p\n", transport, ifIndex,
      data);
     for (i = 0; i < gNumTransports && gTransports[i].id != transport; i++)
         ;
-    if (gTransports[i].id == transport)
+    if ((i < gNumTransports) && gTransports[i].id == transport)
     {
         NetBIOSTransport *transportPtr = &gTransports[i].transport;
 
-        TRACE(": found transport %p for id 0x%08lx\n", transportPtr, transport);
+        TRACE(": found transport %p for id 0x%08x\n", transportPtr, transport);
 
         EnterCriticalSection(&gNBTable.cs);
         ret = FALSE;
@@ -211,6 +212,7 @@
             gNBTable.table[i].impl.data = data;
             gNBTable.table[i].cmdQueue = NBCmdQueueCreate(GetProcessHeap());
             InitializeCriticalSection(&gNBTable.table[i].cs);
+            gNBTable.table[i].cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": NetBIOSAdapterTable.NetBIOSAdapter.cs");
             gNBTable.table[i].enabled = TRUE;
             ret = TRUE;
         }
@@ -247,6 +249,7 @@
         if (adapter->transport->cleanupAdapter)
             adapter->transport->cleanupAdapter(adapter->impl.data);
         NBCmdQueueDestroy(adapter->cmdQueue);
+        adapter->cs.DebugInfo->Spare[0] = 0;
         DeleteCriticalSection(&adapter->cs);
         memset(adapter, 0, sizeof(NetBIOSAdapter));
     }
@@ -293,7 +296,7 @@
 void NetBIOSEnumAdapters(ULONG transport, NetBIOSEnumAdaptersCallback cb,
  void *closure)
 {
-    TRACE("transport 0x%08lx, callback %p, closure %p\n", transport, cb,
+    TRACE("transport 0x%08x, callback %p, closure %p\n", transport, cb,
      closure);
     if (cb)
     {
@@ -637,7 +640,7 @@
     return NRC_GOODRET;
 }
 
-static UCHAR nbHangup(NetBIOSAdapter *adapter, PNCB ncb)
+static UCHAR nbHangup(NetBIOSAdapter *adapter, const NCB *ncb)
 {
     UCHAR ret;
     NetBIOSSession *session;
@@ -658,7 +661,7 @@
     return ret;
 }
 
-void NetBIOSHangupSession(PNCB ncb)
+void NetBIOSHangupSession(const NCB *ncb)
 {
     NetBIOSAdapter *adapter;
 
@@ -795,7 +798,7 @@
         ncb->ncb_retcode = ncb->ncb_cmd_cplt = ret = nbEnum(ncb);
     else if (cmd == NCBADDNAME)
     {
-        FIXME("NCBADDNAME: stub, returning success");
+        FIXME("NCBADDNAME: stub, returning success\n");
         ncb->ncb_retcode = ncb->ncb_cmd_cplt = ret = NRC_GOODRET;
     }
     else

Modified: trunk/reactos/dll/win32/netapi32/netbios.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/netbios.h?rev=27911&r1=27910&r2=27911&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netapi32/netbios.h (original)
+++ trunk/reactos/dll/win32/netapi32/netbios.h Fri Jul 27 13:46:28 2007
@@ -12,7 +12,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 #ifndef __WINE_NETBIOS_H__
 #define __WINE_NETBIOS_H__
@@ -92,7 +92,7 @@
  * This function is intended for use by a transport, if the session is closed
  * by some error in the transport layer.
  */
-void NetBIOSHangupSession(PNCB ncb);
+void NetBIOSHangupSession(const NCB *ncb);
 
 /**
  * Functions a transport implementation must implement
@@ -132,7 +132,7 @@
  * some calls (recv) will block indefinitely, so a reset, shutdown, etc. will
  * never occur.
  */
-#define NCB_CANCELLED(pncb) *(PBOOL)((pncb)->ncb_reserve)
+#define NCB_CANCELLED(pncb) *(const BOOL *)((pncb)->ncb_reserve)
 
 typedef UCHAR (*NetBIOSAstat)(void *adapter, PNCB ncb);
 typedef UCHAR (*NetBIOSFindName)(void *adapter, PNCB ncb);

Added: trunk/reactos/dll/win32/netapi32/share.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/share.c?rev=27911&view=auto
==============================================================================
--- trunk/reactos/dll/win32/netapi32/share.c (added)
+++ trunk/reactos/dll/win32/netapi32/share.c Fri Jul 27 13:46:28 2007
@@ -1,0 +1,94 @@
+/* Copyright 2006 Paul Vriens
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "wine/debug.h"
+#include "lm.h"
+#include "winerror.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(share);
+
+/************************************************************
+ * NetSessionEnum  (NETAPI32.@)
+ *
+ * PARAMS
+ *   servername    [I]   Pointer to a string with the name of the server
+ *   UncClientName [I]   Pointer to a string with the name of the session
+ *   username      [I]   Pointer to a string with the name of the user
+ *   level         [I]   Data information level
+ *   bufptr        [O]   Buffer to the data
+ *   prefmaxlen    [I]   Preferred maximum length of the data
+ *   entriesread   [O]   Pointer to the number of entries enumerated
+ *   totalentries  [O]   Pointer to the possible number of entries
+ *   resume_handle [I/O] Pointer to a handle for subsequent searches
+ *
+ * RETURNS
+ *   If successful, the function returns NERR_Success
+ *   On failure it returns:
+ *     ERROR_ACCESS_DENIED         User has no access to the requested information
+ *     ERROR_INVALID_LEVEL         Value of 'level' is not correct
+ *     ERROR_INVALID_PARAMETER     Wrong parameter
+ *     ERROR_MORE_DATA             Need a larger buffer
+ *     ERROR_NOT_ENOUGH_MEMORY     Not enough memory
+ *     NERR_ClientNameNotFound     A session does not exist on a given computer
+ *     NERR_InvalidComputer        Invalid computer name
+ *     NERR_UserNotFound           User name could not be found.
+ */
+NET_API_STATUS WINAPI NetSessionEnum(LPWSTR servername, LPWSTR UncClientName,
+    LPWSTR username, DWORD level, LPBYTE* bufptr, DWORD prefmaxlen, LPDWORD entriesread,
+    LPDWORD totalentries, LPDWORD resume_handle)
+{
+    FIXME("Stub (%s %s %s %d %p %d %p %p %p)\n", debugstr_w(servername),
+        debugstr_w(UncClientName), debugstr_w(username),
+        level, bufptr, prefmaxlen, entriesread, totalentries, resume_handle);
+
+    return NERR_Success;
+}
+
+/************************************************************
+ * NetShareEnum  (NETAPI32.@)
+ *
+ * PARAMS
+ *   servername    [I]   Pointer to a string with the name of the server
+ *   level         [I]   Data information level
+ *   bufptr        [O]   Buffer to the data
+ *   prefmaxlen    [I]   Preferred maximum length of the data
+ *   entriesread   [O]   Pointer to the number of entries enumerated
+ *   totalentries  [O]   Pointer to the possible number of entries
+ *   resume_handle [I/O] Pointer to a handle for subsequent searches
+ *
+ * RETURNS
+ *   If successful, the function returns NERR_Success
+ *   On failure it returns a system error code (FIXME: find out which)
+ *
+ */
+NET_API_STATUS WINAPI NetShareEnum( LPWSTR servername, DWORD level, LPBYTE* bufptr,
+    DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries, LPDWORD resume_handle)
+{
+    FIXME("Stub (%s %d %p %d %p %p %p)\n", debugstr_w(servername), level, bufptr,
+        prefmaxlen, entriesread, totalentries, resume_handle);
+
+    return ERROR_NOT_SUPPORTED;
+}
+
+/************************************************************
+ * NetShareDel  (NETAPI32.@)
+ */
+NET_API_STATUS WINAPI NetShareDel(LMSTR servername, LMSTR netname, DWORD reserved)
+{
+    FIXME("Stub (%s %s %d)\n", debugstr_w(servername), debugstr_w(netname), reserved);
+    return NERR_Success;
+}

Propchange: trunk/reactos/dll/win32/netapi32/share.c
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: trunk/reactos/dll/win32/netapi32/wksta.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/wksta.c?rev=27911&r1=27910&r2=27911&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netapi32/wksta.c (original)
+++ trunk/reactos/dll/win32/netapi32/wksta.c Fri Jul 27 13:46:28 2007
@@ -15,7 +15,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
 #include "config.h"
@@ -35,7 +35,6 @@
 #include "lmwksta.h"
 #include "iphlpapi.h"
 #include "winerror.h"
-#include "winreg.h"
 #include "ntsecapi.h"
 #include "netbios.h"
 #include "wine/debug.h"
@@ -72,7 +71,7 @@
     }
 }
 
-static void wprint_mac(WCHAR* buffer, int len, PMIB_IFROW ifRow)
+static void wprint_mac(WCHAR* buffer, int len, const MIB_IFROW *ifRow)
 {
     int i;
     unsigned char val;
@@ -254,7 +253,7 @@
 {
     NET_API_STATUS ret;
 
-    TRACE(":%s, 0x%08lx, %p, 0x%08lx, %p, %p, %p\n", debugstr_w(ServerName), 
+    TRACE(":%s, 0x%08x, %p, 0x%08x, %p, %p, %p\n", debugstr_w(ServerName), 
      level, pbuf, prefmaxlen, read_entries, total_entries,hresume);
     if (!NETAPI_IsLocalComputer(ServerName))
     {
@@ -295,7 +294,7 @@
                 break;
             }
             default:
-                ERR("Invalid level %ld is specified\n", level);
+                TRACE("Invalid level %d is specified\n", level);
                 ret = ERROR_INVALID_LEVEL;
         }
     }
@@ -309,7 +308,7 @@
 NET_API_STATUS WINAPI NetWkstaUserGetInfo(LPWSTR reserved, DWORD level,
                                           PBYTE* bufptr)
 {
-    TRACE("(%s, %ld, %p)\n", debugstr_w(reserved), level, bufptr);
+    TRACE("(%s, %d, %p)\n", debugstr_w(reserved), level, bufptr);
     switch (level)
     {
     case 0:
@@ -366,7 +365,7 @@
                                  &PolicyHandle);
         if (NtStatus != STATUS_SUCCESS)
         {
-            ERR("LsaOpenPolicyFailed with NT status %lx\n",
+            TRACE("LsaOpenPolicyFailed with NT status %x\n",
                 LsaNtStatusToWinError(NtStatus));
             NetApiBufferFree(ui0);
             return ERROR_NOT_ENOUGH_MEMORY;
@@ -426,7 +425,7 @@
         break;
     }
     default:
-        ERR("Invalid level %ld is specified\n", level);
+        TRACE("Invalid level %d is specified\n", level);
         return ERROR_INVALID_LEVEL;
     }
     return NERR_Success;
@@ -444,7 +443,7 @@
     if (GetComputerNameW(*Buffer,  &dwSize))
     {
         NetApiBufferReallocate(
-            *Buffer, dwSize * sizeof(WCHAR),
+            *Buffer, (dwSize + 1) * sizeof(WCHAR),
             (LPVOID *) Buffer);
         return NERR_Success;
     }
@@ -475,7 +474,7 @@
 {
     NET_API_STATUS ret;
 
-    TRACE("%s %ld %p\n", debugstr_w( servername ), level, bufptr );
+    TRACE("%s %d %p\n", debugstr_w( servername ), level, bufptr );
     if (servername)
     {
         if (!NETAPI_IsLocalComputer(servername))
@@ -489,7 +488,10 @@
     switch (level)
     {
         case 100:
-        {
+        case 101:
+        case 102:
+        {
+            static const WCHAR lanroot[] = {'c',':','\\','l','a','n','m','a','n',0};  /* FIXME */
             DWORD computerNameLen, domainNameLen, size;
             WCHAR computerName[MAX_COMPUTERNAME_LENGTH + 1];
             LSA_OBJECT_ATTRIBUTES ObjectAttributes;
@@ -512,28 +514,31 @@
                 LsaQueryInformationPolicy(PolicyHandle,
                  PolicyAccountDomainInformation, (PVOID*)&DomainInfo);
                 domainNameLen = lstrlenW(DomainInfo->DomainName.Buffer) + 1;
-                size = sizeof(WKSTA_INFO_100) + computerNameLen * sizeof(WCHAR)
-                 + domainNameLen * sizeof(WCHAR);
+                size = sizeof(WKSTA_INFO_102) + computerNameLen * sizeof(WCHAR)
+                    + domainNameLen * sizeof(WCHAR) + sizeof(lanroot);
                 ret = NetApiBufferAllocate(size, (LPVOID *)bufptr);
                 if (ret == NERR_Success)
                 {
-                    PWKSTA_INFO_100 info = (PWKSTA_INFO_100)*bufptr;
+                    /* INFO_100 and INFO_101 structures are subsets of INFO_102 */
+                    PWKSTA_INFO_102 info = (PWKSTA_INFO_102)*bufptr;
                     OSVERSIONINFOW verInfo;
 
-                    info->wki100_platform_id = PLATFORM_ID_NT;
-                    info->wki100_computername = (LPWSTR)(*bufptr +
-                     sizeof(WKSTA_INFO_100));
-                    memcpy(info->wki100_computername, computerName,
+                    info->wki102_platform_id = PLATFORM_ID_NT;
+                    info->wki102_computername = (LPWSTR)(*bufptr +
+                     sizeof(WKSTA_INFO_102));
+                    memcpy(info->wki102_computername, computerName,
                      computerNameLen * sizeof(WCHAR));
-                    info->wki100_langroup = (LPWSTR)(*bufptr +
-                     sizeof(WKSTA_INFO_100) + computerNameLen * sizeof(WCHAR));
-                    memcpy(info->wki100_langroup, DomainInfo->DomainName.Buffer,
+                    info->wki102_langroup = info->wki102_computername + computerNameLen;
+                    memcpy(info->wki102_langroup, DomainInfo->DomainName.Buffer,
                      domainNameLen * sizeof(WCHAR));
+                    info->wki102_lanroot = info->wki102_langroup + domainNameLen;
+                    memcpy(info->wki102_lanroot, lanroot, sizeof(lanroot));
                     memset(&verInfo, 0, sizeof(verInfo));
                     verInfo.dwOSVersionInfoSize = sizeof(verInfo);
                     GetVersionExW(&verInfo);
-                    info->wki100_ver_major = verInfo.dwMajorVersion;
-                    info->wki100_ver_minor = verInfo.dwMinorVersion;
+                    info->wki102_ver_major = verInfo.dwMajorVersion;
+                    info->wki102_ver_minor = verInfo.dwMinorVersion;
+                    info->wki102_logged_on_users = 1;
                 }
                 LsaFreeMemory(DomainInfo);
                 LsaClose(PolicyHandle);
@@ -542,7 +547,7 @@
         }
 
         default:
-            FIXME("level %ld unimplemented\n", level);
+            FIXME("level %d unimplemented\n", level);
             ret = ERROR_INVALID_LEVEL;
     }
     return ret;




More information about the Ros-diffs mailing list