Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. CList Get_StartUp_Programs(CString csRegistryPath)
  2.  
  3. CList<CString,CString> listData;
  4. HKEY hKey;
  5.  
  6. if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,csRegistryPath,0,KEY_ALL_ACCESS | KEY_WOW64_64KEY,&hKey) == ERROR_SUCCESS)
  7. {
  8.  
  9. DWORD dwValues, dwMaxValueNameLen, dwMaxValueLen;
  10.  
  11. LONG lRet = ::RegQueryInfoKey(hKey,
  12. NULL, NULL, // lpClass, lpcClass
  13. NULL, // lpReserved
  14. NULL, NULL, // lpcSubKeys, lpcMaxSubKeyLen
  15. NULL, // lpcMaxClassLen
  16. &dwValues,
  17. &dwMaxValueNameLen,
  18. &dwMaxValueLen,
  19. NULL, // lpcbSecurityDescriptor
  20. NULL); // lpftLastWriteTime
  21.  
  22. if(ERROR_SUCCESS == lRet)
  23. {
  24.  
  25. LPTSTR pszName = new TCHAR[dwMaxValueNameLen + 1];
  26. LPBYTE lpData = new BYTE[dwMaxValueLen];
  27. for(DWORD dwIndex = 0; dwIndex < dwValues; dwIndex++)
  28. {
  29. DWORD dwNameSize = dwMaxValueNameLen + 1;
  30. DWORD dwValueSize = dwMaxValueLen;
  31. DWORD dwType;
  32. lRet = ::RegEnumValue(hKey, dwIndex, pszName, &dwNameSize,0, &dwType, lpData, &dwValueSize);
  33. CString strName = pszName;
  34. listData.AddHead(strName);
  35. CLog::Log(strName + _T(""));
  36. }
  37. delete []pszName;
  38. delete []lpData;
  39. }
  40. }
  41.  
  42. void FunctionToGetListData(CList<CString,CString> &listData)
  43. {
  44. listData.RemobveAll();
  45. ...
  46.  
  47. CList<CString,CString> listData;
  48. FunctionToGetListData(listData);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement