NULL, NULL, "RPCSS\0", register_username, register_password)) == NULL)
{
CloseServiceHandle(hSCM);
- write_stderr(_("%s: could not register service \"%s\": error code %lu\n"), progname, register_servicename, GetLastError());
+ write_stderr(_("%s: could not register service \"%s\": error code %lu\n"),
+ progname, register_servicename,
+ (unsigned long) GetLastError());
exit(1);
}
CloseServiceHandle(hService);
if ((hService = OpenService(hSCM, register_servicename, DELETE)) == NULL)
{
CloseServiceHandle(hSCM);
- write_stderr(_("%s: could not open service \"%s\": error code %lu\n"), progname, register_servicename, GetLastError());
+ write_stderr(_("%s: could not open service \"%s\": error code %lu\n"),
+ progname, register_servicename,
+ (unsigned long) GetLastError());
exit(1);
}
if (!DeleteService(hService))
{
CloseServiceHandle(hService);
CloseServiceHandle(hSCM);
- write_stderr(_("%s: could not unregister service \"%s\": error code %lu\n"), progname, register_servicename, GetLastError());
+ write_stderr(_("%s: could not unregister service \"%s\": error code %lu\n"),
+ progname, register_servicename,
+ (unsigned long) GetLastError());
exit(1);
}
CloseServiceHandle(hService);
if (StartServiceCtrlDispatcher(st) == 0)
{
- write_stderr(_("%s: could not start service \"%s\": error code %lu\n"), progname, register_servicename, GetLastError());
+ write_stderr(_("%s: could not start service \"%s\": error code %lu\n"),
+ progname, register_servicename,
+ (unsigned long) GetLastError());
exit(1);
}
}
/* Open the current token to use as a base for the restricted one */
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ALL_ACCESS, &origToken))
{
- write_stderr(_("%s: could not open process token: error code %lu\n"), progname, GetLastError());
+ /*
+ * Most Windows targets make DWORD a 32-bit unsigned long. Cygwin
+ * x86_64, an LP64 target, makes it a 32-bit unsigned int. In code
+ * built for Cygwin as well as for native Windows targets, cast DWORD
+ * before printing.
+ */
+ write_stderr(_("%s: could not open process token: error code %lu\n"),
+ progname, (unsigned long) GetLastError());
return 0;
}
SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_POWER_USERS, 0, 0, 0, 0, 0,
0, &dropSids[1].Sid))
{
- write_stderr(_("%s: could not allocate SIDs: error code %lu\n"), progname, GetLastError());
+ write_stderr(_("%s: could not allocate SIDs: error code %lu\n"),
+ progname, (unsigned long) GetLastError());
return 0;
}
if (!b)
{
- write_stderr(_("%s: could not create restricted token: error code %lu\n"), progname, GetLastError());
+ write_stderr(_("%s: could not create restricted token: error code %lu\n"),
+ progname, (unsigned long) GetLastError());
return 0;
}
HANDLE job;
char jobname[128];
- sprintf(jobname, "PostgreSQL_%lu", processInfo->dwProcessId);
+ sprintf(jobname, "PostgreSQL_%lu",
+ (unsigned long) processInfo->dwProcessId);
job = _CreateJobObject(NULL, jobname);
if (job)