Ejemplo n.º 1
0
USHORT MNetServerSetInfo (
    const CHAR FAR * pszServer,
    SHORT	     Level,
    const CHAR FAR * pbBuffer,
    USHORT	     cbBuffer,
    USHORT	     wpParmNum ) {

    return(NetServerSetInfo(pszServer, Level, pbBuffer, cbBuffer,
	    wpParmNum));

}
Ejemplo n.º 2
0
APIERR MNetServerSetInfo(
	const TCHAR FAR	 * pszServer,
	UINT		   Level,
	BYTE FAR	 * pbBuffer,
	UINT		   cbBuffer,
	UINT		   ParmNum )
{
    UNREFERENCED( cbBuffer );

    // mapping layer does not do  this right now, since UI never uses it.
    if( ParmNum != PARMNUM_ALL )	
    {
    	return ERROR_NOT_SUPPORTED;
    }

    return (APIERR)NetServerSetInfo( (TCHAR *)pszServer,
    				     Level,
				     pbBuffer,
				     NULL );

}   // MNetServerSetInfo
Ejemplo n.º 3
0
INT
cmdConfig(
    INT argc,
    WCHAR **argv)
{
    INT i, result = 0;
    BOOL bServer = FALSE;
    BOOL bWorkstation = FALSE;
    PWSTR p, endptr;
    BOOL bModify = FALSE;
    LONG lValue;
    PSERVER_INFO_102 ServerInfo = NULL;
    NET_API_STATUS Status;

    for (i = 2; i < argc; i++)
    {
        if (_wcsicmp(argv[i], L"server") == 0)
        {
            if (bWorkstation == FALSE)
                bServer = TRUE;
            continue;
        }

        if (_wcsicmp(argv[i], L"workstation") == 0)
        {
            if (bServer == FALSE)
                bWorkstation = TRUE;
            continue;
        }

        if (_wcsicmp(argv[i], L"help") == 0)
        {
            /* Print short syntax help */
            if (bServer == TRUE)
            {
                PrintMessageString(4381);
                ConPuts(StdOut, L"\n");
                PrintNetMessage(MSG_CONFIG_SERVER_SYNTAX);
            }
            else
            {
                PrintMessageString(4381);
                ConPuts(StdOut, L"\n");
                PrintNetMessage(MSG_CONFIG_SYNTAX);
            }
            return 0;
        }

        if (_wcsicmp(argv[i], L"/help") == 0)
        {
            /* Print full help text*/
            if (bServer == TRUE)
            {
                PrintMessageString(4381);
                ConPuts(StdOut, L"\n");
                PrintNetMessage(MSG_CONFIG_SERVER_SYNTAX);
                PrintNetMessage(MSG_CONFIG_SERVER_HELP);
            }
            else
            {
                PrintMessageString(4381);
                ConPuts(StdOut, L"\n");
                PrintNetMessage(MSG_CONFIG_SYNTAX);
                PrintNetMessage(MSG_CONFIG_HELP);
            }
            return 0;
        }
    }

    if (bServer)
    {
        Status = NetServerGetInfo(NULL, 102, (PBYTE*)&ServerInfo);
        if (Status != NERR_Success)
            goto done;

        for (i = 2; i < argc; i++)
        {
            if (argv[i][0] != L'/')
                continue;

            if (_wcsnicmp(argv[i], L"/autodisconnect:", 16) == 0)
            {
                p = &argv[i][16];
                lValue = wcstol(p, &endptr, 10);
                if (*endptr != 0)
                {
                    PrintMessageStringV(3952, L"/AUTODISCONNECT");
                    result = 1;
                    goto done;
                }

                if (lValue < -1 || lValue > 65535)
                {
                    PrintMessageStringV(3952, L"/AUTODISCONNECT");
                    result = 1;
                    goto done;
                }

                ServerInfo->sv102_disc = lValue;
                bModify = TRUE;
            }
            else if (_wcsnicmp(argv[i], L"/srvcomment:", 12) == 0)
            {
                ServerInfo->sv102_comment = &argv[i][12];
                bModify = TRUE;
            }
            else if (_wcsnicmp(argv[i], L"/hidden:", 8) == 0)
            {
                p = &argv[i][8];
                if (_wcsicmp(p, L"yes") != 0 && _wcsicmp(p, L"no") != 0)
                {
                    PrintMessageStringV(3952, L"/HIDDEN");
                    result = 1;
                    goto done;
                }

                ServerInfo->sv102_hidden = (_wcsicmp(p, L"yes") == 0) ? TRUE : FALSE;
                bModify = TRUE;
            }
            else
            {
                PrintMessageString(4381);
                ConPuts(StdOut, L"\n");
                PrintNetMessage(MSG_CONFIG_SERVER_SYNTAX);
                result = 1;
                goto done;
            }
        }

        if (bModify)
        {
            Status = NetServerSetInfo(NULL, 102, (PBYTE)&ServerInfo, NULL);
            if (Status != NERR_Success)
                result = 1;
        }
        else
        {
            result = DisplayServerConfig(ServerInfo);
        }
    }
    else if (bWorkstation)
    {
        result = DisplayWorkstationConfig();
    }
    else
    {
        PrintMessageString(4378);
        ConPuts(StdOut, L"\n");
        ConPuts(StdOut, L"   Server\n");
        ConPuts(StdOut, L"   Workstation\n");
        ConPuts(StdOut, L"\n");
    }

done:
    if (ServerInfo != NULL)
        NetApiBufferFree(ServerInfo);

    if (result == 0)
        PrintErrorMessage(ERROR_SUCCESS);

    return result;
}