Index: Makefile.global.in
===================================================================
RCS file: /projects/cvsroot/pgsql/src/Makefile.global.in,v
retrieving revision 1.208
diff -c -r1.208 Makefile.global.in
*** Makefile.global.in	19 Dec 2004 02:16:18 -0000	1.208
--- Makefile.global.in	24 Jan 2005 18:38:47 -0000
***************
*** 384,392 ****
  endif
  endif

! # to make ws2_32.lib the last library
  ifeq ($(PORTNAME),win32)
! LIBS += -lws2_32
  endif

  # Not really standard libc functions, used by the backend.
--- 384,393 ----
  endif
  endif

! # to make ws2_32.lib the last library, and always link with shfolder,
! # so SHGetFolderName isn't picked up from shell32.dll
  ifeq ($(PORTNAME),win32)
! LIBS += -lws2_32 -lshfolder
  endif

  # Not really standard libc functions, used by the backend.
Index: bin/psql/win32.mak
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/psql/win32.mak,v
retrieving revision 1.25
diff -c -r1.25 win32.mak
*** bin/psql/win32.mak	28 Sep 2004 16:17:26 -0000	1.25
--- bin/psql/win32.mak	24 Jan 2005 20:47:22 -0000
***************
*** 79,85 ****

  LINK32=link.exe
  LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
!  advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
   odbccp32.lib wsock32.lib /nologo /subsystem:console /incremental:no\
   /pdb:"$(OUTDIR)\psql.pdb" /machine:I386 $(LOPT) /out:"$(OUTDIR)\psql.exe"
  LINK32_OBJS= \
--- 79,85 ----

  LINK32=link.exe
  LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
!  advapi32.lib shfolder.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
   odbccp32.lib wsock32.lib /nologo /subsystem:console /incremental:no\
   /pdb:"$(OUTDIR)\psql.pdb" /machine:I386 $(LOPT) /out:"$(OUTDIR)\psql.exe"
  LINK32_OBJS= \
Index: interfaces/ecpg/ecpglib/Makefile
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/ecpg/ecpglib/Makefile,v
retrieving revision 1.30
diff -c -r1.30 Makefile
*** interfaces/ecpg/ecpglib/Makefile	18 Jan 2005 05:00:17 -0000	1.30
--- interfaces/ecpg/ecpglib/Makefile	24 Jan 2005 18:45:04 -0000
***************
*** 30,35 ****
--- 30,40 ----
  SHLIB_LINK = -L../pgtypeslib -lpgtypes $(libpq) \
  	$(filter -lintl -lssl -lcrypto -lkrb5 -lcrypt -lm, $(LIBS)) $(PTHREAD_LIBS)

+ ifeq ($(PORTNAME), win32)
+ # Link to shfolder.dll instead of shell32.dll
+ SHLIB_LINK += -lshfolder
+ endif
+
  all: all-lib

  # Shared library stuff
Index: interfaces/libpq/Makefile
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/libpq/Makefile,v
retrieving revision 1.127
diff -c -r1.127 Makefile
*** interfaces/libpq/Makefile	18 Jan 2005 05:00:30 -0000	1.127
--- interfaces/libpq/Makefile	24 Jan 2005 18:42:06 -0000
***************
*** 55,61 ****
  # matter.)
  SHLIB_LINK += $(filter -lcrypt -ldes -lkrb -lcom_err -lcrypto -lk5crypto -lkrb5 -lssl -lsocket -lnsl -lresolv -lintl, $(LIBS)) $(PTHREAD_LIBS)
  ifeq ($(PORTNAME), win32)
! SHLIB_LINK += -lwsock32 -lws2_32 -lshell32 $(filter -leay32 -lssleay32, $(LIBS))
  endif


--- 55,61 ----
  # matter.)
  SHLIB_LINK += $(filter -lcrypt -ldes -lkrb -lcom_err -lcrypto -lk5crypto -lkrb5 -lssl -lsocket -lnsl -lresolv -lintl, $(LIBS)) $(PTHREAD_LIBS)
  ifeq ($(PORTNAME), win32)
! SHLIB_LINK += -lshfolder -lwsock32 -lws2_32 $(filter -leay32 -lssleay32, $(LIBS))
  endif


Index: interfaces/libpq/fe-connect.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v
retrieving revision 1.301
diff -c -r1.301 fe-connect.c
*** interfaces/libpq/fe-connect.c	14 Jan 2005 00:25:56 -0000	1.301
--- interfaces/libpq/fe-connect.c	24 Jan 2005 19:59:37 -0000
***************
*** 38,44 ****
  #ifdef _WIN32_IE
  #undef _WIN32_IE
  #endif
! #define _WIN32_IE 0x0400
  #ifdef near
  #undef near
  #endif
--- 38,44 ----
  #ifdef _WIN32_IE
  #undef _WIN32_IE
  #endif
! #define _WIN32_IE 0x0500
  #ifdef near
  #undef near
  #endif
***************
*** 3296,3302 ****
  	char		tmppath[MAX_PATH];

  	ZeroMemory(tmppath, sizeof(tmppath));
! 	if (!SHGetSpecialFolderPath(NULL, tmppath, CSIDL_APPDATA, FALSE))
  		return false;
  	snprintf(buf, bufsize, "%s/postgresql", tmppath);
  	return true;
--- 3296,3302 ----
  	char		tmppath[MAX_PATH];

  	ZeroMemory(tmppath, sizeof(tmppath));
! 	if (SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, tmppath) != S_OK)
  		return false;
  	snprintf(buf, bufsize, "%s/postgresql", tmppath);
  	return true;
Index: interfaces/libpq/win32.mak
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/libpq/win32.mak,v
retrieving revision 1.29
diff -c -r1.29 win32.mak
*** interfaces/libpq/win32.mak	10 Jan 2005 00:19:44 -0000	1.29
--- interfaces/libpq/win32.mak	24 Jan 2005 20:03:26 -0000
***************
*** 138,144 ****
  RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libpq.res"
  
  LINK32=link.exe
! LINK32_FLAGS=kernel32.lib user32.lib advapi32.lib shell32.lib wsock32.lib $(SSL_LIBS)  \
   /nologo /subsystem:windows /dll $(LOPT) /incremental:no\
   /pdb:"$(OUTDIR)\libpqdll.pdb" /machine:I386 /out:"$(OUTDIR)\$(OUTFILENAME).dll"\
   /implib:"$(OUTDIR)\$(OUTFILENAME)dll.lib"  /def:$(OUTFILENAME)dll.def
--- 138,144 ----
  RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libpq.res"
  
  LINK32=link.exe
! LINK32_FLAGS=kernel32.lib user32.lib advapi32.lib shfolder.lib wsock32.lib $(SSL_LIBS)  \
   /nologo /subsystem:windows /dll $(LOPT) /incremental:no\
   /pdb:"$(OUTDIR)\libpqdll.pdb" /machine:I386 /out:"$(OUTDIR)\$(OUTFILENAME).dll"\
   /implib:"$(OUTDIR)\$(OUTFILENAME)dll.lib"  /def:$(OUTFILENAME)dll.def
Index: port/path.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/port/path.c,v
retrieving revision 1.50
diff -c -r1.50 path.c
*** port/path.c	10 Jan 2005 00:19:51 -0000	1.50
--- port/path.c	24 Jan 2005 20:46:44 -0000
***************
*** 21,27 ****
  #ifdef _WIN32_IE
  #undef _WIN32_IE
  #endif
! #define _WIN32_IE 0x0400
  #ifdef near
  #undef near
  #endif
--- 21,27 ----
  #ifdef _WIN32_IE
  #undef _WIN32_IE
  #endif
! #define _WIN32_IE 0x0500
  #ifdef near
  #undef near
  #endif
***************
*** 476,482 ****
  	char		tmppath[MAX_PATH];
  
  	ZeroMemory(tmppath, sizeof(tmppath));
! 	if (!SHGetSpecialFolderPath(NULL, tmppath, CSIDL_APPDATA, FALSE))
  		return false;
  	snprintf(ret_path, MAXPGPATH, "%s/postgresql", tmppath);
  	return true;
--- 476,482 ----
  	char		tmppath[MAX_PATH];

  	ZeroMemory(tmppath, sizeof(tmppath));
! 	if (SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, tmppath) != S_OK)
  		return false;
  	snprintf(ret_path, MAXPGPATH, "%s/postgresql", tmppath);
  	return true;

