mirror of
https://github.com/winfsp/winfsp.git
synced 2025-06-14 15:52:47 -05:00
inc: winfsp/launch.h
This commit is contained in:
@ -207,7 +207,7 @@ static NTSTATUS FspFileSystemLauncherDefineDosDevice(
|
||||
Argv[0] = Argv0;
|
||||
Argv[1] = VolumeName;
|
||||
|
||||
Result = FspLaunchCallLauncherPipe('D', 2, Argv, 0, 0, 0, &ErrorCode);
|
||||
Result = FspLaunchCallLauncherPipe(FspLaunchCmdDefineDosDevice, 2, Argv, 0, 0, 0, &ErrorCode);
|
||||
return !NT_SUCCESS(Result) ? Result : FspNtStatusFromWin32(ErrorCode);
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
#include <dll/library.h>
|
||||
#include <launcher/launcher.h>
|
||||
|
||||
FSP_API NTSTATUS FspLaunchCallLauncherPipe(
|
||||
WCHAR Command, ULONG Argc, PWSTR *Argv, ULONG *Argl,
|
||||
@ -31,7 +30,7 @@ FSP_API NTSTATUS FspLaunchCallLauncherPipe(
|
||||
*PSize = 0;
|
||||
*PLauncherError = 0;
|
||||
|
||||
PipeBuf = MemAlloc(LAUNCHER_PIPE_BUFFER_SIZE);
|
||||
PipeBuf = MemAlloc(FSP_LAUNCH_PIPE_BUFFER_SIZE);
|
||||
if (0 == PipeBuf)
|
||||
{
|
||||
Result = STATUS_INSUFFICIENT_RESOURCES;
|
||||
@ -44,7 +43,7 @@ FSP_API NTSTATUS FspLaunchCallLauncherPipe(
|
||||
if (0 != Argv[I])
|
||||
{
|
||||
Length = 0 == Argl || -1 == Argl[I] ? lstrlenW(Argv[I]) : Argl[I];
|
||||
if (LAUNCHER_PIPE_BUFFER_SIZE < ((ULONG)(P - PipeBuf) + Length + 1) * sizeof(WCHAR))
|
||||
if (FSP_LAUNCH_PIPE_BUFFER_SIZE < ((ULONG)(P - PipeBuf) + Length + 1) * sizeof(WCHAR))
|
||||
{
|
||||
Result = STATUS_INVALID_PARAMETER;
|
||||
goto exit;
|
||||
@ -52,9 +51,9 @@ FSP_API NTSTATUS FspLaunchCallLauncherPipe(
|
||||
memcpy(P, Argv[I], Length * sizeof(WCHAR)); P += Length; *P++ = L'\0';
|
||||
}
|
||||
|
||||
Result = FspCallNamedPipeSecurely(L"" LAUNCHER_PIPE_NAME,
|
||||
PipeBuf, (ULONG)(P - PipeBuf) * sizeof(WCHAR), PipeBuf, LAUNCHER_PIPE_BUFFER_SIZE,
|
||||
&BytesTransferred, NMPWAIT_USE_DEFAULT_WAIT, LAUNCHER_PIPE_OWNER);
|
||||
Result = FspCallNamedPipeSecurely(L"" FSP_LAUNCH_PIPE_NAME,
|
||||
PipeBuf, (ULONG)(P - PipeBuf) * sizeof(WCHAR), PipeBuf, FSP_LAUNCH_PIPE_BUFFER_SIZE,
|
||||
&BytesTransferred, NMPWAIT_USE_DEFAULT_WAIT, FSP_LAUNCH_PIPE_OWNER);
|
||||
if (!NT_SUCCESS(Result))
|
||||
goto exit;
|
||||
|
||||
@ -62,18 +61,18 @@ FSP_API NTSTATUS FspLaunchCallLauncherPipe(
|
||||
ErrorCode = ERROR_BROKEN_PIPE; /* protocol error! */
|
||||
if (sizeof(WCHAR) <= BytesTransferred)
|
||||
{
|
||||
if (LauncherSuccess == PipeBuf[0])
|
||||
if (FspLaunchCmdSuccess == PipeBuf[0])
|
||||
{
|
||||
ErrorCode = 0;
|
||||
|
||||
if (0 != PSize)
|
||||
{
|
||||
BytesTransferred -= sizeof(WCHAR);
|
||||
memcpy(Buffer, PipeBuf, *PSize < BytesTransferred ? *PSize : BytesTransferred);
|
||||
memcpy(Buffer, PipeBuf + 1, *PSize < BytesTransferred ? *PSize : BytesTransferred);
|
||||
*PSize = BytesTransferred;
|
||||
}
|
||||
}
|
||||
else if (LauncherFailure == PipeBuf[0])
|
||||
else if (FspLaunchCmdFailure == PipeBuf[0])
|
||||
{
|
||||
ErrorCode = 0;
|
||||
|
||||
@ -112,7 +111,7 @@ FSP_API NTSTATUS FspLaunchStart(
|
||||
memcpy(Argv + 2, Argv, Argc * sizeof(PWSTR));
|
||||
|
||||
return FspLaunchCallLauncherPipe(
|
||||
HasSecret ? LauncherSvcInstanceStartWithSecret : LauncherSvcInstanceStart,
|
||||
HasSecret ? FspLaunchCmdStartWithSecret : FspLaunchCmdStart,
|
||||
Argc + 2, Argv, 0, 0, 0, PLauncherError);
|
||||
}
|
||||
|
||||
@ -125,7 +124,7 @@ FSP_API NTSTATUS FspLaunchStop(
|
||||
Argv[0] = ClassName;
|
||||
Argv[1] = InstanceName;
|
||||
|
||||
return FspLaunchCallLauncherPipe(LauncherSvcInstanceStop,
|
||||
return FspLaunchCallLauncherPipe(FspLaunchCmdStop,
|
||||
2, Argv, 0, 0, 0, PLauncherError);
|
||||
}
|
||||
|
||||
@ -139,7 +138,7 @@ FSP_API NTSTATUS FspLaunchGetInfo(
|
||||
Argv[0] = ClassName;
|
||||
Argv[1] = InstanceName;
|
||||
|
||||
return FspLaunchCallLauncherPipe(LauncherSvcInstanceInfo,
|
||||
return FspLaunchCallLauncherPipe(FspLaunchCmdGetInfo,
|
||||
2, Argv, 0, Buffer, PSize, PLauncherError);
|
||||
}
|
||||
|
||||
@ -147,6 +146,6 @@ FSP_API NTSTATUS FspLaunchGetNameList(
|
||||
PWSTR Buffer, PULONG PSize,
|
||||
PULONG PLauncherError)
|
||||
{
|
||||
return FspLaunchCallLauncherPipe(LauncherSvcInstanceList,
|
||||
return FspLaunchCallLauncherPipe(FspLaunchCmdGetNameList,
|
||||
0, 0, 0, Buffer, PSize, PLauncherError);
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#define WINFSP_DLL_INTERNAL
|
||||
#include <winfsp/winfsp.h>
|
||||
#include <winfsp/launch.h>
|
||||
#include <shared/minimal.h>
|
||||
#include <strsafe.h>
|
||||
|
||||
|
12
src/dll/np.c
12
src/dll/np.c
@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
#include <dll/library.h>
|
||||
#include <launcher/launcher.h>
|
||||
#include <npapi.h>
|
||||
#include <wincred.h>
|
||||
|
||||
@ -268,8 +267,8 @@ static DWORD FspNpGetCredentialsKind(PWSTR RemoteName, PDWORD PCredentialsKind)
|
||||
memcpy(ClassNameBuf, ClassName, ClassNameLen * sizeof(WCHAR));
|
||||
ClassNameBuf[ClassNameLen] = '\0';
|
||||
|
||||
NpResult = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"" LAUNCHER_REGKEY,
|
||||
0, LAUNCHER_REGKEY_WOW64 | KEY_READ, &RegKey);
|
||||
NpResult = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"" FSP_LAUNCH_REGKEY,
|
||||
0, FSP_LAUNCH_REGKEY_WOW64 | KEY_READ, &RegKey);
|
||||
if (ERROR_SUCCESS != NpResult)
|
||||
goto exit;
|
||||
|
||||
@ -557,8 +556,7 @@ DWORD APIENTRY NPAddConnection(LPNETRESOURCEW lpNetResource, LPWSTR lpPassword,
|
||||
}
|
||||
|
||||
NpResult = FspNpCallLauncherPipe(
|
||||
FSP_NP_CREDENTIALS_NONE != CredentialsKind ?
|
||||
LauncherSvcInstanceStartWithSecret : LauncherSvcInstanceStart,
|
||||
FSP_NP_CREDENTIALS_NONE != CredentialsKind ? FspLaunchCmdStartWithSecret : FspLaunchCmdStart,
|
||||
Argc, Argv, Argl, 0, 0);
|
||||
switch (NpResult)
|
||||
{
|
||||
@ -610,7 +608,7 @@ DWORD APIENTRY NPAddConnection(LPNETRESOURCEW lpNetResource, LPWSTR lpPassword,
|
||||
Argv[Argc] = InstanceName; Argl[Argc] = InstanceNameLen; Argc++;
|
||||
|
||||
if (WN_SUCCESS != FspNpCallLauncherPipe(
|
||||
LauncherSvcInstanceInfo,
|
||||
FspLaunchCmdGetInfo,
|
||||
Argc, Argv, Argl, 0, 0))
|
||||
{
|
||||
/* looks like the file system is gone! */
|
||||
@ -772,7 +770,7 @@ DWORD APIENTRY NPCancelConnection(LPWSTR lpName, BOOL fForce)
|
||||
Argv[Argc] = InstanceName; Argl[Argc] = InstanceNameLen; Argc++;
|
||||
|
||||
NpResult = FspNpCallLauncherPipe(
|
||||
LauncherSvcInstanceStop,
|
||||
FspLaunchCmdStop,
|
||||
Argc, Argv, Argl, 0, 0);
|
||||
switch (NpResult)
|
||||
{
|
||||
|
Reference in New Issue
Block a user