mirror of
https://github.com/winfsp/winfsp.git
synced 2025-06-07 20:42:09 -05:00
launcher, launchctl: ensure that they build under all platforms/configurations
This commit is contained in:
parent
c1985bef6c
commit
9971472be7
@ -19,11 +19,11 @@
|
||||
|
||||
#define PROGNAME "launchctl"
|
||||
|
||||
#define info(format, ...) log(GetStdHandle(STD_OUTPUT_HANDLE), format, __VA_ARGS__)
|
||||
#define warn(format, ...) log(GetStdHandle(STD_ERROR_HANDLE), format, __VA_ARGS__)
|
||||
#define info(format, ...) printlog(GetStdHandle(STD_OUTPUT_HANDLE), format, __VA_ARGS__)
|
||||
#define warn(format, ...) printlog(GetStdHandle(STD_ERROR_HANDLE), format, __VA_ARGS__)
|
||||
#define fatal(ExitCode, format, ...) (warn(format, __VA_ARGS__), ExitProcess(ExitCode))
|
||||
|
||||
static void vlog(HANDLE h, const char *format, va_list ap)
|
||||
static void vprintlog(HANDLE h, const char *format, va_list ap)
|
||||
{
|
||||
char buf[1024];
|
||||
/* wvsprintf is only safe with a 1024 byte buffer */
|
||||
@ -39,12 +39,12 @@ static void vlog(HANDLE h, const char *format, va_list ap)
|
||||
WriteFile(h, buf, (DWORD)len, &BytesTransferred, 0);
|
||||
}
|
||||
|
||||
static void log(HANDLE h, const char *format, ...)
|
||||
static void printlog(HANDLE h, const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
vlog(h, format, ap);
|
||||
vprintlog(h, format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@ NTSTATUS SvcInstanceCreate(HANDLE ClientToken,
|
||||
HKEY RegKey = 0;
|
||||
DWORD RegResult, RegSize;
|
||||
DWORD ClassNameSize, InstanceNameSize;
|
||||
WCHAR Executable[MAX_PATH], CommandLineBuf[512] = L"%0 ", SecurityBuf[512] = L"O:SYG:SY";
|
||||
WCHAR Executable[MAX_PATH], CommandLineBuf[512], SecurityBuf[512];
|
||||
PWSTR CommandLine, Security;
|
||||
DWORD JobControl;
|
||||
PSECURITY_DESCRIPTOR SecurityDescriptor;
|
||||
@ -250,10 +250,12 @@ NTSTATUS SvcInstanceCreate(HANDLE ClientToken,
|
||||
|
||||
*PSvcInstance = 0;
|
||||
|
||||
lstrcpyW(CommandLineBuf, L"%0 ");
|
||||
lstrcpyW(SecurityBuf, L"O:SYG:SY");
|
||||
|
||||
if (Argc > sizeof Argv / sizeof Argv[0] - 1)
|
||||
Argc = sizeof Argv / sizeof Argv[0] - 1;
|
||||
for (ULONG Argi = 0; Argc > Argi; Argi++)
|
||||
Argv[Argi + 1] = Argv0[Argi];
|
||||
memcpy(Argv + 1, Argv0, Argc * sizeof(PWSTR));
|
||||
Argv[0] = 0;
|
||||
Argc++;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user