84{
   87    UINT32                          ModuleDetailsSize    = 0;
 
   92    size_t                          CharSize             = 0;
   93    wchar_t *                       WcharBuff            = 
NULL;
 
   94    wstring                         SearchModuleString;
   95 
   96    
   97    
   98    
  100 
  101    
  102    
  103    
  104    ModuleCountRequest.
ProcessId        = ProcessId;
 
  106 
  107    
  108    
  109    
  110    Status = DeviceIoControl(
  113                                                
  114        &ModuleCountRequest,                    
  116        &ModuleCountRequest,                    
  118                                                
  119        &ReturnedLength,                        
  120        NULL                                    
  121    );
  122 
  123    if (!Status)
  124    {
  125        ShowMessages(
"ioctl failed with code 0x%x\n", GetLastError());
 
  127    }
  128 
  129    
  130    
  131    
  133    {
  135 
  136        
  137 
  140 
  142 
  143        if (ModuleDetailsRequest == NULL)
  144        {
  146        }
  147 
  148        RtlZeroMemory(ModuleDetailsRequest, ModuleDetailsSize);
  149 
  150        
  151        
  152        
  153        ModuleDetailsRequest->
ProcessId        = ProcessId;
 
  155 
  156        
  157        
  158        
  159        Status = DeviceIoControl(
  162                                                    
  163            ModuleDetailsRequest,                   
  165            ModuleDetailsRequest,                   
  166            ModuleDetailsSize,                      
  167                                                    
  168            &ReturnedLength,                        
  169            NULL                                    
  170        );
  171 
  172        if (!Status)
  173        {
  174            free(ModuleDetailsRequest);
  175            ShowMessages(
"ioctl failed with code 0x%x\n", GetLastError());
 
  177        }
  178 
  179        
  180        
  181        
  183        {
  188 
  189            if (SearchModule != NULL)
  190            {
  191                CharSize  = strlen(SearchModule) + 1;
  192                WcharBuff = (wchar_t *)malloc(CharSize * 2);
  193 
  194                if (WcharBuff == NULL)
  195                {
  197                }
  198 
  199                RtlZeroMemory(WcharBuff, CharSize);
  200 
  201                mbstowcs(WcharBuff, SearchModule, CharSize);
  202 
  203                SearchModuleString.assign(WcharBuff, wcslen(WcharBuff));
  204            }
  205 
  206            for (size_t i = 0; i < ModulesCount; i++)
  207            {
  208                
  209                
  210                
  211                if (SearchModule != NULL)
  212                {
  213                    
  214                    
  215                    
  216                    std::wstring FullPathName((wchar_t *)Modules[i].FilePath);
  217 
  219                    {
  220                        
  221                        
  222                        
  223                        continue;
  224                    }
  225                }
  226 
  227                
  228                
  229                
  230                if (ModuleDetailsRequest->
Is32Bit)
 
  231                {
  233                                 Modules[i].BaseAddress,
  234                                 Modules[i].Entrypoint,
  236                }
  237                else
  238                {
  240                                 Modules[i].BaseAddress,
  241                                 Modules[i].Entrypoint,
  242                                 Modules[i].FilePath);
  243                }
  244            }
  245 
  246            if (SearchModule != NULL)
  247            {
  248                free(WcharBuff);
  249            }
  250        }
  251        else
  252        {
  255        }
  256 
  257        free(ModuleDetailsRequest);
  259    }
  260    else
  261    {
  264    }
  265}
#define DEBUGGER_OPERATION_WAS_SUCCESSFUL
General value to indicate that the operation or request was successful.
Definition ErrorCodes.h:23
#define IOCTL_GET_USER_MODE_MODULE_DETAILS
ioctl, to get user mode modules details
Definition Ioctls.h:240
struct _USERMODE_LOADED_MODULE_SYMBOLS * PUSERMODE_LOADED_MODULE_SYMBOLS
struct _USERMODE_LOADED_MODULE_DETAILS USERMODE_LOADED_MODULE_DETAILS
struct _USERMODE_LOADED_MODULE_DETAILS * PUSERMODE_LOADED_MODULE_DETAILS
size_t FindCaseInsensitiveW(std::wstring Input, std::wstring ToSearch, size_t Pos)
Find case insensitive sub string in a given substring (unicode)
Definition common.cpp:836
BOOLEAN ShowErrorMessage(UINT32 Error)
shows the error message
Definition debugger.cpp:38
HANDLE g_DeviceHandle
Holds the global handle of device which is used to send the request to the kernel by IOCTL,...
Definition globals.h:471
std::wstring CommandLmConvertWow64CompatibilityPaths(const wchar_t *LocalFilePath)
Convert redirection of 32-bit compatibility path.
Definition lm.cpp:51
UINT32 Result
Definition Symbols.h:52
UINT32 ModulesCount
Definition Symbols.h:51
UINT32 ProcessId
Definition Symbols.h:48
BOOLEAN Is32Bit
Definition Symbols.h:50
BOOLEAN OnlyCountModules
Definition Symbols.h:49