mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 08:23:05 -05:00
dll: FspDebugLogSD
This commit is contained in:
parent
73ca6b30dc
commit
5a1384462b
@ -205,6 +205,7 @@ FSP_API VOID FspPathCombine(PWSTR Prefix, PWSTR Suffix);
|
||||
*/
|
||||
FSP_API NTSTATUS FspNtStatusFromWin32(DWORD Error);
|
||||
FSP_API VOID FspDebugLog(const char *format, ...);
|
||||
FSP_API VOID FspDebugLogSD(const char *format, PSECURITY_DESCRIPTOR SecurityDescriptor);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include <dll/library.h>
|
||||
#include <sddl.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
FSP_API VOID FspDebugLog(const char *format, ...)
|
||||
@ -18,3 +19,21 @@ FSP_API VOID FspDebugLog(const char *format, ...)
|
||||
buf[sizeof buf - 1] = '\0';
|
||||
OutputDebugStringA(buf);
|
||||
}
|
||||
|
||||
FSP_API VOID FspDebugLogSD(const char *format, PSECURITY_DESCRIPTOR SecurityDescriptor)
|
||||
{
|
||||
char *Sddl;
|
||||
|
||||
if (0 == SecurityDescriptor)
|
||||
FspDebugLog(format, "null security descriptor");
|
||||
else if (ConvertSecurityDescriptorToStringSecurityDescriptorA(SecurityDescriptor, SDDL_REVISION_1,
|
||||
OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION |
|
||||
DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION,
|
||||
&Sddl, 0))
|
||||
{
|
||||
FspDebugLog(format, Sddl);
|
||||
LocalFree(Sddl);
|
||||
}
|
||||
else
|
||||
FspDebugLog(format, "invalid security descriptor");
|
||||
}
|
||||
|
@ -18,8 +18,11 @@
|
||||
#if !defined(NDEBUG)
|
||||
#define DEBUGLOG(fmt, ...) \
|
||||
FspDebugLog("[U] " LIBRARY_NAME "!" __FUNCTION__ ": " fmt "\n", __VA_ARGS__)
|
||||
#define DEBUGLOGSD(fmt, SD) \
|
||||
FspDebugLogSD("[U] " LIBRARY_NAME "!" __FUNCTION__ ": " fmt "\n", SD)
|
||||
#else
|
||||
#define DEBUGLOG(fmt, ...) ((void)0)
|
||||
#define DEBUGLOGSD(fmt, SD) ((void)0)
|
||||
#endif
|
||||
|
||||
static inline PVOID MemAlloc(SIZE_T Size)
|
||||
|
Loading…
x
Reference in New Issue
Block a user