openexr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Openexr-devel] Microsoft Windows non-administrator user ilmbase-1.0


From: Florian Kainz
Subject: Re: [Openexr-devel] Microsoft Windows non-administrator user ilmbase-1.0.0 build problem
Date: Fri, 21 Dec 2007 14:32:02 -0800
User-agent: Mozilla Thunderbird 1.0 (X11/20041207)

Hi Pavel,

a very similar fix for createDLL was submitted in
August by James Burgess.  The fix is included in
ilmbase-1.0.1.  Would you mind checking if that
version of createDLL works for you?

Florian



Павел wrote:
Hello!

I found some bugs while building ilmbase-1.0.0 on my Microsoft Windows Vista PC with MSVC 2005 Express Edition.

The thing is createDLL attempts to create some files in the root directory of disk C: ("C:\\response.txt" in static void createResponseFile and "C:\\createDLL_out.txt" in int main). But creating files in root directory under non-administrator acount is not allowed. So build breaks.

Here is a quick'n'dirty patch to avoid this problem using WinAPI GetTempPath function (buggy under some older versions of Windows):

--- createDLL_orig.cpp  2006-12-11 11:36:52.000000000 +0300
+++ createDLL.cpp       2007-12-13 19:48:17.000000000 +0300
@@ -652,10 +652,18 @@ static void getSymbolsFromMap(char* buf,
     }
 }

+static std::string getTempPath()
+{
+       DWORD   dwBufferLength = GetTempPathA( 0, NULL );
+       std::auto_ptr<char>     lpBuffer ( new char [dwBufferLength + 1] );
+       GetTempPathA( dwBufferLength, lpBuffer.get() );
+       return  string( lpBuffer.get() );
+}

static void createResponseFile(string& path, string& moduleName, vector<string>& libpath, string& implib, set<string>& libs, set<string>& objs, bool noDefaultLibs)
 {
-    FILE* r = fopen("C:\\response.txt", "wb");
+       string  rName = getTempPath() + "response.txt";
+    FILE* r = fopen(rName.c_str(), "wb");
     if (r != 0)
     {
fprintf(r, "/OUT:\"%s\\%s.dll\" /NOLOGO ", path.c_str(), moduleName.c_str());
@@ -701,7 +709,7 @@ static void createResponseFile(string& p
     }
     else
     {
- std::cerr << "Unable to open response file C:\\response.txt" << endl;
+        std::cerr << "Unable to open response file " << rName << endl;
     }
 }

@@ -729,7 +737,8 @@ int main(int argC, char* argV[])
     std::cout << "CreateDLL v1.1" << std::endl;

     // banner
-    std::ofstream logfile("c:\\createDLL_out.txt", std::ios::out);
+       std::string logName = getTempPath() + "createDLL_out.txt";
+    std::ofstream logfile(logName.c_str(), std::ios::out);
logfile << "createDLL was built " << __DATE__ << " " << __TIME__ << endl;

     if (mapFileName == "" || importlib == "")
@@ -865,7 +874,8 @@ int main(int argC, char* argV[])
             char**  new_argv = new char *[3];
             size_t  new_argc = 0;
             new_argv[0] = "createDLL";
-            new_argv[1] = "@C:\\response.txt";
+ std::string new_argv1 = "@" + getTempPath() + "response.txt";
+            new_argv[1] = const_cast<char*>( new_argv1.c_str() );
             new_argv[2] = 0;

             int status = -1;


--
Best regards,
Pavel Burov <address@hidden>


_______________________________________________
Openexr-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/openexr-devel







reply via email to

[Prev in Thread] Current Thread [Next in Thread]