#include #include #include #include #include #include using namespace std; HANDLE hMutex; void startserver(void *lol){ WaitForSingleObject( hMutex, INFINITE ); string b="\"F:\\Program Files (x86)\\namecoind\\namecoind\" "; const char * d = b.c_str(); system(d); ReleaseMutex( hMutex ); } void cbracket() {} string icomma() { } void genconf(){ system("md %APPDATA%\\Roaming\\Namecoin"); fstream config; config.open("%APPDATA%\\Namecoin\\bitcoin.conf",ios::out); config<<"rpcuser=username\nrpcpassword=l0l0l0l0l0l\nrpcport=8336\ndaemon=1"; config.close(); } int main() { hMutex = CreateMutex( NULL, FALSE, NULL ); string a; string b="\"F:\\Program Files (x86)\\namecoind\\namecoind\" "; string c; const char * d = b.c_str(); _beginthread(startserver,0,NULL); cout<<"namecoind instance starting..."; if (WaitForSingleObject( hMutex, 15000 )!=WAIT_TIMEOUT){ cout<<"\nconfig missing. Generating config..."; genconf(); cout<<"ok, \npress any key to quit. restart the program after this"<"; getline(cin,a); if (a=="quit") { system("\"F:\\Program Files (x86)\\namecoind\\namecoind\" stop"); break; } //else if(a=="genconf")genconf(); else { c=b+a; d = c.c_str(); system(d); } } _endthread(); } }