|
From: Drakier D. <dra...@us...> - 2004-02-12 22:22:16
|
Log Message:
-----------
Changed the "buffer" to use the TextBox and added an AppendExportText function.
Modified Files:
--------------
/cvsroot/decaldev/source/DenAgent:
ExportDlg.cpp
ExportDlg.h
Revision Data
-------------
Index: ExportDlg.cpp
===================================================================
RCS file: /cvsroot/decaldev/source/DenAgent/ExportDlg.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ExportDlg.cpp 6 Feb 2004 17:39:03 -0000 1.1
+++ ExportDlg.cpp 12 Feb 2004 22:17:00 -0000 1.2
@@ -16,7 +16,6 @@
/////////////////////////////////////////////////////////////////////////////
// cExportDlg dialog
-
cExportDlg::cExportDlg(CWnd* pParent /*=NULL*/)
: CDialog(cExportDlg::IDD, pParent)
{
@@ -65,10 +64,31 @@
int m_iconIndex;
};
+void cExportDlg::AppendExportText(const char *szNewText)
+{
+ int dwOldTextLength =::SendMessage(GetDlgItem(IDC_EDITEXPORT)->m_hWnd, WM_GETTEXTLENGTH, 0, 0) + 1;
+ int dwNewTextLength = strlen(szNewText) + 1;
+ char *szOldText = new char[dwOldTextLength];
+ memset(szOldText, 0, dwOldTextLength);
+ char *szBuffer = new char[dwOldTextLength + dwNewTextLength];
+ memset(szBuffer, 0, dwOldTextLength + dwNewTextLength);
+ ::SendMessage(GetDlgItem(IDC_EDITEXPORT)->m_hWnd, WM_GETTEXT, dwOldTextLength, (LPARAM) szOldText);
+ if(dwOldTextLength > 0)
+ sprintf(szBuffer, "%s%s", szOldText, szNewText);
+ else
+ sprintf(szBuffer, "%s", szNewText);
+ ::SendMessage(GetDlgItem(IDC_EDITEXPORT)->m_hWnd, WM_SETTEXT, 0, (LPARAM) szBuffer);
+ delete[]szBuffer;
+ delete[]szOldText;
+}
+
void cExportDlg::OnBnClickedBtnexport()
{
USES_CONVERSION;
std::string szDelim = ", ";
+
+
+ // Drakier: Get plugins/filters/services/etc from decal
cPluginGroup _groups[] = {
{ _T( "Plugins" ), _T( "Plugins" ), 4 },
{ _T( "Network Filters" ), _T( "NetworkFilters" ), 1 },
@@ -80,6 +100,9 @@
int nCount = 0;
std::string szOutput;
+ szOutput = "";
+ ::SendMessage( GetDlgItem( IDC_EDITEXPORT )->m_hWnd,WM_SETTEXT, 0, (LPARAM)szOutput.c_str());
+
szOutput += "type, ";
if ( ::SendMessage( GetDlgItem( IDC_CHKENABLED )->m_hWnd, BM_GETCHECK, 0, 0 ) )
szOutput += "enabled, ";
@@ -89,15 +112,20 @@
if ( ::SendMessage( GetDlgItem( IDC_CHKCLSID )->m_hWnd, BM_GETCHECK, 0, 0 ) )
szOutput += "clsid";
szOutput += "\r\n";
+ //::SendMessage( GetDlgItem( IDC_EDITEXPORT )->m_hWnd, WM_SETTEXT, 0, (LPARAM)szOutput.c_str() );
+ AppendExportText(szOutput.c_str());
+ // Go through all the groups exporting their sub-lists
for ( cPluginGroup *i = _groups; i != _end_groups; ++ i )
{
CComPtr<IDecalEnum> pEnum;
HRESULT hRes = m_pDecal->get_Configuration ( _bstr_t ( i->m_groupKey ), GUID_NULL, &pEnum );
_ASSERTE( SUCCEEDED ( hRes ) );
+ // enum through all items in a group
while ( pEnum->Next () == S_OK )
{
+ szOutput = "";
CLSID clsid;
CComBSTR strName;
CString strDLL;
@@ -144,26 +172,422 @@
szOutput += OLE2T(szCLSID);
::CoTaskMemFree ( szCLSID );
}
-
szOutput += "\r\n";
+ //::SendMessage( GetDlgItem( IDC_EDITEXPORT )->m_hWnd, WM_SETTEXT, 0, (LPARAM)szOutput.c_str() );
+ AppendExportText(szOutput.c_str());
}
}
- ::SendMessage( GetDlgItem( IDC_EDITEXPORT )->m_hWnd, WM_SETTEXT, 0, (LPARAM)szOutput.c_str() );
+
+ // Drakier: Get the OS Version
+ szOutput = "\r\nOperating System:\r\n";
+ const int BUFSIZE = 80;
+ OSVERSIONINFOEX osvi;
+ BOOL bOsVersionInfoEx;
+
+ // Try calling GetVersionEx using the OSVERSIONINFOEX structure.
+ // If that fails, try using the OSVERSIONINFO structure.
+ ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
+
+ if( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) )
+ {
+ osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
+ GetVersionEx ( (OSVERSIONINFO *) &osvi);
+ }
+
+ switch (osvi.dwPlatformId)
+ {
+ // Test for the Windows NT product family.
+ case VER_PLATFORM_WIN32_NT:
+
+ // Test for the specific product family.
+ if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 )
+ szOutput += "Microsoft Windows Server 2003 family, ";
+ if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 )
+ szOutput += "Microsoft Windows XP ";
+ if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 )
+ szOutput += "Microsoft Windows 2000 ";
+ if ( osvi.dwMajorVersion <= 4 )
+ szOutput += "Microsoft Windows NT ";
+
+ // Test for specific product on Windows NT 4.0 SP6 and later.
+ if( bOsVersionInfoEx )
+ {
+ // Test for the workstation type.
+ if ( osvi.wProductType == VER_NT_WORKSTATION )
+ {
+ if( osvi.dwMajorVersion == 4 )
+ szOutput += "Workstation 4.0 ";
+ else if( osvi.wSuiteMask & VER_SUITE_PERSONAL )
+ szOutput += "Home Edition ";
+ else
+ szOutput += "Professional ";
+ }
+
+ // Test for the server type.
+ else if ( osvi.wProductType == VER_NT_SERVER )
+ {
+ if( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 )
+ {
+ if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
+ szOutput += "Datacenter Edition ";
+ else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
+ szOutput += "Enterprise Edition ";
+ else if ( osvi.wSuiteMask == VER_SUITE_BLADE )
+ szOutput += "Web Edition ";
+ else
+ szOutput += "Standard Edition ";
+ }
+
+ else if( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 )
+ {
+ if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
+ szOutput += "Datacenter Server ";
+ else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
+ szOutput += "Advanced Server ";
+ else
+ szOutput += "Server ";
+ }
+
+ else // Windows NT 4.0
+ {
+ if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
+ szOutput += "Server 4.0, Enterprise Edition ";
+ else
+ szOutput += "Server 4.0 ";
+ }
+ }
+ }
+ else // Test for specific product on Windows NT 4.0 SP5 and earlier
+ {
+ HKEY hKey;
+ char szProductType[BUFSIZE];
+ DWORD dwBufLen=BUFSIZE;
+ LONG lRet;
+
+ lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
+ "SYSTEM\\CurrentControlSet\\Control\\ProductOptions",
+ 0, KEY_QUERY_VALUE, &hKey );
+ if( lRet == ERROR_SUCCESS )
+ {
+ lRet = RegQueryValueEx( hKey, "ProductType", NULL, NULL,
+ (LPBYTE) szProductType, &dwBufLen);
+ if( (lRet == ERROR_SUCCESS) && (dwBufLen <= BUFSIZE) )
+ {
+ RegCloseKey( hKey );
+
+ if ( lstrcmpi( "WINNT", szProductType) == 0 )
+ szOutput += "Workstation ";
+ if ( lstrcmpi( "LANMANNT", szProductType) == 0 )
+ szOutput += "Server ";
+ if ( lstrcmpi( "SERVERNT", szProductType) == 0 )
+ szOutput += "Advanced Server ";
+
+ szOutput += (char)osvi.dwMajorVersion;
+ szOutput += ".";
+ szOutput += (char)osvi.dwMinorVersion;
+ }
+ }
+ }
+
+ // Display service pack (if any) and build number.
+ if( osvi.dwMajorVersion == 4 &&
+ lstrcmpi( osvi.szCSDVersion, "Service Pack 6" ) == 0 )
+ {
+ HKEY hKey;
+ LONG lRet;
+
+ // Test for SP6 versus SP6a.
+ lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
+ "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Hotfix\\Q246009",
+ 0, KEY_QUERY_VALUE, &hKey );
+ if( lRet == ERROR_SUCCESS )
+ {
+ char szBuild[6]; //might make it a bit longer
+ memset(szBuild, 0, 6);
+ ltoa(osvi.dwBuildNumber & 0xFFFF, szBuild, 10);
+
+ szOutput += "Service Pack 6a (Build ";
+ szOutput += szBuild;
+ szOutput += ")\r\n";
+ }
+ else // Windows NT 4.0 prior to SP6a
+ {
+ char szBuild[6]; //might make it a bit longer
+ memset(szBuild, 0, 6);
+ ltoa(osvi.dwBuildNumber & 0xFFFF, szBuild, 10);
+
+ szOutput += osvi.szCSDVersion;
+ szOutput += " (Build ";
+ szOutput += szBuild;
+ szOutput += ")\r\n";
+ }
+ RegCloseKey( hKey );
+ }
+ else // Windows NT 3.51 and earlier or Windows 2000 and later
+ {
+ char szBuild[6]; //might make it a bit longer
+ memset(szBuild, 0, 6);
+ ltoa(osvi.dwBuildNumber & 0xFFFF, szBuild, 10);
+
+ szOutput += osvi.szCSDVersion;
+ szOutput += " (Build ";
+ szOutput += szBuild;
+ szOutput += ")\r\n";
+ }
+ break;
+
+ // Test for the Windows 95 product family.
+ case VER_PLATFORM_WIN32_WINDOWS:
+ if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0)
+ {
+ szOutput += "Microsoft Windows 95 ";
+ if ( osvi.szCSDVersion[1] == 'C' || osvi.szCSDVersion[1] == 'B' )
+ szOutput += "OSR2 ";
+ }
+ if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10)
+ {
+ szOutput += "Microsoft Windows 98 ";
+ if ( osvi.szCSDVersion[1] == 'A' )
+ szOutput += "SE ";
+ }
+ if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90)
+ {
+ szOutput += "Microsoft Windows Millennium Edition\r\n";
+ }
+ break;
+
+ case VER_PLATFORM_WIN32s:
+ szOutput += "Microsoft Win32s\r\n";
+ break;
+ }
+ //::SendMessage( GetDlgItem( IDC_EDITEXPORT )->m_hWnd, WM_SETTEXT, 0, (LPARAM)szOutput.c_str() );
+ AppendExportText(szOutput.c_str());
+
+ // Drakier: Check the Protected Storage
+ RegKey key;
+ if ( key.Open( HKEY_LOCAL_MACHINE, _T( "SYSTEM\\CurrentControlSet\\Services\\ProtectedStorage" ) ) == ERROR_SUCCESS )
+ {
+ DWORD dwStartMode;
+ szOutput = "\r\n[Protected Storage Service] : ";
+ if ( key.QueryDWORDValue( "Start", dwStartMode ) == ERROR_SUCCESS )
+ {
+ switch (dwStartMode)
+ {
+ case 2: //automatic
+ szOutput += "Automatic\r\n";
+ break;
+ case 3: // manual
+ szOutput += "Manual\r\n";
+ break;
+ case 4: // disabled
+ szOutput += "Disabled\r\n";
+ break;
+ }
+ }
+ key.Close();
+ }
+ //::SendMessage( GetDlgItem( IDC_EDITEXPORT )->m_hWnd, WM_SETTEXT, 0, (LPARAM)szOutput.c_str() );
+ AppendExportText(szOutput.c_str());
+
+ // Drakier: Get the Injection Mode
+
+ if( key.Create( HKEY_LOCAL_MACHINE, _T( "SOFTWARE\\Decal" )) == ERROR_SUCCESS )
+ {
+ DWORD dwViewMode;
+ szOutput = "\r\n[Injection Method] : ";
+ if( key.QueryDWORDValue( "OldInjection", dwViewMode )== ERROR_SUCCESS )
+ {
+ if (dwViewMode == 1)
+ {
+ szOutput += "OLD\r\n";
+ }
+ else
+ {
+ szOutput += "NEW\r\n";
+ }
+ }
+ key.Close();
+ }
+ //::SendMessage( GetDlgItem( IDC_EDITEXPORT )->m_hWnd, WM_SETTEXT, 0, (LPARAM)szOutput.c_str() );
+ AppendExportText(szOutput.c_str());
+
+ // Drakier: Get the Runtime versions (if installed).
+ szOutput = "\r\nRuntime Libraries\r\n";
+ AppendExportText(szOutput.c_str());
+ // Visual Basic 6 Runtimes
+ szOutput = "[msvbvm60.dll]\t: ";
+ HMODULE hLib = ::LoadLibrary( "msvbvm60.dll" );
+ if( hLib == NULL )
+ szOutput += "Not Installed\r\n";
+ else
+ szOutput += "Installed\r\n";
+ ::FreeLibrary(hLib);
+
+ // msvcp 7.0 Runtime
+ szOutput = "[msvcr70.dll]\t: ";
+ hLib = ::LoadLibrary( "msvcr70.dll" );
+ if( hLib == NULL )
+ szOutput += "Not Installed\r\n";
+ else
+ szOutput += "Installed\r\n";
+ ::FreeLibrary(hLib);
+ // msvcr 7.0 Runtime
+ szOutput += "[msvcp70.dll]\t: ";
+ hLib = ::LoadLibrary( "msvcp70.dll" );
+ if( hLib == NULL )
+ szOutput += "Not Installed\r\n";
+ else
+ szOutput += "Installed\r\n";
+ ::FreeLibrary(hLib);
+
+ // msvcp 7.1 Runtime
+ szOutput += "[msvcr71.dll]\t: ";
+ hLib = ::LoadLibrary( "msvcr71.dll" );
+ if( hLib == NULL )
+ szOutput += "Not Installed\r\n";
+ else
+ szOutput += "Installed\r\n";
+ ::FreeLibrary(hLib);
+ // msvcr 7.1 Runtime
+ szOutput += "[msvcp71.dll]\t: ";
+ hLib = ::LoadLibrary( "msvcp71.dll" );
+ if( hLib == NULL )
+ szOutput += "Not Installed\r\n";
+ else
+ szOutput += "Installed\r\n";
+ ::FreeLibrary(hLib);
+
+ // Haz - mfc+atl
+ // mfc 7.0 runtime
+ szOutput += "[mfc70.dll]\t: ";
+ hLib = ::LoadLibrary( "mfc70.dll" );
+ if( hLib == NULL )
+ szOutput += "Not Installed\r\n";
+ else
+ szOutput += "Installed\r\n";
+ ::FreeLibrary(hLib);
+
+ // mfc 7.1 runtime
+ szOutput += "[mfc71.dll]\t: ";
+ hLib = ::LoadLibrary( "mfc71.dll" );
+ if( hLib == NULL )
+ szOutput += "Not Installed\r\n";
+ else
+ szOutput += "Installed\r\n";
+ ::FreeLibrary(hLib);
+
+ // atl 7.0 runtime
+ szOutput += "[atl70.dll]\t\t: ";
+ hLib = ::LoadLibrary( "atl70.dll" );
+ if( hLib == NULL )
+ szOutput += "Not Installed\r\n";
+ else
+ szOutput += "Installed\r\n";
+ ::FreeLibrary(hLib);
+
+ // atl 7.1 runtime
+ szOutput += "[atl71.dll]\t\t: ";
+ hLib = ::LoadLibrary( "atl71.dll" );
+ if( hLib == NULL )
+ szOutput += "Not Installed\r\n";
+ else
+ szOutput += "Installed\r\n";
+ ::FreeLibrary(hLib);
+
+ //::SendMessage( GetDlgItem( IDC_EDITEXPORT )->m_hWnd, WM_SETTEXT, 0, (LPARAM)szOutput.c_str() );
+ AppendExportText(szOutput.c_str());
+ szOutput = "";
+
+
+ // Drakier: Get the MSXML Versions
+ szOutput += "\r\nMicrosoft XML Libraries\r\n";
+
+ // msxml3
+ szOutput += "[msxml3.dll]\t: ";
+ hLib = ::LoadLibrary( "msxml3.dll" );
+ if( hLib == NULL )
+ szOutput += "Not Installed\r\n";
+ else
+ szOutput += "Installed\r\n";
+ ::FreeLibrary(hLib);
+
+ // msxml4
+ szOutput += "[msxml4.dll]\t: ";
+ hLib = ::LoadLibrary( "msxml4.dll" );
+ if( hLib == NULL )
+ szOutput += "Not Installed\r\n";
+ else
+ szOutput += "Installed\r\n";
+ ::FreeLibrary(hLib);
+
+ //::SendMessage( GetDlgItem( IDC_EDITEXPORT )->m_hWnd, WM_SETTEXT, 0, (LPARAM)szOutput.c_str() );
+ AppendExportText(szOutput.c_str());
+ szOutput = "";
+
+ // Drakier: Get the Compat Mode Layers and display them.
+ if (key.Open( HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers" ) == ERROR_SUCCESS)
+ {
+ RegKey hkItem;
+ DWORD dwIndex = 0;
+ DWORD dwValues = NULL;
+ BOOL bTitle = FALSE;
+
+ // Enum regkey for AppCompatFlags checking for client.exe
+ ::RegQueryInfoKey(key, NULL, NULL, NULL, NULL, NULL, NULL, &dwValues, NULL, NULL, NULL, NULL);
+ if (dwValues)
+ {
+ HRESULT retCode = ERROR_SUCCESS;
+ for (dwIndex = 0; dwIndex < dwValues; dwIndex++)
+ {
+ DWORD dwValueNameLen = 255;
+ DWORD dwValueDataLen = 10;
+ TCHAR szValueName[255];
+ BYTE szValueData[10];
+ //TCHAR szValueData[10];
+ DWORD dwType;
+
+ retCode = ::RegEnumValue ( key, dwIndex, szValueName, &dwValueNameLen, NULL, &dwType, szValueData, &dwValueDataLen );
+ if ( retCode == ERROR_SUCCESS)
+ {
+ if ( strstr(szValueName, "client.exe") != NULL )
+ {
+ if (!bTitle)
+ szOutput += "\r\nApplication Compatibility\r\n";
+ bTitle = TRUE;
+ szOutput += szValueName;
+ szOutput += ": ";
+ szOutput += (char *)szValueData;
+ szOutput += "\r\n";
+ }
+ }
+ }
+ }
+ }
+ key.Close();
+
+ // Display information
+ //::SendMessage( GetDlgItem( IDC_EDITEXPORT )->m_hWnd, WM_SETTEXT, 0, (LPARAM)szOutput.c_str() );
+ AppendExportText(szOutput.c_str());
if (::MessageBox(NULL, "Would you like to export the data to the clipboard?", "Export Data...", MB_YESNO | MB_ICONQUESTION) == IDYES )
{
if(OpenClipboard())
{
- char *pszData = (char*)szOutput.c_str();
+ DWORD dwTextLength = ::SendMessage( GetDlgItem( IDC_EDITEXPORT )->m_hWnd, WM_GETTEXTLENGTH, 0, 0) + 1;
+ char *szCBText = new char[dwTextLength];
+ memset(szCBText, 0, dwTextLength);
+ ::SendMessage( GetDlgItem( IDC_EDITEXPORT )->m_hWnd, WM_GETTEXT, dwTextLength, (LPARAM)szCBText );
HGLOBAL hData;
LPVOID pData;
EmptyClipboard();
- hData = GlobalAlloc(GMEM_DDESHARE|GMEM_MOVEABLE,strlen(pszData) + 1);
+ hData = GlobalAlloc(GMEM_DDESHARE|GMEM_MOVEABLE,strlen(szCBText) + 1);
pData = GlobalLock(hData);
- strcpy((LPSTR)pData, pszData);
+ strcpy((LPSTR)pData, szCBText);
GlobalUnlock(hData);
SetClipboardData(CF_TEXT, hData);
CloseClipboard();
+ delete[] szCBText;
}
else
::MessageBox(NULL, "Error opening clipboard!", "Error...", MB_OK | MB_ICONERROR);
Index: ExportDlg.h
===================================================================
RCS file: /cvsroot/decaldev/source/DenAgent/ExportDlg.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ExportDlg.h 6 Feb 2004 17:39:03 -0000 1.1
+++ ExportDlg.h 12 Feb 2004 22:17:00 -0000 1.2
@@ -45,6 +45,7 @@
DECLARE_MESSAGE_MAP()
public:
void SetDecal(IDecal* pDecal);
+ void AppendExportText(const char* szNewText);
CComPtr<IDecal> m_pDecal;
afx_msg void OnBnClickedBtnexport();
};
|