netapi32.c 3.64 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 16
 *
 * 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
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  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 28

HMODULE NETAPI32_hModule = 0;

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 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 55 56 57 58 59 60 61 62 63
NET_API_STATUS  WINAPI NetServerEnum(
  LPCWSTR servername,
  DWORD level,
  LPBYTE* bufptr,
  DWORD prefmaxlen,
  LPDWORD entriesread,
  LPDWORD totalentries,
  DWORD servertype,
  LPCWSTR domain,
  LPDWORD resume_handle
)
{
64 65 66
    FIXME("Stub (%s %ld %p %ld %p %p %ld %s %p)\n", debugstr_w(servername),
     level, bufptr, prefmaxlen, entriesread, totalentries, servertype,
     debugstr_w(domain), resume_handle);
67 68 69

    return ERROR_NO_BROWSER_SERVERS_FOUND;
}
70 71


72 73 74
/************************************************************
 *                NetServerGetInfo  (NETAPI32.@)
 */
75
NET_API_STATUS WINAPI NetServerGetInfo(LMSTR servername, DWORD level, LPBYTE* bufptr)
76 77 78 79 80 81
{
    FIXME("stub (%p, %ld, %p)\n", servername, level, bufptr);
    return ERROR_ACCESS_DENIED;
}


82 83 84
/************************************************************
 *                NetStatisticsGet  (NETAPI32.@)
 */
85
NET_API_STATUS WINAPI NetStatisticsGet(LPWSTR server, LPWSTR service,
86 87 88 89 90 91
                                       DWORD level, DWORD options,
                                       LPBYTE *bufptr)
{
    TRACE("(%p, %p, %ld, %ld, %p)\n", server, service, level, options, bufptr);
    return NERR_InternalError;
}
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136

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;
}