VirtualBox

Changeset 59569 in vbox for trunk


Ignore:
Timestamp:
Feb 3, 2016 11:45:40 AM (9 years ago)
Author:
vboxsync
Message:

BugReportTool(bugref:8169): Added Setup API logs, dropped factory, open files as binary

Location:
trunk/src/VBox/Frontends/VBoxBugReport
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxBugReport/VBoxBugReport.cpp

    r59521 r59569  
    120120typedef std::list<MachineInfo*> MachineInfoList;
    121121
    122 /*
    123  * An auxiliary class to facilitate in-place path joins.
    124  */
    125 class PathJoin
    126 {
    127 public:
    128     PathJoin(const char *folder, const char *file) { m_path = RTPathJoinA(folder, file); }
    129     ~PathJoin() { RTStrFree(m_path); };
    130     operator char*() const { return m_path; };
    131 private:
    132     char *m_path;
    133 };
    134 
    135122
    136123/*
     
    224211PRTSTREAM BugReportFile::getStream(void)
    225212{
    226     handleRtError(RTStrmOpen(m_pszPath, "r", &m_Strm),
     213    handleRtError(RTStrmOpen(m_pszPath, "rb", &m_Strm),
    227214                  "Failed to open '%s'", m_pszPath);
    228215    return m_Strm;
     
    458445void createBugReport(BugReport* report, const char *pszHome, MachineInfoList& machines)
    459446{
    460     BugReportItemFactory *factory = createBugReportItemFactory();
    461 
    462447    report->addItem(new BugReportFile(PathJoin(pszHome, "VBoxSVC.log"), "VBoxSVC.log"));
    463448    report->addItem(new BugReportFile(PathJoin(pszHome, "VBoxSVC.log.1"), "VBoxSVC.log.1"));
     
    473458                                            (*it)->getName(), NULL));
    474459    }
    475     report->addItem(factory->createNetworkAdapterReport());
    476 
    477     delete factory;
     460
     461    createBugReportOsSpecific(report, pszHome);
    478462}
    479463
  • trunk/src/VBox/Frontends/VBoxBugReport/VBoxBugReport.h

    r59494 r59569  
    7171
    7272/*
     73 * An auxiliary class to facilitate in-place path joins.
     74 */
     75class PathJoin
     76{
     77public:
     78    PathJoin(const char *folder, const char *file) { m_path = RTPathJoinA(folder, file); }
     79    ~PathJoin() { RTStrFree(m_path); };
     80    operator char*() const { return m_path; };
     81private:
     82    char *m_path;
     83};
     84
     85
     86/*
    7387 * An abstract class serving as the root of the bug report item tree.
    7488 */
     
    115129    char m_szFileName[RTPATH_MAX];
    116130};
    117 
    118 
    119 /*
    120  * This class provides a platform-agnostic way to create platform-specific item
    121  * objects.
    122  *
    123  * @todo At the moment it is capable of creating a single object, the one
    124  * intended to collect network adapter data. There will be more later.
    125  *
    126  * @todo Make an abstract class if enough platform-specific factories implemented.
    127  */
    128 class BugReportItemFactory
    129 {
    130 public:
    131     virtual BugReportItem *createNetworkAdapterReport(void) { return NULL; };
    132 };
    133 
    134131
    135132
     
    221218/* Platform-specific */
    222219
    223 BugReportItemFactory *createBugReportItemFactory(void);
     220#ifdef RT_OS_WINDOWS
     221void createBugReportOsSpecific(BugReport* report, const char *pszHome);
     222#else /* !RT_OS_WINDOWS */
     223/* @todo Replace with platform-specific implementations. */
     224void createBugReportOsSpecific(BugReport* report, const char *pszHome) {}
     225#endif /* !RT_OS_WINDOWS */
    224226
    225227#endif /* !___H_VBOXBUGREPORT */
  • trunk/src/VBox/Frontends/VBoxBugReport/VBoxBugReportWin.cpp

    r59494 r59569  
    5151};
    5252
    53 class BugReportItemFactoryWin : public BugReportItemFactory
    54 {
    55 public:
    56     virtual BugReportItem *createNetworkAdapterReport(void) { return new BugReportNetworkAdaptersWin; };
    57 };
    58 
    59 BugReportItemFactory *createBugReportItemFactory(void)
    60 {
    61     return new BugReportItemFactoryWin;
    62 }
     53
    6354
    6455void BugReportNetworkAdaptersWin::printCharteristics(DWORD dwChars)
     
    225216           
    226217}
     218
     219void createBugReportOsSpecific(BugReport* report, const char *pszHome)
     220{
     221    TCHAR szWinDir[MAX_PATH];
     222
     223    int cbNeeded = GetWindowsDirectory(szWinDir, RT_ELEMENTS(szWinDir));
     224    if (cbNeeded == 0)
     225        throw RTCError(RTCStringFmt("Failed to get Windows directory (err=%d)\n", GetLastError()));
     226    if (cbNeeded > MAX_PATH)
     227        throw RTCError(RTCStringFmt("Failed to get Windows directory (needed %d-byte buffer)\n", cbNeeded));
     228    RTCStringFmt WinInfDir("%ls/inf", szWinDir);
     229    report->addItem(new BugReportFile(PathJoin(WinInfDir.c_str(), "setupapi.app.log"), "setupapi.app.log"));
     230    report->addItem(new BugReportFile(PathJoin(WinInfDir.c_str(), "setupapi.dev.log"), "setupapi.dev.log"));
     231    report->addItem(new BugReportNetworkAdaptersWin);
     232}
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