Fixed some problems found while compiling and linking Wine under
Cygwin.

diff --git a/configure b/configure
index bf4dd7d..13198bc 100755
--- a/configure
+++ b/configure
@@ -13875,6 +13875,7 @@
 
 
 
+
 for ac_header in \
 	arpa/inet.h \
 	arpa/nameser.h \
@@ -13904,6 +13905,7 @@
 	netinet/tcp.h \
 	netinet/tcp_fsm.h \
 	openssl/ssl.h \
+	process.h \
 	pthread.h \
 	pty.h \
 	pwd.h \
diff --git a/configure.ac b/configure.ac
index b8852ec..850eb78 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1020,6 +1020,7 @@
 	netinet/tcp.h \
 	netinet/tcp_fsm.h \
 	openssl/ssl.h \
+	process.h \
 	pthread.h \
 	pty.h \
 	pwd.h \
diff --git a/dlls/gdi/Makefile.in b/dlls/gdi/Makefile.in
index 9924bf4..d27c993 100644
--- a/dlls/gdi/Makefile.in
+++ b/dlls/gdi/Makefile.in
@@ -4,7 +4,7 @@
 SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 MODULE    = gdi32.dll
-IMPORTS   = advapi32 kernel32
+IMPORTS   = advapi32 kernel32 ntdll
 ALTNAMES  = gdi.exe dispdib.dll wing.dll
 EXTRAINCL = @FREETYPEINCL@
 EXTRALIBS = $(LIBUNICODE) @ICULIBS@
diff --git a/dlls/iphlpapi/ifenum.c b/dlls/iphlpapi/ifenum.c
index be88f5a..052fa49 100644
--- a/dlls/iphlpapi/ifenum.c
+++ b/dlls/iphlpapi/ifenum.c
@@ -565,34 +565,48 @@
 
       switch (ifr.ifr_hwaddr.sa_family)
       {
+#ifdef ARPHRD_LOOPBACK
         case ARPHRD_LOOPBACK:
           addrLen = 0;
           *type = MIB_IF_TYPE_LOOPBACK;
           break;
+#endif
+#ifdef ARPHRD_ETHER
         case ARPHRD_ETHER:
           addrLen = ETH_ALEN;
           *type = MIB_IF_TYPE_ETHERNET;
           break;
+#endif
+#ifdef ARPHRD_FDDI
         case ARPHRD_FDDI:
           addrLen = ETH_ALEN;
           *type = MIB_IF_TYPE_FDDI;
           break;
+#endif
+#ifdef ARPHRD_IEEE802
         case ARPHRD_IEEE802: /* 802.2 Ethernet && Token Ring, guess TR? */
           addrLen = ETH_ALEN;
           *type = MIB_IF_TYPE_TOKENRING;
           break;
+#endif
+#ifdef ARPHRD_IEEE802_TR
         case ARPHRD_IEEE802_TR: /* also Token Ring? */
           addrLen = ETH_ALEN;
           *type = MIB_IF_TYPE_TOKENRING;
           break;
+#endif
+#ifdef ARPHRD_SLIP
         case ARPHRD_SLIP:
           addrLen = 0;
           *type = MIB_IF_TYPE_SLIP;
           break;
+#endif
+#ifdef ARPHRD_PPP
         case ARPHRD_PPP:
           addrLen = 0;
           *type = MIB_IF_TYPE_PPP;
           break;
+#endif
         default:
           addrLen = min(MAX_INTERFACE_PHYSADDR, sizeof(ifr.ifr_hwaddr.sa_data));
           *type = MIB_IF_TYPE_OTHER;
diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c
index 4de13a4..4499dd3 100644
--- a/dlls/iphlpapi/ipstats.c
+++ b/dlls/iphlpapi/ipstats.c
@@ -686,11 +686,16 @@
           if (ptr && *ptr) {
             DWORD flags = strtoul(ptr, &endPtr, 16);
 
+#ifdef ATF_COM
             if (flags & ATF_COM)
               ret->table[ret->dwNumEntries].dwType = MIB_IPNET_TYPE_DYNAMIC;
-            else if (flags & ATF_PERM)
+            else
+#endif
+#ifdef ATF_PERM
+            if (flags & ATF_PERM)
               ret->table[ret->dwNumEntries].dwType = MIB_IPNET_TYPE_STATIC;
             else
+#endif
               ret->table[ret->dwNumEntries].dwType = MIB_IPNET_TYPE_OTHER;
 
             ptr = endPtr;
diff --git a/dlls/mshtml/mshtml.spec b/dlls/mshtml/mshtml.spec
index a5effc0..c233908 100644
--- a/dlls/mshtml/mshtml.spec
+++ b/dlls/mshtml/mshtml.spec
@@ -10,7 +10,7 @@
 9 stub DllUnregisterServer
 10 stub MatchExactGetIDsOfNames
 11 stub RNIGetCompatibleVersion
-12 stdcall RunHTMLApplication()
+12 stdcall RunHTMLApplication(long long str long)
 13 stub ShowHTMLDialog
 14 stub ShowModalDialog
 15 stub ShowModelessHTMLDialog
diff --git a/dlls/msi/msi.spec b/dlls/msi/msi.spec
index 8915521..c3562fd 100644
--- a/dlls/msi/msi.spec
+++ b/dlls/msi/msi.spec
@@ -28,13 +28,13 @@
 28 stdcall MsiDatabaseImportW(wstr wstr)
 29 stub MsiDatabaseMergeA
 30 stub MsiDatabaseMergeW
-31 stdcall MsiDatabaseOpenViewA(str ptr)
-32 stdcall MsiDatabaseOpenViewW(wstr ptr)
+31 stdcall MsiDatabaseOpenViewA(long str ptr)
+32 stdcall MsiDatabaseOpenViewW(long wstr ptr)
 33 stdcall MsiDoActionA(long str)
 34 stdcall MsiDoActionW(long wstr)
 35 stub MsiEnableUIPreview
-36 stdcall MsiEnumClientsA(long ptr)
-37 stdcall MsiEnumClientsW(long ptr)
+36 stdcall MsiEnumClientsA(str long ptr)
+37 stdcall MsiEnumClientsW(wstr long ptr)
 38 stdcall MsiEnumComponentQualifiersA(str long str ptr str ptr)
 39 stdcall MsiEnumComponentQualifiersW(wstr long wstr ptr wstr ptr)
 40 stdcall MsiEnumComponentsA(long ptr)
@@ -74,8 +74,8 @@
 74 stub MsiGetPropertyW
 75 stub MsiGetSourcePathA
 76 stub MsiGetSourcePathW
-77 stdcall MsiGetSummaryInformationA(str long ptr)
-78 stdcall MsiGetSummaryInformationW(wstr long ptr)
+77 stdcall MsiGetSummaryInformationA(long str long ptr)
+78 stdcall MsiGetSummaryInformationW(long wstr long ptr)
 79 stub MsiGetTargetPathA
 80 stub MsiGetTargetPathW
 81 stub MsiGetUserInfoA
diff --git a/dlls/rpcrt4/Makefile.in b/dlls/rpcrt4/Makefile.in
index 6211490..a244caf 100644
--- a/dlls/rpcrt4/Makefile.in
+++ b/dlls/rpcrt4/Makefile.in
@@ -4,7 +4,7 @@
 SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 MODULE    = rpcrt4.dll
-IMPORTS   = advapi32 kernel32
+IMPORTS   = advapi32 kernel32 ntdll
 EXTRALIBS = $(LIBUUID)
 
 C_SRCS = \
diff --git a/dlls/wininet/Makefile.in b/dlls/wininet/Makefile.in
index 42c8059..b5f6cef 100644
--- a/dlls/wininet/Makefile.in
+++ b/dlls/wininet/Makefile.in
@@ -4,7 +4,7 @@
 SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 MODULE    = wininet.dll
-IMPORTS   = mpr shlwapi shell32 user32 advapi32 kernel32
+IMPORTS   = mpr shlwapi shell32 user32 advapi32 kernel32 ntdll
 EXTRALIBS = $(LIBUNICODE)
 
 C_SRCS = \
diff --git a/dlls/wininet/internet.h b/dlls/wininet/internet.h
index 22e6962..acb1b66 100644
--- a/dlls/wininet/internet.h
+++ b/dlls/wininet/internet.h
@@ -36,6 +36,9 @@
 # include <openssl/ssl.h>
 #undef DSA
 #endif
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
 
 /* used for netconnection.c stuff */
 typedef struct
diff --git a/dlls/winsock/socket.c b/dlls/winsock/socket.c
index f708d01..d3dce46 100644
--- a/dlls/winsock/socket.c
+++ b/dlls/winsock/socket.c
@@ -283,7 +283,9 @@
     MAP_OPTION( IP_ADD_MEMBERSHIP ),
     MAP_OPTION( IP_DROP_MEMBERSHIP ),
     MAP_OPTION( IP_OPTIONS ),
+#ifdef IP_HDRINCL
     MAP_OPTION( IP_HDRINCL ),
+#endif
     MAP_OPTION( IP_TOS ),
     MAP_OPTION( IP_TTL ),
     { 0, 0 }
@@ -2032,8 +2034,10 @@
                            intArray->iiFlags = 0;
                            if (ifInfo.ifr_flags & IFF_BROADCAST)
                               intArray->iiFlags |= WS_IFF_BROADCAST;
+#ifdef IFF_POINTOPOINT
                            if (ifInfo.ifr_flags & IFF_POINTOPOINT)
                               intArray->iiFlags |= WS_IFF_POINTTOPOINT;
+#endif
                            if (ifInfo.ifr_flags & IFF_LOOPBACK)
                               intArray->iiFlags |= WS_IFF_LOOPBACK;
                            if (ifInfo.ifr_flags & IFF_UP)
diff --git a/include/config.h.in b/include/config.h.in
index acb44f4..62f75c1 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -395,6 +395,9 @@
 /* Define to 1 if you have the `pread' function. */
 #undef HAVE_PREAD
 
+/* Define to 1 if you have the <process.h> header file. */
+#undef HAVE_PROCESS_H
+
 /* Define to 1 if you have the <pthread.h> header file. */
 #undef HAVE_PTHREAD_H
 
diff --git a/include/wine/port.h b/include/wine/port.h
index fb96b39..44d4638 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -36,6 +36,9 @@
 #ifdef HAVE_IO_H
 # include <io.h>
 #endif
+#ifdef HAVE_PROCESS_H
+# include <process.h>
+#endif
 #include <string.h>
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
diff --git a/libs/wine/wine.def b/libs/wine/wine.def
index 148037b..97e19f0 100644
--- a/libs/wine/wine.def
+++ b/libs/wine/wine.def
@@ -11,6 +11,7 @@
     __wine_dll_register
     __wine_main_argc
     __wine_main_argv
+    __wine_main_environ
     __wine_main_wargv
     wine_anon_mmap
     wine_dbg_add_option
@@ -29,6 +30,7 @@
     wine_dll_unload
     wine_dlopen
     wine_dlsym
+    wine_get_argv0_path
     wine_get_config_dir
     wine_get_cs
     wine_get_ds
@@ -50,5 +52,8 @@
     wine_ldt_init_locking
     wine_ldt_realloc_entries
     wine_ldt_set_entry
+    wine_pthread_init_process
+    wine_pthread_init_thread
     wine_set_fs
     wine_set_gs
+    wine_switch_to_stack