Sync to Wine-0_9_3:
[reactos.git] / reactos / lib / netapi32 / netapi32.c
1 /* Copyright 2001 Mike McCormack
2 * Copyright 2003 Juan Lang
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19 #include "config.h"
20
21 #include "wine/debug.h"
22 #include "lm.h"
23 #include "netbios.h"
24
25 WINE_DEFAULT_DEBUG_CHANNEL(netbios);
26
27 HMODULE NETAPI32_hModule = 0;
28
29 BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
30 {
31 TRACE("%p,%lx,%p\n", hinstDLL, fdwReason, lpvReserved);
32
33 switch (fdwReason) {
34 case DLL_PROCESS_ATTACH:
35 {
36 DisableThreadLibraryCalls(hinstDLL);
37 NETAPI32_hModule = hinstDLL;
38 NetBIOSInit();
39 NetBTInit();
40 break;
41 }
42 case DLL_PROCESS_DETACH:
43 {
44 NetBIOSShutdown();
45 break;
46 }
47 }
48
49 return TRUE;
50 }
51
52 NET_API_STATUS WINAPI NetServerEnum(
53 LPCWSTR servername,
54 DWORD level,
55 LPBYTE* bufptr,
56 DWORD prefmaxlen,
57 LPDWORD entriesread,
58 LPDWORD totalentries,
59 DWORD servertype,
60 LPCWSTR domain,
61 LPDWORD resume_handle
62 )
63 {
64 FIXME("Stub (%s %ld %p %ld %p %p %ld %s %p)\n", debugstr_w(servername),
65 level, bufptr, prefmaxlen, entriesread, totalentries, servertype,
66 debugstr_w(domain), resume_handle);
67
68 return ERROR_NO_BROWSER_SERVERS_FOUND;
69 }
70
71
72 /************************************************************
73 * NetServerGetInfo (NETAPI32.@)
74 */
75 NET_API_STATUS WINAPI NetServerGetInfo(LMSTR servername, DWORD level, LPBYTE* bufptr)
76 {
77 FIXME("stub (%p, %ld, %p)\n", servername, level, bufptr);
78 return ERROR_ACCESS_DENIED;
79 }
80
81
82 /************************************************************
83 * NetStatisticsGet (NETAPI32.@)
84 */
85 NET_API_STATUS WINAPI NetStatisticsGet(LPWSTR server, LPWSTR service,
86 DWORD level, DWORD options,
87 LPBYTE *bufptr)
88 {
89 TRACE("(%p, %p, %ld, %ld, %p)\n", server, service, level, options, bufptr);
90 return NERR_InternalError;
91 }
92
93 DWORD WINAPI NetpNetBiosStatusToApiStatus(DWORD nrc)
94 {
95 DWORD ret;
96
97 switch (nrc)
98 {
99 case NRC_GOODRET:
100 ret = NO_ERROR;
101 break;
102 case NRC_NORES:
103 ret = NERR_NoNetworkResource;
104 break;
105 case NRC_DUPNAME:
106 ret = NERR_AlreadyExists;
107 break;
108 case NRC_NAMTFUL:
109 ret = NERR_TooManyNames;
110 break;
111 case NRC_ACTSES:
112 ret = NERR_DeleteLater;
113 break;
114 case NRC_REMTFUL:
115 ret = ERROR_REM_NOT_LIST;
116 break;
117 case NRC_NOCALL:
118 ret = NERR_NameNotFound;
119 break;
120 case NRC_NOWILD:
121 ret = ERROR_INVALID_PARAMETER;
122 break;
123 case NRC_INUSE:
124 ret = NERR_DuplicateName;
125 break;
126 case NRC_NAMERR:
127 ret = ERROR_INVALID_PARAMETER;
128 break;
129 case NRC_NAMCONF:
130 ret = NERR_DuplicateName;
131 break;
132 default:
133 ret = NERR_NetworkError;
134 }
135 return ret;
136 }