summaryrefslogtreecommitdiff
path: root/win/configure.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-04-16 21:31:24 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-04-16 21:31:24 +0000
commit6ef9fba15a779af7104f9a51d60f2f40066e3ffe (patch)
tree49941141ead4ddb1847b150e3e46776683b3c765 /win/configure.cpp
parent75d17f67a472d04ff899513fcb9987c387161d71 (diff)
Automatic rebasing of load addresses for .so files on windows, thanks to GreenReaper for the hints and tips
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9519 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'win/configure.cpp')
-rw-r--r--win/configure.cpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/win/configure.cpp b/win/configure.cpp
index 94d1b898c..1b097da06 100644
--- a/win/configure.cpp
+++ b/win/configure.cpp
@@ -26,6 +26,7 @@ void Run();
void Banner();
void WriteCompileModules();
void WriteCompileCommands();
+void Rebase();
/* detects if we are running windows xp or higher (5.1) */
bool iswinxp()
@@ -143,6 +144,17 @@ int get_svn_revision(char * buffer, size_t len)
int __stdcall WinMain(IN HINSTANCE hInstance, IN HINSTANCE hPrevInstance, IN LPSTR lpCmdLine, IN int nShowCmd )
{
+ if (!strcmp(lpCmdLine, "/rebase"))
+ {
+ AllocConsole();
+ // pipe standard handles to this console
+ freopen("CONIN$", "r", stdin);
+ freopen("CONOUT$", "w", stdout);
+ freopen("CONOUT$", "w", stderr);
+ Rebase();
+ FreeConsole();
+ return 0;
+ }
FILE * j = fopen("inspircd_config.h", "r");
if (j)
{
@@ -412,6 +424,52 @@ void Run()
printf("\nconfigure is done.. exiting!\n");
}
+void Rebase()
+{
+ char dest[65535];
+ char command[65535];
+
+ *dest = 0;
+
+ WIN32_FIND_DATA fd;
+ HANDLE fh = FindFirstFile("..\\bin\\release\\lib\\*.so", &fd);
+ if(fh == INVALID_HANDLE_VALUE)
+ return;
+
+ do
+ {
+ strcat(dest, " ..\\bin\\release\\lib\\");
+ strcat(dest, fd.cFileName);
+ }
+ while (FindNextFile(fh, &fd));
+
+ FindClose(fh);
+
+ sprintf(command, "rebase.exe -v -b 10000000 -c baseaddr_commands.txt %s", dest);
+ printf("%s\n", command);
+ system(command);
+
+ fh = FindFirstFile("..\\bin\\release\\modules\\*.so", &fd);
+ if(fh == INVALID_HANDLE_VALUE)
+ return;
+
+ *dest = 0;
+
+ do
+ {
+ strcat(dest, " ..\\bin\\release\\modules\\");
+ strcat(dest, fd.cFileName);
+ }
+ while (FindNextFile(fh, &fd));
+
+ sprintf(command, "rebase.exe -v -b 10000000 -c baseaddr_modules.txt %s", dest);
+ printf("%s\n", command);
+ system(command);
+
+ FindClose(fh);
+
+}
+
void WriteCompileCommands()
{
char commands[300][100];