List all system and program files

This is a discussion on List all system and program files within the Windows Programming forums, part of the Platform Specific Boards category; Hi all, I'm trying to get list of all system and program files in my computer (WinXP Pro). With system ...

  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    6

    List all system and program files

    Hi all,
    I'm trying to get list of all system and program files in my computer (WinXP Pro).
    With system files, I found a solution at (System Files Reference).
    Now I'm finding a way to list all program files in my computer. Actually, I did a lot of search but it seems that ...
    Below are some solutions for this (but they're not good enough):
    Soution 1: Read InstallLocation from "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Cur rentVersion\Uninstall". But I found out that some Product don't have value InstallLocation, because it didn't set when installing.
    Solution 2: msiexec have some options to uninstall a software, it make me think about some msi functions (Installer Function Reference (Windows)). I found out that we have 2 useful functions to get all installed products and product's information (MsiEnumProductsEx, MsiGetProductInfoEx). But after read carefully about MsiGetProductInfoEx functions, there is no way to guarantee that I can get InstallLocation property for all products. At this time, it seems that I'm chasing my tail.

    Anyone face this before???
    Any help or comments are appreciated.

    Thanks in advance,
    Tu

    PS: sorry for bad English

  2. #2
    Registered User
    Join Date
    Apr 2007
    Posts
    137
    For "Add/Remove Programs" list, it's done with COM...

  3. #3
    Registered User
    Join Date
    Jun 2009
    Posts
    6
    Hi Alex,
    Can you explain more about this?
    As I know, the way "Add & Remove Programs" do is just get "DisplayName" value from key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows \Cur rentVersion\Uninstall".
    For more reference about this : The Old New Thing : How does Add/Remove Programs get the size and other information?

    Thanks for your reply,
    TU

  4. #4
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,700
    There is really no way to do this and be 100% thorough about it. Programs can create whatever registry keys they wish, and many programs don't even touch the registry at all! So, yeah, you're basically chasing your tail with this one.
    Code:
    bool fun(bool value)
    {
        return std::pow(std::exp(1), std::complex<float>(0, 1) 
        * std::complex<float>(std::atan(1)*(1 << (value + 2))))
        .real() > 0;
    }

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    If I wanted to find all programs (.exe, .com and .bat) and all system files in a folder I would use FindFirstFile() (etc).

    Programs are found using a filter (ie "C:\\*.exe").

    System files are flagged in the returned WIN32_FIND_DATA dwFileAttibutes as FILE_ATTRIBUTE_SYSTEM

    If WIN32_FIND_DATA dwFileAttibutes also tells you if the 'file' is a folder (watch out for the folders "." and "..") I use a recusive find method.

    Your whole PC could be a big target however....
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  6. #6
    Registered User
    Join Date
    Jun 2009
    Posts
    6
    Hi novacain,
    Programs are found using a filter (ie "C:\\*.exe").
    I think it's not enough. Ex: When I installed Acrobat 6.0 in my computer, there are some files like: Pdfmark.pdf, index.pdf, USEnglish.doc, ... Actually these files belongs to Acrobat but they'll not be in the list according to your way.

    Btw, thks for your response.

    -Tu

  7. #7
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    The files you list are types used by programs (but can not be 'run' on their own).
    ie .pdf is 'portable document format' IIRC and requires Adobe Acrobat to open.

    Try renaming AcroRd32.exe (or similar for your version of Acrobat) and open a .pdf file.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  8. #8
    Registered User
    Join Date
    Jun 2009
    Posts
    6
    I think you misunderstood my idea.
    Btw, I found a way to work around my problem.
    An installed application usually create an msi database and store in C:\WINDOWS\Installer. So that I'll read these databases to get my information.
    With some applications that don't touch registry, I agree with you Sebastiani, there is no way to get information from them.

    -Tu

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Client-server system with input from separate program
    By robot-ic in forum Networking/Device Communication
    Replies: 3
    Last Post: 01-16-2009, 02:30 PM
  2. Program Deployment and DLL/OCX Files?
    By dfghjk in forum C++ Programming
    Replies: 5
    Last Post: 06-16-2008, 02:47 AM
  3. Replies: 2
    Last Post: 07-27-2007, 12:48 PM
  4. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  5. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 11:39 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21