removed wizard proj

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@3174 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
driAn
2008-10-21 21:44:08 +00:00
parent 5c3e19d319
commit 9002ae1c8d
4 changed files with 0 additions and 422 deletions
-14
View File
@@ -1,14 +0,0 @@
CXXOPTFLAGS=-O3 -fomit-frame-pointer
INCLUDES=
CXXFLAGS=$(CXXOPTFLAGS) $(INCLUDES) -fsigned-char -Wall -Wno-deprecated
LIBS=
default:
$(CXX) $(CXXFLAGSS) wizard.cpp -o server_wizard $(LIBBS)
clean:
-$(RM) -f $(OBJS) server_wizard
install: default
cp server_wizard ../../../bin_unix/server_wizard
strip ../../../bin_unix/server_wizard
-53
View File
@@ -1,53 +0,0 @@
// minimal windows service installer
class winserviceinstaller
{
private:
LPCSTR name;
LPCSTR displayName;
LPCSTR path;
SC_HANDLE scm;
public:
winserviceinstaller(LPCSTR name, LPCSTR displayName, LPCSTR path) : name(name), displayName(displayName), path(path)
{
}
~winserviceinstaller()
{
CloseManager();
}
bool OpenManger()
{
return ((scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS)) != NULL);
}
void CloseManager()
{
if(scm) CloseServiceHandle(scm);
}
int IsInstalled()
{
if(!scm) return -1;
SC_HANDLE svc = OpenService(scm, name, SC_MANAGER_CONNECT);
bool installed = svc != NULL;
CloseServiceHandle(svc);
return installed ? 1 : 0;
}
int Install()
{
if(!scm) return -1;
SC_HANDLE svc = CreateService(scm, name, displayName, SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL, path, NULL, NULL, NULL, NULL, NULL);
if(svc == NULL) return 0;
else
{
CloseServiceHandle(svc);
return 1;
}
}
};
-170
View File
@@ -1,170 +0,0 @@
// wizard to start an AssaultCube server and storing the configuration
#include <stdio.h>
#include <map>
#include <string>
#include <iostream>
#include <fstream>
using namespace std;
#ifdef WIN32
#pragma warning( disable : 4996 )
#include <windows.h>
#include <direct.h>
#include <tchar.h>
#include "winserviceinstaller.h"
#elif __GNUC__
#include <sys/types.h>
#include <sys/stat.h>
#endif
int main(int argc, char **argv)
{
if(argc < 3)
{
cout << "usage: server_wizard <outfile> <relbinarypath>";
return EXIT_FAILURE;
}
string outfile(argv[1]);
string relpath(argv[2]);
map<string, string> args;
cout << "AssaultCube Server Wizard" << endl << endl;
cout << "You can now specify some optional server settings. The default settings will be used if you decide to leave the fields empty. See README.html for a description of the settings." << endl << endl;
cout << "server description:\t";
getline(cin, args["n"]);
cout << "max clients:\t\t";
getline(cin, args["c"]);
cout << "password:\t\t";
getline(cin, args["p"]);
cout << "admin password:\t\t";
getline(cin, args["x"]);
cout << "message of the day:\t";
getline(cin, args["o"]);
cout << "server port:\t\t";
getline(cin, args["f"]);
cout << "masterserver:\t\t";
getline(cin, args["m"]);
cout << "maprotation file:\t";
getline(cin, args["r"]);
cout << "score threshold:\t";
getline(cin, args["k"]);
cout << "upstream bandwidth:\t";
getline(cin, args["u"]);
cout << "ip:\t\t\t";
getline(cin, args["i"]);
#ifdef WIN32
string wsname, wsdisplayname;
cout << "win service name:\t";
getline(cin, wsname);
if(!wsname.empty())
{
cout << "win service display:\t";
getline(cin, wsdisplayname);
}
#endif
string argstr;
for(map<string, string>::iterator i = args.begin(); i != args.end(); i++)
{
if((*i).second.empty()) continue; // arg value not set
else
{
argstr += " -" + (*i).first;
if((*i).second.find(" ") == string::npos) argstr += (*i).second;
else argstr += '"' + (*i).second + '"'; // escape spaces
}
}
cout << endl << "Writing your configuration to " << outfile << " ... ";
try
{
fstream startupScript(outfile.c_str(), ios::out);
#ifdef WIN32
startupScript << relpath << argstr << endl << "pause" << endl;
#elif __GNUC__
startupScript << "#! /bin/sh" << endl << relpath << argstr << endl;
#endif
startupScript.close();
}
catch(...)
{
cout << "Failed!" << endl;
return EXIT_FAILURE;
}
cout << "Done" << endl << endl;
cout << "Note: You can start " << outfile << " directly the next time you want to use this configuration again." << endl << endl;
#ifdef WIN32
if(!wsname.empty())
{
if(wsdisplayname.empty()) wsdisplayname = wsname;
cout << "Installing the AC Server as windows service ... ";
char path[MAX_PATH];
_getcwd(path, MAX_PATH);
strncat(path, ("\\" + relpath + " -S" + wsname + " " + argstr).c_str(), MAX_PATH);
winserviceinstaller installer(wsname.c_str(), wsdisplayname.c_str(), path);
int r;
if(!installer.OpenManger())
{
cout << "Failed!" << endl;
cout << "Could not open the Service Control Manager: " << GetLastError() << endl;
installer.CloseManager();
return EXIT_FAILURE;
}
if((r = installer.IsInstalled()) != 0)
{
cout << "Failed!" << endl;
if(r == -1) cout << "Error accessing the Service Control Manager" << endl;
else if(r == 1) cout << "A windows service with this name (" << wsname << ")is already installed: " << GetLastError() << endl;
return EXIT_FAILURE;
}
if((r = installer.Install()) != 1)
{
cout << "Failed!" << endl;
if(r == -1) cout << "Error accessing the Service Control Manager" << endl;
else if(r == 0) cout << "Could not create the new windows service: " << GetLastError() << endl;
return EXIT_FAILURE;
}
cout << "Done" << endl << endl;
cout << "Note: You can now manage your AC server using services.msc and sc.exe" << endl << endl;
}
#endif
cout << "Press Enter to start the server now" << endl;
cin.get();
cout << "Starting the AC server ..." << endl;
system((relpath + argstr).c_str());
return EXIT_SUCCESS;
}
-185
View File
@@ -1,185 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="wizard"
ProjectGUID="{CE6FFAA3-DBA7-4D33-9DD0-C46AB4550775}"
RootNamespace="wizard"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="../../../bin_win32/server_wizard.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="../../../bin_win32/server_wizard.exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="..\src\winserviceinstaller.h"
>
</File>
<File
RelativePath="..\src\wizard.cpp"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>