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