📄 netinfo.c
字号:
Qstrcat (pqszStrings[i], "Extended Memory (XMS)");
break;
default:
Qstrcat (pqszStrings[i], pszUnknown);
}
/* Set the next pointer */
PrepNextString (pqszStrings, i++);
}
/* Shell OS */
QstrcpyAlign (pqszStrings[i], paszNetworkTitles[NET_NOVELL_SHELL_OS],
wAlignColumn);
if (pNetInfo->wNovellShellOs == 0)
Qstrcat (pqszStrings[i], pszMsDos);
else
Qstrcat (pqszStrings[i], pNetInfo->szNovellShellOs);
/* Set the next pointer */
PrepNextString (pqszStrings, i++);
/* Shell OS Version */
QstrcpyAlign (pqszStrings[i], paszNetworkTitles[NET_NOVELL_SHELL_OS_VER],
wAlignColumn);
Qstrcat (pqszStrings[i], pNetInfo->szNovellShellOsVersion);
/* Set the next pointer */
PrepNextString (pqszStrings, i++);
/* Hardware Type */
QstrcpyAlign (pqszStrings[i], paszNetworkTitles[NET_NOVELL_HDW_TYPE],
wAlignColumn);
Qstrcat (pqszStrings[i], pNetInfo->szNovellHdwType);
/* Set the next pointer */
PrepNextString (pqszStrings, i++);
/* Station number */
QstrcpyAlign (pqszStrings[i], paszNetworkTitles[NET_NOVELL_STATION_NMBR],
wAlignColumn);
sprintf (chBuffer, "%d", pNetInfo->wStationNmbr);
Qstrcat (pqszStrings[i], chBuffer);
/* Set the next pointer */
PrepNextString (pqszStrings, i++);
/* Physical station number */
QstrcpyAlign (pqszStrings[i], paszNetworkTitles[NET_NOVELL_PHYSICAL_NMBR],
wAlignColumn);
sprintf (chBuffer, "%04X:%04X:%04X", pNetInfo->wPhysicalStaNmbr1,
pNetInfo->wPhysicalStaNmbr2, pNetInfo->wPhysicalStaNmbr3);
Qstrcat (pqszStrings[i], chBuffer);
/* Set the next pointer */
PrepNextString (pqszStrings, i++);
/* IPX Installed */
QstrcpyAlign (pqszStrings[i], paszNetworkTitles[NET_NOVELL_IPX],
wAlignColumn);
Qstrcat (pqszStrings[i], (pNetInfo->fIpxInstalled) ? pszYes : pszNo);
/* Set the next pointer */
PrepNextString (pqszStrings, i++);
/* SPX Installed */
QstrcpyAlign (pqszStrings[i], paszNetworkTitles[NET_NOVELL_SPX],
wAlignColumn);
Qstrcat (pqszStrings[i], (pNetInfo->fSpxInstalled) ? pszYes : pszNo);
/* Set the next pointer */
PrepNextString (pqszStrings, i++);
/* ODI/LSL Installed */
QstrcpyAlign (pqszStrings[i], paszNetworkTitles[NET_NOVELL_ODI_LSL],
wAlignColumn);
Qstrcat (pqszStrings[i], (pNetInfo->fOdiLslInstalled) ? pszYes : pszNo);
/* Set the next pointer */
PrepNextString (pqszStrings, i++);
}
}
{
/* LANtastic Information */
if (pNetInfo->wNetworkType == NET_LANTASTIC)
{
/* Server */
QstrcpyAlign (pqszStrings[i], paszNetworkTitles[NET_LANTASTIC_SERVER],
wAlignColumn);
if (pNetInfo->fLANtasticServer)
Qstrcat (pqszStrings[i], pszYes);
else
Qstrcat (pqszStrings[i], pszNo);
/* Set the next pointer */
PrepNextString (pqszStrings, i++);
/* Redir */
QstrcpyAlign (pqszStrings[i], paszNetworkTitles[NET_LANTASTIC_REDIR],
wAlignColumn);
if (pNetInfo->fLANtasticRedir)
Qstrcat (pqszStrings[i], pszYes);
else
Qstrcat (pqszStrings[i], pszNo);
/* Set the next pointer */
PrepNextString (pqszStrings, i++);
/* Server */
QstrcpyAlign (pqszStrings[i], paszNetworkTitles[NET_LANTASTIC_POPUP],
wAlignColumn);
if (pNetInfo->fLANtasticPopUp)
Qstrcat (pqszStrings[i], pszYes);
else
Qstrcat (pqszStrings[i], pszNo);
/* Set the next pointer */
PrepNextString (pqszStrings, i++);
}
}
#if HEAP_DEBUG
HeapCheck ("Before NetBiosStrings");
#endif
/* Add NetBIOS strings */
if (pNetInfo->wNumberOfNets != 0)
NetBiosStrings (pNetInfo, pqszStrings, &i);
#if HEAP_DEBUG
HeapCheck ("After NetBiosStrings");
#endif
/* Additional LANMAN information */
if (pNetInfo->wNetworkType == NET_LANMAN ||
pNetInfo->wNetworkType == NET_LANMAN_BASIC ||
pNetInfo->wNetworkType == NET_LANMAN_ENHANCED ||
pNetInfo->wNetworkType == NET_WORKGROUP_CLIENT)
{
/* Add the list of workstation services */
GetServicesInfo (pqszStrings, &i);
#if HEAP_DEBUG
HeapCheck ("After GetServicesInfo");
#endif
/* Add the PROTOCOL.INI information */
GetProtocolInfo (pNetInfo, pqszStrings, &i);
#if HEAP_DEBUG
HeapCheck ("After GetProtocolInfo");
#endif
if (pNetInfo->wNetworkType != NET_WORKGROUP_CLIENT)
{
/* Add the driver information from LANMAN.INI */
GetLanmanIniDriverInfo (pNetInfo, pqszStrings, &i);
#if HEAP_DEBUG
HeapCheck ("After GetLanmanIniDriverInfo");
#endif
}
}
/* Set the last pointer to NULL */
pqszStrings[i] = NULL;
/* Return the pointer to pqszStrings */
return (pqszStrings);
}
/*********************************************************************
* NetBiosStrings - Adds the NetBIOS strings to pqszStrings.
*
* pNetInfo - Network information structure.
* pqszStrings - String array to add the NetBIOS strings to.
* pI - Pointer to current line counter.
*
* Returns: NULL if an error occured.
*********************************************************************/
VOID NetBiosStrings (NETWORK_STRUCT * pNetInfo,
QSZ * pqszStrings,
INT * pI)
{
CHAR chBuffer[80]; /* Local character buffer */
WORD i, j, n; /* Looping variables */
WORD wIndex = *pI; /* Index to pqszStrings */
WORD wNmbrSessions = 0; /* Count of the number of sessions */
/* Blank line */
pqszStrings[wIndex][0] = '\0';
PrepNextString (pqszStrings, wIndex++);
/* Title line */
Qstrcpy (pqszStrings[wIndex], paszNetworkTitles[NET_LANMAN_NET_CARD]);
PrepNextString (pqszStrings, wIndex++);
for (i = 0; i < pNetInfo->wNumberOfNets; ++i)
{
sprintf (chBuffer, " Net%2.2d ID: %2.2X%2.2X%2.2X%2.2X%2.2X%2.2X",
i + 1,
pNetInfo->ncsNets[i].bUnitID_Number[0],
pNetInfo->ncsNets[i].bUnitID_Number[1],
pNetInfo->ncsNets[i].bUnitID_Number[2],
pNetInfo->ncsNets[i].bUnitID_Number[3],
pNetInfo->ncsNets[i].bUnitID_Number[4],
pNetInfo->ncsNets[i].bUnitID_Number[5]);
Qstrcpy (pqszStrings[wIndex], chBuffer);
PrepNextString (pqszStrings, wIndex++);
sprintf (chBuffer, " Active Sessions for Net%2.2d", i + 1);
Qstrcpy (pqszStrings[wIndex], chBuffer);
PrepNextString (pqszStrings, wIndex++);
/* Indent for the session names */
Qstrcpy (pqszStrings[wIndex], " ");
/* Add the session names */
for (j = 0; j < (WORD) pNetInfo->ncsNets[i].bNumber_Of_Sessions &&
j < NUMBER_OF_SESSIONS; ++j)
{
if (pNetInfo->ncsNets[i].snRemoteSessionNames[j].szSessionName[0] != '*')
{
for (n = 0;
n < 79 &&
pNetInfo->ncsNets[i].snRemoteSessionNames[j].szSessionName[n] > ' '; n++)
chBuffer[n] = pNetInfo->ncsNets[i].snRemoteSessionNames[j].szSessionName[n];
chBuffer[n] = '\0';
/* Is a ", " needed */
if (wNmbrSessions++ > 0)
Qstrcat (pqszStrings[wIndex], pszCommaSpace);
/* Does this session name need to be word wrapped */
if (Qstrlen (pqszStrings[wIndex]) +
strlen (chBuffer) + 2 > REPORT_WIDTH)
{
PrepNextString (pqszStrings, wIndex++);
Qstrcpy (pqszStrings[wIndex], " ");
}
/* Add the session name */
Qstrcat (pqszStrings[wIndex], chBuffer);
}
}
PrepNextString (pqszStrings, wIndex++);
}
*pI = wIndex;
}
/*********************************************************************
* GetServicesInfo calls NetServicEnum and NetServiceGetInfo to
* detect services that may be installed or uninstalled on DOS LANMAN
* enhanced.
*
* LOCAL vars
* err - holds return error of netwkstagetinfo
* ta - contains total available bytes from netwkstagetinfo
* wkstabuf - buffer info for netwkstagetinfo
* wksta0 - stuct mapping to wkstabuf which hold info from
* netwkstagetinfo
*
* Returns: TRUE if an error occured.
*********************************************************************/
BOOL GetServicesInfo (QSZ *pqszStrings, INT *pI)
{
unsigned short int err = 0, en = 0, ta = 0;
char sbuf[BUFSIZ], sinfobuf[BUFSIZ];
struct service_info_0 *service0;
struct service_info_1 *service1;
WORD wIndex = *pI; /* Index to pqszStrings */
/* Clear out the input buffers */
memset (sbuf, '\0', BUFSIZ);
memset (sinfobuf, '\0', BUFSIZ);
/* Blank line */
pqszStrings[wIndex][0] = '\0';
PrepNextString (pqszStrings, wIndex++);
/* Title line */
Qstrcpy (pqszStrings[wIndex], paszNetworkTitles[NET_LANMAN_WKSTA_SVS]);
PrepNextString (pqszStrings, wIndex++);
/* Get list of services loaded */
err = NetServiceEnum (NULL, 0, sbuf, sizeof (sbuf), &en, &ta);
if ((err != 0) || (en == 0))
{
Qstrcpy (pqszStrings[wIndex], " No Services Loaded");
PrepNextString (pqszStrings, wIndex++);
}
if (err != 0)
return (FALSE);
/* loop through all services. See if installed. add to buffer */
for (service0 = (struct service_info_0 *)sbuf; en--; ++service0)
{
/* Clear out the string */
Qmemset (pqszStrings[wIndex], ' ', 21);
pqszStrings[wIndex][21] = '\0';
/* Load the service name */
Qstrncpy (&pqszStrings[wIndex][2], service0->svci0_name,
strlen (service0->svci0_name));
/* See if the service is installed */
err = NetServiceGetInfo (NULL, service0->svci0_name, 1,
sinfobuf, sizeof(sinfobuf), &ta);
service1 = (struct service_info_1 *)sinfobuf;
/* Put in the answer */
if ((service1->svci1_status & SERVICE_INSTALL_STATE) == SERVICE_INSTALLED)
Qstrcat (pqszStrings[wIndex], "Installed");
if ((service1->svci1_status & SERVICE_INSTALL_STATE) == SERVICE_UNINSTALLED)
Qstrcat (pqszStrings[wIndex], "Uninstalled");
if ((service1->svci1_status & SERVICE_INSTALL_STATE) == SERVICE_UNINSTALL_PENDING)
Qstrcat (pqszStrings[wIndex], "Install Pending");
if ((service1->svci1_status & SERVICE_INSTALL_STATE) == SERVICE_INSTALL_PENDING)
Qstrcat (pqszStrings[wIndex], "Uninstall Pending");
PrepNextString (pqszStrings, wIndex++);
}
*pI = wIndex;
return (FALSE);
}
/*********************************************************************
* GetProtocolInfo - Puts PROTOCOL.INI informatione into pqszStrings.
*
* LOCAL:
* fileProtocolIni - file pointer of fopen
* ProtocolPath - holds (lanroot)\protocol.ini
* pBuffer - needed for strstr.
*
* Returns: TRUE if an error occured.
*********************************************************************/
BOOL GetProtocolInfo (NETWORK_STRUCT *pNetInfo, QSZ *pqszStrings, INT *pI)
{
FILE * fileProtocolIni;
CHAR szProtocolPath[_MAX_PATH];
CHAR chBuffer[80];
CHAR *pBuffer = NULL;
CHAR NifPath[_MAX_PATH];
CHAR NifFile[32];
INT i;
WORD wIndex = *pI; /* Index to pqszStrings */
BOOL fProtFound = FALSE; /* TRUE when "[PROT" is found */
/* Blank line */
pqszStrings[wIndex][0] = '\0';
PrepNextString (pqszStrings, wIndex++);
/* Title line */
Qstrcpy (pqszStrings[wIndex], paszNetworkTitles[NET_LANMAN_PROTOCOLS]);
PrepNextString (pqszStrings, wIndex++);
/* Create (lanroot)\protocol.ini path */
strcpy (szProtocolPath, pNetInfo->szLanRoot);
strcat (szProtocolPath, "\\PROTOCOL.INI");
/* OPEN file (lanroot)\protocol.ini */
fileProtocolIni = OpenFile (szProtocolPath, "rb", FALSE);
if (fileProtocolIni == NULL)
return (TRUE);
/* Find the [PROT section */
while (ReadLine (chBuffer, 80, fileProtocolIni, FALSE) != EOF)
{
static PSZ pszProt = "[PROT";
/* Find the [PROTMAN] or [PROTOCOL MANAGER] section */
if (fProtFound == FALSE)
{
if (memicmp (pszProt, chBuffer, 5) == 0)
fProtFound = TRUE;
}
if (fProtFound == TRUE)
{
/* Break out if another section is found */
if (chBuffer[0] == '[' && memicmp (pszProt, chBuffer, 5) != 0)
break;
/* Add the lines in the [PROTMAN] or [PROTOCOL MANAGER] section */
if ((chBuffer[0] != '\r') && (chBuffer[0] != '\n'))
{
Qstrcpy (pqszStrings[wIndex], " ");
Qstrcat (pqszStrings[wIndex], chBuffer);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -