I can't figure out how to get this program to work. It compiles fine. It doesn't work at school or on my friends Lan at his house. The purpose of the program is to send anonymous net send messages but the functions don't seem to be doing anything and nothing happens when I run the program (stuff happens, but there is no result). I've read everything about the functions at the MSDN thing, but I don't know what I'm doing wrong. I've even tried manually registering the alias's with the system() function in replace of the NetMessageNameAdd() function. Here is the code (to compile it you have to link it with the netapi32 library):
Code:
#include <iostream>
#include <cstring>
#include <windows.h>
#include <Lm.h>
using namespace std;
int main()
{
char fromName[20];
char computerName[20];
char message[100];
char fake[30];
char completeCommand[140];
int num;
cout<<"Welcome, you are about to have the best fun of"
<<"\nyour typing career at the expense of someone else!"<<endl;
cout<<"Please enter the name of the computer you want to spam: ";
cin.getline(computerName, 20);
char* compConst = computerName;
cout<<"Please enter the message you wish to spam with (must be below 100 chars): ";
cin.getline(message, 100);
cout<<"Please enter the assumed name: ";
cin.getline(fake, 30);
char* nameConst = fake;
cout<<"Please enter the number of messages you wish to send to that alias: ";
cin>>num;
int msg = strlen(message);
NetMessageNameAdd(NULL, LPCWSTR("RECTOR"));
for(int i = 0; i<num; i++){
NetMessageBufferSend(NULL,(LPCWSTR)compConst, (LPCWSTR)nameConst, (BYTE*)message, msg*2);}
cout<<"Done."<<endl;
system("PAUSE");
return 0;
}
Any help possible would be greatly appreciated.