Index: /trunk/zoo-project/zoo-kernel/makefile.vc
===================================================================
--- /trunk/zoo-project/zoo-kernel/makefile.vc	(revision 450)
+++ /trunk/zoo-project/zoo-kernel/makefile.vc	(revision 451)
@@ -6,8 +6,4 @@
 #
 
-!IF DEFINED(MS_DIR)
-MS_BASE=$(MS_DIR)
-!INCLUDE $(MS_DIR)\nmake.opt
-!ENDIF
 !INCLUDE nmake.opt
 
Index: /trunk/zoo-project/zoo-kernel/nmake.opt
===================================================================
--- /trunk/zoo-project/zoo-kernel/nmake.opt	(revision 450)
+++ /trunk/zoo-project/zoo-kernel/nmake.opt	(revision 451)
@@ -2,4 +2,9 @@
 CC=cl $(CFLAGS)
 CPP=cl /TP $(CFLAGS)
+
+!IF DEFINED(MS_DIR)
+MS_BASE=$(MS_DIR)
+!INCLUDE $(MS_DIR)\nmake.opt
+!ENDIF
 
 !IFDEF JS_DIR
@@ -36,5 +41,5 @@
 PYTHON_CPATH=$(PY_DIR)
 
-CFLAGS=$(MS_DEFS) $(INCLUDES) $(CFLAGS1) /nologo /MD /W3 /EHsc /Ox /D_CRT_SECURE_NO_WARNINGS /DWIN32 $(CJFLAGS) -I$(ZOOK_DIR) -I./ $(JAVA_CFLAGS) $(MS_CFLAGS) -I$(TROOT)\..\..\thirds\dirent-win32 -I$(INTL_DIR) -I$(CURL_DIR)\include -I$(XML2_DIR)\include -I$(GDAL_DIR)\port $(JS_CFLAGS) -I$(GDAL_DIR)\ogr -I$(GDAL_DIR)\gcore -I$(GD_DIR) -I$(ICONV_DIR) -I$(TROOT)\..\..\thirds\include -I$(TROOT)\..\..\thirds\cgic206 -I$(PYTHON_CPATH)\include -I$(SSL_DIR)/inc32 -I$(FCGI_DIR)\include $(PY_CFLAGS) -DLINUX_FREE_ISSUE #-DDEBUG #-DDEBUG_SERVICE_CONF
+CFLAGS=/traceback  $(MS_DEFS) $(INCLUDES) $(CFLAGS1) /nologo /MD /W3 /EHsc /Ox /D_CRT_SECURE_NO_WARNINGS /DWIN32 $(CJFLAGS) -I$(ZOOK_DIR) -I./ $(JAVA_CFLAGS) $(MS_CFLAGS) -I$(TROOT)\..\..\thirds\dirent-win32 -I$(INTL_DIR) -I$(CURL_DIR)\include -I$(XML2_DIR)\include -I$(GDAL_DIR)\port $(JS_CFLAGS) -I$(GDAL_DIR)\ogr -I$(GDAL_DIR)\gcore -I$(GD_DIR) -I$(ICONV_DIR) -I$(TROOT)\..\..\thirds\include -I$(TROOT)\..\..\thirds\cgic206 -I$(PYTHON_CPATH)\include -I$(SSL_DIR)/inc32 -I$(FCGI_DIR)\include $(PY_CFLAGS) -DLINUX_FREE_ISSUE #-DDEBUG #-DDEBUG_SERVICE_CONF
 
 LDFLAGSCGI=$(TROOT)/../../thirds/cgic206/libcgic.lib 
Index: /trunk/zoo-project/zoo-kernel/service_internal.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/service_internal.c	(revision 450)
+++ /trunk/zoo-project/zoo-kernel/service_internal.c	(revision 451)
@@ -2610,5 +2610,5 @@
     fcontent[res.nDataLen]=0;
     fsize=res.nDataLen;
-    mimeType=res.mimeType;
+    mimeType=(char*)res.mimeType;
   }
   if(fsize==0){
Index: /trunk/zoo-project/zoo-kernel/service_internal_ms.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/service_internal_ms.c	(revision 450)
+++ /trunk/zoo-project/zoo-kernel/service_internal_ms.c	(revision 451)
@@ -211,62 +211,62 @@
   map* msSrs=NULL;
   hSRS = OSRNewSpatialReference(NULL);
-  if( pszProjection!=NULL && strlen(pszProjection)>1 &&
-      OSRImportFromWkt( hSRS, &pszProjection ) == CE_None ){
-    char *proj4Str=NULL;
-    if(OSRGetAuthorityName(hSRS,NULL)!=NULL && 
-       OSRGetAuthorityCode(hSRS,NULL)!=NULL){
-      char tmpSrs[20];
-      sprintf(tmpSrs,"%s:%s",
-	      OSRGetAuthorityName(hSRS,NULL),OSRGetAuthorityCode(hSRS,NULL));
-      msLoadProjectionStringEPSG(&m->projection,tmpSrs);
-      msLoadProjectionStringEPSG(&myLayer->projection,tmpSrs);
-      
-      char tmpSrss[256];
-      sprintf(tmpSrss,"EPSG:4326 EPSG:900913 %s",tmpSrs);
-
-      msInsertHashTable(&(m->web.metadata), "ows_srs", tmpSrss);
-      msInsertHashTable(&(myLayer->metadata), "ows_srs", tmpSrss);
-
-#ifdef DEBUGMS
-      fprintf(stderr,"isGeo %b\n\n",OSRIsGeographic(hSRS)==TRUE);
-#endif
-      if(output!=NULL){
-	if(OSRIsGeographic(hSRS)==TRUE)
-	  addToMap(output->content,"crs_isGeographic","true");
-	else
-	  addToMap(output->content,"crs_isGeographic","false");
-	addToMap(output->content,"crs",tmpSrs);
-      }
-    }
-    else{
-      OSRExportToProj4(hSRS,&proj4Str);
-      if(proj4Str!=NULL){
-#ifdef DEBUGMS
-	fprintf(stderr,"PROJ (%s)\n",proj4Str);
-#endif
-	msLoadProjectionString(&(m->projection),proj4Str);
-	msLoadProjectionString(&(myLayer->projection),proj4Str);
-	if(output!=NULL){ 
+  if( pszProjection!=NULL && strlen(pszProjection)>1){
+    if(OSRImportFromWkt( hSRS, &pszProjection ) == CE_None ){
+      char *proj4Str=NULL;
+      if(OSRGetAuthorityName(hSRS,NULL)!=NULL && 
+	 OSRGetAuthorityCode(hSRS,NULL)!=NULL){
+	char tmpSrs[20];
+	sprintf(tmpSrs,"%s:%s",
+		OSRGetAuthorityName(hSRS,NULL),OSRGetAuthorityCode(hSRS,NULL));
+	msLoadProjectionStringEPSG(&m->projection,tmpSrs);
+	msLoadProjectionStringEPSG(&myLayer->projection,tmpSrs);
+	
+	char tmpSrss[256];
+	sprintf(tmpSrss,"EPSG:4326 EPSG:900913 %s",tmpSrs);
+	
+	msInsertHashTable(&(m->web.metadata), "ows_srs", tmpSrss);
+	msInsertHashTable(&(myLayer->metadata), "ows_srs", tmpSrss);
+	
+#ifdef DEBUGMS
+	fprintf(stderr,"isGeo %b\n\n",OSRIsGeographic(hSRS)==TRUE);
+#endif
+	if(output!=NULL){
 	  if(OSRIsGeographic(hSRS)==TRUE)
 	    addToMap(output->content,"crs_isGeographic","true");
 	  else
 	    addToMap(output->content,"crs_isGeographic","false");
+	  addToMap(output->content,"crs",tmpSrs);
 	}
       }
       else{
-	msLoadProjectionStringEPSG(&m->projection,"EPSG:4326");
-	msLoadProjectionStringEPSG(&myLayer->projection,"EPSG:4326");
+	OSRExportToProj4(hSRS,&proj4Str);
+	fprintf(stderr,"Debug WKT: %s \n",proj4Str);
+	if(proj4Str!=NULL){
+#ifdef DEBUGMS
+	  fprintf(stderr,"PROJ (%s)\n",proj4Str);
+#endif
+	  msLoadProjectionString(&(m->projection),proj4Str);
+	  msLoadProjectionString(&(myLayer->projection),proj4Str);
+	  if(output!=NULL){ 
+	    if(OSRIsGeographic(hSRS)==TRUE)
+	      addToMap(output->content,"crs_isGeographic","true");
+	    else
+	      addToMap(output->content,"crs_isGeographic","false");
+	  }
+	}
+	else{
+	  msLoadProjectionStringEPSG(&m->projection,"EPSG:4326");
+	  msLoadProjectionStringEPSG(&myLayer->projection,"EPSG:4326");
+	  if(output!=NULL){
+	    addToMap(output->content,"crs_isGeographic","true");
+	  }
+	}
 	if(output!=NULL){
-	  addToMap(output->content,"crs_isGeographic","true");
+	  addToMap(output->content,"crs","EPSG:4326");
+	  addToMap(output->content,"real_extent","true");
 	}
+	msInsertHashTable(&(m->web.metadata),"ows_srs", "EPSG:4326 EPSG:900913");
+	msInsertHashTable(&(myLayer->metadata),"ows_srs","EPSG:4326 EPSG:900913");
       }
-      if(output!=NULL){
-	addToMap(output->content,"crs","EPSG:4326");
-        addToMap(output->content,"real_extent","true");
-      }
-      msInsertHashTable(&(m->web.metadata),"ows_srs", "EPSG:4326 EPSG:900913");
-      msInsertHashTable(&(myLayer->metadata),"ows_srs","EPSG:4326 EPSG:900913");
-
-
     }
   }
@@ -684,5 +684,5 @@
   }
 #ifdef DEBUGMS
-    fprintf(stderr,"Accessing the DataSource %s %d\n",pszFilename,__LINE__);
+  fprintf(stderr,"Accessing the DataSource %s %d\n",pszFilename,__LINE__);
 #endif
 
@@ -696,4 +696,5 @@
     return -1;
   }
+  m->layers[m->numlayers]->index=m->numlayers;
 
   layerObj* myLayer=m->layers[m->numlayers];
@@ -714,4 +715,5 @@
   if(tmpMap!=NULL)
     abstract=tmpMap->value;
+
   msInsertHashTable(&(myLayer->metadata), "ows_label", title);
   msInsertHashTable(&(myLayer->metadata), "ows_title", title);
Index: /trunk/zoo-project/zoo-kernel/service_internal_python.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/service_internal_python.c	(revision 450)
+++ /trunk/zoo-project/zoo-kernel/service_internal_python.c	(revision 451)
@@ -113,4 +113,6 @@
 
 int zoo_python_support(maps** main_conf,map* request,service* s,maps **real_inputs,maps **real_outputs){
+  char *pythonpath;
+  char *python_path;
   maps* m=*main_conf;
   maps* inputs=*real_inputs;
@@ -119,10 +121,9 @@
   char *ntmp=tmp0->value;
   map* tmp=NULL;
+  int hasToClean=0;
   tmp=getMapFromMaps(*main_conf,"env","PYTHONPATH");
-  char *python_path;
 #ifdef DEBUG
   fprintf(stderr,"PYTHON SUPPORT \n");
 #endif
-  fflush(stderr);
   if(tmp!=NULL){
 #ifdef DEBUG
@@ -131,17 +132,17 @@
     python_path=(char*)malloc((strlen(tmp->value))*sizeof(char));
     sprintf(python_path,"%s",tmp->value);
+    hasToClean=1;
   }
   else{
-    python_path=strdup(".");
+    python_path=".";
   }
   tmp=NULL;
   tmp=getMap(request,"metapath");
-  char *pythonpath;//=(char*)malloc((1+strlen(python_path)+2048)*sizeof(char));
   if(tmp!=NULL && strcmp(tmp->value,"")!=0){
     pythonpath=(char*)malloc((4+strlen(python_path)+strlen(ntmp)+strlen(tmp->value))*sizeof(char));
 #ifdef WIN32
-    sprintf(pythonpath,"%s/%s/;%s",ntmp,tmp->value,python_path);
-#else
-    sprintf(pythonpath,"%s/%s/:%s",ntmp,tmp->value,python_path);
+  sprintf(pythonpath,"%s/%s/;%s",ntmp,tmp->value,python_path);
+#else
+  sprintf(pythonpath,"%s/%s/:%s",ntmp,tmp->value,python_path);
 #endif
   }
@@ -164,6 +165,8 @@
   sprintf(toto,"PYTHONPATH=%s",pythonpath);
   putenv(toto);
-#endif
-  free(python_path);
+  free(toto);
+#endif
+  if(hasToClean>0)
+    free(python_path);
   free(pythonpath);
 
