mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 08:23:05 -05:00
dll: FspSxsSuffix
This commit is contained in:
parent
40ba537dc2
commit
62a6bbab66
@ -308,7 +308,7 @@ static BOOL WINAPI FspFsctlServiceVersionInitialize(
|
||||
QUERY_SERVICE_CONFIGW *ServiceConfig = 0;
|
||||
DWORD Size;
|
||||
|
||||
wsprintfW(DriverName, L"" FSP_FSCTL_DRIVER_NAME "%s", FspSxsIdent());
|
||||
wsprintfW(DriverName, L"" FSP_FSCTL_DRIVER_NAME "%s", FspSxsSuffix());
|
||||
|
||||
ScmHandle = OpenSCManagerW(0, 0, 0);
|
||||
if (0 == ScmHandle)
|
||||
@ -383,7 +383,7 @@ static NTSTATUS FspFsctlStartService(VOID)
|
||||
DWORD LastError;
|
||||
NTSTATUS Result;
|
||||
|
||||
wsprintfW(DriverName, L"" FSP_FSCTL_DRIVER_NAME "%s", FspSxsIdent());
|
||||
wsprintfW(DriverName, L"" FSP_FSCTL_DRIVER_NAME "%s", FspSxsSuffix());
|
||||
|
||||
AcquireSRWLockExclusive(&Lock);
|
||||
|
||||
@ -588,7 +588,7 @@ NTSTATUS FspFsctlRegister(VOID)
|
||||
SERVICE_DESCRIPTION ServiceDescription;
|
||||
NTSTATUS Result;
|
||||
|
||||
wsprintfW(DriverName, L"" FSP_FSCTL_DRIVER_NAME "%s", FspSxsIdent());
|
||||
wsprintfW(DriverName, L"" FSP_FSCTL_DRIVER_NAME "%s", FspSxsSuffix());
|
||||
|
||||
if (0 == GetModuleFileNameW(DllInstance, DriverPath, MAX_PATH))
|
||||
return FspNtStatusFromWin32(GetLastError());
|
||||
@ -677,7 +677,7 @@ NTSTATUS FspFsctlUnregister(VOID)
|
||||
DWORD LastError;
|
||||
NTSTATUS Result;
|
||||
|
||||
wsprintfW(DriverName, L"" FSP_FSCTL_DRIVER_NAME "%s", FspSxsIdent());
|
||||
wsprintfW(DriverName, L"" FSP_FSCTL_DRIVER_NAME "%s", FspSxsSuffix());
|
||||
|
||||
ScmHandle = OpenSCManagerW(0, 0, SC_MANAGER_CREATE_SERVICE);
|
||||
/*
|
||||
|
@ -71,6 +71,7 @@ NTSTATUS FspEventLogRegister(VOID);
|
||||
NTSTATUS FspEventLogUnregister(VOID);
|
||||
|
||||
PWSTR FspSxsIdent(VOID);
|
||||
PWSTR FspSxsSuffix(VOID);
|
||||
|
||||
PSID FspWksidNew(WELL_KNOWN_SID_TYPE WellKnownSidType, PNTSTATUS PResult);
|
||||
PSID FspWksidGet(WELL_KNOWN_SID_TYPE WellKnownSidType);
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <dll/library.h>
|
||||
|
||||
static INIT_ONCE FspSxsIdentInitOnce = INIT_ONCE_STATIC_INIT;
|
||||
static WCHAR FspSxsIdentBuf[32 + 1] = L"";
|
||||
static WCHAR FspSxsIdentBuf[32 + 2] = L"";
|
||||
|
||||
static BOOL WINAPI FspSxsIdentInitialize(
|
||||
PINIT_ONCE InitOnce, PVOID Parameter, PVOID *Context)
|
||||
@ -31,8 +31,8 @@ static BOOL WINAPI FspSxsIdentInitialize(
|
||||
WCHAR Path[MAX_PATH];
|
||||
DWORD Size;
|
||||
HANDLE Handle = INVALID_HANDLE_VALUE;
|
||||
CHAR Buffer[ARRAYSIZE(FspSxsIdentBuf) - 1];
|
||||
WCHAR WBuffer[ARRAYSIZE(FspSxsIdentBuf) - 1];
|
||||
CHAR Buffer[ARRAYSIZE(FspSxsIdentBuf) - 2];
|
||||
WCHAR WBuffer[ARRAYSIZE(FspSxsIdentBuf) - 2];
|
||||
|
||||
if (0 == GetModuleFileNameW(DllInstance, Path, MAX_PATH))
|
||||
goto exit;
|
||||
@ -93,8 +93,9 @@ static BOOL WINAPI FspSxsIdentInitialize(
|
||||
if (0 == Size)
|
||||
goto exit;
|
||||
|
||||
memcpy(FspSxsIdentBuf, WBuffer, Size * sizeof(WCHAR));
|
||||
FspSxsIdentBuf[Size] = L'\0';
|
||||
FspSxsIdentBuf[0] = L'-';
|
||||
memcpy(FspSxsIdentBuf + 1, WBuffer, Size * sizeof(WCHAR));
|
||||
FspSxsIdentBuf[1 + Size] = L'\0';
|
||||
|
||||
exit:
|
||||
if (INVALID_HANDLE_VALUE != Handle)
|
||||
@ -104,6 +105,12 @@ exit:
|
||||
}
|
||||
|
||||
PWSTR FspSxsIdent(VOID)
|
||||
{
|
||||
InitOnceExecuteOnce(&FspSxsIdentInitOnce, FspSxsIdentInitialize, 0, 0);
|
||||
return FspSxsIdentBuf + 1;
|
||||
}
|
||||
|
||||
PWSTR FspSxsSuffix(VOID)
|
||||
{
|
||||
InitOnceExecuteOnce(&FspSxsIdentInitOnce, FspSxsIdentInitialize, 0, 0);
|
||||
return FspSxsIdentBuf;
|
||||
|
Loading…
x
Reference in New Issue
Block a user