- Timestamp:
- Feb 3, 2016 11:45:40 AM (9 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxBugReport
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxBugReport/VBoxBugReport.cpp
r59521 r59569 120 120 typedef std::list<MachineInfo*> MachineInfoList; 121 121 122 /*123 * An auxiliary class to facilitate in-place path joins.124 */125 class PathJoin126 {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 135 122 136 123 /* … … 224 211 PRTSTREAM BugReportFile::getStream(void) 225 212 { 226 handleRtError(RTStrmOpen(m_pszPath, "r ", &m_Strm),213 handleRtError(RTStrmOpen(m_pszPath, "rb", &m_Strm), 227 214 "Failed to open '%s'", m_pszPath); 228 215 return m_Strm; … … 458 445 void createBugReport(BugReport* report, const char *pszHome, MachineInfoList& machines) 459 446 { 460 BugReportItemFactory *factory = createBugReportItemFactory();461 462 447 report->addItem(new BugReportFile(PathJoin(pszHome, "VBoxSVC.log"), "VBoxSVC.log")); 463 448 report->addItem(new BugReportFile(PathJoin(pszHome, "VBoxSVC.log.1"), "VBoxSVC.log.1")); … … 473 458 (*it)->getName(), NULL)); 474 459 } 475 report->addItem(factory->createNetworkAdapterReport()); 476 477 delete factory; 460 461 createBugReportOsSpecific(report, pszHome); 478 462 } 479 463 -
trunk/src/VBox/Frontends/VBoxBugReport/VBoxBugReport.h
r59494 r59569 71 71 72 72 /* 73 * An auxiliary class to facilitate in-place path joins. 74 */ 75 class PathJoin 76 { 77 public: 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; }; 81 private: 82 char *m_path; 83 }; 84 85 86 /* 73 87 * An abstract class serving as the root of the bug report item tree. 74 88 */ … … 115 129 char m_szFileName[RTPATH_MAX]; 116 130 }; 117 118 119 /*120 * This class provides a platform-agnostic way to create platform-specific item121 * objects.122 *123 * @todo At the moment it is capable of creating a single object, the one124 * 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 BugReportItemFactory129 {130 public:131 virtual BugReportItem *createNetworkAdapterReport(void) { return NULL; };132 };133 134 131 135 132 … … 221 218 /* Platform-specific */ 222 219 223 BugReportItemFactory *createBugReportItemFactory(void); 220 #ifdef RT_OS_WINDOWS 221 void createBugReportOsSpecific(BugReport* report, const char *pszHome); 222 #else /* !RT_OS_WINDOWS */ 223 /* @todo Replace with platform-specific implementations. */ 224 void createBugReportOsSpecific(BugReport* report, const char *pszHome) {} 225 #endif /* !RT_OS_WINDOWS */ 224 226 225 227 #endif /* !___H_VBOXBUGREPORT */ -
trunk/src/VBox/Frontends/VBoxBugReport/VBoxBugReportWin.cpp
r59494 r59569 51 51 }; 52 52 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 63 54 64 55 void BugReportNetworkAdaptersWin::printCharteristics(DWORD dwChars) … … 225 216 226 217 } 218 219 void 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.