Permalink
Browse files

Merge pull request #320 from ChrisTX/insp20+cleanupwin

Windows: In-depth cleanup (see details)
  • Loading branch information...
2 parents e496d32 + 5b96822 commit c05ad37bfd03486475889485606ed5cffc7bf5a2 @Adam- Adam- committed Oct 12, 2012
Showing with 533 additions and 1,287 deletions.
  1. +25 −0 .gitignore
  2. +0 −4 include/bancache.h
  3. +2 −2 include/base.h
  4. +1 −1 include/configparser.h
  5. +0 −4 include/dns.h
  6. +6 −0 include/dynamic.h
  7. +4 −14 include/hash_map.h
  8. +1 −1 include/hashcomp.h
  9. +14 −6 include/inspircd.h
  10. +1 −1 include/modules.h
  11. +1 −1 include/socket.h
  12. +0 −4 include/threadengine.h
  13. +4 −1 include/threadengines/threadengine_win32.h
  14. +5 −10 include/typedefs.h
  15. +1 −1 include/users.h
  16. +30 −4 src/commands/cmd_stats.cpp
  17. +35 −5 src/configreader.cpp
  18. +1 −1 src/dns.cpp
  19. +23 −1 src/dynamic.cpp
  20. +5 −12 src/hashcomp.cpp
  21. +17 −0 src/helperfuncs.cpp
  22. +56 −51 src/inspircd.cpp
  23. +1 −1 src/modmanager_dynamic.cpp
  24. +2 −2 src/modules.cpp
  25. +1 −1 src/modules/extra/m_geoip.cpp
  26. +1 −1 src/modules/extra/m_ldapauth.cpp
  27. +1 −1 src/modules/extra/m_ldapoper.cpp
  28. +1 −1 src/modules/extra/m_mysql.cpp
  29. +1 −1 src/modules/extra/m_regex_pcre.cpp
  30. +1 −1 src/modules/extra/m_sqlite3.cpp
  31. +1 −1 src/modules/extra/m_ssl_gnutls.cpp
  32. +1 −1 src/modules/extra/m_ssl_openssl.cpp
  33. +1 −1 src/modules/m_spanningtree/main.cpp
  34. +2 −2 src/modules/m_spanningtree/resolvers.cpp
  35. +1 −1 src/modules/m_spanningtree/utils.cpp
  36. +3 −7 src/modules/m_spanningtree/utils.h
  37. +2 −5 src/modules/m_watch.cpp
  38. +1 −1 src/modules/ssl.h
  39. +5 −3 src/server.cpp
  40. +6 −6 src/socketengine.cpp
  41. +1 −1 src/socketengines/socketengine_poll.cpp
  42. +2 −2 src/socketengines/socketengine_select.cpp
  43. +10 −1 src/threadengines/threadengine_win32.cpp
  44. +1 −3 win/{colours.h → colors.h}
  45. +64 −129 win/configure.cpp
  46. +28 −23 win/configure.vcxproj
  47. +47 −47 win/inspircd.vcxproj
  48. +2 −2 win/inspircd_memory_functions.cpp
  49. +0 −196 win/inspircd_namedpipe.cpp
  50. +0 −55 win/inspircd_namedpipe.h
  51. +13 −496 win/inspircd_win32wrapper.cpp
  52. +49 −122 win/inspircd_win32wrapper.h
  53. +28 −30 win/m_spanningtree.vcxproj
  54. +0 −3 win/rebase.bat
  55. +24 −16 win/win32service.cpp
View
25 .gitignore
@@ -9,6 +9,7 @@
/inspircd
/org.inspircd.plist
/run
+/bin
/include/inspircd_config.h
/include/inspircd_version.h
@@ -26,3 +27,27 @@
/src/modules/m_sqlite3.cpp
/src/modules/m_ssl_gnutls.cpp
/src/modules/m_ssl_openssl.cpp
+
+*.ilk
+*.lib
+*.pdb
+*.exp
+*.dll
+*.exe
+/src/commands/debug
+/src/commands/release
+/src/commands/debug_x64
+/src/commands/release_x64
+/src/commands/commands.mak
+/src/modules/debug
+/src/modules/release
+/src/modules/debug_x64
+/src/modules/release_x64
+/src/modules/modules.mak
+/win/x64*
+/win/debug*
+/win/release*
+/win/*.suo
+/win/*.sdf
+/win/*.user
+/win/*.opensdf
View
4 include/bancache.h
@@ -65,11 +65,7 @@ class CoreExport BanCacheHit
/* A container of ban cache items.
* must be defined after class BanCacheHit.
*/
-#if defined(WINDOWS) && !defined(HASHMAP_DEPRECATED)
-typedef nspace::hash_map<std::string, BanCacheHit*, nspace::hash_compare<std::string, std::less<std::string> > > BanCacheHash;
-#else
typedef nspace::hash_map<std::string, BanCacheHit*, nspace::hash<std::string> > BanCacheHash;
-#endif
/** A manager for ban cache, which allocates and deallocates and checks cached bans.
*/
View
4 include/base.h
@@ -157,15 +157,15 @@ class CoreExport reference
return *this;
}
- inline operator bool() const { return value; }
+ inline operator bool() const { return (value != NULL); }
inline operator T*() const { return value; }
inline T* operator->() const { return value; }
inline T& operator*() const { return *value; }
inline bool operator<(const reference<T>& other) const { return value < other.value; }
inline bool operator>(const reference<T>& other) const { return value > other.value; }
static inline void* operator new(size_t, void* m) { return m; }
private:
-#ifndef WIN32
+#ifndef _WIN32
static void* operator new(size_t);
static void operator delete(void*);
#endif
View
2 include/configparser.h
@@ -63,7 +63,7 @@ struct FileWrapper
FILE* const f;
bool close_with_pclose;
FileWrapper(FILE* file, bool use_pclose = false) : f(file), close_with_pclose(use_pclose) {}
- operator bool() { return f; }
+ operator bool() { return (f != NULL); }
operator FILE*() { return f; }
~FileWrapper()
{
View
4 include/dns.h
@@ -102,11 +102,7 @@ class CoreExport CachedQuery
/** DNS cache information. Holds IPs mapped to hostnames, and hostnames mapped to IPs.
*/
-#if defined(WINDOWS) && !defined(HASHMAP_DEPRECATED)
-typedef nspace::hash_map<irc::string, CachedQuery, nspace::hash_compare<irc::string> > dnscache;
-#else
typedef nspace::hash_map<irc::string, CachedQuery, irc::hash> dnscache;
-#endif
/**
* Error types that class Resolver can emit to its error method.
View
6 include/dynamic.h
@@ -33,6 +33,12 @@ class CoreExport DLLManager : public classbase
*/
std::string err;
+#ifdef _WIN32
+ /** Sets the last error string
+ */
+ void RetrieveLastError();
+#endif
+
public:
/** This constructor loads the module using dlopen()
* @param fname The filename to load. This should be within
View
18 include/hash_map.h
@@ -28,7 +28,7 @@
/** Where hash_map is varies from compiler to compiler
* as it is not standard unless we have tr1.
*/
- #ifndef WIN32
+ #ifndef _WIN32
#ifdef HASHMAP_DEPRECATED
// GCC4+ has deprecated hash_map and uses tr1. But of course, uses a different include to MSVC. FOR FUCKS SAKE.
#include <tr1/unordered_map>
@@ -41,19 +41,9 @@
#define END_HASHMAP_NAMESPACE }
#endif
#else
- #if _MSC_VER >= 1600
- // New MSVC has tr1. Just to make things fucked up, though, MSVC and GCC use different includes! FFS.
- #include <unordered_map>
- #define HAS_TR1_UNORDERED
- #define HASHMAP_DEPRECATED
- #else
- /** Oddball windows namespace for hash_map */
- #include <hash_map>
- #define nspace stdext
- using stdext::hash_map;
- #define BEGIN_HASHMAP_NAMESPACE namespace nspace {
- #define END_HASHMAP_NAMESPACE }
- #endif
+ #include <unordered_map>
+ #define HAS_TR1_UNORDERED
+ #define HASHMAP_DEPRECATED
#endif
// tr1: restoring sanity to our headers. now if only compiler vendors could agree on a FUCKING INCLUDE FILE.
View
2 include/hashcomp.h
@@ -598,7 +598,7 @@ BEGIN_HASHMAP_NAMESPACE
/** Hashing function to hash irc::string
*/
-#if defined(WINDOWS) && !defined(HAS_TR1_UNORDERED)
+#if defined(_WIN32) && !defined(HAS_TR1_UNORDERED)
template<> class CoreExport hash_compare<irc::string, std::less<irc::string> >
{
public:
View
20 include/inspircd.h
@@ -31,7 +31,7 @@
#define _LARGEFILE_SOURCE
#endif
-#ifndef WIN32
+#ifndef _WIN32
#define DllExport
#define CoreExport
#define printf_c printf
@@ -55,7 +55,7 @@
#include <cstring>
#include <climits>
#include <cstdio>
-#ifndef WIN32
+#ifndef _WIN32
#include <unistd.h>
#endif
@@ -232,12 +232,24 @@ class serverstats
/** Total bytes of data received
*/
unsigned long statsRecv;
+#ifdef _WIN32
+ /** Cpu usage at last sample
+ */
+ FILETIME LastCPU;
+ /** Time QP sample was read
+ */
+ LARGE_INTEGER LastSampled;
+ /** QP frequency
+ */
+ LARGE_INTEGER QPFrequency;
+#else
/** Cpu usage at last sample
*/
timeval LastCPU;
/** Time last sample was read
*/
timespec LastSampled;
+#endif
/** The constructor initializes all the counts to zero
*/
serverstats()
@@ -308,10 +320,6 @@ class CoreExport InspIRCd
*/
char ReadBuffer[65535];
-#ifdef WIN32
- IPC* WindowsIPC;
-#endif
-
public:
/** Global cull list, will be processed on next iteration
View
2 include/modules.h
@@ -1696,7 +1696,7 @@ struct AllModuleList {
* and functions needed to make a module loadable by the OS.
* It defines the class factory and external init_module function.
*/
-#ifdef WINDOWS
+#ifdef _WIN32
#define MODULE_INIT(y) \
extern "C" DllExport Module * MODULE_INIT_SYM() \
View
2 include/socket.h
@@ -25,7 +25,7 @@
#ifndef INSPIRCD_SOCKET_H
#define INSPIRCD_SOCKET_H
-#ifndef WIN32
+#ifndef _WIN32
#include <arpa/inet.h>
#include <sys/time.h>
View
4 include/threadengine.h
@@ -27,10 +27,6 @@
#include "inspircd_config.h"
#include "base.h"
-#ifdef WINDOWS
-#include "threadengines/threadengine_win32.h"
-#endif
-
class ThreadData;
/** Derive from this class to implement your own threaded sections of
View
5 include/threadengines/threadengine_win32.h
@@ -108,12 +108,15 @@ class ThreadQueueData
public:
ThreadQueueData()
{
- InitializeCriticalSection(&mutex);
event = CreateEvent(NULL, false, false, NULL);
+ if (event == NULL)
+ throw CoreException("CreateEvent() failed in ThreadQueueData::ThreadQueueData()!");
+ InitializeCriticalSection(&mutex);
}
~ThreadQueueData()
{
+ CloseHandle(event);
DeleteCriticalSection(&mutex);
}
View
15 include/typedefs.h
@@ -56,17 +56,12 @@ struct ResourceRecord;
#include "hashcomp.h"
#include "base.h"
-#if defined(WINDOWS) && !defined(HASHMAP_DEPRECATED)
- typedef nspace::hash_map<std::string, User*, nspace::hash_compare<std::string, std::less<std::string> > > user_hash;
- typedef nspace::hash_map<std::string, Channel*, nspace::hash_compare<std::string, std::less<std::string> > > chan_hash;
+#ifdef HASHMAP_DEPRECATED
+ typedef nspace::hash_map<std::string, User*, nspace::insensitive, irc::StrHashComp> user_hash;
+ typedef nspace::hash_map<std::string, Channel*, nspace::insensitive, irc::StrHashComp> chan_hash;
#else
- #ifdef HASHMAP_DEPRECATED
- typedef nspace::hash_map<std::string, User*, nspace::insensitive, irc::StrHashComp> user_hash;
- typedef nspace::hash_map<std::string, Channel*, nspace::insensitive, irc::StrHashComp> chan_hash;
- #else
- typedef nspace::hash_map<std::string, User*, nspace::hash<std::string>, irc::StrHashComp> user_hash;
- typedef nspace::hash_map<std::string, Channel*, nspace::hash<std::string>, irc::StrHashComp> chan_hash;
- #endif
+ typedef nspace::hash_map<std::string, User*, nspace::hash<std::string>, irc::StrHashComp> user_hash;
+ typedef nspace::hash_map<std::string, Channel*, nspace::hash<std::string>, irc::StrHashComp> chan_hash;
#endif
/** A list of failed port bindings, used for informational purposes on startup */
View
2 include/users.h
@@ -60,7 +60,7 @@ enum UserModes {
*/
enum RegistrationState {
-#ifndef WIN32 // Burlex: This is already defined in win32, luckily it is still 0.
+#ifndef _WIN32 // Burlex: This is already defined in win32, luckily it is still 0.
REG_NONE = 0, /* Has sent nothing */
#endif
View
34 src/commands/cmd_stats.cpp
@@ -23,8 +23,9 @@
#include "xline.h"
#include "commands/cmd_whowas.h"
-#ifdef WINDOWS
-# pragma comment(lib, "psapi.lib") // For GetProcessMemoryInfo()
+#ifdef _WIN32
+#include <psapi.h>
+#pragma comment(lib, "psapi.lib") // For GetProcessMemoryInfo()
#endif
/** Handle /STATS. These command handlers can be reloaded by the core,
@@ -240,7 +241,7 @@ void CommandStats::DoStats(char statschar, User* user, string_list &results)
results.push_back(sn+" 249 "+user->nick+" :Bandwidth out: "+ConvToStr(kbitpersec_out_s)+" kilobits/sec");
results.push_back(sn+" 249 "+user->nick+" :Bandwidth in: "+ConvToStr(kbitpersec_in_s)+" kilobits/sec");
-#ifndef WIN32
+#ifndef _WIN32
/* Moved this down here so all the not-windows stuff (look w00tie, I didn't say win32!) is in one ifndef.
* Also cuts out some identical code in both branches of the ifndef. -- Om
*/
@@ -278,7 +279,32 @@ void CommandStats::DoStats(char statschar, User* user, string_list &results)
results.push_back(sn+" 249 "+user->nick+" :Total allocation: "+ConvToStr((MemCounters.WorkingSetSize + MemCounters.PagefileUsage) / 1024)+"K");
results.push_back(sn+" 249 "+user->nick+" :Pagefile usage: "+ConvToStr(MemCounters.PagefileUsage / 1024)+"K");
results.push_back(sn+" 249 "+user->nick+" :Page faults: "+ConvToStr(MemCounters.PageFaultCount));
- results.push_back(sn+" 249 "+user->nick+" :CPU Usage: " + ConvToStr(getcpu()) + "%");
+ }
+
+ FILETIME CreationTime;
+ FILETIME ExitTime;
+ FILETIME KernelTime;
+ FILETIME UserTime;
+ LARGE_INTEGER ThisSample;
+ if(GetProcessTimes(GetCurrentProcess(), &CreationTime, &ExitTime, &KernelTime, &UserTime) &&
+ QueryPerformanceCounter(&ThisSample))
+ {
+ KernelTime.dwHighDateTime += UserTime.dwHighDateTime;
+ KernelTime.dwLowDateTime += UserTime.dwLowDateTime;
+ double n_eaten = (double)( ( (uint64_t)(KernelTime.dwHighDateTime - ServerInstance->stats->LastCPU.dwHighDateTime) << 32 ) + (uint64_t)(KernelTime.dwLowDateTime - ServerInstance->stats->LastCPU.dwLowDateTime) )/100000;
+ double n_elapsed = (double)(ThisSample.QuadPart - ServerInstance->stats->LastSampled.QuadPart) / ServerInstance->stats->QPFrequency.QuadPart;
+ double per = (n_eaten/n_elapsed);
+
+ char percent[30];
+
+ snprintf(percent, 30, "%03.5f%%", per);
+ results.push_back(sn+" 249 "+user->nick+" :CPU Use (now): "+percent);
+
+ n_elapsed = ServerInstance->Time() - ServerInstance->startup_time;
+ n_eaten = (double)(( (uint64_t)(KernelTime.dwHighDateTime) << 32 ) + (uint64_t)(KernelTime.dwLowDateTime))/100000;
+ per = (n_eaten / n_elapsed);
+ snprintf(percent, 30, "%03.5f%%", per);
+ results.push_back(sn+" 249 "+user->nick+" :CPU Use (total): "+percent);
}
#endif
}
View
40 src/configreader.cpp
@@ -28,6 +28,10 @@
#include "exitcodes.h"
#include "commands/cmd_whowas.h"
#include "configparser.h"
+#ifdef _WIN32
+#include <Iphlpapi.h>
+#pragma comment(lib, "Iphlpapi.lib")
+#endif
ServerConfig::ServerConfig()
{
@@ -140,15 +144,41 @@ bool ServerConfig::ApplyDisabledCommands(const std::string& data)
return true;
}
-#ifdef WINDOWS
-// Note: the windows validator is in win32wrapper.cpp
-void FindDNS(std::string& server);
-#else
static void FindDNS(std::string& server)
{
if (!server.empty())
return;
+#ifdef _WIN32
+ // attempt to look up their nameserver from the system
+ ServerInstance->Logs->Log("CONFIG",DEFAULT,"WARNING: <dns:server> not defined, attempting to find a working server in the system settings...");
+
+ PFIXED_INFO pFixedInfo;
+ DWORD dwBufferSize = sizeof(FIXED_INFO);
+ pFixedInfo = (PFIXED_INFO) HeapAlloc(GetProcessHeap(), 0, sizeof(FIXED_INFO));
+
+ if(pFixedInfo)
+ {
+ if (GetNetworkParams(pFixedInfo, &dwBufferSize) == ERROR_BUFFER_OVERFLOW) {
+ HeapFree(GetProcessHeap(), 0, pFixedInfo);
+ pFixedInfo = (PFIXED_INFO) HeapAlloc(GetProcessHeap(), 0, dwBufferSize);
+ }
+
+ if(pFixedInfo) {
+ if (GetNetworkParams(pFixedInfo, &dwBufferSize) == NO_ERROR)
+ server = pFixedInfo->DnsServerList.IpAddress.String;
+
+ HeapFree(GetProcessHeap(), 0, pFixedInfo);
+ }
+
+ if(!server.empty())
+ {
+ ServerInstance->Logs->Log("CONFIG",DEFAULT,"<dns:server> set to '%s' as first active resolver in the system settings.", server.c_str());
+ return;
+ }
+ }
+ ServerInstance->Logs->Log("CONFIG",DEFAULT,"No viable nameserver found! Defaulting to nameserver '127.0.0.1'!");
+#else
// attempt to look up their nameserver from /etc/resolv.conf
ServerInstance->Logs->Log("CONFIG",DEFAULT,"WARNING: <dns:server> not defined, attempting to find working server in /etc/resolv.conf...");
@@ -168,9 +198,9 @@ static void FindDNS(std::string& server)
}
ServerInstance->Logs->Log("CONFIG",DEFAULT,"/etc/resolv.conf contains no viable nameserver entries! Defaulting to nameserver '127.0.0.1'!");
+#endif
server = "127.0.0.1";
}
-#endif
static void ReadXLine(ServerConfig* conf, const std::string& tag, const std::string& key, XLineFactory* make)
{
View
2 src/dns.cpp
@@ -34,7 +34,7 @@ Please do not assume that firedns works like this,
looks like this, walks like this or tastes like this.
*/
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/types.h>
#include <sys/socket.h>
#include <errno.h>
View
24 src/dynamic.cpp
@@ -23,8 +23,12 @@
#include "inspircd.h"
#include "dynamic.h"
-#ifndef WIN32
+#ifndef _WIN32
#include <dlfcn.h>
+#else
+#define dlopen(path, state) (void*)LoadLibraryA(path)
+#define dlsym(handle, export) (void*)GetProcAddress((HMODULE)handle, export)
+#define dlclose(handle) FreeLibrary((HMODULE)handle)
#endif
DLLManager::DLLManager(const char *fname)
@@ -39,7 +43,11 @@ DLLManager::DLLManager(const char *fname)
h = dlopen(fname, RTLD_NOW|RTLD_LOCAL);
if (!h)
{
+#ifdef _WIN32
+ RetrieveLastError();
+#else
err = dlerror();
+#endif
}
}
@@ -64,7 +72,11 @@ Module* DLLManager::CallInit()
initfn.vptr = dlsym(h, MODULE_INIT_STR);
if (!initfn.vptr)
{
+#ifdef _WIN32
+ RetrieveLastError();
+#else
err = dlerror();
+#endif
return NULL;
}
@@ -81,3 +93,13 @@ std::string DLLManager::GetVersion()
return srcver;
return "Unversioned module";
}
+
+#ifdef _WIN32
+void DLLManager::RetrieveLastError()
+{
+ CHAR errmsg[100];
+ FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, 0, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), errmsg, 100, 0);
+ SetLastError(ERROR_SUCCESS);
+ err = errmsg;
+}
+#endif
View
17 src/hashcomp.cpp
@@ -127,15 +127,12 @@ void nspace::strlower(char *n)
}
}
-#if defined(WINDOWS) && !defined(HASHMAP_DEPRECATED)
- size_t nspace::hash_compare<std::string, std::less<std::string> >::operator()(const std::string &s) const
+#ifdef HASHMAP_DEPRECATED
+ size_t CoreExport nspace::insensitive::operator()(const std::string &s) const
#else
- #ifdef HASHMAP_DEPRECATED
- size_t CoreExport nspace::insensitive::operator()(const std::string &s) const
- #else
- size_t nspace::hash<std::string>::operator()(const std::string &s) const
- #endif
+ size_t nspace::hash<std::string>::operator()(const std::string &s) const
#endif
+
{
/* XXX: NO DATA COPIES! :)
* The hash function here is practically
@@ -150,11 +147,7 @@ void nspace::strlower(char *n)
}
-#if defined(WINDOWS) && !defined(HASHMAP_DEPRECATED)
- size_t nspace::hash_compare<irc::string, std::less<irc::string> >::operator()(const irc::string &s) const
-#else
- size_t CoreExport irc::hash::operator()(const irc::string &s) const
-#endif
+size_t CoreExport irc::hash::operator()(const irc::string &s) const
{
register size_t t = 0;
for (irc::string::const_iterator x = s.begin(); x != s.end(); ++x) /* ++x not x++, as its faster */
View
17 src/helperfuncs.cpp
@@ -24,6 +24,11 @@
/* $Core */
+#ifdef _WIN32
+#define _CRT_RAND_S
+#include <stdlib.h>
+#endif
+
#include "inspircd.h"
#include "xline.h"
#include "exitcodes.h"
@@ -311,12 +316,14 @@ bool InspIRCd::OpenLog(char**, int)
void InspIRCd::CheckRoot()
{
+#ifndef _WIN32
if (geteuid() == 0)
{
printf("WARNING!!! You are running an irc server as ROOT!!! DO NOT DO THIS!!!\n\n");
this->Logs->Log("STARTUP",DEFAULT,"Cant start as root");
Exit(EXIT_STATUS_ROOT);
}
+#endif
}
void InspIRCd::SendWhoisLine(User* user, User* dest, int numeric, const std::string &text)
@@ -451,7 +458,17 @@ unsigned long InspIRCd::GenRandomInt(unsigned long max)
void GenRandomHandler::Call(char *output, size_t max)
{
for(unsigned int i=0; i < max; i++)
+#ifdef _WIN32
+ {
+ unsigned int uTemp;
+ if(rand_s(&uTemp) != 0)
+ output[i] = rand();
+ else
+ output[i] = uTemp;
+ }
+#else
output[i] = random();
+#endif
}
ModResult OnCheckExemptionHandler::Call(User* user, Channel* chan, const std::string& restriction)
View
107 src/inspircd.cpp
@@ -31,7 +31,7 @@
#include "inspircd_version.h"
#include <signal.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <dirent.h>
#include <unistd.h>
#include <sys/resource.h>
@@ -163,9 +163,9 @@ void InspIRCd::Restart(const std::string &reason)
char** argv = Config->cmdline.argv;
-#ifdef WINDOWS
+#ifdef _WIN32
char module[MAX_PATH];
- if (GetModuleFileName(NULL, module, MAX_PATH))
+ if (GetModuleFileNameA(NULL, module, MAX_PATH))
me = module;
#else
me = argv[0];
@@ -223,7 +223,7 @@ void InspIRCd::RehashUsersAndChans()
void InspIRCd::SetSignals()
{
-#ifndef WIN32
+#ifndef _WIN32
signal(SIGALRM, SIG_IGN);
signal(SIGHUP, InspIRCd::SetSignal);
signal(SIGPIPE, SIG_IGN);
@@ -241,7 +241,7 @@ void InspIRCd::QuickExit(int status)
bool InspIRCd::DaemonSeed()
{
-#ifdef WINDOWS
+#ifdef _WIN32
printf_c("InspIRCd Process ID: \033[1;32m%lu\033[0m\n", GetCurrentProcessId());
return true;
#else
@@ -285,6 +285,7 @@ bool InspIRCd::DaemonSeed()
void InspIRCd::WritePID(const std::string &filename)
{
+#ifndef _WIN32
std::string fname(filename);
if (fname.empty())
fname = DATA_PATH "/inspircd.pid";
@@ -300,6 +301,7 @@ void InspIRCd::WritePID(const std::string &filename)
this->Logs->Log("STARTUP",DEFAULT,"Failed to write PID-file '%s', exiting.",fname.c_str());
Exit(EXIT_STATUS_PID);
}
+#endif
}
InspIRCd::InspIRCd(int argc, char** argv) :
@@ -321,14 +323,6 @@ InspIRCd::InspIRCd(int argc, char** argv) :
FloodQuitUser(&HandleFloodQuitUser),
OnCheckExemption(&HandleOnCheckExemption)
{
-#ifdef WIN32
- // Strict, frequent checking of memory on debug builds
- _CrtSetDbgFlag ( _CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
-
- // Avoid erroneous frees on early exit
- WindowsIPC = 0;
-#endif
-
ServerInstance = this;
Extensions.Register(&NICKForced);
@@ -393,7 +387,11 @@ InspIRCd::InspIRCd(int argc, char** argv) :
this->Config->cmdline.argv = argv;
this->Config->cmdline.argc = argc;
+#ifdef _WIN32
+ srand(TIME.tv_nsec ^ TIME.tv_sec);
+#else
srandom(TIME.tv_nsec ^ TIME.tv_sec);
+#endif
struct option longopts[] =
{
@@ -444,27 +442,17 @@ InspIRCd::InspIRCd(int argc, char** argv) :
Exit(EXIT_STATUS_NOERROR);
}
-#ifdef WIN32
-
- // Handle forking
- if(!do_nofork)
- {
- DWORD ExitCode = WindowsForkStart();
- if(ExitCode)
- exit(ExitCode);
- }
-
+#ifdef _WIN32
// Set up winsock
WSADATA wsadata;
- WSAStartup(MAKEWORD(2,0), &wsadata);
- ChangeWindowsSpecificPointers();
+ WSAStartup(MAKEWORD(2,2), &wsadata);
#endif
/* Set the finished argument values */
- Config->cmdline.nofork = do_nofork;
- Config->cmdline.forcedebug = do_debug;
- Config->cmdline.writelog = !do_nolog;
- Config->cmdline.TestSuite = do_testsuite;
+ Config->cmdline.nofork = (do_nofork != 0);
+ Config->cmdline.forcedebug = (do_debug != 0);
+ Config->cmdline.writelog = (!do_nolog != 0);
+ Config->cmdline.TestSuite = (do_testsuite != 0);
if (do_debug)
{
@@ -480,7 +468,7 @@ InspIRCd::InspIRCd(int argc, char** argv) :
if (!ServerConfig::FileExists(ConfigFileName.c_str()))
{
-#ifdef WIN32
+#ifdef _WIN32
/* Windows can (and defaults to) hide file extensions, so let's play a bit nice for windows users. */
std::string txtconf = this->ConfigFileName;
txtconf.append(".txt");
@@ -507,6 +495,7 @@ InspIRCd::InspIRCd(int argc, char** argv) :
this->Modes = new ModeParser;
+#ifndef _WIN32
if (!do_root)
this->CheckRoot();
else
@@ -521,6 +510,7 @@ InspIRCd::InspIRCd(int argc, char** argv) :
printf("\nInspIRCd starting in 20 seconds, ctrl+c to abort...\n");
sleep(20);
}
+#endif
this->SetSignals();
@@ -598,7 +588,7 @@ InspIRCd::InspIRCd(int argc, char** argv) :
printf("\nInspIRCd is now running as '%s'[%s] with %d max open sockets\n",
Config->ServerName.c_str(),Config->GetSID().c_str(), SE->GetMaxFds());
-#ifndef WINDOWS
+#ifndef _WIN32
if (!Config->cmdline.nofork)
{
if (kill(getppid(), SIGTERM) == -1)
@@ -640,19 +630,21 @@ InspIRCd::InspIRCd(int argc, char** argv) :
Logs->Log("STARTUP", DEFAULT,"Keeping pseudo-tty open as we are running in the foreground.");
}
#else
- WindowsIPC = new IPC;
- if(!Config->cmdline.nofork)
+ /* Set win32 service as running, if we are running as a service */
+ SetServiceRunning();
+
+ // Handle forking
+ if(!do_nofork)
{
- WindowsForkKillOwner();
FreeConsole();
}
- /* Set win32 service as running, if we are running as a service */
- SetServiceRunning();
+
+ QueryPerformanceFrequency(&stats->QPFrequency);
#endif
Logs->Log("STARTUP", DEFAULT, "Startup complete as '%s'[%s], %d max open sockets", Config->ServerName.c_str(),Config->GetSID().c_str(), SE->GetMaxFds());
-#ifndef WIN32
+#ifndef _WIN32
std::string SetUser = Config->ConfValue("security")->getString("runasuser");
std::string SetGroup = Config->ConfValue("security")->getString("runasgroup");
if (!SetGroup.empty())
@@ -711,20 +703,28 @@ InspIRCd::InspIRCd(int argc, char** argv) :
this->QuickExit(0);
}
}
-#endif
this->WritePID(Config->PID);
+#endif
}
void InspIRCd::UpdateTime()
{
-#ifdef HAS_CLOCK_GETTIME
- clock_gettime(CLOCK_REALTIME, &TIME);
+#ifdef _WIN32
+ SYSTEMTIME st;
+ GetSystemTime(&st);
+
+ TIME.tv_sec = time(NULL);
+ TIME.tv_nsec = st.wMilliseconds;
#else
- struct timeval tv;
- gettimeofday(&tv, NULL);
- TIME.tv_sec = tv.tv_sec;
- TIME.tv_nsec = tv.tv_usec * 1000;
+ #ifdef HAS_CLOCK_GETTIME
+ clock_gettime(CLOCK_REALTIME, &TIME);
+ #else
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ TIME.tv_sec = tv.tv_sec;
+ TIME.tv_nsec = tv.tv_usec * 1000;
+ #endif
#endif
}
@@ -743,12 +743,8 @@ int InspIRCd::Run()
while (true)
{
-#ifndef WIN32
+#ifndef _WIN32
static rusage ru;
-#else
- static time_t uptime;
- static struct tm * stime;
- static char window_title[100];
#endif
/* Check if there is a config thread which has finished executing but has not yet been freed */
@@ -774,12 +770,21 @@ int InspIRCd::Run()
if (TIME.tv_sec != OLDTIME)
{
OLDTIME = TIME.tv_sec;
-#ifndef WIN32
+#ifndef _WIN32
getrusage(RUSAGE_SELF, &ru);
stats->LastSampled = TIME;
stats->LastCPU = ru.ru_utime;
#else
- WindowsIPC->Check();
+ if(QueryPerformanceCounter(&stats->LastSampled))
+ {
+ FILETIME CreationTime;
+ FILETIME ExitTime;
+ FILETIME KernelTime;
+ FILETIME UserTime;
+ GetProcessTimes(GetCurrentProcess(), &CreationTime, &ExitTime, &KernelTime, &UserTime);
+ stats->LastCPU.dwHighDateTime = KernelTime.dwHighDateTime + UserTime.dwHighDateTime;
+ stats->LastCPU.dwLowDateTime = KernelTime.dwLowDateTime + UserTime.dwLowDateTime;
+ }
#endif
/* Allow a buffer of two seconds drift on this so that ntpdate etc dont harass admins */
View
2 src/modmanager_dynamic.cpp
@@ -25,7 +25,7 @@
#include "dns.h"
#include "exitcodes.h"
-#ifndef WIN32
+#ifndef _WIN32
#include <dirent.h>
#endif
View
4 src/modules.cpp
@@ -32,7 +32,7 @@
#include "dns.h"
#include "exitcodes.h"
-#ifndef WIN32
+#ifndef _WIN32
#include <dirent.h>
#endif
@@ -558,7 +558,7 @@ dynamic_reference_base::operator bool()
if (i != ServerInstance->Modules->DataProviders.end())
value = static_cast<DataProvider*>(i->second);
}
- return value;
+ return (value != NULL);
}
void InspIRCd::SendMode(const std::vector<std::string>& parameters, User *user)
View
2 src/modules/extra/m_geoip.cpp
@@ -23,7 +23,7 @@
#include <GeoIP.h>
-#ifdef WINDOWS
+#ifdef _WIN32
# pragma comment(lib, "GeoIP.lib")
#endif
View
2 src/modules/extra/m_ldapauth.cpp
@@ -30,7 +30,7 @@
#include <ldap.h>
-#ifdef WINDOWS
+#ifdef _WIN32
# pragma comment(lib, "ldap.lib")
# pragma comment(lib, "lber.lib")
#endif
View
2 src/modules/extra/m_ldapoper.cpp
@@ -27,7 +27,7 @@
#include <ldap.h>
-#ifdef WINDOWS
+#ifdef _WIN32
# pragma comment(lib, "ldap.lib")
# pragma comment(lib, "lber.lib")
#endif
View
2 src/modules/extra/m_mysql.cpp
@@ -27,7 +27,7 @@
#include <mysql.h>
#include "sql.h"
-#ifdef WINDOWS
+#ifdef _WIN32
# pragma comment(lib, "mysqlclient.lib")
# pragma comment(lib, "advapi32.lib")
# pragma comment(linker, "/NODEFAULTLIB:LIBCMT")
View
2 src/modules/extra/m_regex_pcre.cpp
@@ -27,7 +27,7 @@
/* $CompileFlags: exec("pcre-config --cflags") */
/* $LinkerFlags: exec("pcre-config --libs") rpath("pcre-config --libs") -lpcre */
-#ifdef WINDOWS
+#ifdef _WIN32
# pragma comment(lib, "libpcre.lib")
#endif
View
2 src/modules/extra/m_sqlite3.cpp
@@ -24,7 +24,7 @@
#include <sqlite3.h>
#include "sql.h"
-#ifdef WINDOWS
+#ifdef _WIN32
# pragma comment(lib, "sqlite3.lib")
#endif
View
2 src/modules/extra/m_ssl_gnutls.cpp
@@ -28,7 +28,7 @@
#include "ssl.h"
#include "m_cap.h"
-#ifdef WINDOWS
+#ifdef _WIN32
# pragma comment(lib, "libgnutls.lib")
# pragma comment(lib, "libgcrypt.lib")
# pragma comment(lib, "libgpg-error.lib")
View
2 src/modules/extra/m_ssl_openssl.cpp
@@ -27,7 +27,7 @@
#include <openssl/err.h>
#include "ssl.h"
-#ifdef WINDOWS
+#ifdef _WIN32
# pragma comment(lib, "libcrypto.lib")
# pragma comment(lib, "libssl.lib")
# pragma comment(lib, "user32.lib")
View
2 src/modules/m_spanningtree/main.cpp
@@ -306,7 +306,7 @@ void ModuleSpanningTree::ConnectServer(Link* x, Autoconnect* y)
{
try
{
- bool cached;
+ bool cached = false;
ServernameResolver* snr = new ServernameResolver(Utils, x->IPAddr, x, cached, start_type, y);
ServerInstance->AddResolver(snr, cached);
}
View
4 src/modules/m_spanningtree/resolvers.cpp
@@ -71,7 +71,7 @@ void ServernameResolver::OnError(ResolverError e, const std::string &errormessag
/* Ooops! */
if (query == DNS_QUERY_AAAA)
{
- bool cached;
+ bool cached = false;
ServernameResolver* snr = new ServernameResolver(Utils, host, MyLink, cached, DNS_QUERY_A, myautoconnect);
ServerInstance->AddResolver(snr, cached);
return;
@@ -102,7 +102,7 @@ void SecurityIPResolver::OnError(ResolverError e, const std::string &errormessag
{
if (query == DNS_QUERY_AAAA)
{
- bool cached;
+ bool cached = false;
SecurityIPResolver* res = new SecurityIPResolver(mine, Utils, host, MyLink, cached, DNS_QUERY_A);
ServerInstance->AddResolver(res, cached);
return;
View
2 src/modules/m_spanningtree/utils.cpp
@@ -314,7 +314,7 @@ void SpanningTreeUtilities::RefreshIPCache()
{
try
{
- bool cached;
+ bool cached = false;
SecurityIPResolver* sr = new SecurityIPResolver(Creator, this, L->IPAddr, L, cached, DNS_QUERY_AAAA);
ServerInstance->AddResolver(sr, cached);
}
View
10 src/modules/m_spanningtree/utils.h
@@ -36,14 +36,10 @@ class SpanningTreeUtilities;
/* This hash_map holds the hash equivalent of the server
* tree, used for rapid linear lookups.
*/
-#if defined(WINDOWS) && !defined(HASHMAP_DEPRECATED)
- typedef nspace::hash_map<std::string, TreeServer*, nspace::hash_compare<std::string, std::less<std::string> > > server_hash;
+#ifdef HASHMAP_DEPRECATED
+ typedef nspace::hash_map<std::string, TreeServer*, nspace::insensitive, irc::StrHashComp> server_hash;
#else
- #ifdef HASHCOMP_DEPRECATED
- typedef nspace::hash_map<std::string, TreeServer*, nspace::insensitive, irc::StrHashComp> server_hash;
- #else
- typedef nspace::hash_map<std::string, TreeServer*, nspace::hash<std::string>, irc::StrHashComp> server_hash;
- #endif
+ typedef nspace::hash_map<std::string, TreeServer*, nspace::hash<std::string>, irc::StrHashComp> server_hash;
#endif
typedef std::map<TreeServer*,TreeServer*> TreeServerList;
View
7 src/modules/m_watch.cpp
@@ -96,11 +96,8 @@
* Before you start screaming, this definition is only used here, so moving it to a header is pointless.
* Yes, it's horrid. Blame cl for being different. -- w00t
*/
-#if defined(WINDOWS) && !defined(HASHMAP_DEPRECATED)
- typedef nspace::hash_map<irc::string, std::deque<User*>, nspace::hash_compare<irc::string, std::less<irc::string> > > watchentries;
-#else
- typedef nspace::hash_map<irc::string, std::deque<User*>, irc::hash> watchentries;
-#endif
+
+typedef nspace::hash_map<irc::string, std::deque<User*>, irc::hash> watchentries;
typedef std::map<irc::string, std::string> watchlist;
/* Who's watching each nickname.
View
2 src/modules/ssl.h
@@ -121,7 +121,7 @@ class ssl_cert : public refcountbase
std::string GetMetaLine()
{
std::stringstream value;
- bool hasError = error.length();
+ bool hasError = !error.empty();
value << (IsInvalid() ? "v" : "V") << (IsTrusted() ? "T" : "t") << (IsRevoked() ? "R" : "r")
<< (IsUnknownSigner() ? "s" : "S") << (hasError ? "E" : "e") << " ";
if (hasError)
View
8 src/server.cpp
@@ -27,21 +27,23 @@
void InspIRCd::SignalHandler(int signal)
{
+#ifdef _WIN32
+ if (signal == SIGTERM)
+#else
if (signal == SIGHUP)
{
Rehash("Caught SIGHUP");
}
else if (signal == SIGTERM)
+#endif
{
Exit(signal);
}
}
void InspIRCd::Exit(int status)
{
-#ifdef WINDOWS
- if (WindowsIPC)
- delete WindowsIPC;
+#ifdef _WIN32
SetServiceStopped(status);
#endif
if (this)
View
12 src/socketengine.cpp
@@ -98,7 +98,7 @@ bool SocketEngine::HasFd(int fd)
{
if ((fd < 0) || (fd > GetMaxFds()))
return false;
- return ref[fd];
+ return (ref[fd] != NULL);
}
EventHandler* SocketEngine::GetRef(int fd)
@@ -125,7 +125,7 @@ int SocketEngine::Accept(EventHandler* fd, sockaddr *addr, socklen_t *addrlen)
int SocketEngine::Close(EventHandler* fd)
{
-#ifdef WINDOWS
+#ifdef _WIN32
return closesocket(fd->GetFd());
#else
return close(fd->GetFd());
@@ -134,7 +134,7 @@ int SocketEngine::Close(EventHandler* fd)
int SocketEngine::Close(int fd)
{
-#ifdef WINDOWS
+#ifdef _WIN32
return closesocket(fd);
#else
return close(fd);
@@ -143,7 +143,7 @@ int SocketEngine::Close(int fd)
int SocketEngine::Blocking(int fd)
{
-#ifdef WINDOWS
+#ifdef _WIN32
unsigned long opt = 0;
return ioctlsocket(fd, FIONBIO, &opt);
#else
@@ -154,7 +154,7 @@ int SocketEngine::Blocking(int fd)
int SocketEngine::NonBlocking(int fd)
{
-#ifdef WINDOWS
+#ifdef _WIN32
unsigned long opt = 1;
return ioctlsocket(fd, FIONBIO, &opt);
#else
@@ -209,7 +209,7 @@ int SocketEngine::SendTo(EventHandler* fd, const void *buf, size_t len, int flag
int SocketEngine::Connect(EventHandler* fd, const sockaddr *serv_addr, socklen_t addrlen)
{
int ret = connect(fd->GetFd(), serv_addr, addrlen);
-#ifdef WINDOWS
+#ifdef _WIN32
if ((ret == SOCKET_ERROR) && (WSAGetLastError() == WSAEWOULDBLOCK))
errno = EINPROGRESS;
#endif
View
2 src/socketengines/socketengine_poll.cpp
@@ -33,7 +33,7 @@
#include "inspircd.h"
#include "socketengine.h"
-#ifndef WINDOWS
+#ifndef _WIN32
#ifndef __USE_XOPEN
#define __USE_XOPEN /* fuck every fucking OS ever made. needed by poll.h to work.*/
#endif
View
4 src/socketengines/socketengine_select.cpp
@@ -23,9 +23,9 @@
#include "inspircd.h"
#include "socketengine.h"
-#ifndef WINDOWS
+#ifndef _WIN32
#include <sys/select.h>
-#endif // WINDOWS
+#endif // _WIN32
/** A specialisation of the SocketEngine class, designed to use traditional select().
*/
View
11 src/threadengines/threadengine_win32.cpp
@@ -37,7 +37,16 @@ void ThreadEngine::Start(Thread* thread)
{
thread->state = NULL;
delete data;
- throw CoreException(std::string("Unable to create new thread: ") + dlerror());
+ std::string err = "Unable to create new thread: ";
+#ifdef _WIN32
+ CHAR errdetail[100];
+ FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, 0, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), errdetail, 100, 0);
+ SetLastError(ERROR_SUCCESS);
+ err += errdetail;
+#else
+ err += dlerror();
+#endif
+ throw CoreException(err);
}
}
View
4 win/colours.h → win/colors.h
@@ -28,8 +28,6 @@
#define TWHITE TNORMAL | FOREGROUND_INTENSITY
#define TBLUE FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY
-inline void sc(WORD color) { SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color); }
-
/* Handles colors in printf */
int printf_c(const char * format, ...)
{
@@ -97,7 +95,7 @@ int printf_c(const char * format, ...)
default:
char message[50];
sprintf(message, "Unknown color code: %s", temp);
- MessageBox(0, message, message, MB_OK);
+ MessageBoxA(0, message, message, MB_OK);
break;
}
}
View
193 win/configure.cpp
@@ -34,27 +34,31 @@
#include <vector>
#include <time.h>
#include "inspircd_win32wrapper.h"
-#include "colours.h"
+#include "colors.h"
using namespace std;
void Run();
void Banner();
void WriteCompileModules(const vector<string> &, const vector<string> &);
void WriteCompileCommands();
-void Rebase();
void CopyExtras();
-/* detects if we are running windows xp or higher (5.1) */
-bool iswinxp()
-{
- OSVERSIONINFO vi;
- vi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- GetVersionEx(&vi);
- if(vi.dwMajorVersion >= 5)
- return true;
-
- return false;
-}
+inline void sc(WORD color) { SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color); }
+
+#ifdef _WIN64
+ // /MACHINE:X64
+ #ifdef _DEBUG
+ #define OUTFOLDER "debug_x64"
+ #else
+ #define OUTFOLDER "release_x64"
+ #endif
+#else
+ #ifdef _DEBUG
+ #define OUTFOLDER "debug"
+ #else
+ #define OUTFOLDER "release"
+ #endif
+#endif
int get_int_option(const char * text, int def)
{
@@ -79,7 +83,7 @@ bool get_bool_option(const char * text, bool def)
strcpy(ret, def ? "y" : "n");
printf("\n");
- return !strncmp(ret, "y", 1);
+ return !strnicmp(ret, "y", 1);
}
string get_string_option(const char * text, char * def)
@@ -144,7 +148,7 @@ string get_git_commit()
fclose(f);
}
- return commit != NULL ? commit : "";
+ return commit != NULL ? commit : "0";
}
void get_machine_info(char * buffer, size_t len)
@@ -153,15 +157,15 @@ void get_machine_info(char * buffer, size_t len)
char buf2[500];
DWORD dwSize = sizeof(buf);
- if (!GetComputerNameEx((COMPUTER_NAME_FORMAT)ComputerNameDnsFullyQualified, buf, &dwSize))
+ if (!GetComputerNameExA((COMPUTER_NAME_FORMAT)ComputerNameDnsFullyQualified, buf, &dwSize))
sprintf(buf, "%s", "unknown");
FILE * f = fopen("ver.txt.tmp", "r");
if (f)
{
while (fgets(buf2, sizeof(buf2), f)) { }
fclose(f);
- unlink("ver.txt.tmp");
+ _unlink("ver.txt.tmp");
}
else
sprintf(buf2, "%s", "unknown");
@@ -184,7 +188,7 @@ void get_machine_info(char * buffer, size_t len)
vector<string> get_dir_list(const string &path_list)
{
- char *paths = strdup(path_list.c_str());
+ char *paths = _strdup(path_list.c_str());
char *paths_save = paths;
char *p = paths;
vector<string> paths_return;
@@ -204,16 +208,10 @@ vector<string> get_dir_list(const string &path_list)
int __stdcall WinMain(IN HINSTANCE hInstance, IN HINSTANCE hPrevInstance, IN LPSTR lpCmdLine, IN int nShowCmd )
{
- if (!strcmp(lpCmdLine, "/rebase"))
- {
- Rebase();
- return 0;
- }
-
- FILE * j = fopen("inspircd_config.h", "r");
+ FILE * j = fopen("..\\include\\inspircd_config.h", "r");
if (j)
{
- if (MessageBox(0, "inspircd_config.h already exists. Remove it and build from clean?", "Configure program", MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2) != IDYES)
+ if (MessageBoxA(0, "inspircd_config.h already exists. Remove it and build from clean?", "Configure program", MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2) != IDYES)
{
fclose(j);
exit(0);
@@ -280,12 +278,12 @@ void Run()
string branch(version);
branch.erase(branch.find_last_of('.'));
-#ifdef WIN64
- printf_c("Your operating system is: \033[1;32mwindows_x64 \033[0m\n");
+#ifdef _WIN64
+ printf_c("Your operating system is: \033[1;32mWindows x64\033[0m\n");
#else
- printf_c("Your operating system is: \033[1;32mwindows_x32 \033[0m\n");
+ printf_c("Your operating system is: \033[1;32mWindows x86\033[0m\n");
#endif
- printf_c("InspIRCd revision ID: \033[1;32m%s \033[0m\n\n", !revision.empty() ? revision.c_str() : "(Non-GIT build)");
+ printf_c("InspIRCd revision ID: \033[1;32m%s \033[0m\n\n", (!revision.empty() && revision != "0") ? revision.c_str() : "(Non-GIT build)");
printf_c("\033[1mExtra modules.\033[0m\n");
if (get_bool_option("Do you want to compile any extra non-core modules?", false))
@@ -310,12 +308,12 @@ void Run()
CopyExtras();
// dump all the options back out
- printf_c("\033[0mBase install path:\033[1;32m %s\n", base_path.c_str());
- printf_c("\033[0mConfig path:\033[1;32m %s\n", config_path.c_str());
- printf_c("\033[0mModule path:\033[1;32m %s\n", mod_path.c_str());
- printf_c("\033[0mData path:\033[1;32m %s\n", data_path.c_str());
- printf_c("\033[0mLog path:\033[1;32m %s\n", log_path.c_str());
- printf_c("\033[0mSocket Engine:\033[1;32m %s\n", "select");
+ printf_c("\033[0mBase install path:\033[1;32m\t%s\n", base_path.c_str());
+ printf_c("\033[0mConfig path:\033[1;32m\t\t%s\n", config_path.c_str());
+ printf_c("\033[0mModule path:\033[1;32m\t\t%s\n", mod_path.c_str());
+ printf_c("\033[0mData path:\033[1;32m\t\t%s\n", data_path.c_str());
+ printf_c("\033[0mLog path:\033[1;32m\t\t%s\n", log_path.c_str());
+ printf_c("\033[0mSocket Engine:\033[1;32m\t\t%s\n", "select");
printf("\n"); sc(TNORMAL);
if(get_bool_option("Are these settings correct?", true) == false)
@@ -332,7 +330,7 @@ void Run()
escape_string(mod_path);
printf("\nWriting inspircd_config.h...");
- FILE * f = fopen("inspircd_config.h", "w");
+ FILE * f = fopen("..\\include\\inspircd_config.h", "w");
fprintf(f, "/* Auto generated by configure, do not modify! */\n");
fprintf(f, "#ifndef __CONFIGURATION_AUTO__\n");
fprintf(f, "#define __CONFIGURATION_AUTO__\n\n");
@@ -345,25 +343,13 @@ void Run()
fprintf(f, "#define MAXBUF 514\n");
fprintf(f, "\n#include \"inspircd_win32wrapper.h\"");
- fprintf(f, "\n#include \"inspircd_namedpipe.h\"");
fprintf(f, "\n#include \"threadengines/threadengine_win32.h\"\n\n");
fprintf(f, "#endif\n\n");
fclose(f);
sc(TGREEN); printf(" done\n"); sc(TNORMAL);
- printf("Writing inspircd_se_config.h...");
-
- f = fopen("inspircd_se_config.h", "w");
- fprintf(f, "/* Auto generated by configure, do not modify or commit to Git! */\n");
- fprintf(f, "#ifndef __CONFIGURATION_SOCKETENGINE__\n");
- fprintf(f, "#define __CONFIGURATION_SOCKETENGINE__\n\n");
- fprintf(f, "#include \"socketengines/socketengine_%s.h\"\n\n", "select");
- fprintf(f, "#endif\n\n");
- fclose(f);
-
- sc(TGREEN); printf(" done\n"); sc(TNORMAL);
printf("Writing inspircd_version.h...");
- f = fopen("inspircd_version.h", "w");
+ f = fopen("..\\include\\inspircd_version.h", "w");
fprintf(f, "#define BRANCH \"%s\"\n", branch.c_str());
fprintf(f, "#define VERSION \"%s\"\n", version);
fprintf(f, "#define REVISION \"%s\"\n", revision.c_str());
@@ -387,8 +373,8 @@ void CopyExtras()
printf("\nUpdating extra modules in src/modules...\n");
- WIN32_FIND_DATA fd;
- HANDLE fh = FindFirstFile("..\\src\\modules\\extra\\*.*", &fd);
+ WIN32_FIND_DATAA fd;
+ HANDLE fh = FindFirstFileA("..\\src\\modules\\extra\\*.*", &fd);
if(fh == INVALID_HANDLE_VALUE)
return;
@@ -403,61 +389,25 @@ void CopyExtras()
if (x)
{
fclose(x);
- CopyFile(src, dest, false);
+ CopyFileA(src, dest, false);
sc(TGREEN); printf(" %s", fd.cFileName); sc(TNORMAL);
printf("...\n");
}
}
- while (FindNextFile(fh, &fd));
+ while (FindNextFileA(fh, &fd));
FindClose(fh);
printf("\n\n");
}
-
-void Rebase()
-{
- char dest[65535];
- char command[65535];
-
- WIN32_FIND_DATA fd;
-
-#ifdef _DEBUG
- HANDLE fh = FindFirstFile("..\\bin\\debug\\modules\\*.so", &fd);
-#else
- HANDLE fh = FindFirstFile("..\\bin\\release\\modules\\*.so", &fd);
-#endif
- if(fh == INVALID_HANDLE_VALUE)
- return;
-
- *dest = 0;
-
- do
- {
-#ifdef _DEBUG
- strcat(dest, " ..\\bin\\debug\\modules\\");
-#else
- strcat(dest, " ..\\bin\\release\\modules\\");
-#endif
- strcat(dest, fd.cFileName);
- }
- while (FindNextFile(fh, &fd));
-
- sprintf(command, "rebase.exe -v -b 11000000 -c baseaddr_modules.txt %s", dest);
- printf("%s\n", command);
- system(command);
-
- FindClose(fh);
-}
-
void WriteCompileCommands()
{
char commands[300][100];
int command_count = 0;
printf("\n Finding Command Sources...\n");
- WIN32_FIND_DATA fd;
- HANDLE fh = FindFirstFile("..\\src\\commands\\cmd_*.cpp", &fd);
+ WIN32_FIND_DATAA fd;
+ HANDLE fh = FindFirstFileA("..\\src\\commands\\cmd_*.cpp", &fd);
if(fh == INVALID_HANDLE_VALUE)
printf_c("\033[1;32m No command sources could be found! This \033[1m*could*\033[1;32m be a bad thing.. :P\033[0m");
else
@@ -469,7 +419,7 @@ void WriteCompileCommands()
commands[command_count][strlen(fd.cFileName) - 4] = 0;
printf(" %s\n", commands[command_count]);
++command_count;
- } while(FindNextFile(fh, &fd));
+ } while(FindNextFileA(fh, &fd));
sc(TNORMAL);
}
@@ -486,41 +436,28 @@ void WriteCompileCommands()
fprintf(f, "%s.so ", commands[i]);
fprintf(f, "\n.cpp.obj:\n");
-#ifdef WIN64
+#ifdef _WIN64
// /MACHINE:X64
#ifdef _DEBUG
- fprintf(f, " cl /nologo /LD /Od /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/commands\" /I \"../../win\" /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /Gm /EHsc /RTC1 /MDd /Fo\"Debug/\" /Fd\"Debug/vc90.pdb\" /W2 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link ..\\..\\bin\\debug_x64\\inspircd.lib /OUT:\"..\\..\\bin\\debug_x64\\modules\\$*.so\" /PDB:\"..\\..\\bin\\debug_x64\\modules\\$*.pdb\" /MACHINE:X64 /IMPLIB:\"..\\..\\bin\\debug_x64\\modules\\$*.lib\"\n\n");
- CreateDirectory("..\\src\\commands\\debug", NULL);
- CreateDirectory("..\\bin\\debug\\modules", NULL);
+ fprintf(f, " cl /nologo /LD /Od /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/commands\" /I \"../../win\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /Gm /EHsc /RTC1 /MDd /Fo\"Debug_x64/\" /Fd\"Debug_x64/vc90.pdb\" /W2 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link ..\\..\\bin\\debug_x64\\inspircd.lib /OUT:\"..\\..\\bin\\debug_x64\\modules\\$*.so\" /PDB:\"..\\..\\bin\\debug_x64\\modules\\$*.pdb\" /MACHINE:X64 /IMPLIB:\"..\\..\\bin\\debug_x64\\modules\\$*.lib\"\n\n");
#else
- fprintf(f, " cl /nologo /LD /Od /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/commands\" /I \"../../win\" /D \"WIN32\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /Gm /EHsc /GL /MD /Fo\"Release/\" /Fd\"Release/vc90.pdb\" /W2 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link ..\\..\\bin\\release_x64\\inspircd.lib /OUT:\"..\\..\\bin\\release_x64\\modules\\$*.so\" /PDB:\"..\\..\\bin\\release_x64\\modules\\$*.pdb\" /MACHINE:X64 /IMPLIB:\"..\\..\\bin\\release_x64\\modules\\$*.lib\"\n\n");
- CreateDirectory("..\\src\\commands\\release", NULL);
- CreateDirectory("..\\bin\\release\\modules", NULL);
+ fprintf(f, " cl /nologo /LD /O2 /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/commands\" /I \"../../win\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /Gm /EHsc /GL /MD /Fo\"Release_x64/\" /Fd\"Release_x64/vc90.pdb\" /W2 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link ..\\..\\bin\\release_x64\\inspircd.lib /OUT:\"..\\..\\bin\\release_x64\\modules\\$*.so\" /PDB:\"..\\..\\bin\\release_x64\\modules\\$*.pdb\" /MACHINE:X64 /IMPLIB:\"..\\..\\bin\\release_x64\\modules\\$*.lib\"\n\n");
#endif
#else
#ifdef _DEBUG
- fprintf(f, " cl /nologo /LD /Od /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/commands\" /I \"../../win\" /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /Gm /EHsc /RTC1 /MDd /Fo\"Debug/\" /Fd\"Debug/vc90.pdb\" /W2 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link ..\\..\\bin\\debug\\inspircd.lib /OUT:\"..\\..\\bin\\debug\\modules\\$*.so\" /PDB:\"..\\..\\bin\\debug\\modules\\$*.pdb\" /IMPLIB:\"..\\..\\bin\\debug\\modules\\$*.lib\"\n\n");
- CreateDirectory("..\\src\\commands\\debug", NULL);
- CreateDirectory("..\\bin\\debug\\modules", NULL);
+ fprintf(f, " cl /nologo /LD /Od /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/commands\" /I \"../../win\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /Gm /EHsc /RTC1 /MDd /Fo\"Debug/\" /Fd\"Debug/vc90.pdb\" /W2 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link ..\\..\\bin\\debug\\inspircd.lib /OUT:\"..\\..\\bin\\debug\\modules\\$*.so\" /PDB:\"..\\..\\bin\\debug\\modules\\$*.pdb\" /IMPLIB:\"..\\..\\bin\\debug\\modules\\$*.lib\"\n\n");
#else
- fprintf(f, " cl /nologo /LD /Od /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/commands\" /I \"../../win\" /D \"WIN32\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /Gm /EHsc /GL /MD /Fo\"Release/\" /Fd\"Release/vc90.pdb\" /W2 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link ..\\..\\bin\\release\\inspircd.lib /OUT:\"..\\..\\bin\\release\\modules\\$*.so\" /PDB:\"..\\..\\bin\\release\\modules\\$*.pdb\" /IMPLIB:\"..\\..\\bin\\release\\modules\\$*.lib\"\n\n");
- CreateDirectory("..\\src\\commands\\release", NULL);
- CreateDirectory("..\\bin\\release\\modules", NULL);
+ fprintf(f, " cl /nologo /LD /O2 /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/commands\" /I \"../../win\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /Gm /EHsc /GL /MD /Fo\"Release/\" /Fd\"Release/vc90.pdb\" /W2 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link ..\\..\\bin\\release\\inspircd.lib /OUT:\"..\\..\\bin\\release\\modules\\$*.so\" /PDB:\"..\\..\\bin\\release\\modules\\$*.pdb\" /IMPLIB:\"..\\..\\bin\\release\\modules\\$*.lib\"\n\n");
#endif
#endif
fprintf(f, "makedir:\n");
-#ifdef _DEBUG
- fprintf(f, " if not exist ..\\..\\bin\\debug mkdir ..\\..\\bin\\debug\n");
- fprintf(f, " if not exist ..\\..\\bin\\debug\\modules mkdir ..\\..\\bin\\debug\\modules\n");
- fprintf(f, " if not exist ..\\..\\bin\\debug\\data mkdir ..\\..\\bin\\debug\\data\n");
- fprintf(f, " if not exist ..\\..\\bin\\debug\\logs mkdir ..\\..\\bin\\debug\\logs\n");
-#else
- fprintf(f, " if not exist ..\\..\\bin\\release mkdir ..\\..\\bin\\release\n");
- fprintf(f, " if not exist ..\\..\\bin\\release\\modules mkdir ..\\..\\bin\\release\\modules\n");
- fprintf(f, " if not exist ..\\..\\bin\\release\\data mkdir ..\\..\\bin\\release\\data\n");
- fprintf(f, " if not exist ..\\..\\bin\\release\\logs mkdir ..\\..\\bin\\release\\logs\n");
-#endif
+
+ CreateDirectoryA("..\\src\\commands\\" OUTFOLDER, NULL);
+ CreateDirectoryA("..\\bin\\" OUTFOLDER "\\modules", NULL);
+ fprintf(f, " if not exist ..\\..\\bin\\" OUTFOLDER "\\modules mkdir ..\\..\\bin\\" OUTFOLDER "\\modules\n");
+ fprintf(f, " if not exist ..\\..\\bin\\" OUTFOLDER "\\data mkdir ..\\..\\bin\\" OUTFOLDER "\\data\n");
+ fprintf(f, " if not exist ..\\..\\bin\\" OUTFOLDER "\\logs mkdir ..\\..\\bin\\" OUTFOLDER "\\logs\n");
// dump modules.. again the second and last time :)
for(int i = 0; i < command_count; ++i)
@@ -536,8 +473,8 @@ void WriteCompileModules(const vector<string> &includes, const vector<string> &l
int module_count = 0;
printf("Finding Modules...\n");
- WIN32_FIND_DATA fd;
- HANDLE fh = FindFirstFile("..\\src\\modules\\m_*.cpp", &fd);
+ WIN32_FIND_DATAA fd;
+ HANDLE fh = FindFirstFileA("..\\src\\modules\\m_*.cpp", &fd);
if(fh == INVALID_HANDLE_VALUE)
printf_c("\033[1;32m No module sources could be found! This \033[1m*could*\033[1;32m be a bad thing.. :P\033[0m");
else
@@ -549,7 +486,7 @@ void WriteCompileModules(const vector<string> &includes, const vector<string> &l
modules[module_count][strlen(fd.cFileName) - 4] = 0;
printf(" %s\n", modules[module_count]);
++module_count;
- } while(FindNextFile(fh, &fd));
+ } while(FindNextFileA(fh, &fd));
sc(TNORMAL);
}
@@ -572,24 +509,22 @@ void WriteCompileModules(const vector<string> &includes, const vector<string> &l
fprintf(f, "%s.so ", modules[i]);
fprintf(f, "\n.cpp.obj:\n");
-#ifdef WIN64
+#ifdef _WIN64
// /MACHINE:X64
#ifdef _DEBUG
- fprintf(f, " cl /nologo /LD /Od /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/modules\" /I \"../../win\" %s /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /Gm /EHsc /RTC1 /MDd /Fo\"Debug/\" /Fd\"Debug/vc90.pdb\" /W2 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link %s ..\\..\\bin\\debug_x64\\inspircd.lib ws2_32.lib /OUT:\"..\\..\\bin\\debug_x64\\modules\\$*.so\" /PDB:\"..\\..\\bin\\debug_x64\\modules\\$*.pdb\" /MACHINE:X64 /IMPLIB:\"..\\..\\bin\\debug_x64\\modules\\$*.lib\"\n\n", extra_include.c_str(), extra_lib.c_str());
- CreateDirectory("..\\src\\modules\\debug_x64", NULL);
+ fprintf(f, " cl /nologo /LD /Od /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/modules\" /I \"../../win\" %s /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /Gm /EHsc /RTC1 /MDd /Fo\"Debug_x64/\" /Fd\"Debug_x64/vc90.pdb\" /W2 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link %s ..\\..\\bin\\debug_x64\\inspircd.lib /OUT:\"..\\..\\bin\\debug_x64\\modules\\$*.so\" /PDB:\"..\\..\\bin\\debug_x64\\modules\\$*.pdb\" /MACHINE:X64 /IMPLIB:\"..\\..\\bin\\debug_x64\\modules\\$*.lib\"\n\n", extra_include.c_str(), extra_lib.c_str());
#else
- fprintf(f, " cl /nologo /LD /Od /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/modules\" /I \"../../win\" %s /D \"WIN32\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /Gm /EHsc /GL /MD /Fo\"Release/\" /Fd\"Release/vc90.pdb\" /W2 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link %s ..\\..\\bin\\release_x64\\inspircd.lib ws2_32.lib /OUT:\"..\\..\\bin\\release_x64\\modules\\$*.so\" /PDB:\"..\\..\\bin\\release_x64\\modules\\$*.pdb\" /MACHINE:X64 /IMPLIB:\"..\\..\\bin\\release_x64\\modules\\$*.lib\"\n\n", extra_include.c_str(), extra_lib.c_str());
- CreateDirectory("..\\src\\modules\\release_x64", NULL);
+ fprintf(f, " cl /nologo /LD /O2 /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/modules\" /I \"../../win\" %s /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /Gm /EHsc /GL /MD /Fo\"Release_x64/\" /Fd\"Release_x64/vc90.pdb\" /W2 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link %s ..\\..\\bin\\release_x64\\inspircd.lib /OUT:\"..\\..\\bin\\release_x64\\modules\\$*.so\" /PDB:\"..\\..\\bin\\release_x64\\modules\\$*.pdb\" /MACHINE:X64 /IMPLIB:\"..\\..\\bin\\release_x64\\modules\\$*.lib\"\n\n", extra_include.c_str(), extra_lib.c_str());
#endif
#else
#ifdef _DEBUG
- fprintf(f, " cl /nologo /LD /Od /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/modules\" /I \"../../win\" %s /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /Gm /EHsc /RTC1 /MDd /Fo\"Debug/\" /Fd\"Debug/vc90.pdb\" /W2 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link %s ..\\..\\bin\\debug\\inspircd.lib ws2_32.lib /OUT:\"..\\..\\bin\\debug\\modules\\$*.so\" /PDB:\"..\\..\\bin\\debug\\modules\\$*.pdb\" /IMPLIB:\"..\\..\\bin\\debug\\modules\\$*.lib\"\n\n", extra_include.c_str(), extra_lib.c_str());
- CreateDirectory("..\\src\\modules\\debug", NULL);
+ fprintf(f, " cl /nologo /LD /Od /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/modules\" /I \"../../win\" %s /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /Gm /EHsc /RTC1 /MDd /Fo\"Debug/\" /Fd\"Debug/vc90.pdb\" /W2 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link %s ..\\..\\bin\\debug\\inspircd.lib /OUT:\"..\\..\\bin\\debug\\modules\\$*.so\" /PDB:\"..\\..\\bin\\debug\\modules\\$*.pdb\" /IMPLIB:\"..\\..\\bin\\debug\\modules\\$*.lib\"\n\n", extra_include.c_str(), extra_lib.c_str());
#else
- fprintf(f, " cl /nologo /LD /Od /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/modules\" /I \"../../win\" %s /D \"WIN32\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /Gm /EHsc /GL /MD /Fo\"Release/\" /Fd\"Release/vc90.pdb\" /W2 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link %s ..\\..\\bin\\release\\inspircd.lib ws2_32.lib /OUT:\"..\\..\\bin\\release\\modules\\$*.so\" /PDB:\"..\\..\\bin\\release\\modules\\$*.pdb\" /IMPLIB:\"..\\..\\bin\\release\\modules\\$*.lib\"\n\n", extra_include.c_str(), extra_lib.c_str());
- CreateDirectory("..\\src\\modules\\release", NULL);
+ fprintf(f, " cl /nologo /LD /O2 /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/modules\" /I \"../../win\" %s /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /Gm /EHsc /GL /MD /Fo\"Release/\" /Fd\"Release/vc90.pdb\" /W2 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link %s ..\\..\\bin\\release\\inspircd.lib /OUT:\"..\\..\\bin\\release\\modules\\$*.so\" /PDB:\"..\\..\\bin\\release\\modules\\$*.pdb\" /IMPLIB:\"..\\..\\bin\\release\\modules\\$*.lib\"\n\n", extra_include.c_str(), extra_lib.c_str());
#endif
#endif
+
+ CreateDirectoryA("..\\src\\modules\\" OUTFOLDER, NULL);
#ifdef _DEBUG
fprintf(f, "makedir:\n if not exist debug mkdir debug\n\n");
View
51 win/configure.vcxproj
@@ -1,4 +1,5 @@
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
@@ -78,7 +79,7 @@
<PropertyGroup>
<_ProjectFileVersion>10.0.20506.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug_configureVc90\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug_configure\</IntDir>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">configure</TargetName>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.exe</TargetExt>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
@@ -88,7 +89,7 @@
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">.exe</TargetExt>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release_Configure\</IntDir>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">configure</TargetName>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.exe</TargetExt>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
@@ -101,21 +102,22 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
- <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)configure.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <RandomizedBaseAddress>true</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
@@ -127,46 +129,47 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)configure.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <RandomizedBaseAddress>true</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
- <AdditionalOptions>/I:"include" %(AdditionalOptions)</AdditionalOptions>
- <Optimization>Disabled</Optimization>
+ <Optimization>MaxSpeed</Optimization>
<WholeProgramOptimization>true</WholeProgramOptimization>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>false</MinimalRebuild>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
- <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <RandomizedBaseAddress>true</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
@@ -177,28 +180,30 @@
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>false</MinimalRebuild>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <RandomizedBaseAddress>true</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
- <ClInclude Include="colours.h" />
+ <ClInclude Include="colors.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="configure.cpp" />
View
94 win/inspircd.vcxproj
@@ -88,13 +88,13 @@
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">inspircd</TargetName>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.exe</TargetExt>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">..\bin\debug_x64\bin\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">x64DebugVc80\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">..\bin\debug_x64\</OutDir>