Sync to Wine-0_9_3:
[reactos.git] / reactos / lib / netapi32 / wksta.c
index 6dd7c55..425a989 100644 (file)
@@ -23,6 +23,8 @@
 
 #include <stdarg.h>
 #include <stdlib.h>
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
 #include "windef.h"
 #include "winbase.h"
 #include "winsock2.h"
@@ -33,7 +35,6 @@
 #include "lmwksta.h"
 #include "iphlpapi.h"
 #include "winerror.h"
-#include "ntstatus.h"
 #include "winreg.h"
 #include "ntsecapi.h"
 #include "netbios.h"
@@ -52,6 +53,8 @@ BOOL NETAPI_IsLocalComputer(LPCWSTR ServerName)
     {
         return TRUE;
     }
+    else if (ServerName[0] == '\0')
+        return TRUE;
     else
     {
         DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
@@ -135,6 +138,10 @@ static void wprint_name(WCHAR *buffer, int len, ULONG transport,
         *ptr1 = *ptr2;
     *ptr1 = '\0';
 }
+
+/***********************************************************************
+ *                NetWkstaTransportEnum  (NETAPI32.@)
+ */
  
 struct WkstaTransportEnumData
 {
@@ -145,6 +152,8 @@ struct WkstaTransportEnumData
     NET_API_STATUS ret;
 };
 
+/**********************************************************************/
+
 static BOOL WkstaEnumAdaptersCallback(UCHAR totalLANAs, UCHAR lanaIndex,
  ULONG transport, const NetBIOSAdapterImpl *data, void *closure)
 {
@@ -236,6 +245,8 @@ static BOOL WkstaEnumAdaptersCallback(UCHAR totalLANAs, UCHAR lanaIndex,
     return ret;
 }
 
+/**********************************************************************/
+
 NET_API_STATUS WINAPI 
 NetWkstaTransportEnum(LPWSTR ServerName, DWORD level, PBYTE* pbuf,
       DWORD prefmaxlen, LPDWORD read_entries,
@@ -296,9 +307,9 @@ NetWkstaTransportEnum(LPWSTR ServerName, DWORD level, PBYTE* pbuf,
  *                NetWkstaUserGetInfo  (NETAPI32.@)
  */
 NET_API_STATUS WINAPI NetWkstaUserGetInfo(LPWSTR reserved, DWORD level,
-                                          LPBYTE* bufptr)
+                                          PBYTE* bufptr)
 {
-    FIXME("(%s, %ld, %p)\n", debugstr_w(reserved), level, bufptr);
+    TRACE("(%s, %ld, %p)\n", debugstr_w(reserved), level, bufptr);
     switch (level)
     {
     case 0:
@@ -317,11 +328,9 @@ NET_API_STATUS WINAPI NetWkstaUserGetInfo(LPWSTR reserved, DWORD level,
         if (!GetUserNameW(ui->wkui0_username, &dwSize))
         {
             NetApiBufferFree(ui);
-           FIXME("NetWkstaUserGetInfo - ERROR_NOT_ENOUGH_MEMORY\n");
             return ERROR_NOT_ENOUGH_MEMORY;
         }
         else
-           FIXME("NetWkstaUserGetInfo - trying NetApiBufferReallocate\n");
             NetApiBufferReallocate(
                 *bufptr, sizeof(WKSTA_USER_INFO_0) +
                 (lstrlenW(ui->wkui0_username) + 1) * sizeof(WCHAR),
@@ -348,7 +357,6 @@ NET_API_STATUS WINAPI NetWkstaUserGetInfo(LPWSTR reserved, DWORD level,
 
         /* get some information first to estimate size of the buffer */
         ui0 = NULL;
-           FIXME("NetWkstaUserGetInfo - ??NetWkstaUserGetInfo\n");
         NetWkstaUserGetInfo(NULL, 0, (PBYTE *) &ui0);
         username_sz = lstrlenW(ui0->wkui0_username) + 1;
 
@@ -421,7 +429,6 @@ NET_API_STATUS WINAPI NetWkstaUserGetInfo(LPWSTR reserved, DWORD level,
         ERR("Invalid level %ld is specified\n", level);
         return ERROR_INVALID_LEVEL;
     }
-    FIXME("NetWkstaUserGetInfo - ERROR_NOT_ENOUGH_MEMORY\n");
     return NERR_Success;
 }
 
@@ -448,16 +455,34 @@ NET_API_STATUS WINAPI NetpGetComputerName(LPWSTR *Buffer)
     }
 }
 
+NET_API_STATUS WINAPI I_NetNameCompare(LPVOID p1, LPWSTR wkgrp, LPWSTR comp,
+ LPVOID p4, LPVOID p5)
+{
+    FIXME("(%p %s %s %p %p): stub\n", p1, debugstr_w(wkgrp), debugstr_w(comp),
+     p4, p5);
+    return ERROR_INVALID_PARAMETER;
+}
+
+NET_API_STATUS WINAPI I_NetNameValidate(LPVOID p1, LPWSTR wkgrp, LPVOID p3,
+ LPVOID p4)
+{
+    FIXME("(%p %s %p %p): stub\n", p1, debugstr_w(wkgrp), p3, p4);
+    return ERROR_INVALID_PARAMETER;
+}
+
 NET_API_STATUS WINAPI NetWkstaGetInfo( LPWSTR servername, DWORD level,
                                        LPBYTE* bufptr)
 {
     NET_API_STATUS ret;
 
-    TRACE("%p %ld %p\n", debugstr_w( servername ), level, bufptr );
+    TRACE("%s %ld %p\n", debugstr_w( servername ), level, bufptr );
     if (servername)
     {
-        FIXME("remote computers not supported\n");
-        return ERROR_INVALID_LEVEL;
+        if (!NETAPI_IsLocalComputer(servername))
+        {
+            FIXME("remote computers not supported\n");
+            return ERROR_INVALID_LEVEL;
+        }
     }
     if (!bufptr) return ERROR_INVALID_PARAMETER;
 
@@ -522,3 +547,19 @@ NET_API_STATUS WINAPI NetWkstaGetInfo( LPWSTR servername, DWORD level,
     }
     return ret;
 }
+
+/************************************************************
+ *                NetGetJoinInformation (NETAPI32.@)
+ */
+NET_API_STATUS NET_API_FUNCTION NetGetJoinInformation(
+    LPCWSTR Server,
+    LPWSTR *Name,
+    PNETSETUP_JOIN_STATUS type)
+{
+    FIXME("Stub %s %p %p\n", wine_dbgstr_w(Server), Name, type);
+
+    *Name = NULL;
+    *type = NetSetupUnknownStatus;
+
+    return NERR_Success;
+}