How to get the mapped file object name from the objecthandle in C++?

163 Views Asked by At

I am working on a project where I need to decrypt some media files which are mapped to memory by a process. I have successfully hooked the CreateFileW() and MappedViewOfFile() functions. I need to verify the "name of mapping object" inside the MappedViewOfFile() function. I just have the handle of the object and I am not sure how to retrieve its name. Please see the below code for a better understanding of my question. I have hooked already the read and write functions of the other process. That works pretty well, but when another process writes to other files using the above file, it fails..

LPVOID WINAPI MapViewHooked(  
__in HANDLE hFileMappingObject,
 __in DWORD  dwDesiredAccess,
 __in DWORD  dwFileOffsetHigh,
 __in DWORD  dwFileOffsetLow,
 __in SIZE_T dwNumberOfBytesToMap   ) 
{ 
//string pszobjectnamefrom handle=some_function(hFileMappingObject);//here i am stucked
if(pszobjectnamefrom=="MYOBJECT")
??How to update the data in memory i have the code to decrypt the buffer

}
0

There are 0 best solutions below