mirror of
https://github.com/vxcontrol/MemoryModule.git
synced 2026-07-20 21:59:45 -04:00
Handle case where resource to load is NULL.
This commit is contained in:
@@ -825,6 +825,9 @@ HMEMORYRSRC MemoryFindResourceEx(HMEMORYMODULE module, LPCTSTR name, LPCTSTR typ
|
||||
DWORD MemorySizeofResource(HMEMORYMODULE module, HMEMORYRSRC resource)
|
||||
{
|
||||
PIMAGE_RESOURCE_DATA_ENTRY entry = (PIMAGE_RESOURCE_DATA_ENTRY) resource;
|
||||
if (entry == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return entry->Size;
|
||||
}
|
||||
@@ -833,6 +836,9 @@ LPVOID MemoryLoadResource(HMEMORYMODULE module, HMEMORYRSRC resource)
|
||||
{
|
||||
unsigned char *codeBase = ((PMEMORYMODULE) module)->codeBase;
|
||||
PIMAGE_RESOURCE_DATA_ENTRY entry = (PIMAGE_RESOURCE_DATA_ENTRY) resource;
|
||||
if (entry == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return codeBase + entry->OffsetToData;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user