Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2002.12.09;
Скачать: CL | DM;

Вниз

НЭТВОТЧ !   Найти похожие ветки 

 
DemOk ©   (2002-10-14 11:38) [0]

Помогите написать НЕТВОТЧ...
Вопрос: каким образом можно посмотреть кто в данный момент подсоединен к компьютеру (какие файлы открыл).

Стандартные "смотрелки" - не имеют функции поиска (например под НТ4) так что решил написать, а с чего начать низнаю..
ПОМОГИТЕ ПЛИЗ !!


 
Ghost. ©   (2002-10-14 15:40) [1]

Вот это на СИ
#define STRICT
#include
#include
#include
#include

void UserEnum()
{
BOOL keepGoing = TRUE ;
DWORD entriesRead, totalEntries ;
USER_INFO_2 * pInfo = NULL ;
DWORD resumeHandle = 0 ; // must be 0 to start with
char nameBuf[ UNLEN + 1 ] ; // constants defined in LMCONS.H
char commentBuf[ MAXCOMMENTSZ + 1 ] ;
WCHAR serverName[ 100 ] ;
lstrcpyW( serverName, L"\\\\PDC" ) ; //L"" ) ;
while ( keepGoing )
{
NET_API_STATUS ret = NetUserEnum(
serverName, //NULL,
2,
0, //FILTER_NORMAL_ACCOUNT,
(LPBYTE *)&pInfo, // Important: ADDRESS of POINTER
sizeof( USER_INFO_2 ) * 100, // requested buffer size; it may not
actually allocate this much
&entriesRead,
&totalEntries,
&resumeHandle ) ;

keepGoing = ( ret == ERROR_MORE_DATA ) ;

if ( ret == 0 || ret == ERROR_MORE_DATA )
{
DWORD i ;
for ( i = 0 ; i < entriesRead ; i++ )
{
// Note that strings in the INFO structures
// will ALWAYS be Unicode, regardless of
// your settings! Even though they"re declared
// as LPTSTR, they"re always LPWSTR.
// I"m compiling for non-Unicode, so I
// convert them to ANSI strings...
// Check for NULL pointers in the INFO structure
LPWSTR pName = (LPWSTR)pInfo[ i ].usri2_name ;
LPWSTR pComm = (LPWSTR)pInfo[ i ].usri2_comment ;
if ( pName == NULL )
{
lstrcpy( nameBuf, "(no name!)" ) ;
}
else if ( lstrlenW( pName ) == 0 )
{
lstrcpy( nameBuf, "(empty name!)" ) ;
}
else
{
WideCharToMultiByte( CP_ACP, 0,
pName, -1,
nameBuf, UNLEN,
NULL, NULL ) ;
}
if ( pComm == NULL )
{
lstrcpy( commentBuf, "(no comment!)" ) ;
}
else if ( lstrlenW( pComm ) == 0 )
{
lstrcpy( commentBuf, "(empty comment!)" ) ;
}
else
{
WideCharToMultiByte( CP_ACP, 0,
pComm, -1,
commentBuf, MAXCOMMENTSZ,
NULL, NULL ) ;
}
cout << nameBuf << ": " << commentBuf << endl ;
}
}
else
{
cout << "NetUserEnum error " << ret << endl ;
}

if ( pInfo )
{
NetApiBufferFree( pInfo ) ;
pInfo = NULL ;
}
}
}
//****************************************************************************/
/



Страницы: 1 вся ветка

Текущий архив: 2002.12.09;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.014 c
1-28072
alvin
2002-11-28 06:47
2002.12.09
Нажатие клавиш в Word


14-28279
Cr@sh
2002-11-19 14:21
2002.12.09
Подскажите с чего начать...


7-28312
gluka
2002-10-05 01:32
2002.12.09
Service & Desktop


1-28099
Dracula
2002-11-28 11:06
2002.12.09
Формы при разном разрешении


1-27946
Кокандокало
2002-11-29 12:05
2002.12.09
Exceptions и SocketError