rusgrisli
November 18th, 2005, 03:46 AM
Im from Russia. Help my pls. My system XP SP2, Net, my right - Im Netadmin
Error code 50. Were is misteike
#pragma hdrstop
#include <windows.h>
#include <lmcons.h>
#include <lmserver.h>
#include <lmshare.h>
#include <lmerr.h>
#include <lmremutl.h>
#include <lmapibuf.h>
#include <lmmsg.h>
#include <lmrepl.h>
#include <lmat.h>
#include <lmstats.h>
#include <rassapi.h>
#include <iostream.h>
//-----------------------------------------------
const char *StrError(DWORD err)
{
static char retbuff[1024];
if (err == 0)
strcpy(retbuff, "\n");
else
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, retbuff, 1024, NULL);
if (strlen(retbuff) == 0)
strcpy(retbuff, "\n");
return retbuff;
}
DWORD DoNetStatisticsGet(LPWSTR RemoteName, LPWSTR ServiceName, DWORD Level )
{
NET_API_STATUS netapistatus;
LPBYTE ptb;
printf("NetStatisticsGet(%S) Level %u:\n", ServiceName, Level);
netapistatus = NetStatisticsGet(0, (wchar_t *)ServiceName, Level, 0, &ptb);
if (netapistatus != NERR_Success || ptb == NULL)
{
printf("Error %d getting statistics: %s", netapistatus, "" );
MessageBoxA(0, StrError(netapistatus), "Bad!!!", MB_OK);
} else {
if (wcscmp(ServiceName, L"SERVER") == 0)
{
STAT_SERVER_0 *pstatserver0 = (STAT_SERVER_0 *)ptb;
} else if (wcscmp(ServiceName, L"WORKSTATION") == 0) {
STAT_WORKSTATION_0 *pstatworkstation0 = (STAT_WORKSTATION_0 *)ptb;
}
puts("Not yet implemented");
NetApiBufferFree(ptb);
}
return netapistatus;
}
#pragma argsused
int main(int argc, char* argv[])
{
DoNetStatisticsGet(L"192.168.0.77", L"WORKSTATION", 0);
return 0;
}
Rezult Error code 50. Sir Help my pls.
Error code 50. Were is misteike
#pragma hdrstop
#include <windows.h>
#include <lmcons.h>
#include <lmserver.h>
#include <lmshare.h>
#include <lmerr.h>
#include <lmremutl.h>
#include <lmapibuf.h>
#include <lmmsg.h>
#include <lmrepl.h>
#include <lmat.h>
#include <lmstats.h>
#include <rassapi.h>
#include <iostream.h>
//-----------------------------------------------
const char *StrError(DWORD err)
{
static char retbuff[1024];
if (err == 0)
strcpy(retbuff, "\n");
else
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, retbuff, 1024, NULL);
if (strlen(retbuff) == 0)
strcpy(retbuff, "\n");
return retbuff;
}
DWORD DoNetStatisticsGet(LPWSTR RemoteName, LPWSTR ServiceName, DWORD Level )
{
NET_API_STATUS netapistatus;
LPBYTE ptb;
printf("NetStatisticsGet(%S) Level %u:\n", ServiceName, Level);
netapistatus = NetStatisticsGet(0, (wchar_t *)ServiceName, Level, 0, &ptb);
if (netapistatus != NERR_Success || ptb == NULL)
{
printf("Error %d getting statistics: %s", netapistatus, "" );
MessageBoxA(0, StrError(netapistatus), "Bad!!!", MB_OK);
} else {
if (wcscmp(ServiceName, L"SERVER") == 0)
{
STAT_SERVER_0 *pstatserver0 = (STAT_SERVER_0 *)ptb;
} else if (wcscmp(ServiceName, L"WORKSTATION") == 0) {
STAT_WORKSTATION_0 *pstatworkstation0 = (STAT_WORKSTATION_0 *)ptb;
}
puts("Not yet implemented");
NetApiBufferFree(ptb);
}
return netapistatus;
}
#pragma argsused
int main(int argc, char* argv[])
{
DoNetStatisticsGet(L"192.168.0.77", L"WORKSTATION", 0);
return 0;
}
Rezult Error code 50. Sir Help my pls.