Using variadic function in miniport?

Hello,

I would like to add some internal tracing (dump to a buffer) while writing storport miniport. I’ve noticed that I am unable to use RtlStringCchVPrintfW in my variadic function due to restriction of PASSIVE_LEVEL irql.

What would you suggest to use to be able to use my own variadic function?

Is there any other printf-like function I can you in kernel?
va_list args;
va_start(args, fmt);

va_end(args);

to be exact… what can I use to format a string in my own variadic function at least at DISPATCH_LEVEL?

Variadic and IRQL are two different independent things.

You cannot use RtlStringCchVPrintfW because it’s using paged code and/or data. You need to roll your own function.

> What would you suggest to use to be able to use my own variadic function?

Yes, just declare it as __cdecl

Also, ETW can help a lot. Can work on > PASSIVE.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

And as Max knows, this is only relevant to x86 ? on x64 the calling conventions have been standardized and vararg functions are supported without any special support

The better question is why you think you need a vararg function in KM besides a trace ? and if a trace then why not use a pre-built trace facility

Sent from Mailhttps: for Windows 10

From: Maxim S. Shatskihmailto:xxxxx
Sent: March 28, 2016 4:40 AM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: Re:[ntdev] Using variadic function in miniport?

> What would you suggest to use to be able to use my own variadic function?

Yes, just declare it as __cdecl

Also, ETW can help a lot. Can work on > PASSIVE.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com


NTDEV is sponsored by OSR

Visit the list online at: http:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at http:

To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:></mailto:xxxxx></mailto:xxxxx></https:>