Public Types | Public Member Functions | Static Public Member Functions

FileTypeManager Struct Reference

#include <globals.h>

Inheritance diagram for FileTypeManager:
Inheritance graph
Collaboration diagram for FileTypeManager:
Collaboration graph

List of all members.

Public Types

typedef map< String, FileTypeInfosuper

Public Member Functions

const FileTypeInfooperator[] (String ext)
LPCTSTR set_type (struct Entry *entry, bool dont_hide_ext=false)

Static Public Member Functions

static bool is_exe_file (LPCTSTR ext)

Detailed Description

Definition at line 43 of file globals.h.

Member Typedef Documentation

Definition at line 45 of file globals.h.

Member Function Documentation

bool FileTypeManager::is_exe_file ( LPCTSTR  ext ) [static]

Definition at line 154 of file explorer.cpp.

References _MAX_EXT, and TEXT.

Referenced by set_type().

    static const LPCTSTR s_executable_extensions[] = {

    TCHAR ext_buffer[_MAX_EXT];
    const LPCTSTR* p;
    LPCTSTR s;
    LPTSTR d;

    for(s=ext+1,d=ext_buffer; (*d=toupper(*s)); s++)

    for(p=s_executable_extensions; *p; p++)
        if (!lstrcmp(ext_buffer, *p))
            return true;

    return false;

Here is the caller graph for this function:

const FileTypeInfo & FileTypeManager::operator[] ( String  ext )

Definition at line 183 of file explorer.cpp.

References FileTypeInfo::_classname, FileTypeInfo::_displayname, FileTypeInfo::_neverShowExt, TEXT, and String::toLower().


    iterator found = find(ext);
    if (found != end())
        return found->second;

    FileTypeInfo& ftype = super::operator[](ext);

    ftype._neverShowExt = false;

    HKEY hkey;
    TCHAR value[MAX_PATH], display_name[MAX_PATH];
    LONG valuelen = sizeof(value);

    if (!RegQueryValue(HKEY_CLASSES_ROOT, ext, value, &valuelen)) {
        ftype._classname = value;

        valuelen = sizeof(display_name);
        if (!RegQueryValue(HKEY_CLASSES_ROOT, ftype._classname, display_name, &valuelen))
            ftype._displayname = display_name;

        if (!RegOpenKey(HKEY_CLASSES_ROOT, ftype._classname, &hkey)) {
            if (!RegQueryValueEx(hkey, TEXT("NeverShowExt"), 0, NULL, NULL, NULL))
                ftype._neverShowExt = true;


    return ftype;

Here is the call graph for this function:

LPCTSTR FileTypeManager::set_type ( struct Entry entry,
bool  dont_hide_ext = false 

Definition at line 217 of file explorer.cpp.

References Entry::_data, Entry::_display_name, FileTypeInfo::_displayname, FileTypeInfo::_neverShowExt, _tcsrchr, Entry::_type_name, ATTRIBUTE_EXECUTABLE, is_exe_file(), and TEXT.

Referenced by WinDirectory::read_directory(), and ShellDirectory::read_directory().

    LPCTSTR ext = _tcsrchr(entry->_data.cFileName, TEXT('.'));

    if (ext) {
        const FileTypeInfo& type = (*this)[ext];

        if (!type._displayname.empty())
            entry->_type_name = _tcsdup(type._displayname);

         // hide some file extensions
        if (type._neverShowExt && !dont_hide_ext) {
            int len = ext - entry->_data.cFileName;

            if (entry->_display_name != entry->_data.cFileName)

            entry->_display_name = (LPTSTR) malloc((len+1)*sizeof(TCHAR));
            lstrcpyn(entry->_display_name, entry->_data.cFileName, len + 1);

        if (is_exe_file(ext))
            entry->_data.dwFileAttributes |= ATTRIBUTE_EXECUTABLE;

    return ext;

Here is the call graph for this function:

Here is the caller graph for this function:

The documentation for this struct was generated from the following files:

ROS Explorer Source Code Documentation
generated on 02.01.2013 by doxygen

ROS Explorer Homepage