mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 16:33:02 -05:00
inc: winfsp.hpp: SetDebugLogFile
This commit is contained in:
parent
bf87c539fd
commit
4c102ab57c
@ -53,6 +53,26 @@ inline DWORD Win32FromNtStatus(NTSTATUS Status)
|
|||||||
return FspWin32FromNtStatus(Status);
|
return FspWin32FromNtStatus(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline NTSTATUS SetDebugLogFile(PWSTR FileName)
|
||||||
|
{
|
||||||
|
HANDLE Handle;
|
||||||
|
if ('-' == FileName[0] && '\0' == FileName[1])
|
||||||
|
Handle = GetStdHandle(STD_ERROR_HANDLE);
|
||||||
|
else
|
||||||
|
Handle = CreateFileW(
|
||||||
|
FileName,
|
||||||
|
FILE_APPEND_DATA,
|
||||||
|
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||||
|
0,
|
||||||
|
OPEN_ALWAYS,
|
||||||
|
FILE_ATTRIBUTE_NORMAL,
|
||||||
|
0);
|
||||||
|
if (INVALID_HANDLE_VALUE == Handle)
|
||||||
|
return FspNtStatusFromWin32(GetLastError());
|
||||||
|
FspDebugLogSetHandle(Handle);
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
class FileSystem
|
class FileSystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -942,24 +942,12 @@ NTSTATUS PtfsService::OnStart(ULONG argc, PWSTR *argv)
|
|||||||
|
|
||||||
if (0 != DebugLogFile)
|
if (0 != DebugLogFile)
|
||||||
{
|
{
|
||||||
if (0 == wcscmp(L"-", DebugLogFile))
|
Result = SetDebugLogFile(DebugLogFile);
|
||||||
DebugLogHandle = GetStdHandle(STD_ERROR_HANDLE);
|
if (!NT_SUCCESS(Result))
|
||||||
else
|
|
||||||
DebugLogHandle = CreateFileW(
|
|
||||||
DebugLogFile,
|
|
||||||
FILE_APPEND_DATA,
|
|
||||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
|
||||||
0,
|
|
||||||
OPEN_ALWAYS,
|
|
||||||
FILE_ATTRIBUTE_NORMAL,
|
|
||||||
0);
|
|
||||||
if (INVALID_HANDLE_VALUE == DebugLogHandle)
|
|
||||||
{
|
{
|
||||||
fail(L"cannot open debug log file");
|
fail(L"cannot open debug log file");
|
||||||
goto usage;
|
goto usage;
|
||||||
}
|
}
|
||||||
|
|
||||||
FspDebugLogSetHandle(DebugLogHandle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ptfs = new ::Ptfs;
|
Ptfs = new ::Ptfs;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user