summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2005-01-26 19:24:21 +0000
committerTom Lane2005-01-26 19:24:21 +0000
commit9f7331c1cf7aef1f079ab92ed420da2e3ba22542 (patch)
tree5d4a7abedb1c42014f696ffecc0ff9e52a9c4b3f
parent9e34c4d47c1cc36328b19c33344db5ed53b28112 (diff)
Use SHGetFolderPath instead of SHGetSpecialFolderPath to find the
APPDATA directory on Windows. Magnus Hagander
-rw-r--r--src/Makefile.global.in5
-rw-r--r--src/bin/psql/win32.mak2
-rw-r--r--src/interfaces/ecpg/ecpglib/Makefile5
-rw-r--r--src/interfaces/libpq/Makefile2
-rw-r--r--src/interfaces/libpq/fe-connect.c4
-rw-r--r--src/interfaces/libpq/win32.mak2
-rw-r--r--src/port/path.c4
7 files changed, 15 insertions, 9 deletions
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 3c473c6489..9a8b4935d8 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -384,9 +384,10 @@ override LDFLAGS := -L$(top_builddir)/src/port $(LDFLAGS)
endif
endif
-# to make ws2_32.lib the last library
+# 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
+LIBS += -lws2_32 -lshfolder
endif
# Not really standard libc functions, used by the backend.
diff --git a/src/bin/psql/win32.mak b/src/bin/psql/win32.mak
index 64dd1ff312..74df49a05c 100644
--- a/src/bin/psql/win32.mak
+++ b/src/bin/psql/win32.mak
@@ -79,7 +79,7 @@ CPP_SBRS=.
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\
+ 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= \
diff --git a/src/interfaces/ecpg/ecpglib/Makefile b/src/interfaces/ecpg/ecpglib/Makefile
index 4a706916dc..3f939da291 100644
--- a/src/interfaces/ecpg/ecpglib/Makefile
+++ b/src/interfaces/ecpg/ecpglib/Makefile
@@ -30,6 +30,11 @@ OBJS= execute.o typename.o descriptor.o data.o error.o prepare.o memory.o \
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
diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile
index b45f1385a7..4097948655 100644
--- a/src/interfaces/libpq/Makefile
+++ b/src/interfaces/libpq/Makefile
@@ -55,7 +55,7 @@ endif
# 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))
+SHLIB_LINK += -lshfolder -lwsock32 -lws2_32 $(filter -leay32 -lssleay32, $(LIBS))
endif
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index f8ca5fee4f..6c924c2b49 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -38,7 +38,7 @@
#ifdef _WIN32_IE
#undef _WIN32_IE
#endif
-#define _WIN32_IE 0x0400
+#define _WIN32_IE 0x0500
#ifdef near
#undef near
#endif
@@ -3296,7 +3296,7 @@ pqGetHomeDirectory(char *buf, int bufsize)
char tmppath[MAX_PATH];
ZeroMemory(tmppath, sizeof(tmppath));
- if (!SHGetSpecialFolderPath(NULL, tmppath, CSIDL_APPDATA, FALSE))
+ if (SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, tmppath) != S_OK)
return false;
snprintf(buf, bufsize, "%s/postgresql", tmppath);
return true;
diff --git a/src/interfaces/libpq/win32.mak b/src/interfaces/libpq/win32.mak
index 25a30f3487..0377f43b54 100644
--- a/src/interfaces/libpq/win32.mak
+++ b/src/interfaces/libpq/win32.mak
@@ -138,7 +138,7 @@ LIB32_OBJS= \
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) \
+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
diff --git a/src/port/path.c b/src/port/path.c
index d3d374e17e..a992094d4a 100644
--- a/src/port/path.c
+++ b/src/port/path.c
@@ -21,7 +21,7 @@
#ifdef _WIN32_IE
#undef _WIN32_IE
#endif
-#define _WIN32_IE 0x0400
+#define _WIN32_IE 0x0500
#ifdef near
#undef near
#endif
@@ -476,7 +476,7 @@ get_home_path(char *ret_path)
char tmppath[MAX_PATH];
ZeroMemory(tmppath, sizeof(tmppath));
- if (!SHGetSpecialFolderPath(NULL, tmppath, CSIDL_APPDATA, FALSE))
+ if (SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, tmppath) != S_OK)
return false;
snprintf(ret_path, MAXPGPATH, "%s/postgresql", tmppath);
return true;