inc: winfsp.h: FspLoad

This commit is contained in:
Bill Zissimopoulos 2017-01-31 16:07:50 -08:00
parent acf6ce1008
commit 7425eba8af
4 changed files with 10 additions and 4 deletions

View File

@ -76,7 +76,7 @@ Then add the following lines in the beginning of `wmain`:
.`*wmain excerpt*` .`*wmain excerpt*`
[source,c] [source,c]
---- ----
if (!NT_SUCCESS(FspLoad())) if (!NT_SUCCESS(FspLoad(0)))
return ERROR_DELAY_LOAD_FAILED; return ERROR_DELAY_LOAD_FAILED;
---- ----

View File

@ -1630,7 +1630,7 @@ FSP_API NTSTATUS FspCallNamedPipeSecurely(PWSTR PipeName,
* Delay load * Delay load
*/ */
static inline static inline
NTSTATUS FspLoad(VOID) NTSTATUS FspLoad(PVOID *PModule)
{ {
#if defined(_WIN64) #if defined(_WIN64)
#define FSP_DLLNAME "winfsp-x64.dll" #define FSP_DLLNAME "winfsp-x64.dll"
@ -1645,6 +1645,9 @@ NTSTATUS FspLoad(VOID)
LONG Result; LONG Result;
HMODULE Module; HMODULE Module;
if (0 != PModule)
*PModule = 0;
Module = LoadLibraryW(L"" FSP_DLLNAME); Module = LoadLibraryW(L"" FSP_DLLNAME);
if (0 == Module) if (0 == Module)
{ {
@ -1666,6 +1669,9 @@ NTSTATUS FspLoad(VOID)
return STATUS_DLL_NOT_FOUND; return STATUS_DLL_NOT_FOUND;
} }
if (0 != PModule)
*PModule = Module;
return STATUS_SUCCESS; return STATUS_SUCCESS;
#undef FSP_DLLNAME #undef FSP_DLLNAME

View File

@ -525,5 +525,5 @@ static int maperror(int winerrno)
long WinFspLoad(void) long WinFspLoad(void)
{ {
return FspLoad(); return FspLoad(0);
} }

View File

@ -918,7 +918,7 @@ static NTSTATUS SvcStop(FSP_SERVICE *Service)
int wmain(int argc, wchar_t **argv) int wmain(int argc, wchar_t **argv)
{ {
if (!NT_SUCCESS(FspLoad())) if (!NT_SUCCESS(FspLoad(0)))
return ERROR_DELAY_LOAD_FAILED; return ERROR_DELAY_LOAD_FAILED;
return FspServiceRun(L"" PROGNAME, SvcStart, SvcStop, 0); return FspServiceRun(L"" PROGNAME, SvcStart, SvcStop, 0);