Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //******************************************************************************
- //* UNIT: UNT_EnumInstalledPrograms
- //* AUTOR: Fakedo0r
- //* FECHA: 19.04.2012
- //* CORREO: [email protected]
- //* BLOG: Sub-Soul.blogspot.com
- //* USO: EnumPrograms(' : ');
- //******************************************************************************
- Unit UNT_EnumInstalledPrograms;
- //******************************************************************************
- //DECLARACION DE LIBRERIAS / CLASES
- //******************************************************************************
- Interface
- Uses
- Winapi.Windows, System.SysUtils, Vcl.Dialogs;
- //******************************************************************************
- //DECLARACION DE FUNCIONES / PROCEDIMIENTOS
- //******************************************************************************
- Function EnumPrograms(sDelimitador: String): String;
- //******************************************************************************
- Implementation
- //******************************************************************************
- //<--- ENUMERA LOS PROGRAMAS INSTALADOS JUNTO A SUS UNINSTALL's --->
- //******************************************************************************
- Function EnumPrograms(sDelimitador: String): String;
- Var
- ihKey: HKEY;
- ihSubKey: HKEY;
- dwIndex: DWORD;
- dwName: DWORD;
- dwDataSize: DWORD;
- pszName: PChar;
- sProName: String;
- sProPath: String;
- iRegType: Integer;
- tLastWriteTime: FileTime;
- Begin
- dwIndex := 0;
- dwName := 0;
- dwDataSize := 0;
- iRegType := 1;
- If RegOpenKeyEx(HKEY_LOCAL_MACHINE, 'Software\Microsoft\Windows\CurrentVersion\Uninstall', 0, KEY_ENUMERATE_SUB_KEYS, ihKey) = ERROR_SUCCESS Then;
- Begin
- dwName := 255;
- GetMem(pszName, dwName);
- While RegEnumKeyEx(ihKey, dwIndex, @pszName[0], dwName, Nil, Nil, Nil, @tLastWriteTime) = ERROR_SUCCESS do
- Begin
- Inc(dwIndex);
- dwName := 255;
- If RegOpenKeyEx(ihKey, pszName, 0, KEY_QUERY_VALUE, ihSubKey) = ERROR_SUCCESS Then
- Begin
- If RegQueryValueEx(ihSubKey, 'DisplayName', Nil, @iRegType, Nil, @dwDataSize) = ERROR_SUCCESS Then
- Begin
- SetLength(sProName, dwDataSize);
- RegQueryValueEx(ihSubKey, 'DisplayName', Nil, @iRegType, PByte(PChar(sProName)), @dwDataSize);
- sProName := TrimA(sProName);
- If RegQueryValueEx(ihSubKey, 'UninstallString', Nil, @iRegType, Nil, @dwDataSize) = ERROR_SUCCESS Then
- Begin
- If iRegType = REG_SZ Then
- Begin
- SetLength(sProPath, dwDataSize);
- RegQueryValueEx(ihSubKey, 'UninstallString', Nil, @iRegType, PByte(PChar(sProPath)), @dwDataSize);
- sProPath := Trim(sProPath);
- Result := Result + sProName + sDelimitador + sProPath + #13#10;
- End;
- End;
- End;
- End;
- End;
- End;
- End;
- End.
Advertisement
Add Comment
Please, Sign In to add comment