netapi32.c 4.42 KB
Newer Older
1 2
/* Copyright 2001 Mike McCormack
 * Copyright 2003 Juan Lang
3 4 5 6 7 8 9 10 11 12 13 14 15
 *
 * 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
16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 18
 */

19 20
#include "config.h"

21
#include "wine/debug.h"
22
#include "lm.h"
23
#include "netbios.h"
24

25
WINE_DEFAULT_DEBUG_CHANNEL(netbios);
26

27
static HMODULE NETAPI32_hModule;
28

29
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
30
{
31
    TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved);
32 33

    switch (fdwReason) {
34 35
        case DLL_PROCESS_ATTACH:
        {
36
            DisableThreadLibraryCalls(hinstDLL);
37
            NETAPI32_hModule = hinstDLL;
38 39 40 41 42 43 44 45 46
            NetBIOSInit();
            NetBTInit();
            break;
        }
        case DLL_PROCESS_DETACH:
        {
            NetBIOSShutdown();
            break;
        }
47 48 49 50 51
    }

    return TRUE;
}

52 53 54
/************************************************************
 *                NetServerEnum (NETAPI32.@)
 */
55 56 57 58 59 60 61 62 63 64 65 66
NET_API_STATUS  WINAPI NetServerEnum(
  LPCWSTR servername,
  DWORD level,
  LPBYTE* bufptr,
  DWORD prefmaxlen,
  LPDWORD entriesread,
  LPDWORD totalentries,
  DWORD servertype,
  LPCWSTR domain,
  LPDWORD resume_handle
)
{
67
    FIXME("Stub (%s %d %p %d %p %p %d %s %p)\n", debugstr_w(servername),
68 69
     level, bufptr, prefmaxlen, entriesread, totalentries, servertype,
     debugstr_w(domain), resume_handle);
70 71 72

    return ERROR_NO_BROWSER_SERVERS_FOUND;
}
73

74 75 76 77 78 79 80 81 82 83 84 85 86 87
/************************************************************
 *                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)
{
88
    FIXME("Stub (%s %d %p %d %p %p %d %s %p)\n", debugstr_w(ServerName),
89 90 91 92 93
     Level, Bufptr, PrefMaxlen, EntriesRead, totalentries, servertype,
     debugstr_w(domain), debugstr_w(FirstNameToReturn));
                                                                                
    return ERROR_NO_BROWSER_SERVERS_FOUND;
}
94

95 96 97
/************************************************************
 *                NetServerGetInfo  (NETAPI32.@)
 */
98
NET_API_STATUS WINAPI NetServerGetInfo(LMSTR servername, DWORD level, LPBYTE* bufptr)
99
{
100
    FIXME("stub (%p, %d, %p)\n", servername, level, bufptr);
101 102 103 104
    return ERROR_ACCESS_DENIED;
}


105 106 107
/************************************************************
 *                NetStatisticsGet  (NETAPI32.@)
 */
108
NET_API_STATUS WINAPI NetStatisticsGet(LPWSTR server, LPWSTR service,
109 110 111
                                       DWORD level, DWORD options,
                                       LPBYTE *bufptr)
{
112
    TRACE("(%p, %p, %d, %d, %p)\n", server, service, level, options, bufptr);
113 114
    return NERR_InternalError;
}
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159

DWORD WINAPI NetpNetBiosStatusToApiStatus(DWORD nrc)
{
    DWORD ret;

    switch (nrc)
    {
        case NRC_GOODRET:
            ret = NO_ERROR;
            break;
        case NRC_NORES:
            ret = NERR_NoNetworkResource;
            break;
        case NRC_DUPNAME:
            ret = NERR_AlreadyExists;
            break;
        case NRC_NAMTFUL:
            ret = NERR_TooManyNames;
            break;
        case NRC_ACTSES:
            ret = NERR_DeleteLater;
            break;
        case NRC_REMTFUL:
            ret = ERROR_REM_NOT_LIST;
            break;
        case NRC_NOCALL:
            ret = NERR_NameNotFound;
            break;
        case NRC_NOWILD:
            ret = ERROR_INVALID_PARAMETER;
            break;
        case NRC_INUSE:
            ret = NERR_DuplicateName;
            break;
        case NRC_NAMERR:
            ret = ERROR_INVALID_PARAMETER;
            break;
        case NRC_NAMCONF:
            ret = NERR_DuplicateName;
            break;
        default:
            ret = NERR_NetworkError;
    }
    return ret;
}