mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-23 00:43:00 -05:00
sys: DEBUGRANDTEST()
This commit is contained in:
parent
f491d6015f
commit
dde82a1081
@ -690,7 +690,7 @@ static NTSTATUS FspFsvolCreateTryOpen(PIRP Irp, const FSP_FSCTL_TRANSACT_RSP *Re
|
|||||||
FSP_FSCTL_TRANSACT_REQ *Request = FspIrpRequest(Irp);
|
FSP_FSCTL_TRANSACT_REQ *Request = FspIrpRequest(Irp);
|
||||||
BOOLEAN Success;
|
BOOLEAN Success;
|
||||||
|
|
||||||
Success = FspFileNodeTryAcquireExclusive(FileNode, Both);
|
Success = DEBUGRANDTEST(90, TRUE) && FspFileNodeTryAcquireExclusive(FileNode, Both);
|
||||||
if (!Success)
|
if (!Success)
|
||||||
{
|
{
|
||||||
/* repost the IRP to retry later */
|
/* repost the IRP to retry later */
|
||||||
|
@ -261,4 +261,22 @@ const char *FsInformationClassSym(FS_INFORMATION_CLASS FsInformationClass)
|
|||||||
return "FS_INFORMATION_CLASS:Unknown";
|
return "FS_INFORMATION_CLASS:Unknown";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ULONG DebugRandom(VOID)
|
||||||
|
{
|
||||||
|
static KSPIN_LOCK SpinLock = 0;
|
||||||
|
static ULONG Seed = 1;
|
||||||
|
KIRQL Irql;
|
||||||
|
ULONG Result;
|
||||||
|
|
||||||
|
KeAcquireSpinLock(&SpinLock, &Irql);
|
||||||
|
|
||||||
|
/* see ucrt sources */
|
||||||
|
Seed = Seed * 214013 + 2531011;
|
||||||
|
Result = (Seed >> 16) & 0x7fff;
|
||||||
|
|
||||||
|
KeReleaseSpinLock(&SpinLock, Irql);
|
||||||
|
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -56,7 +56,7 @@ extern __declspec(selectany) int fsp_bp = 1;
|
|||||||
#define DEBUGBREAK() \
|
#define DEBUGBREAK() \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
static int bp = 1; \
|
static int bp = 1; \
|
||||||
if (bp && fsp_bp && !KD_DEBUGGER_NOT_PRESENT)\
|
if (bp && fsp_bp && !KD_DEBUGGER_NOT_PRESENT)\
|
||||||
DbgBreakPoint(); \
|
DbgBreakPoint(); \
|
||||||
} while (0,0)
|
} while (0,0)
|
||||||
@ -64,6 +64,13 @@ extern __declspec(selectany) int fsp_bp = 1;
|
|||||||
#define DEBUGBREAK() do {} while (0,0)
|
#define DEBUGBREAK() do {} while (0,0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* DEBUGRANDTEST */
|
||||||
|
#if DBG
|
||||||
|
#define DEBUGRANDTEST(Percent, Default) (DebugRandom() <= (Percent) * 0x7fff / 100 ? (Default) : !(Default))
|
||||||
|
#else
|
||||||
|
#define DEBUGRANDTEST(Percent, Default) (Default)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* FSP_ENTER/FSP_LEAVE */
|
/* FSP_ENTER/FSP_LEAVE */
|
||||||
#if DBG
|
#if DBG
|
||||||
#define FSP_DEBUGLOG_(fmt, rfmt, ...) \
|
#define FSP_DEBUGLOG_(fmt, rfmt, ...) \
|
||||||
@ -632,6 +639,7 @@ const char *IrpMinorFunctionSym(UCHAR MajorFunction, UCHAR MinorFunction);
|
|||||||
const char *IoctlCodeSym(ULONG ControlCode);
|
const char *IoctlCodeSym(ULONG ControlCode);
|
||||||
const char *FileInformationClassSym(FILE_INFORMATION_CLASS FileInformationClass);
|
const char *FileInformationClassSym(FILE_INFORMATION_CLASS FileInformationClass);
|
||||||
const char *FsInformationClassSym(FS_INFORMATION_CLASS FsInformationClass);
|
const char *FsInformationClassSym(FS_INFORMATION_CLASS FsInformationClass);
|
||||||
|
ULONG DebugRandom(VOID);
|
||||||
static inline
|
static inline
|
||||||
VOID FspDebugLogIrp(const char *func, PIRP Irp, NTSTATUS Result)
|
VOID FspDebugLogIrp(const char *func, PIRP Irp, NTSTATUS Result)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user