1 /* Copyright 2001 Mike McCormack
2 * Copyright 2003 Juan Lang
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.
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.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 WINE_DEFAULT_DEBUG_CHANNEL(netapi32
);
25 BOOL WINAPI
DllMain (HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
27 TRACE("%p,%x,%p\n", hinstDLL
, fdwReason
, lpvReserved
);
30 case DLL_PROCESS_ATTACH
:
31 DisableThreadLibraryCalls(hinstDLL
);
35 case DLL_PROCESS_DETACH
:
36 if (lpvReserved
) break;
44 /************************************************************
45 * NetServerEnum (NETAPI32.@)
47 NET_API_STATUS WINAPI
NetServerEnum(
59 FIXME("Stub (%s %d %p %d %p %p %d %s %p)\n", debugstr_w(servername
),
60 level
, bufptr
, prefmaxlen
, entriesread
, totalentries
, servertype
,
61 debugstr_w(domain
), resume_handle
);
63 return ERROR_NO_BROWSER_SERVERS_FOUND
;
66 /************************************************************
67 * NetServerEnumEx (NETAPI32.@)
69 NET_API_STATUS WINAPI
NetServerEnumEx(
78 LMCSTR FirstNameToReturn
)
80 FIXME("Stub (%s %d %p %d %p %p %d %s %s)\n",
81 debugstr_w(ServerName
), Level
, Bufptr
, PrefMaxlen
, EntriesRead
, totalentries
,
82 servertype
, debugstr_w(domain
), debugstr_w(FirstNameToReturn
));
84 return ERROR_NO_BROWSER_SERVERS_FOUND
;
87 /************************************************************
88 * NetServerGetInfo (NETAPI32.@)
90 NET_API_STATUS WINAPI
NetServerGetInfo(LMSTR servername
, DWORD level
, LPBYTE
* bufptr
)
94 TRACE("%s %d %p\n", debugstr_w( servername
), level
, bufptr
);
97 if (!NETAPI_IsLocalComputer(servername
))
99 FIXME("remote computers not supported\n");
100 return ERROR_INVALID_LEVEL
;
103 if (!bufptr
) return ERROR_INVALID_PARAMETER
;
110 DWORD computerNameLen
, size
;
111 WCHAR computerName
[MAX_COMPUTERNAME_LENGTH
+ 1];
113 computerNameLen
= MAX_COMPUTERNAME_LENGTH
+ 1;
114 GetComputerNameW(computerName
, &computerNameLen
);
115 computerNameLen
++; /* include NULL terminator */
117 size
= sizeof(SERVER_INFO_101
) + computerNameLen
* sizeof(WCHAR
);
118 ret
= NetApiBufferAllocate(size
, (LPVOID
*)bufptr
);
119 if (ret
== NERR_Success
)
121 /* INFO_100 structure is a subset of INFO_101 */
122 PSERVER_INFO_101 info
= (PSERVER_INFO_101
)*bufptr
;
123 OSVERSIONINFOW verInfo
;
125 info
->sv101_platform_id
= PLATFORM_ID_NT
;
126 info
->sv101_name
= (LMSTR
)(*bufptr
+ sizeof(SERVER_INFO_101
));
127 memcpy(info
->sv101_name
, computerName
,
128 computerNameLen
* sizeof(WCHAR
));
129 verInfo
.dwOSVersionInfoSize
= sizeof(verInfo
);
130 GetVersionExW(&verInfo
);
131 info
->sv101_version_major
= verInfo
.dwMajorVersion
;
132 info
->sv101_version_minor
= verInfo
.dwMinorVersion
;
133 /* Use generic type as no wine equivalent of DC / Server */
134 info
->sv101_type
= SV_TYPE_NT
;
135 info
->sv101_comment
= NULL
;
141 FIXME("level %d unimplemented\n", level
);
142 ret
= ERROR_INVALID_LEVEL
;
148 /************************************************************
149 * NetStatisticsGet (NETAPI32.@)
151 NET_API_STATUS WINAPI
NetStatisticsGet(LMSTR server
, LMSTR service
,
152 DWORD level
, DWORD options
,
155 TRACE("(%p, %p, %d, %d, %p)\n", server
, service
, level
, options
, bufptr
);
156 return NERR_InternalError
;
161 NetpNtStatusToApiStatus(NTSTATUS Status
)
163 NET_API_STATUS ApiStatus
;
168 ApiStatus
= NERR_Success
;
171 case STATUS_INVALID_ACCOUNT_NAME
:
172 ApiStatus
= NERR_BadUsername
;
175 case STATUS_PASSWORD_RESTRICTION
:
176 ApiStatus
= NERR_PasswordTooShort
;
180 ApiStatus
= RtlNtStatusToDosError(Status
);