|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 3/3] Fix CodeQL warnings
- ExAllocatePoolWithTag is deprecated for Win10 2004, use
ExAllocatePoolUninitialized instead
- Add "(VOID)" before AccessWmiBuffer, where the return value is not needed
Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
src/xeniface/driver.c | 6 +-
src/xeniface/ioctl_evtchn.c | 15 ++--
src/xeniface/ioctls.c | 7 +-
src/xeniface/util.h | 4 +
src/xeniface/wmi.c | 145 ++++++++++++++++++++----------------
5 files changed, 99 insertions(+), 78 deletions(-)
diff --git a/src/xeniface/driver.c b/src/xeniface/driver.c
index 5ba4469..dff6e5f 100644
--- a/src/xeniface/driver.c
+++ b/src/xeniface/driver.c
@@ -38,6 +38,7 @@
#include "assert.h"
#include "wmi.h"
+#include "util.h"
PDRIVER_OBJECT DriverObject;
@@ -55,7 +56,8 @@ DriverUnload(
Trace("====>\n");
if (DriverParameters.RegistryPath.Buffer != NULL) {
- ExFreePool(DriverParameters.RegistryPath.Buffer);
+ __FreePoolWithTag(DriverParameters.RegistryPath.Buffer,
+ XENIFACE_POOL_TAG);
}
DriverObject = NULL;
@@ -155,7 +157,7 @@ DriverEntry(
DriverParameters.RegistryPath.MaximumLength = RegistryPath->Length +
sizeof(UNICODE_NULL);
DriverParameters.RegistryPath.Length = RegistryPath->Length;
- DriverParameters.RegistryPath.Buffer = ExAllocatePoolWithTag (PagedPool,
+ DriverParameters.RegistryPath.Buffer = __AllocatePoolWithTag(PagedPool,
DriverParameters.RegistryPath.MaximumLength,
XENIFACE_POOL_TAG);
if (NULL == DriverParameters.RegistryPath.Buffer) {
diff --git a/src/xeniface/ioctl_evtchn.c b/src/xeniface/ioctl_evtchn.c
index 85b66af..f528485 100644
--- a/src/xeniface/ioctl_evtchn.c
+++ b/src/xeniface/ioctl_evtchn.c
@@ -35,6 +35,7 @@
#include "ioctls.h"
#include "xeniface_ioctls.h"
#include "log.h"
+#include "util.h"
_Function_class_(KDEFERRED_ROUTINE)
_IRQL_requires_(DISPATCH_LEVEL)
@@ -82,7 +83,7 @@ EvtchnInterruptHandler(
ASSERT(Context != NULL);
- KeGetCurrentProcessorNumberEx(&ProcNumber);
+ (VOID) KeGetCurrentProcessorNumberEx(&ProcNumber);
ProcIndex = KeGetProcessorIndexFromNumber(&ProcNumber);
(VOID) KeInsertQueueDpc(&Context->Dpc, NULL, NULL);
@@ -112,7 +113,7 @@ EvtchnFree(
ObDereferenceObject(Context->Event);
RtlZeroMemory(Context, sizeof(XENIFACE_EVTCHN_CONTEXT));
- ExFreePoolWithTag(Context, XENIFACE_POOL_TAG);
+ __FreePoolWithTag(Context, XENIFACE_POOL_TAG);
}
_Requires_exclusive_lock_held_(Fdo->EvtchnLock)
@@ -170,11 +171,10 @@ IoctlEvtchnBindUnbound(
}
status = STATUS_NO_MEMORY;
- Context = ExAllocatePoolWithTag(NonPagedPool,
sizeof(XENIFACE_EVTCHN_CONTEXT), XENIFACE_POOL_TAG);
+ Context = __AllocatePoolWithTag(NonPagedPool,
sizeof(XENIFACE_EVTCHN_CONTEXT), XENIFACE_POOL_TAG);
if (Context == NULL)
goto fail2;
- RtlZeroMemory(Context, sizeof(XENIFACE_EVTCHN_CONTEXT));
Context->FileObject = FileObject;
Trace("> RemoteDomain %d, Mask %d, FO %p\n",
@@ -231,7 +231,7 @@ fail4:
fail3:
Error("Fail3\n");
RtlZeroMemory(Context, sizeof(XENIFACE_EVTCHN_CONTEXT));
- ExFreePoolWithTag(Context, XENIFACE_POOL_TAG);
+ __FreePoolWithTag(Context, XENIFACE_POOL_TAG);
fail2:
Error("Fail2\n");
@@ -264,11 +264,10 @@ IoctlEvtchnBindInterdomain(
}
status = STATUS_NO_MEMORY;
- Context = ExAllocatePoolWithTag(NonPagedPool,
sizeof(XENIFACE_EVTCHN_CONTEXT), XENIFACE_POOL_TAG);
+ Context = __AllocatePoolWithTag(NonPagedPool,
sizeof(XENIFACE_EVTCHN_CONTEXT), XENIFACE_POOL_TAG);
if (Context == NULL)
goto fail2;
- RtlZeroMemory(Context, sizeof(XENIFACE_EVTCHN_CONTEXT));
Context->FileObject = FileObject;
Trace("> RemoteDomain %d, RemotePort %lu, Mask %d, FO %p\n",
@@ -327,7 +326,7 @@ fail4:
fail3:
Error("Fail3\n");
RtlZeroMemory(Context, sizeof(XENIFACE_EVTCHN_CONTEXT));
- ExFreePoolWithTag(Context, XENIFACE_POOL_TAG);
+ __FreePoolWithTag(Context, XENIFACE_POOL_TAG);
fail2:
Error("Fail2\n");
diff --git a/src/xeniface/ioctls.c b/src/xeniface/ioctls.c
index bf280cb..a624bd1 100644
--- a/src/xeniface/ioctls.c
+++ b/src/xeniface/ioctls.c
@@ -36,6 +36,7 @@
#include "ioctls.h"
#include "xeniface_ioctls.h"
#include "log.h"
+#include "util.h"
NTSTATUS
__CaptureUserBuffer(
@@ -53,7 +54,7 @@ __CaptureUserBuffer(
}
Status = STATUS_NO_MEMORY;
- TempBuffer = ExAllocatePoolWithTag(NonPagedPool, Length,
XENIFACE_POOL_TAG);
+ TempBuffer = __AllocatePoolWithTag(NonPagedPool, Length,
XENIFACE_POOL_TAG);
if (TempBuffer == NULL)
return STATUS_INSUFFICIENT_RESOURCES;
@@ -65,7 +66,7 @@ __CaptureUserBuffer(
RtlCopyMemory(TempBuffer, Buffer, Length);
} except(EXCEPTION_EXECUTE_HANDLER) {
Error("Exception while probing/reading buffer at %p, size 0x%lx\n",
Buffer, Length);
- ExFreePoolWithTag(TempBuffer, XENIFACE_POOL_TAG);
+ __FreePoolWithTag(TempBuffer, XENIFACE_POOL_TAG);
TempBuffer = NULL;
Status = GetExceptionCode();
}
@@ -81,7 +82,7 @@ __FreeCapturedBuffer(
)
{
if (CapturedBuffer != NULL) {
- ExFreePoolWithTag(CapturedBuffer, XENIFACE_POOL_TAG);
+ __FreePoolWithTag(CapturedBuffer, XENIFACE_POOL_TAG);
}
}
diff --git a/src/xeniface/util.h b/src/xeniface/util.h
index f07f708..bc7518a 100644
--- a/src/xeniface/util.h
+++ b/src/xeniface/util.h
@@ -151,8 +151,12 @@ __AllocatePoolWithTag(
__analysis_assume(PoolType == NonPagedPool ||
PoolType == PagedPool);
+#if (_MSC_VER >= 1928) // VS 16.9 (EWDK 20344 or later)
+ Buffer = ExAllocatePoolUninitialized(PoolType, NumberOfBytes, Tag);
+#else
#pragma warning(suppress:28160) // annotation error
Buffer = ExAllocatePoolWithTag(PoolType, NumberOfBytes, Tag);
+#endif
if (Buffer == NULL)
return NULL;
diff --git a/src/xeniface/wmi.c b/src/xeniface/wmi.c
index b09cbff..8f6095a 100644
--- a/src/xeniface/wmi.c
+++ b/src/xeniface/wmi.c
@@ -45,6 +45,26 @@
#include "log.h"
#include "xeniface_ioctls.h"
#include <version.h>
+#include "util.h"
+
+#define WMI_POOL_TAG 'XenP'
+
+static FORCEINLINE PVOID
+WmiAllocate(
+ IN ULONG Length
+ )
+{
+ // Zeroes the allocation
+ return __AllocatePoolWithTag(NonPagedPool, Length, WMI_POOL_TAG);
+}
+
+static FORCEINLINE VOID
+WmiFree(
+ IN PVOID Buffer
+ )
+{
+ __FreePoolWithTag(Buffer, WMI_POOL_TAG);
+}
void LockSessions(
XENIFACE_FDO* fdoData)
@@ -266,7 +286,7 @@ NTSTATUS GetUTF8String(UTF8_STRING** utf8, USHORT bufsize,
LPWSTR ustring)
bytecount += CountUtf8FromUtf32(utf32);
}
- *utf8 = ExAllocatePoolWithTag(NonPagedPool, sizeof(UTF8_STRING)+bytecount,
'XIU8');
+ *utf8 = WmiAllocate(sizeof(UTF8_STRING) + bytecount);
if ((*utf8) == NULL)
return STATUS_INSUFFICIENT_RESOURCES;
@@ -284,7 +304,7 @@ NTSTATUS GetUTF8String(UTF8_STRING** utf8, USHORT bufsize,
LPWSTR ustring)
}
void FreeUTF8String(UTF8_STRING *utf8) {
- ExFreePoolWithTag(utf8, 'XIU8');
+ WmiFree(utf8);
}
NTSTATUS GetCountedUTF8String(UTF8_STRING **utf8, UCHAR *location)
@@ -505,11 +525,10 @@ WriteCountedUTF8String(const char * string, UCHAR
*location) {
NTSTATUS status = STATUS_SUCCESS;
WCHAR *buffer;
bytesize = CountBytesUtf16FromUtf8(string);
- buffer = ExAllocatePoolWithTag(NonPagedPool, bytesize+sizeof(WCHAR),
'XSUc');
-
- if (buffer == NULL) {
+ buffer = WmiAllocate(bytesize + sizeof(WCHAR));
+ if (buffer == NULL)
return STATUS_INSUFFICIENT_RESOURCES;
- }
+
buffer[bytesize/sizeof(WCHAR)] = 0;
i=0;
@@ -520,7 +539,7 @@ WriteCountedUTF8String(const char * string, UCHAR
*location) {
}
RtlInitUnicodeString(&unicode, buffer);
status = WriteCountedUnicodeString(&unicode, location);
- ExFreePoolWithTag(buffer, 'XSUc');
+ WmiFree(buffer);
return status;
}
@@ -548,7 +567,7 @@ WriteCountedString(
}
void AllocUnicodeStringBuffer(UNICODE_STRING *string, USHORT buffersize) {
- string->Buffer = ExAllocatePoolWithTag(NonPagedPool, buffersize, 'XIUC');
+ string->Buffer = WmiAllocate(buffersize);
string->Length = 0;
if (string->Buffer == NULL) {
string->MaximumLength=0;
@@ -560,7 +579,7 @@ void AllocUnicodeStringBuffer(UNICODE_STRING *string,
USHORT buffersize) {
}
void FreeUnicodeStringBuffer(UNICODE_STRING *string) {
if (string->Buffer)
- ExFreePoolWithTag(string->Buffer, 'XIUC');
+ WmiFree(string->Buffer);
string->Length=0;
string->MaximumLength=0;
string->Buffer = NULL;
@@ -772,14 +791,14 @@ void FireWatch(XenStoreWatch* watch) {
ULONG RequiredSize;
UCHAR *sesbuf;
- AccessWmiBuffer(0, FALSE, &RequiredSize, 0,
+ (VOID) AccessWmiBuffer(0, FALSE, &RequiredSize, 0,
WMI_STRING, GetCountedUnicodeStringSize(&watch->path),
&sesbuf,
WMI_DONE);
- eventdata = ExAllocatePoolWithTag(NonPagedPool, RequiredSize,'XIEV');
+ eventdata = WmiAllocate(RequiredSize);
if (eventdata!=NULL) {
- AccessWmiBuffer(eventdata, FALSE, &RequiredSize, RequiredSize,
+ (VOID) AccessWmiBuffer(eventdata, FALSE, &RequiredSize, RequiredSize,
WMI_STRING, GetCountedUnicodeStringSize(&watch->path),
&sesbuf,
WMI_DONE);
@@ -809,24 +828,24 @@ StartWatch(XENIFACE_FDO *fdoData, XenStoreWatch *watch)
if (!NT_SUCCESS(status)) {
return STATUS_INSUFFICIENT_RESOURCES;
}
- tmppath = ExAllocatePoolWithTag(NonPagedPool, ansipath.Length+1, 'XenP');
+ tmppath = WmiAllocate(ansipath.Length + 1);
if (!tmppath) {
RtlFreeAnsiString(&ansipath);
return STATUS_INSUFFICIENT_RESOURCES;
}
- RtlZeroMemory(tmppath, ansipath.Length+1);
+
RtlCopyBytes(tmppath,ansipath.Buffer, ansipath.Length);
status = XENBUS_STORE(WatchAdd, &fdoData->StoreInterface, NULL, tmppath,
&watch->watchevent, &watch->watchhandle );
if (!NT_SUCCESS(status)) {
- ExFreePool(tmppath);
+ WmiFree(tmppath);
RtlFreeAnsiString(&ansipath);
return status;
}
Info("Start Watch %p\n", watch->watchhandle);
- ExFreePool(tmppath);
+ WmiFree(tmppath);
RtlFreeAnsiString(&ansipath);
return STATUS_SUCCESS;
@@ -867,7 +886,7 @@ VOID WatchCallbackThread(__in PVOID StartContext) {
if (watch->finished) {
FreeUnicodeStringBuffer(&watch->path);
RemoveEntryList((LIST_ENTRY*)watch);
- ExFreePool(watch);
+ WmiFree(watch);
session->mapchanged = TRUE;
session->watchcount --;
} else if (!session->suspended &&
@@ -895,7 +914,7 @@ VOID WatchCallbackThread(__in PVOID StartContext) {
watch=(XenStoreWatch *)session->watches.Flink) {
FreeUnicodeStringBuffer(&watch->path);
RemoveEntryList((LIST_ENTRY*)watch);
- ExFreePool(watch);
+ WmiFree(watch);
session->mapchanged = TRUE;
session->watchcount --;
}
@@ -928,10 +947,9 @@ SessionAddWatchLocked(XenStoreSession *session,
return STATUS_INSUFFICIENT_RESOURCES;
}
- *watch = ExAllocatePoolWithTag(NonPagedPool, sizeof(XenStoreWatch),
'XenP');
- if (*watch == NULL) {
+ *watch = WmiAllocate(sizeof(XenStoreWatch));
+ if (*watch == NULL)
return STATUS_INSUFFICIENT_RESOURCES;
- }
(*watch)->finished = FALSE;
(*watch)->fdoData = fdoData;
@@ -947,7 +965,7 @@ SessionAddWatchLocked(XenStoreSession *session,
status = StartWatch(fdoData, *watch);
if ((!NT_SUCCESS(status)) || ((*watch)->watchhandle == NULL)) {
- ExFreePool(*watch);
+ WmiFree(*watch);
return STATUS_INSUFFICIENT_RESOURCES;
}
@@ -1053,16 +1071,16 @@ PSTR Xmasprintf(const char *fmt, ...) {
va_start(argv, fmt);
do{
basesize = basesize * 2;
- out = ExAllocatePoolWithTag(NonPagedPool, basesize, 'XenP');
+ out = WmiAllocate((ULONG)basesize);
if (out == NULL)
return NULL;
status = RtlStringCbVPrintfExA(out, basesize, NULL, &unused,0, fmt,
argv);
- ExFreePool(out);
+ WmiFree(out);
}while (status != STATUS_SUCCESS);
- out = ExAllocatePoolWithTag(NonPagedPool, basesize-unused +1, 'XenP');
+ out = WmiAllocate((ULONG)(basesize - unused + 1));
if (out == NULL)
return NULL;
@@ -1086,16 +1104,15 @@ CreateNewSession(XENIFACE_FDO *fdoData,
if (fdoData->Sessions == MAX_SESSIONS) {
return STATUS_INSUFFICIENT_RESOURCES;
}
- session = ExAllocatePoolWithTag(NonPagedPool, sizeof(XenStoreSession),
'XenP');
+ session = WmiAllocate(sizeof(XenStoreSession));
if (session == NULL)
return STATUS_INSUFFICIENT_RESOURCES;
- RtlZeroMemory(session, sizeof(XenStoreSession));
InitializeMutex(&session->WatchMapLock);
session->mapchanged = TRUE;
status = RtlUnicodeStringToAnsiString(&ansi, stringid, TRUE);
if (!NT_SUCCESS(status)) {
- ExFreePool(session);
+ WmiFree(session);
return status;
}
LockSessions(fdoData);
@@ -1107,16 +1124,16 @@ CreateNewSession(XENIFACE_FDO *fdoData,
if (iname == NULL) {
UnlockSessions(fdoData);
RtlFreeAnsiString(&ansi);
- ExFreePool(session);
+ WmiFree(session);
return status;
}
status = GetInstanceName(&session->instancename ,fdoData,iname);
- ExFreePool(iname);
+ WmiFree(iname);
if (!NT_SUCCESS(status)) {
UnlockSessions(fdoData);
RtlFreeAnsiString(&ansi);
- ExFreePool(session);
+ WmiFree(session);
return status;
}
count++;
@@ -1158,7 +1175,7 @@ CreateNewSession(XENIFACE_FDO *fdoData,
status = PsCreateSystemThread(&hthread, THREAD_ALL_ACCESS, &oa, NULL,
NULL, WatchCallbackThread, session);
if (!NT_SUCCESS(status)) {
RtlFreeAnsiString(&ansi);
- ExFreePool(session);
+ WmiFree(session);
return status;
}
ObReferenceObjectByHandle(hthread, THREAD_ALL_ACCESS, NULL, KernelMode,
&session->WatchThread, NULL);
@@ -1185,7 +1202,7 @@ RemoveSessionLocked(XENIFACE_FDO *fdoData,
ObDereferenceObject(session->WatchThread);
FreeUnicodeStringBuffer(&session->stringid);
FreeUnicodeStringBuffer(&session->instancename);
- ExFreePool(session);
+ WmiFree(session);
}
void
@@ -1473,11 +1490,11 @@ SessionExecuteRemoveValue(UCHAR *InBuffer,
return status;
status = STATUS_INSUFFICIENT_RESOURCES;
- tmpbuffer = ExAllocatePoolWithTag(NonPagedPool, pathname->Length+1,
'XenP');
+ tmpbuffer = WmiAllocate(pathname->Length + 1);
if (!tmpbuffer) {
goto fail1;
}
- RtlZeroMemory(tmpbuffer, pathname->Length+1);
+
RtlCopyBytes(tmpbuffer,pathname->Buffer, pathname->Length);
status = STATUS_WMI_INSTANCE_NOT_FOUND;
@@ -1489,7 +1506,7 @@ SessionExecuteRemoveValue(UCHAR *InBuffer,
UnlockSessions(fdoData);
fail2:
- ExFreePool(tmpbuffer);
+ WmiFree(tmpbuffer);
fail1:
FreeUTF8String(pathname);
@@ -1648,22 +1665,22 @@ SessionExecuteSetValue(UCHAR *InBuffer,
return status;
status = STATUS_INSUFFICIENT_RESOURCES;
- tmppath = ExAllocatePoolWithTag(NonPagedPool, pathname->Length+1, 'XenP');
+ tmppath = WmiAllocate(pathname->Length + 1);
if (!tmppath) {
goto fail1;
}
- RtlZeroMemory(tmppath, pathname->Length+1);
+
RtlCopyBytes(tmppath,pathname->Buffer, pathname->Length);
status = GetCountedUTF8String(&value, uvalue);
if (!NT_SUCCESS(status)){
goto fail2;
}
status = STATUS_INSUFFICIENT_RESOURCES;
- tmpvalue = ExAllocatePoolWithTag(NonPagedPool,value->Length+1,'XenP');
+ tmpvalue = WmiAllocate(value->Length + 1);
if (!tmpvalue) {
goto fail3;
}
- RtlZeroMemory(tmpvalue, value->Length+1);
+
RtlCopyBytes(tmpvalue,value->Buffer, value->Length);
status = STATUS_WMI_INSTANCE_NOT_FOUND;
@@ -1676,13 +1693,13 @@ SessionExecuteSetValue(UCHAR *InBuffer,
UnlockSessions(fdoData);
fail4:
- ExFreePool(tmpvalue);
+ WmiFree(tmpvalue);
fail3:
FreeUTF8String(value);
fail2:
- ExFreePool(tmppath);
+ WmiFree(tmppath);
fail1:
FreeUTF8String(pathname);
@@ -1724,11 +1741,11 @@ SessionExecuteGetFirstChild(UCHAR *InBuffer,
}
status = STATUS_INSUFFICIENT_RESOURCES;
- tmppath = ExAllocatePoolWithTag(NonPagedPool,path->Length+1, 'XenP');
+ tmppath = WmiAllocate(path->Length + 1);
if (!tmppath) {
goto fail1;
}
- RtlZeroMemory(tmppath, path->Length+1);
+
RtlCopyBytes(tmppath,path->Buffer, path->Length);
status = STATUS_WMI_INSTANCE_NOT_FOUND;
@@ -1782,7 +1799,7 @@ SessionExecuteGetFirstChild(UCHAR *InBuffer,
WriteCountedUTF8String(fullpath, valuepos);
valuepos+=GetCountedUtf8Size(fullpath);
- ExFreePool(fullpath);
+ WmiFree(fullpath);
}
else {
WriteCountedUTF8String("", valuepos);
@@ -1795,7 +1812,7 @@ fail3:
*byteswritten = RequiredSize;
fail2:
- ExFreePool(tmppath);
+ WmiFree(tmppath);
fail1:
FreeUTF8String(path);
@@ -1842,17 +1859,16 @@ SessionExecuteGetNextSibling(UCHAR *InBuffer,
}
status = STATUS_INSUFFICIENT_RESOURCES;
- tmppath = ExAllocatePoolWithTag(NonPagedPool,path->Length+1,'XenP');
+ tmppath = WmiAllocate(path->Length + 1);
if (!tmppath) {
goto fail1;
}
- RtlZeroMemory(tmppath, path->Length+1);
- tmpleaf = ExAllocatePoolWithTag(NonPagedPool,path->Length+1,'XenP');
+
+ tmpleaf = WmiAllocate(path->Length + 1);
if (!tmpleaf) {
goto fail2;
}
- RtlZeroMemory(tmpleaf, path->Length+1);
status = STATUS_WMI_INSTANCE_NOT_FOUND;
if ((session = FindSessionByInstanceAndLock(fdoData, instance)) ==
@@ -1956,7 +1972,7 @@ SessionExecuteGetNextSibling(UCHAR *InBuffer,
}
WriteCountedUTF8String(fullpath, valuepos);
- ExFreePool(fullpath);
+ WmiFree(fullpath);
}
else {
WriteCountedUTF8String("", valuepos);
@@ -1969,10 +1985,10 @@ fail4:
XENBUS_STORE(Free, &fdoData->StoreInterface, listresults);
fail3:
- ExFreePool(tmpleaf);
+ WmiFree(tmpleaf);
fail2:
- ExFreePool(tmppath);
+ WmiFree(tmppath);
fail1:
FreeUTF8String(path);
@@ -2017,11 +2033,11 @@ SessionExecuteGetChildren(UCHAR *InBuffer,
}
status = STATUS_INSUFFICIENT_RESOURCES;
- tmppath = ExAllocatePoolWithTag(NonPagedPool,path->Length+1,'XenP');
+ tmppath = WmiAllocate(path->Length + 1);
if (!tmppath) {
goto fail1;
}
- RtlZeroMemory(tmppath, path->Length+1);
+
RtlCopyBytes(tmppath,path->Buffer, path->Length);
status = STATUS_WMI_INSTANCE_NOT_FOUND;
@@ -2079,7 +2095,7 @@ SessionExecuteGetChildren(UCHAR *InBuffer,
WriteCountedUTF8String(fullpath, valuepos);
valuepos+=GetCountedUtf8Size(fullpath);
- ExFreePool(fullpath);
+ WmiFree(fullpath);
for (;*nextresults!=0;nextresults++);
nextresults++;
i++;
@@ -2093,7 +2109,7 @@ fail3:
XENBUS_STORE(Free, &fdoData->StoreInterface, listresults);
fail2:
- ExFreePool(tmppath);
+ WmiFree(tmppath);
fail1:
FreeUTF8String(path);
@@ -2285,13 +2301,12 @@ SessionExecuteGetValue(UCHAR *InBuffer,
return status;;
status = STATUS_INSUFFICIENT_RESOURCES;
- tmppath = ExAllocatePoolWithTag(NonPagedPool,path->Length+1,'XenP');
+ tmppath = WmiAllocate(path->Length + 1);
if (!tmppath) {
goto fail1;
}
- RtlZeroMemory(tmppath, path->Length+1);
- RtlCopyBytes(tmppath,path->Buffer, path->Length);
+ RtlCopyBytes(tmppath,path->Buffer, path->Length);
status = STATUS_WMI_INSTANCE_NOT_FOUND;
if ((session = FindSessionByInstanceAndLock(fdoData, instance)) ==
@@ -2318,7 +2333,7 @@ fail3:
*byteswritten = RequiredSize;
fail2:
- ExFreePool(tmppath);
+ WmiFree(tmppath);
fail1:
FreeUTF8String(path);
@@ -2616,7 +2631,7 @@ GenerateSessionBlock(UCHAR *Buffer,
UCHAR *sesbuf;
UCHAR *inamebuf;
- AccessWmiBuffer((PUCHAR)nodesizerequired, FALSE, &RequiredSize, 0,
+ (VOID) AccessWmiBuffer((PUCHAR)nodesizerequired, FALSE, &RequiredSize,
0,
WMI_UINT32, &id,
WMI_STRING,
GetCountedUnicodeStringSize(&session->stringid),
@@ -2624,7 +2639,7 @@ GenerateSessionBlock(UCHAR *Buffer,
WMI_DONE);
nodesizerequired += RequiredSize;
- AccessWmiBuffer((PUCHAR)namesizerequired, FALSE, &RequiredSize, 0,
+ (VOID) AccessWmiBuffer((PUCHAR)namesizerequired, FALSE, &RequiredSize,
0,
WMI_STRING,
GetCountedUnicodeStringSize(&session->instancename),
&inamebuf,
@@ -2666,7 +2681,7 @@ GenerateSessionBlock(UCHAR *Buffer,
UCHAR *sesbuf;
UCHAR *inamebuf;
- AccessWmiBuffer(datapos, FALSE, &RequiredSize,
BufferSize+Buffer-datapos,
+ (VOID) AccessWmiBuffer(datapos, FALSE, &RequiredSize,
BufferSize+Buffer-datapos,
WMI_UINT32, &id,
WMI_STRING,
GetCountedUnicodeStringSize(&session->stringid),
@@ -2681,7 +2696,7 @@ GenerateSessionBlock(UCHAR *Buffer,
WriteCountedUnicodeString(&session->stringid, sesbuf);
datapos+=RequiredSize;
- AccessWmiBuffer(namepos, FALSE, &RequiredSize,
BufferSize+Buffer-namepos,
+ (VOID) AccessWmiBuffer(namepos, FALSE, &RequiredSize,
BufferSize+Buffer-namepos,
WMI_STRING,
GetCountedUnicodeStringSize(&session->instancename),
&inamebuf,
--
2.31.1.windows.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |