#include "winefile.h"
Go to the source code of this file.
Functions | |
void | read_directory_win (Entry *dir, LPCTSTR path) |
static Entry * | find_entry_win (Entry *dir, LPCTSTR name) |
Entry * | read_tree_win (Root *root, LPCTSTR path, enum SORT_ORDER sortOrder, HWND hwnd) |
Definition at line 108 of file winfs.c.
References _Entry::data, _Entry::down, and _Entry::next.
Referenced by read_tree_win().
00109 { 00110 Entry* entry; 00111 00112 for(entry=dir->down; entry; entry=entry->next) { 00113 LPCTSTR p = name; 00114 LPCTSTR q = entry->data.cFileName; 00115 00116 do { 00117 if (!*p || *p=='\\' || *p=='/') 00118 return entry; 00119 } while(tolower(*p++) == tolower(*q++)); 00120 00121 p = name; 00122 q = entry->data.cAlternateFileName; 00123 00124 do { 00125 if (!*p || *p=='\\' || *p=='/') 00126 return entry; 00127 } while(tolower(*p++) == tolower(*q++)); 00128 } 00129 00130 return 0; 00131 }
void read_directory_win | ( | Entry * | dir, | |
LPCTSTR | path | |||
) |
Definition at line 26 of file winfs.c.
References alloc_entry(), _Entry::bhfi, _Entry::bhfi_valid, _Entry::data, _Entry::down, ET_WINDOWS, _Entry::etype, _Entry::expanded, _Entry::level, _Entry::next, _Entry::scanned, and _Entry::up.
Referenced by read_directory().
00027 { 00028 Entry* first_entry = NULL; 00029 Entry* last = NULL; 00030 Entry* entry; 00031 00032 int level = dir->level + 1; 00033 WIN32_FIND_DATA w32fd; 00034 HANDLE hFind; 00035 #ifndef _NO_EXTENSIONS 00036 HANDLE hFile; 00037 #endif 00038 00039 TCHAR buffer[MAX_PATH], *p; 00040 for(p=buffer; *path; ) 00041 *p++ = *path++; 00042 00043 *p++ = '\\'; 00044 p[0] = '*'; 00045 p[1] = '\0'; 00046 00047 hFind = FindFirstFile(buffer, &w32fd); 00048 00049 if (hFind != INVALID_HANDLE_VALUE) { 00050 do { 00051 #ifdef _NO_EXTENSIONS 00052 /* hide directory entry "." */ 00053 if (w32fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { 00054 LPCTSTR name = w32fd.cFileName; 00055 00056 if (name[0]=='.' && name[1]=='\0') 00057 continue; 00058 } 00059 #endif 00060 entry = alloc_entry(); 00061 00062 if (!first_entry) 00063 first_entry = entry; 00064 00065 if (last) 00066 last->next = entry; 00067 00068 memcpy(&entry->data, &w32fd, sizeof(WIN32_FIND_DATA)); 00069 entry->down = NULL; 00070 entry->up = dir; 00071 entry->expanded = FALSE; 00072 entry->scanned = FALSE; 00073 entry->level = level; 00074 00075 #ifndef _NO_EXTENSIONS 00076 entry->etype = ET_WINDOWS; 00077 entry->bhfi_valid = FALSE; 00078 00079 lstrcpy(p, entry->data.cFileName); 00080 00081 hFile = CreateFile(buffer, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, 00082 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); 00083 00084 if (hFile != INVALID_HANDLE_VALUE) { 00085 if (GetFileInformationByHandle(hFile, &entry->bhfi)) 00086 entry->bhfi_valid = TRUE; 00087 00088 CloseHandle(hFile); 00089 } 00090 #endif 00091 00092 last = entry; 00093 } while(FindNextFile(hFind, &w32fd)); 00094 00095 if (last) 00096 last->next = NULL; 00097 00098 FindClose(hFind); 00099 } 00100 00101 dir->down = first_entry; 00102 dir->scanned = TRUE; 00103 }
Entry* read_tree_win | ( | Root * | root, | |
LPCTSTR | path, | |||
enum SORT_ORDER | sortOrder, | |||
HWND | hwnd | |||
) |
Definition at line 136 of file winfs.c.
References _Entry::down, _Root::entry, ET_WINDOWS, _Entry::etype, _Entry::expanded, find_entry_win(), and read_directory().
Referenced by read_tree().
00137 { 00138 TCHAR buffer[MAX_PATH]; 00139 Entry* entry = &root->entry; 00140 LPCTSTR s = path; 00141 PTSTR d = buffer; 00142 00143 HCURSOR old_cursor = SetCursor(LoadCursor(0, IDC_WAIT)); 00144 00145 #ifndef _NO_EXTENSIONS 00146 entry->etype = ET_WINDOWS; 00147 #endif 00148 00149 while(entry) { 00150 while(*s && *s!='\\' && *s!='/') 00151 *d++ = *s++; 00152 00153 while(*s=='\\' || *s=='/') 00154 s++; 00155 00156 *d++ = '\\'; 00157 *d = '\0'; 00158 00159 read_directory(entry, buffer, sortOrder, hwnd); 00160 00161 if (entry->down) 00162 entry->expanded = TRUE; 00163 00164 if (!*s) 00165 break; 00166 00167 entry = find_entry_win(entry, s); 00168 } 00169 00170 SetCursor(old_cursor); 00171 00172 return entry; 00173 }
Winefile Source Code Documentation
generated on 15.09.2008 by |