Index: backend/port/win32/signal.c
===================================================================
--- backend/port/win32/signal.c	(HEAD)
+++ backend/port/win32/signal.c	(working copy)
@@ -251,7 +251,7 @@
 	char		pipename[128];
 	HANDLE		pipe = pgwin32_initial_signal_pipe;
 
-	snprintf(pipename, sizeof(pipename), "\\\\.\\pipe\\pgsignal_%u", GetCurrentProcessId());
+	snprintf(pipename, sizeof(pipename), "\\\\.\\pipe\\pgsignal_%u", (unsigned) GetCurrentProcessId());
 
 	for (;;)
 	{
Index: port/exec.c
===================================================================
--- port/exec.c	(revision 1820)
+++ port/exec.c	(working copy)
@@ -57,6 +57,7 @@
 
 #ifdef WIN32
 static BOOL GetUserSid(PSID * ppSidUser, HANDLE hToken);
+#define GetLastError()		((unsigned) GetLastError())
 #endif
 
 /*
@@ -695,7 +696,6 @@
 	DWORD		dwNewAclSize;
 	DWORD		dwSize = 0;
 	DWORD		dwTokenInfoLength = 0;
-	DWORD		dwResult = 0;
 	HANDLE		hToken = NULL;
 	PACL		pacl = NULL;
 	PSID		psidUser = NULL;
@@ -719,7 +719,7 @@
 			ptdd = (TOKEN_DEFAULT_DACL *) LocalAlloc(LPTR, dwSize);
 			if (ptdd == NULL)
 			{
-				log_error("could not allocate %i bytes of memory", dwSize);
+				log_error("could not allocate %ui bytes of memory", (unsigned) dwSize);
 				goto cleanup;
 			}
 
@@ -759,7 +759,7 @@
 	pacl = (PACL) LocalAlloc(LPTR, dwNewAclSize);
 	if (pacl == NULL)
 	{
-		log_error("could not allocate %i bytes of memory", dwNewAclSize);
+		log_error("could not allocate %ui bytes of memory", (unsigned) dwNewAclSize);
 		goto cleanup;
 	}
 
@@ -828,8 +828,6 @@
 GetUserSid(PSID * ppSidUser, HANDLE hToken)
 {
 	DWORD		dwLength;
-	DWORD		cbName = 250;
-	DWORD		cbDomainName = 250;
 	PTOKEN_USER pTokenUser = NULL;
 
 
@@ -845,7 +843,7 @@
 
 			if (pTokenUser == NULL)
 			{
-				log_error("could not allocate %ui bytes of memory", dwLength);
+				log_error("could not allocate %ui bytes of memory", (unsigned) dwLength);
 				return FALSE;
 			}
 		}
