Index: trunk/zoo-project/zoo-kernel/zoo_service_loader.c
===================================================================
--- trunk/zoo-project/zoo-kernel/zoo_service_loader.c	(revision 931)
+++ trunk/zoo-project/zoo-kernel/zoo_service_loader.c	(revision 943)
@@ -509,5 +509,5 @@
 #ifdef WIN32
       HINSTANCE so =
-        LoadLibraryEx (tmps1, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
+        LoadLibraryEx (tmps1, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);						
 #else
       void *so = dlopen (tmps1, RTLD_LAZY);
@@ -974,5 +974,5 @@
 runRequest (map ** inputs)
 {
- 
+	
 #ifndef USE_GDB
 #ifndef WIN32
@@ -1282,5 +1282,4 @@
 
 
-
   service *s1;
   int scount = 0;
@@ -1327,7 +1326,7 @@
 #endif
   }
-
+  
   if (strncasecmp (REQUEST, "GetCapabilities", 15) == 0)
-    {
+    {	
 #ifdef DEBUG
       dumpMap (r_inputs);
@@ -1397,5 +1396,5 @@
     }
   else
-    {
+    {	  
       r_inputs = getMap (request_inputs, "JobId");
       if(reqId>nbReqIdentifier){
@@ -1533,5 +1532,5 @@
 			  s1 = createService();
 			  t = readServiceFile (m, import->value, &s1, import->name);
-                
+
 			  if (t < 0) // failure reading zcfg
 			    {
@@ -1589,8 +1588,8 @@
 			/**
 			 * No support for dot in service name stored in metadb!?
-			 #ifdef META_DB
+		//	 #ifdef META_DB
 			 service* s2=extractServiceFromDb(m,tmpMapI->value,0);
 			 if(s2==NULL){
-			 #endif
+		//	 #endif
 			*/
 			s1 = createService();
@@ -1811,5 +1810,5 @@
 	  }
 	else if (strncasecmp (REQUEST, "Execute", strlen (REQUEST)) != 0)
-	  {
+	  {	  
 	    map* version=getMapFromMaps(m,"main","rversion");
 	    int vid=getVersionId(version->value);	    
@@ -1868,5 +1867,5 @@
       }
     }
-
+	
   map *postRequest = NULL;
   postRequest = getMap (request_inputs, "xrequest");
@@ -1951,5 +1950,5 @@
 			       "InternalError", NULL);
       }
-
+  
     int saved_stdout = zDup (fileno (stdout));
     zDup2 (fileno (stderr), fileno (stdout));
@@ -2084,5 +2083,5 @@
   dumpMap (request_inputs);
 #endif
-
+  
   map *status = getMap (request_inputs, "status");
   if(vid==0){
@@ -2165,5 +2164,5 @@
   int eres = SERVICE_STARTED;
   int cpid = zGetpid ();
-
+  
   // Create a map containing a copy of the request map
   maps *_tmpMaps = createMaps("request");
@@ -2219,5 +2218,5 @@
   else
     addToMap (_tmpMaps->content, "soap", "false");
-
+  
   // Parse the session file and add it to the main maps
   char* originalCookie=NULL;
@@ -2270,23 +2269,35 @@
 #endif
   int ei = 1;
-  
+ 
+  _tmpMaps = createMaps("renv");	
+
 #ifdef WIN32
   LPVOID orig = GetEnvironmentStrings();
   LPTSTR s = (LPTSTR) orig;
+  
+  while (*s != NULL) {
+    char* env = strdup(s);
+    char* delim = strchr(env,'=');
+    if (delim != NULL) {
+      char* val = delim+1;
+      *delim = '\0';		
+      if(_tmpMaps->content == NULL) {
+        _tmpMaps->content = createMap(env,val);
+      }
+      else {
+        addToMap(_tmpMaps->content,env,val);
+      }			
+    }
+    s += strlen(s)+1;
+  } 
+  FreeEnvironmentStrings((LPCH)orig);	
 #else
   char **orig = environ;
   char *s=*orig;
-#endif
-
-  _tmpMaps = createMaps("renv");
-if(orig!=NULL)
-  for (; 
-#ifdef WIN32
-       *s;
-       s++
-#else
+  
+  if(orig!=NULL)
+    for (; 
        s;
        ei++
-#endif
        ) {
     if(strstr(s,"=")!=NULL && strlen(strstr(s,"="))>1){
@@ -2303,8 +2314,8 @@
       free(tmpName);
     }
-#ifndef WIN32
     s = *(orig+ei);
-#endif
-  }
+  }  
+#endif
+ 
   if(_tmpMaps->content!=NULL && getMap(_tmpMaps->content,"HTTP_COOKIE")!=NULL){
     addToMap(_tmpMaps->content,"HTTP_COOKIE1",&cgiCookie[0]);
@@ -2313,7 +2324,5 @@
   freeMaps (&_tmpMaps);
   free (_tmpMaps);
-#ifdef WIN32
-  FreeEnvironmentStrings((LPCH)orig);
-#endif
+
   if(postRequest!=NULL)
     setMapInMaps (m, "renv", "xrequest", postRequest->value);
@@ -2351,4 +2360,5 @@
   if (status == NULLMAP)
     {
+	  
       if(validateRequest(&m,s1,request_inputs, &request_input_real_format,&request_output_real_format,&hInternet)<0){
 	freeService (&s1);
