VirtualBox

Changeset 30036 in vbox


Ignore:
Timestamp:
Jun 4, 2010 1:27:42 PM (14 years ago)
Author:
vboxsync
Message:

Try a bit harder to locate kernel modules

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServicePageSharing.cpp

    r30035 r30036  
    2525#include <iprt/mem.h>
    2626#include <iprt/stream.h>
     27#include <iprt/file.h>
    2728#include <iprt/string.h>
    2829#include <iprt/semaphore.h>
     
    404405                continue;
    405406
    406             char *pszDot = strrchr(pSystemModules->Modules[i].FullPathName, '.');
    407             if (    pszDot
    408                 &&  (pszDot[1] == 'e' || pszDot[1] == 'E')
    409                 &&  strcmp(&pSystemModules->Modules[i].FullPathName[pSystemModules->Modules[i].OffsetToFileName], "ntoskrnl.exe"))
    410                 continue;   /* ignore executables for now. */
    411 
    412407            /* Found it before? */
    413408            PAVLPVNODECORE pRec = RTAvlPVGet(&pNewTree, pSystemModules->Modules[i].ImageBase);
     
    432427                    {
    433428                        VBoxServiceVerbose(1, "Unexpected kernel module name %s\n", pSystemModules->Modules[i].FullPathName);
    434                         RTMemFree(pModule);
    435                         continue;
     429
     430                        /* Seen just file names in XP; try to locate the file in the system32 and system32\drivers directories. */
     431                        strcat(szFullFilePath, "\\");
     432                        strcat(szFullFilePath, pSystemModules->Modules[i].FullPathName);
     433                        VBoxServiceVerbose(3, "Unexpected kernel module name try %s\n", szFullFilePath);
     434                        if (RTFileExists(szFullFilePath) == false)
     435                        {
     436                            GetSystemDirectoryA(szFullFilePath, sizeof(szFullFilePath));
     437                            strcat(szFullFilePath, "\\drivers\\");
     438                            strcat(szFullFilePath, pSystemModules->Modules[i].FullPathName);
     439                            VBoxServiceVerbose(3, "Unexpected kernel module name try %s\n", szFullFilePath);
     440                            if (RTFileExists(szFullFilePath) == false)
     441                            {
     442                                VBoxServiceVerbose(1, "Unexpected kernel module name %s\n", pSystemModules->Modules[i].FullPathName);
     443                                RTMemFree(pModule);
     444                                continue;
     445                            }
     446                        }
    436447                    }
    437 
    438                     lpPath = strchr(lpPath+1, '\\');
    439                     if (!lpPath)
     448                    else
    440449                    {
    441                         VBoxServiceVerbose(1, "Unexpected kernel module name %s (2)\n", pSystemModules->Modules[i].FullPathName);
    442                         RTMemFree(pModule);
    443                         continue;
     450                        lpPath = strchr(lpPath+1, '\\');
     451                        if (!lpPath)
     452                        {
     453                            VBoxServiceVerbose(1, "Unexpected kernel module name %s (2)\n", pSystemModules->Modules[i].FullPathName);
     454                            RTMemFree(pModule);
     455                            continue;
     456                        }
     457
     458                        strcat(szFullFilePath, lpPath);
    444459                    }
    445460
    446                     strcat(szFullFilePath, lpPath);
    447461                    strcpy(pModule->Info.szExePath, szFullFilePath);
    448462                    pModule->Info.modBaseAddr = (BYTE *)pSystemModules->Modules[i].ImageBase;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette