ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

netapi32.c
Go to the documentation of this file.
00001 /* Copyright 2001 Mike McCormack
00002  * Copyright 2003 Juan Lang
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00017  */
00018 
00019 #include "config.h"
00020 
00021 #include "wine/debug.h"
00022 #include "lm.h"
00023 #include "netbios.h"
00024 
00025 WINE_DEFAULT_DEBUG_CHANNEL(netbios);
00026 
00027 static HMODULE NETAPI32_hModule;
00028 
00029 BOOL NETAPI_IsLocalComputer(LMCSTR ServerName);
00030 
00031 BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
00032 {
00033     TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved);
00034 
00035     switch (fdwReason) {
00036         case DLL_PROCESS_ATTACH:
00037         {
00038             DisableThreadLibraryCalls(hinstDLL);
00039             NETAPI32_hModule = hinstDLL;
00040             NetBIOSInit();
00041             NetBTInit();
00042             break;
00043         }
00044         case DLL_PROCESS_DETACH:
00045         {
00046             NetBIOSShutdown();
00047             break;
00048         }
00049     }
00050 
00051     return TRUE;
00052 }
00053 
00054 /************************************************************
00055  *                NetServerEnum (NETAPI32.@)
00056  */
00057 NET_API_STATUS  WINAPI NetServerEnum(
00058   LMCSTR servername,
00059   DWORD level,
00060   LPBYTE* bufptr,
00061   DWORD prefmaxlen,
00062   LPDWORD entriesread,
00063   LPDWORD totalentries,
00064   DWORD servertype,
00065   LMCSTR domain,
00066   LPDWORD resume_handle
00067 )
00068 {
00069     FIXME("Stub (%s %d %p %d %p %p %d %s %p)\n", debugstr_w(servername),
00070      level, bufptr, prefmaxlen, entriesread, totalentries, servertype,
00071      debugstr_w(domain), resume_handle);
00072 
00073     return ERROR_NO_BROWSER_SERVERS_FOUND;
00074 }
00075 
00076 /************************************************************
00077  *                NetServerEnumEx (NETAPI32.@)
00078  */
00079 NET_API_STATUS WINAPI NetServerEnumEx(
00080     LMCSTR ServerName,
00081     DWORD Level,
00082     LPBYTE *Bufptr,
00083     DWORD PrefMaxlen,
00084     LPDWORD EntriesRead,
00085     LPDWORD totalentries,
00086     DWORD servertype,
00087     LMCSTR domain,
00088     LMCSTR FirstNameToReturn)
00089 {
00090     FIXME("Stub (%s %d %p %d %p %p %d %s %p)\n", debugstr_w(ServerName),
00091      Level, Bufptr, PrefMaxlen, EntriesRead, totalentries, servertype,
00092      debugstr_w(domain), debugstr_w(FirstNameToReturn));
00093                                                                                 
00094     return ERROR_NO_BROWSER_SERVERS_FOUND;
00095 }
00096 
00097 /************************************************************
00098  *                NetServerGetInfo  (NETAPI32.@)
00099  */
00100 NET_API_STATUS WINAPI NetServerGetInfo(LMSTR servername, DWORD level, LPBYTE* bufptr)
00101 {
00102     NET_API_STATUS ret;
00103 
00104     TRACE("%s %d %p\n", debugstr_w( servername ), level, bufptr );
00105     if (servername)
00106     {
00107         if (!NETAPI_IsLocalComputer(servername))
00108         {
00109             FIXME("remote computers not supported\n");
00110             return ERROR_INVALID_LEVEL;
00111         }
00112     }
00113     if (!bufptr) return ERROR_INVALID_PARAMETER;
00114 
00115     switch (level)
00116     {
00117         case 100:
00118         case 101:
00119         {
00120             DWORD computerNameLen, size;
00121             WCHAR computerName[MAX_COMPUTERNAME_LENGTH + 1];
00122 
00123             computerNameLen = MAX_COMPUTERNAME_LENGTH + 1;
00124             GetComputerNameW(computerName, &computerNameLen);
00125             computerNameLen++; /* include NULL terminator */
00126 
00127             size = sizeof(SERVER_INFO_101) + computerNameLen * sizeof(WCHAR);
00128             ret = NetApiBufferAllocate(size, (LPVOID *)bufptr);
00129             if (ret == NERR_Success)
00130             {
00131                 /* INFO_100 structure is a subset of INFO_101 */
00132                 PSERVER_INFO_101 info = (PSERVER_INFO_101)*bufptr;
00133                 OSVERSIONINFOW verInfo;
00134 
00135                 info->sv101_platform_id = PLATFORM_ID_NT;
00136                 info->sv101_name = (LMSTR)(*bufptr + sizeof(SERVER_INFO_101));
00137                 memcpy(info->sv101_name, computerName,
00138                        computerNameLen * sizeof(WCHAR));
00139                 verInfo.dwOSVersionInfoSize = sizeof(verInfo);
00140                 GetVersionExW(&verInfo);
00141                 info->sv101_version_major = verInfo.dwMajorVersion;
00142                 info->sv101_version_minor = verInfo.dwMinorVersion;
00143                  /* Use generic type as no wine equivalent of DC / Server */
00144                 info->sv101_type = SV_TYPE_NT;
00145                 info->sv101_comment = NULL;
00146             }
00147             break;
00148         }
00149 
00150         default:
00151             FIXME("level %d unimplemented\n", level);
00152             ret = ERROR_INVALID_LEVEL;
00153     }
00154     return ret;
00155 }
00156 
00157 
00158 /************************************************************
00159  *                NetStatisticsGet  (NETAPI32.@)
00160  */
00161 NET_API_STATUS WINAPI NetStatisticsGet(LMSTR server, LMSTR service,
00162                                        DWORD level, DWORD options,
00163                                        LPBYTE *bufptr)
00164 {
00165     TRACE("(%p, %p, %d, %d, %p)\n", server, service, level, options, bufptr);
00166     return NERR_InternalError;
00167 }
00168 
00169 DWORD WINAPI NetpNetBiosStatusToApiStatus(DWORD nrc)
00170 {
00171     DWORD ret;
00172 
00173     switch (nrc)
00174     {
00175         case NRC_GOODRET:
00176             ret = NO_ERROR;
00177             break;
00178         case NRC_NORES:
00179             ret = NERR_NoNetworkResource;
00180             break;
00181         case NRC_DUPNAME:
00182             ret = NERR_AlreadyExists;
00183             break;
00184         case NRC_NAMTFUL:
00185             ret = NERR_TooManyNames;
00186             break;
00187         case NRC_ACTSES:
00188             ret = NERR_DeleteLater;
00189             break;
00190         case NRC_REMTFUL:
00191             ret = ERROR_REM_NOT_LIST;
00192             break;
00193         case NRC_NOCALL:
00194             ret = NERR_NameNotFound;
00195             break;
00196         case NRC_NOWILD:
00197             ret = ERROR_INVALID_PARAMETER;
00198             break;
00199         case NRC_INUSE:
00200             ret = NERR_DuplicateName;
00201             break;
00202         case NRC_NAMERR:
00203             ret = ERROR_INVALID_PARAMETER;
00204             break;
00205         case NRC_NAMCONF:
00206             ret = NERR_DuplicateName;
00207             break;
00208         default:
00209             ret = NERR_NetworkError;
00210     }
00211     return ret;
00212 }
00213 
00214 NET_API_STATUS WINAPI NetUseEnum(LMSTR server, DWORD level, LPBYTE* bufptr, DWORD prefmaxsize,
00215                           LPDWORD entriesread, LPDWORD totalentries, LPDWORD resumehandle)
00216 {
00217     FIXME("stub (%p, %d, %p, %d, %p, %p, %p)\n", server, level, bufptr, prefmaxsize,
00218            entriesread, totalentries, resumehandle);
00219     return ERROR_NOT_SUPPORTED;
00220 }

Generated on Sun May 27 2012 04:25:27 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.