home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Encyclopedia 96-1
/
novell-nsepro-1996-1-cd2.iso
/
download
/
netware
/
cnninf.exe
/
CONINFO.C
< prev
next >
Wrap
Text File
|
1995-06-02
|
5KB
|
154 lines
/****************************************************************************
** DISCLAIMER
**
** Novell, Inc. makes no representations or warranties with respect to
** any NetWare software, and specifically disclaims any express or
** implied warranties of merchantability, title, or fitness for a
** particular purpose.
**
** Distribution of any NetWare software is forbidden without the
** express written consent of Novell, Inc. Further, Novell reserves
** the right to discontinue distribution of any NetWare software.
**
** Novell is not responsible for lost profits or revenue, loss of use
** of the software, loss of data, costs of re-creating lost data, the
** cost of any substitute equipment or program, or claims by any party
** other than you. Novell strongly recommends a backup be made before
** any software is installed. Technical support for this software
** may be provided at the discretion of Novell.
****************************************************************************
**
** File: CONINFO.C
**
** Desc: This program will get the connection information i.e.
** User name,
** objectType,
** objectID,
** date and time of login to the server.
**
**
**
** Parameter descriptions: > input
** < output
**
**
** Programmers:
** Ini Who Firm
** ------------------------------------------------------------------
** ARM A. Ray Maxwell Novell Developer Support.
**
** History:
**
** ------------------------------------------------------------------
** 08-08-94 ARM First code.
*/
/***************************************************************************
** Include headers, macros, function prototypes, etc.
*/
/*------------------------------------------------------------------
** ANSI
*/
#include <stdlib.h> /* exit(), atol() */
#include <stdio.h> /* sprintf() */
#include <string.h> /* strcpy() strcmp() */
#include <conio.h> /* clrscr() */
#include <ctype.h> /* toupper() */
/*------------------------------------------------------------------
** NetWare
*/
#include <nwcalls.h>
/*------------------------------------------------------------------
** Defines
*/
#define NWDOS
void main(int argc, char *argv[ ])
{
typedef struct{
BYTE year;
BYTE month;
BYTE day;
BYTE hour;
BYTE minute;
BYTE second;
BYTE dayOfWeek;
}TIMEDATE;
TIMEDATE datebytes;
int i;
NWCONN_HANDLE connHandle;
NWCONN_NUM connNumber;
CONNECT_INFO connInfo;
NWCCODE ccode;
char server[50],
userName[50],
name[50];
NWOBJ_TYPE objectType;
NWOBJ_ID objectID;
BYTE loginTime;
if(argc != 2) {
printf("Usage: CONINFO <servername> \n");
exit(1);
}
strcpy(server, strupr(argv[1]));
ccode = NWCallsInit(NULL, NULL);
if(ccode){
printf("ERROR: NWCallsInit failed %X\n",ccode);
exit(1);
}
ccode = NWGetConnectionHandle(
/* > servername */ server,
/* Novell Reserved1 */ 0,
/* < connection Handle */ &connHandle,
/* Novell Reserved2 */ NULL);
if(ccode){
printf("ERROR: NWGetConnectionHandle failed %X\n",ccode);
exit(1);
}
ccode = NWGetConnectionNumber(
/* > connection Handle */ connHandle,
/* < connection Number */ &connNumber);
if(ccode){
printf("ERROR: NWGetConnectionNumber failed %X\n",ccode);
exit(1);
}
ccode = NWGetConnectionInformation(
/* > connection Handle */ connHandle,
/* > connection number */ connNumber,
/* < pointer to name */ name,
/* < pointer to object type */ &objectType, //optional
/* < pointer to object ID */ &objectID, //optional
/* < pointer to time value */ (BYTE*) &datebytes); //optional
if(ccode){
printf("ERROR: NWGetConnectionInformation failed %X\n",ccode);
exit(1);
}
printf("ServerName %s\nUserName %s\nconnNumber %d\n",server,name,
connNumber);
printf("ObjectType %X\nobjectID %X\n",objectType,objectID);
printf("Login date and time-> %2d/%2d/%2d %2d:%2d:%2d\n",
datebytes.month,
datebytes.day,
datebytes.year,
datebytes.hour,
datebytes.minute,
datebytes.second);
}