mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 08:23:05 -05:00
dll: remove references to StringCbPrintf*()
This commit is contained in:
parent
903450312f
commit
825f4ed2ef
@ -9,10 +9,12 @@
|
|||||||
|
|
||||||
FSP_API VOID FspDebugLog(const char *format, ...)
|
FSP_API VOID FspDebugLog(const char *format, ...)
|
||||||
{
|
{
|
||||||
char buf[512];
|
char buf[1024];
|
||||||
|
/* DbgPrint has a 512 byte limit, but wvsprintf is only safe with a 1024 byte buffer */
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
StringCbVPrintfA(buf, sizeof buf, format, ap);
|
wvsprintfA(buf, format, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
buf[sizeof buf - 1] = '\0';
|
||||||
OutputDebugStringA(buf);
|
OutputDebugStringA(buf);
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,18 @@
|
|||||||
|
|
||||||
static inline VOID GlobalDevicePath(PWCHAR DevicePathBuf, SIZE_T DevicePathSize, PWSTR DevicePath)
|
static inline VOID GlobalDevicePath(PWCHAR DevicePathBuf, SIZE_T DevicePathSize, PWSTR DevicePath)
|
||||||
{
|
{
|
||||||
StringCbPrintfW(DevicePathBuf, DevicePathSize,
|
PWSTR DeviceRoot = L'\\' == DevicePath[0] ? GLOBALROOT : GLOBALROOT "\\Device\\";
|
||||||
L'\\' == DevicePath[0] ? GLOBALROOT "%s" : GLOBALROOT "\\Device\\%s", DevicePath);
|
SIZE_T RootSize = lstrlenW(DeviceRoot) * sizeof(WCHAR);
|
||||||
|
SIZE_T PathSize = lstrlenW(DevicePath) * sizeof(WCHAR) + sizeof(WCHAR);
|
||||||
|
|
||||||
|
if (RootSize + PathSize <= DevicePathSize)
|
||||||
|
{
|
||||||
|
memcpy(DevicePathBuf, DeviceRoot, RootSize);
|
||||||
|
memcpy(DevicePathBuf + RootSize, DevicePath, PathSize);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
/* we should be doing assert(sizeof(WCHAR) <= DevicePathSize), but we don't have assert! */
|
||||||
|
DevicePathBuf[0] = L'\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
static NTSTATUS CreateSelfRelativeSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor,
|
static NTSTATUS CreateSelfRelativeSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user