Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Сети";
Текущий архив: 2002.04.25;
Скачать: [xml.tar.bz2];

Вниз

Получение информации (кто ? че делал ? время доступа ?) о доступе на свой комп.   Найти похожие ветки 

 
Ghost.   (2002-02-14 10:32) [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.04.25;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.44 MB
Время: 0.008 c
1-80845
konusov
2002-04-13 00:37
2002.04.25
Как изменить дату создания файла?


1-80951
Delfin
2002-04-11 12:35
2002.04.25
как написать не x^2, а x2, где 2 - верхний индекс.


4-81111
Stiky
2002-02-20 21:08
2002.04.25
Помогите с ExtractAssociatedIcon!


14-81048
FLIZ
2002-03-18 19:02
2002.04.25
Подскажите, откуда можно скачать перекодировщик Dos/Win, который сможет обработать файл размером 1Гб


6-81023
Evgeny!
2002-02-13 16:45
2002.04.25
Свой proxy





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский