From 7425eba8af26ee86bb13451874fa809567bc75ca Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Tue, 31 Jan 2017 16:07:50 -0800 Subject: [PATCH] inc: winfsp.h: FspLoad --- doc/WinFsp-Tutorial.asciidoc | 2 +- inc/winfsp/winfsp.h | 8 +++++++- tst/passthrough-fuse/winposix.c | 2 +- tst/passthrough/passthrough.c | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/WinFsp-Tutorial.asciidoc b/doc/WinFsp-Tutorial.asciidoc index 48f3bc68..7ffde714 100644 --- a/doc/WinFsp-Tutorial.asciidoc +++ b/doc/WinFsp-Tutorial.asciidoc @@ -76,7 +76,7 @@ Then add the following lines in the beginning of `wmain`: .`*wmain excerpt*` [source,c] ---- - if (!NT_SUCCESS(FspLoad())) + if (!NT_SUCCESS(FspLoad(0))) return ERROR_DELAY_LOAD_FAILED; ---- diff --git a/inc/winfsp/winfsp.h b/inc/winfsp/winfsp.h index f0c5c934..6defcd12 100644 --- a/inc/winfsp/winfsp.h +++ b/inc/winfsp/winfsp.h @@ -1630,7 +1630,7 @@ FSP_API NTSTATUS FspCallNamedPipeSecurely(PWSTR PipeName, * Delay load */ static inline -NTSTATUS FspLoad(VOID) +NTSTATUS FspLoad(PVOID *PModule) { #if defined(_WIN64) #define FSP_DLLNAME "winfsp-x64.dll" @@ -1645,6 +1645,9 @@ NTSTATUS FspLoad(VOID) LONG Result; HMODULE Module; + if (0 != PModule) + *PModule = 0; + Module = LoadLibraryW(L"" FSP_DLLNAME); if (0 == Module) { @@ -1666,6 +1669,9 @@ NTSTATUS FspLoad(VOID) return STATUS_DLL_NOT_FOUND; } + if (0 != PModule) + *PModule = Module; + return STATUS_SUCCESS; #undef FSP_DLLNAME diff --git a/tst/passthrough-fuse/winposix.c b/tst/passthrough-fuse/winposix.c index bcf708ef..d8da50bb 100644 --- a/tst/passthrough-fuse/winposix.c +++ b/tst/passthrough-fuse/winposix.c @@ -525,5 +525,5 @@ static int maperror(int winerrno) long WinFspLoad(void) { - return FspLoad(); + return FspLoad(0); } diff --git a/tst/passthrough/passthrough.c b/tst/passthrough/passthrough.c index 72a29bc7..0adbed4a 100644 --- a/tst/passthrough/passthrough.c +++ b/tst/passthrough/passthrough.c @@ -918,7 +918,7 @@ static NTSTATUS SvcStop(FSP_SERVICE *Service) int wmain(int argc, wchar_t **argv) { - if (!NT_SUCCESS(FspLoad())) + if (!NT_SUCCESS(FspLoad(0))) return ERROR_DELAY_LOAD_FAILED; return FspServiceRun(L"" PROGNAME, SvcStart, SvcStop, 0);