ReactOS  0.4.14-dev-583-g2a1ba2c
winefile.c File Reference
#include "winefile.h"
#include "resource.h"
#include "wine/unicode.h"
Include dependency graph for winefile.c:

Go to the source code of this file.

Classes

struct  _Entry
 
struct  Root
 root entry for file system trees More...
 
struct  Pane
 child window pane for displaying file lists More...
 
struct  ChildWnd
 
struct  FilterDialog
 
struct  PropertiesDialog
 
struct  LANGANDCODEPAGE
 
struct  FullScreenParameters
 

Macros

#define COBJMACROS
 
#define _MAX_DRIVE   3
 
#define _MAX_FNAME   256
 
#define _MAX_DIR   _MAX_FNAME
 
#define _MAX_EXT   _MAX_FNAME
 
#define _MAX_PATH   260
 
#define UNION_MEMBER(x)   DUMMYUNIONNAME.x
 
#define DEFAULT_SPLIT_POS   300
 
#define COLUMNS   10
 
#define RS(b, i)   load_string(b, sizeof(b)/sizeof(b[0]), i)
 
#define FETCH_ITEM_COUNT   32
 
#define RFF_NODEFAULT   0x02 /* No default item selected. */
 

Typedefs

typedef struct _Entry Entry
 

Enumerations

enum  ENTRY_TYPE {
  ET_UNKNOWN, ET_WINDOWS, ET_SHELL, ET_NTOBJS,
  ET_REGISTRY, ET_FAT, ET_WEB, ET_WINDOWS,
  ET_UNIX, ET_SHELL
}
 
enum  COLUMN_FLAGS {
  COL_TYPE = 0x0001, COL_SIZE = 0x0002, COL_DATE = 0x0004, COL_TIME = 0x0008,
  COL_ATTRIBUTES = 0x0010, COL_DOSNAMES = 0x0020, COL_INDEX = 0x0040, COL_LINKS = 0x0080,
  COL_CONTENT = 0x0100, COL_ALL = COL_TYPE|COL_SIZE|COL_DATE|COL_TIME|COL_ATTRIBUTES|COL_DOSNAMES|COL_INDEX|COL_LINKS|COL_CONTENT, COL_SIZE = 0x01, COL_DATE = 0x02,
  COL_TIME = 0x04, COL_ATTRIBUTES = 0x08, COL_DOSNAMES = 0x10, COL_INDEX = 0x20,
  COL_LINKS = 0x40, COL_ALL = COL_SIZE|COL_DATE|COL_TIME|COL_ATTRIBUTES|COL_DOSNAMES|COL_INDEX|COL_LINKS
}
 
enum  SORT_ORDER {
  SORT_NONE, SORT_NAME, SORT_EXT, SORT_SIZE,
  SORT_DATE, SORT_NAME, SORT_EXT, SORT_SIZE,
  SORT_DATE
}
 
enum  TYPE_ORDER {
  TO_DIR, TO_DOT, TO_DOTDOT, TO_OTHER_DIR,
  TO_VIRTUAL_FOLDER, TO_FILE, TO_DIR = 0, TO_DOT = 1,
  TO_DOTDOT = 2, TO_OTHER_DIR = 3, TO_FILE = 4
}
 
enum  TYPE_FILTER {
  TF_DIRECTORIES = 0x01, TF_PROGRAMS = 0x02, TF_DOCUMENTS = 0x04, TF_OTHERS = 0x08,
  TF_HIDDEN = 0x10, TF_ALL = 0x1F
}
 
enum  FILE_TYPE { FT_OTHER = 0, FT_EXECUTABLE = 1, FT_DOCUMENT = 2 }
 

Functions

static void read_directory (Entry *dir, LPCWSTR path, SORT_ORDER sortOrder, HWND hwnd)
 
static void set_curdir (ChildWnd *child, Entry *entry, int idx, HWND hwnd)
 
static void refresh_child (ChildWnd *child)
 
static void refresh_drives (void)
 
static void get_path (Entry *dir, PWSTR path)
 
static void format_date (const FILETIME *ft, WCHAR *buffer, int visible_cols)
 
static LRESULT CALLBACK FrameWndProc (HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
 
static LRESULT CALLBACK ChildWndProc (HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
 
static LRESULT CALLBACK TreeWndProc (HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
 
static void format_longlong (LPWSTR ret, ULONGLONG val)
 
static LPWSTR load_string (LPWSTR buffer, DWORD size, UINT id)
 
static void display_error (HWND hwnd, DWORD error)
 
static void display_network_error (HWND hwnd)
 
static BOOL get_check (HWND hwnd, INT id)
 
static INT set_check (HWND hwnd, INT id, BOOL on)
 
static void choose_font (HWND hwnd)
 
static Entryalloc_entry (void)
 
static void free_entry (Entry *entry)
 
static void free_entries (Entry *dir)
 
static void read_directory_win (Entry *dir, LPCWSTR path)
 
static Entryfind_entry_win (Entry *dir, LPCWSTR name)
 
static Entryread_tree_win (Root *root, LPCWSTR path, SORT_ORDER sortOrder, HWND hwnd)
 
static void free_strret (STRRET *str)
 
static LPWSTR wcscpyn (LPWSTR dest, LPCWSTR source, size_t count)
 
static void get_strretW (STRRET *str, const SHITEMID *shiid, LPWSTR buffer, int len)
 
static HRESULT name_from_pidl (IShellFolder *folder, LPITEMIDLIST pidl, LPWSTR buffer, int len, SHGDNF flags)
 
static HRESULT path_from_pidlW (IShellFolder *folder, LPITEMIDLIST pidl, LPWSTR buffer, int len)
 
static LPITEMIDLIST get_path_pidl (LPWSTR path, HWND hwnd)
 
static LPITEMIDLIST get_to_absolute_pidl (Entry *entry, HWND hwnd)
 
static HICON extract_icon (IShellFolder *folder, LPCITEMIDLIST pidl)
 
static Entryfind_entry_shell (Entry *dir, LPCITEMIDLIST pidl)
 
static Entryread_tree_shell (Root *root, LPITEMIDLIST pidl, SORT_ORDER sortOrder, HWND hwnd)
 
static void fill_w32fdata_shell (IShellFolder *folder, LPCITEMIDLIST pidl, SFGAOF attribs, WIN32_FIND_DATAW *w32fdata)
 
static void read_directory_shell (Entry *dir, HWND hwnd)
 
static int TypeOrderFromDirname (LPCWSTR name)
 
static int compareType (const WIN32_FIND_DATAW *fd1, const WIN32_FIND_DATAW *fd2)
 
static int compareName (const void *arg1, const void *arg2)
 
static int compareExt (const void *arg1, const void *arg2)
 
static int compareSize (const void *arg1, const void *arg2)
 
static int compareDate (const void *arg1, const void *arg2)
 
static void SortDirectory (Entry *dir, SORT_ORDER sortOrder)
 
static Entryread_tree (Root *root, LPCWSTR path, LPITEMIDLIST pidl, LPWSTR drv, SORT_ORDER sortOrder, HWND hwnd)
 
static ChildWndalloc_child_window (LPCWSTR path, LPITEMIDLIST pidl, HWND hwnd)
 
static void free_child_window (ChildWnd *child)
 
static windowOptions load_registry_settings (void)
 
static void save_registry_settings (void)
 
static void resize_frame_rect (HWND hwnd, PRECT prect)
 
static void resize_frame (HWND hwnd, int cx, int cy)
 
static void resize_frame_client (HWND hwnd)
 
static LRESULT CALLBACK CBTProc (int code, WPARAM wparam, LPARAM lparam)
 
static HWND create_child_window (ChildWnd *child)
 
static void WineFile_OnRun (HWND hwnd)
 
static INT_PTR CALLBACK DestinationDlgProc (HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
 
static INT_PTR CALLBACK FilterDialogDlgProc (HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
 
static void PropDlg_DisplayValue (HWND hlbox, HWND hedit)
 
static void CheckForFileInfo (struct PropertiesDialog *dlg, HWND hwnd, LPCWSTR strFilename)
 
static INT_PTR CALLBACK PropertiesDialogDlgProc (HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
 
static void show_properties_dlg (Entry *entry, HWND hwnd)
 
static void frame_get_clientspace (HWND hwnd, PRECT prect)
 
static BOOL toggle_fullscreen (HWND hwnd)
 
static void fullscreen_move (HWND hwnd)
 
static void toggle_child (HWND hwnd, UINT cmd, HWND hchild)
 
static BOOL activate_drive_window (LPCWSTR path)
 
static BOOL activate_fs_window (LPCWSTR filesys)
 
static void resize_tree (ChildWnd *child, int cx, int cy)
 
static HWND create_header (HWND parent, Pane *pane, UINT id)
 
static void init_output (HWND hwnd)
 
static void draw_item (Pane *pane, LPDRAWITEMSTRUCT dis, Entry *entry, int calcWidthCol)
 
static BOOL calc_widths (Pane *pane, BOOL anyway)
 
static void calc_single_width (Pane *pane, int col)
 
static BOOL pattern_match (LPCWSTR str, LPCWSTR pattern)
 
static BOOL pattern_imatch (LPCWSTR str, LPCWSTR pattern)
 
static enum FILE_TYPE get_file_type (LPCWSTR filename)
 
static int insert_entries (Pane *pane, Entry *dir, LPCWSTR pattern, int filter_flags, int idx)
 
static void format_bytes (LPWSTR buffer, LONGLONG bytes)
 
static void set_space_status (void)
 
static void create_tree_window (HWND parent, Pane *pane, UINT id, UINT id_header, LPCWSTR pattern, int filter_flags)
 
static void InitChildWindow (ChildWnd *child)
 
static void calc_width (Pane *pane, LPDRAWITEMSTRUCT dis, int col, LPCWSTR str)
 
static void calc_tabbed_width (Pane *pane, LPDRAWITEMSTRUCT dis, int col, LPCWSTR str)
 
static void output_text (Pane *pane, LPDRAWITEMSTRUCT dis, int col, LPCWSTR str, DWORD flags)
 
static void output_tabbed_text (Pane *pane, LPDRAWITEMSTRUCT dis, int col, LPCWSTR str)
 
static void output_number (Pane *pane, LPDRAWITEMSTRUCT dis, int col, LPCWSTR str)
 
static BOOL is_exe_file (LPCWSTR ext)
 
static BOOL is_registered_type (LPCWSTR ext)
 
static void set_header (Pane *pane)
 
static LRESULT pane_notify (Pane *pane, NMHDR *pnmh)
 
static void scan_entry (ChildWnd *child, Entry *entry, int idx, HWND hwnd)
 
static BOOL expand_entry (ChildWnd *child, Entry *dir)
 
static void collapse_entry (Pane *pane, Entry *dir)
 
static void refresh_right_pane (ChildWnd *child)
 
static void create_drive_bar (void)
 
static BOOL launch_file (HWND hwnd, LPCWSTR cmd, UINT nCmdShow)
 
static BOOL launch_entry (Entry *entry, HWND hwnd, UINT nCmdShow)
 
static void activate_entry (ChildWnd *child, Pane *pane, HWND hwnd)
 
static BOOL pane_command (Pane *pane, UINT cmd)
 
static void set_sort_order (ChildWnd *child, SORT_ORDER sortOrder)
 
static void update_view_menu (ChildWnd *child)
 
static BOOL is_directory (LPCWSTR target)
 
static BOOL prompt_target (Pane *pane, LPWSTR source, LPWSTR target)
 
static void CtxMenu_reset (void)
 
static IContextMenuCtxMenu_query_interfaces (IContextMenu *pcm1)
 
static BOOL CtxMenu_HandleMenuMsg (UINT nmsg, WPARAM wparam, LPARAM lparam)
 
static HRESULT ShellFolderContextMenu (IShellFolder *shell_folder, HWND hwndParent, int cidl, LPCITEMIDLIST *apidl, int x, int y)
 
static void InitInstance (HINSTANCE hinstance)
 
static BOOL show_frame (HWND hwndParent, int cmdshow, LPCWSTR path)
 
static void ExitInstance (void)
 
int APIENTRY wWinMain (HINSTANCE hinstance, HINSTANCE previnstance, LPWSTR cmdline, int cmdshow)
 

Variables

static const WCHAR registry_key []
 
static const WCHAR reg_start_x [] = { 's','t','a','r','t','X','\0'}
 
static const WCHAR reg_start_y [] = { 's','t','a','r','t','Y','\0'}
 
static const WCHAR reg_width [] = { 'w','i','d','t','h','\0'}
 
static const WCHAR reg_height [] = { 'h','e','i','g','h','t','\0'}
 
static const WCHAR reg_logfont [] = { 'l','o','g','f','o','n','t','\0'}
 
WINEFILE_GLOBALS Globals
 
static int last_split
 
static const WCHAR sEmpty [] = {'\0'}
 
static const WCHAR sSpace [] = {' ', '\0'}
 
static const WCHAR sNumFmt [] = {'%','d','\0'}
 
static const WCHAR sQMarks [] = {'?','?','?','\0'}
 
static const WCHAR sWINEFILEFRAME [] = {'W','F','S','_','F','r','a','m','e','\0'}
 
static const WCHAR sWINEFILETREE [] = {'W','F','S','_','T','r','e','e','\0'}
 
static int(* sortFunctions [])(const void *arg1, const void *arg2)
 
static HHOOK hcbthook
 
static ChildWndnewchild = NULL
 
struct LANGANDCODEPAGElpTranslate
 
static LPCSTR InfoStrings []
 
static struct FullScreenParameters g_fullscreen
 
static WCHAR g_pos_names [COLUMNS][40]
 
static const int g_pos_align []
 
static WNDPROC g_orgTreeWndProc
 
static IContextMenu2s_pctxmenu2 = NULL
 
static IContextMenu3s_pctxmenu3 = NULL
 

Macro Definition Documentation

◆ _MAX_DIR

#define _MAX_DIR   _MAX_FNAME

Definition at line 41 of file winefile.c.

◆ _MAX_DRIVE

#define _MAX_DRIVE   3

Definition at line 39 of file winefile.c.

◆ _MAX_EXT

#define _MAX_EXT   _MAX_FNAME

Definition at line 42 of file winefile.c.

◆ _MAX_FNAME

#define _MAX_FNAME   256

Definition at line 40 of file winefile.c.

◆ _MAX_PATH

#define _MAX_PATH   260

Definition at line 43 of file winefile.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 32 of file winefile.c.

◆ COLUMNS

#define COLUMNS   10

Definition at line 119 of file winefile.c.

◆ DEFAULT_SPLIT_POS

#define DEFAULT_SPLIT_POS   300

Definition at line 52 of file winefile.c.

◆ FETCH_ITEM_COUNT

#define FETCH_ITEM_COUNT   32

◆ RFF_NODEFAULT

#define RFF_NODEFAULT   0x02 /* No default item selected. */

Definition at line 1630 of file winefile.c.

◆ RS

#define RS (   b,
  i 
)    load_string(b, sizeof(b)/sizeof(b[0]), i)

Definition at line 195 of file winefile.c.

◆ UNION_MEMBER

#define UNION_MEMBER (   x)    DUMMYUNIONNAME.x

Definition at line 47 of file winefile.c.

Typedef Documentation

◆ Entry

Definition at line 640 of file kefuncs.h.

Enumeration Type Documentation

◆ COLUMN_FLAGS

Enumerator
COL_TYPE 
COL_SIZE 
COL_DATE 
COL_TIME 
COL_ATTRIBUTES 
COL_DOSNAMES 
COL_INDEX 
COL_LINKS 
COL_CONTENT 
COL_ALL 
COL_SIZE 
COL_DATE 
COL_TIME 
COL_ATTRIBUTES 
COL_DOSNAMES 
COL_INDEX 
COL_LINKS 
COL_ALL 

Definition at line 97 of file winefile.c.

97  {
98  COL_SIZE = 0x01,
99  COL_DATE = 0x02,
100  COL_TIME = 0x04,
101  COL_ATTRIBUTES = 0x08,
102  COL_DOSNAMES = 0x10,
103  COL_INDEX = 0x20,
104  COL_LINKS = 0x40,
106 };

◆ ENTRY_TYPE

Enumerator
ET_UNKNOWN 
ET_WINDOWS 
ET_SHELL 
ET_NTOBJS 
ET_REGISTRY 
ET_FAT 
ET_WEB 
ET_WINDOWS 
ET_UNIX 
ET_SHELL 

Definition at line 63 of file winefile.c.

63  {
64  ET_WINDOWS,
65  ET_UNIX,
66  ET_SHELL
67 };

◆ FILE_TYPE

Enumerator
FT_OTHER 
FT_EXECUTABLE 
FT_DOCUMENT 

Definition at line 2568 of file winefile.c.

2568  {
2569  FT_OTHER = 0,
2570  FT_EXECUTABLE = 1,
2571  FT_DOCUMENT = 2
2572 };

◆ SORT_ORDER

Enumerator
SORT_NONE 
SORT_NAME 
SORT_EXT 
SORT_SIZE 
SORT_DATE 
SORT_NAME 
SORT_EXT 
SORT_SIZE 
SORT_DATE 

Definition at line 108 of file winefile.c.

108  {
109  SORT_NAME,
110  SORT_EXT,
111  SORT_SIZE,
112  SORT_DATE
113 } SORT_ORDER;
SORT_ORDER
Definition: winefile.c:108

◆ TYPE_FILTER

Enumerator
TF_DIRECTORIES 
TF_PROGRAMS 
TF_DOCUMENTS 
TF_OTHERS 
TF_HIDDEN 
TF_ALL 

Definition at line 1282 of file winefile.c.

1282  {
1283  TF_DIRECTORIES = 0x01,
1284  TF_PROGRAMS = 0x02,
1285  TF_DOCUMENTS = 0x04,
1286  TF_OTHERS = 0x08,
1287  TF_HIDDEN = 0x10,
1288  TF_ALL = 0x1F
1289 };

◆ TYPE_ORDER

Enumerator
TO_DIR 
TO_DOT 
TO_DOTDOT 
TO_OTHER_DIR 
TO_VIRTUAL_FOLDER 
TO_FILE 
TO_DIR 
TO_DOT 
TO_DOTDOT 
TO_OTHER_DIR 
TO_FILE 

Definition at line 998 of file winefile.c.

998  {
999  TO_DIR = 0,
1000  TO_DOT = 1,
1001  TO_DOTDOT = 2,
1002  TO_OTHER_DIR = 3,
1003  TO_FILE = 4
1004 };

Function Documentation

◆ activate_drive_window()

static BOOL activate_drive_window ( LPCWSTR  path)
static

Definition at line 2009 of file winefile.c.

2010 {
2011  WCHAR drv1[_MAX_DRIVE], drv2[_MAX_DRIVE];
2012  HWND child_wnd;
2013 
2014  _wsplitpath(path, drv1, 0, 0, 0);
2015 
2016  /* search for an already open window for the same drive */
2017  for(child_wnd=GetNextWindow(Globals.hmdiclient,GW_CHILD); child_wnd; child_wnd=GetNextWindow(child_wnd, GW_HWNDNEXT)) {
2019 
2020  if (child) {
2021  _wsplitpath(child->root.path, drv2, 0, 0, 0);
2022 
2023  if (!lstrcmpiW(drv2, drv1)) {
2025 
2026  if (IsIconic(child_wnd))
2027  ShowWindow(child_wnd, SW_SHOWNORMAL);
2028 
2029  return TRUE;
2030  }
2031  }
2032  }
2033 
2034  return FALSE;
2035 }
#define GW_HWNDNEXT
Definition: winuser.h:756
void _wsplitpath(const WCHAR *path, WCHAR *drv, WCHAR *dir, WCHAR *name, WCHAR *ext)
Definition: splitpath.c:22
#define _MAX_DRIVE
Definition: winefile.c:39
#define TRUE
Definition: types.h:120
#define GW_CHILD
Definition: winuser.h:758
#define GetNextWindow(h, c)
Definition: winuser.h:4702
UINT_PTR WPARAM
Definition: windef.h:207
#define GetWindowLongPtrW
Definition: winuser.h:4804
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI IsIconic(_In_ HWND)
static HWND child
Definition: cursoricon.c:298
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
#define GWLP_USERDATA
Definition: treelist.c:63
__wchar_t WCHAR
Definition: xmlstorage.h:180
WINEFILE_GLOBALS Globals
Definition: winefile.c:161
#define WM_MDIACTIVATE
Definition: winuser.h:1796
#define SW_SHOWNORMAL
Definition: winuser.h:764
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
Definition: main.h:57

Referenced by FrameWndProc().

◆ activate_entry()

static void activate_entry ( ChildWnd child,
Pane pane,
HWND  hwnd 
)
static

Definition at line 3570 of file winefile.c.

3571 {
3572  Entry* entry = pane->cur;
3573 
3574  if (!entry)
3575  return;
3576 
3577  if (entry->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
3578  int scanned_old = entry->scanned;
3579 
3580  if (!scanned_old)
3581  {
3582  int idx = SendMessageW(child->left.hwnd, LB_GETCURSEL, 0, 0);
3584  }
3585 
3586  if (entry->data.cFileName[0]=='.' && entry->data.cFileName[1]=='\0')
3587  return;
3588 
3589  if (entry->data.cFileName[0]=='.' && entry->data.cFileName[1]=='.' && entry->data.cFileName[2]=='\0') {
3590  entry = child->left.cur->up;
3591  collapse_entry(&child->left, entry);
3592  goto focus_entry;
3593  } else if (entry->expanded)
3594  collapse_entry(pane, child->left.cur);
3595  else {
3596  expand_entry(child, child->left.cur);
3597 
3598  if (!pane->treePane) focus_entry: {
3599  int idxstart = SendMessageW(child->left.hwnd, LB_GETCURSEL, 0, 0);
3600  int idx = SendMessageW(child->left.hwnd, LB_FINDSTRING, idxstart, (LPARAM)entry);
3601  SendMessageW(child->left.hwnd, LB_SETCURSEL, idx, 0);
3603  }
3604  }
3605 
3606  if (!scanned_old) {
3607  calc_widths(pane, FALSE);
3608 
3609  set_header(pane);
3610  }
3611  } else {
3612  if (GetKeyState(VK_MENU) < 0)
3614  else
3616  }
3617 }
#define LB_SETCURSEL
Definition: winuser.h:2045
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static BOOL launch_entry(Entry *entry, HWND hwnd, UINT nCmdShow)
Definition: winefile.c:3533
static BOOL calc_widths(Pane *pane, BOOL anyway)
Definition: winefile.c:2386
#define VK_MENU
Definition: winuser.h:2179
static HWND child
Definition: cursoricon.c:298
static BOOL expand_entry(ChildWnd *child, Entry *dir)
Definition: winefile.c:3305
unsigned int idx
Definition: utils.c:41
Entry * cur
Definition: winefile.c:126
LONG_PTR LPARAM
Definition: windef.h:208
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
SHORT WINAPI GetKeyState(_In_ int)
static void set_curdir(ChildWnd *child, Entry *entry, int idx, HWND hwnd)
Definition: winefile.c:3381
static void collapse_entry(Pane *pane, Entry *dir)
Definition: winefile.c:3346
uint32_t entry
Definition: isohybrid.c:63
#define SW_SHOWNORMAL
Definition: winuser.h:764
#define LB_FINDSTRING
Definition: winuser.h:2016
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_GETCURSEL
Definition: winuser.h:2021
static void scan_entry(ChildWnd *child, Entry *entry, int idx, HWND hwnd)
Definition: winefile.c:3259
BOOL treePane
Definition: winefile.c:123
static void show_properties_dlg(Entry *entry, HWND hwnd)
Definition: winefile.c:1894
base of all file and directory entries
Definition: entries.h:82
static void set_header(Pane *pane)
Definition: winefile.c:3165

Referenced by ChildWndProc().

◆ activate_fs_window()

static BOOL activate_fs_window ( LPCWSTR  filesys)
static

Definition at line 2037 of file winefile.c.

2038 {
2039  HWND child_wnd;
2040 
2041  /* search for an already open window of the given file system name */
2042  for(child_wnd=GetNextWindow(Globals.hmdiclient,GW_CHILD); child_wnd; child_wnd=GetNextWindow(child_wnd, GW_HWNDNEXT)) {
2044 
2045  if (child) {
2046  if (!lstrcmpiW(child->root.fs, filesys)) {
2048 
2049  if (IsIconic(child_wnd))
2050  ShowWindow(child_wnd, SW_SHOWNORMAL);
2051 
2052  return TRUE;
2053  }
2054  }
2055  }
2056 
2057  return FALSE;
2058 }
#define GW_HWNDNEXT
Definition: winuser.h:756
#define TRUE
Definition: types.h:120
#define GW_CHILD
Definition: winuser.h:758
#define GetNextWindow(h, c)
Definition: winuser.h:4702
UINT_PTR WPARAM
Definition: windef.h:207
#define GetWindowLongPtrW
Definition: winuser.h:4804
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI IsIconic(_In_ HWND)
static HWND child
Definition: cursoricon.c:298
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
#define GWLP_USERDATA
Definition: treelist.c:63
WINEFILE_GLOBALS Globals
Definition: winefile.c:161
#define WM_MDIACTIVATE
Definition: winuser.h:1796
#define SW_SHOWNORMAL
Definition: winuser.h:764
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
Definition: main.h:57

Referenced by FrameWndProc().

◆ alloc_child_window()

static ChildWnd* alloc_child_window ( LPCWSTR  path,
LPITEMIDLIST  pidl,
HWND  hwnd 
)
static

Definition at line 1292 of file winefile.c.

1293 {
1295  WCHAR dir_path[MAX_PATH];
1296  static const WCHAR sAsterics[] = {'*', '\0'};
1297  static const WCHAR sTitleFmt[] = {'%','s',' ','-',' ','%','s','\0'};
1298 
1299  ChildWnd* child = HeapAlloc(GetProcessHeap(), 0, sizeof(ChildWnd));
1300  Root* root = &child->root;
1301  Entry* entry;
1302 
1303  memset(child, 0, sizeof(ChildWnd));
1304 
1305  child->left.treePane = TRUE;
1306  child->left.visible_cols = 0;
1307 
1308  child->right.treePane = FALSE;
1310 
1311  child->pos.length = sizeof(WINDOWPLACEMENT);
1312  child->pos.flags = 0;
1313  child->pos.showCmd = SW_SHOWNORMAL;
1314  child->pos.rcNormalPosition.left = CW_USEDEFAULT;
1315  child->pos.rcNormalPosition.top = CW_USEDEFAULT;
1316  child->pos.rcNormalPosition.right = CW_USEDEFAULT;
1317  child->pos.rcNormalPosition.bottom = CW_USEDEFAULT;
1318 
1319  child->focus_pane = 0;
1320  child->split_pos = DEFAULT_SPLIT_POS;
1321  child->sortOrder = SORT_NAME;
1322  child->header_wdths_ok = FALSE;
1323 
1324  if (path)
1325  {
1326  int pathlen = strlenW(path);
1327  const WCHAR *npath = path;
1328 
1329  if (path[0] == '"' && path[pathlen - 1] == '"')
1330  {
1331  npath++;
1332  pathlen--;
1333  }
1334  lstrcpynW(child->path, npath, pathlen + 1);
1335 
1336  _wsplitpath(child->path, drv, dir, name, ext);
1337  }
1338 
1339  lstrcpyW(child->filter_pattern, sAsterics);
1340  child->filter_flags = TF_ALL;
1341 
1342  root->entry.level = 0;
1343 
1344  lstrcpyW(dir_path, drv);
1345  lstrcatW(dir_path, dir);
1346  entry = read_tree(root, dir_path, pidl, drv, child->sortOrder, hwnd);
1347 
1348  if (root->entry.etype == ET_SHELL)
1349  load_string(root->entry.data.cFileName, sizeof(root->entry.data.cFileName)/sizeof(root->entry.data.cFileName[0]), IDS_DESKTOP);
1350  else
1351  wsprintfW(root->entry.data.cFileName, sTitleFmt, drv, root->fs);
1352 
1353  root->entry.data.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;
1354 
1355  child->left.root = &root->entry;
1356  child->right.root = NULL;
1357 
1358  set_curdir(child, entry, 0, hwnd);
1359 
1360  return child;
1361 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
void _wsplitpath(const WCHAR *path, WCHAR *drv, WCHAR *dir, WCHAR *name, WCHAR *ext)
Definition: splitpath.c:22
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define _MAX_DRIVE
Definition: winefile.c:39
#define TRUE
Definition: types.h:120
struct _WINDOWPLACEMENT WINDOWPLACEMENT
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define _MAX_EXT
Definition: winefile.c:42
GLsizei const GLchar ** path
Definition: glext.h:7234
static Entry * read_tree(Root *root, LPCWSTR path, LPITEMIDLIST pidl, LPWSTR drv, SORT_ORDER sortOrder, HWND hwnd)
Definition: winefile.c:1232
#define _MAX_FNAME
Definition: winefile.c:40
static HWND child
Definition: cursoricon.c:298
#define lstrcpynW
Definition: compat.h:405
#define DEFAULT_SPLIT_POS
Definition: winefile.c:52
#define CW_USEDEFAULT
Definition: winuser.h:225
smooth NULL
Definition: ftsmooth.c:416
char ext[3]
Definition: mkdosfs.c:358
unsigned int dir
Definition: maze.c:112
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
static void set_curdir(ChildWnd *child, Entry *entry, int idx, HWND hwnd)
Definition: winefile.c:3381
root entry for file system trees
Definition: entries.h:148
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _MAX_DIR
Definition: winefile.c:41
#define MAX_PATH
Definition: compat.h:26
uint32_t entry
Definition: isohybrid.c:63
#define SW_SHOWNORMAL
Definition: winuser.h:764
#define lstrcpyW
Definition: compat.h:414
#define IDS_DESKTOP
Definition: shresdef.h:65
Definition: main.h:57
Definition: name.c:38
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define memset(x, y, z)
Definition: compat.h:39
base of all file and directory entries
Definition: entries.h:82
static LPWSTR load_string(LPWSTR buffer, DWORD size, UINT id)
Definition: winefile.c:189

Referenced by ChildWndProc(), FrameWndProc(), and show_frame().

◆ alloc_entry()

static Entry* alloc_entry ( void  )
static

Definition at line 292 of file winefile.c.

293 {
294  Entry* entry = HeapAlloc(GetProcessHeap(), 0, sizeof(Entry));
295 
296  entry->pidl = NULL;
297  entry->folder = NULL;
298  entry->hicon = 0;
299 
300  return entry;
301 }
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
uint32_t entry
Definition: isohybrid.c:63
base of all file and directory entries
Definition: entries.h:82

Referenced by read_directory_shell(), and read_directory_win().

◆ calc_single_width()

static void calc_single_width ( Pane pane,
int  col 
)
static

Definition at line 2471 of file winefile.c.

2472 {
2473  HFONT hfontOld;
2474  int x, cx;
2475  int entries = SendMessageW(pane->hwnd, LB_GETCOUNT, 0, 0);
2476  int cnt;
2477  HDC hdc;
2478 
2479  pane->widths[col] = 0;
2480 
2481  hdc = GetDC(pane->hwnd);
2482  hfontOld = SelectObject(hdc, Globals.hfont);
2483 
2484  for(cnt=0; cnt<entries; cnt++) {
2485  Entry* entry = (Entry*)SendMessageW(pane->hwnd, LB_GETITEMDATA, cnt, 0);
2486  DRAWITEMSTRUCT dis;
2487 
2488  dis.CtlType = 0;
2489  dis.CtlID = 0;
2490  dis.itemID = 0;
2491  dis.itemAction = 0;
2492  dis.itemState = 0;
2493  dis.hwndItem = pane->hwnd;
2494  dis.hDC = hdc;
2495  dis.rcItem.left = 0;
2496  dis.rcItem.top = 0;
2497  dis.rcItem.right = 0;
2498  dis.rcItem.bottom = 0;
2499  /*dis.itemData = 0; */
2500 
2501  draw_item(pane, &dis, entry, col);
2502  }
2503 
2504  SelectObject(hdc, hfontOld);
2505  ReleaseDC(pane->hwnd, hdc);
2506 
2507  cx = pane->widths[col];
2508 
2509  if (cx) {
2510  cx += 3*Globals.spaceSize.cx;
2511 
2512  if (cx < IMAGE_WIDTH)
2513  cx = IMAGE_WIDTH;
2514  }
2515 
2516  pane->widths[col] = cx;
2517 
2518  x = pane->positions[col] + cx;
2519 
2520  for(; col<COLUMNS-1; ) {
2521  pane->positions[++col] = x;
2522  x += pane->widths[col];
2523  }
2524 
2526 }
#define LB_SETHORIZONTALEXTENT
Definition: winuser.h:2046
HDC WINAPI GetDC(_In_opt_ HWND)
#define LB_GETITEMDATA
Definition: winuser.h:2023
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:307
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
int widths[COLUMNS]
Definition: winefile.c:120
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
LONG cx
Definition: windef.h:334
#define LB_GETCOUNT
Definition: winuser.h:2020
WINEFILE_GLOBALS Globals
Definition: winefile.c:161
HDC hdc
Definition: main.c:9
uint32_t entry
Definition: isohybrid.c:63
#define COLUMNS
Definition: winefile.c:119
HWND hwnd
Definition: winefile.c:116
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
_Out_opt_ int * cx
Definition: commctrl.h:581
static void draw_item(Pane *pane, LPDRAWITEMSTRUCT dis, Entry *entry, int calcWidthCol)
Definition: winefile.c:2908
LONG bottom
Definition: windef.h:309
#define IMAGE_WIDTH
Definition: pane.cpp:38
base of all file and directory entries
Definition: entries.h:82
int positions[COLUMNS+1]
Definition: winefile.c:121

Referenced by pane_notify().

◆ calc_tabbed_width()

static void calc_tabbed_width ( Pane pane,
LPDRAWITEMSTRUCT  dis,
int  col,
LPCWSTR  str 
)
static

Definition at line 2786 of file winefile.c.

2787 {
2788  RECT rt = {0, 0, 0, 0};
2789 
2791  /*FIXME rt (0,0) ??? */
2792 
2793  if (rt.right > pane->widths[col])
2794  pane->widths[col] = rt.right;
2795 }
#define DT_EXPANDTABS
Definition: winuser.h:532
#define DT_TABSTOP
Definition: winuser.h:541
LONG right
Definition: windef.h:308
int widths[COLUMNS]
Definition: winefile.c:120
#define DT_CALCRECT
Definition: winuser.h:526
const WCHAR * str
#define DT_SINGLELINE
Definition: winuser.h:540
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17

Referenced by draw_item().

◆ calc_width()

static void calc_width ( Pane pane,
LPDRAWITEMSTRUCT  dis,
int  col,
LPCWSTR  str 
)
static

Definition at line 2776 of file winefile.c.

2777 {
2778  RECT rt = {0, 0, 0, 0};
2779 
2781 
2782  if (rt.right > pane->widths[col])
2783  pane->widths[col] = rt.right;
2784 }
LONG right
Definition: windef.h:308
#define DT_NOPREFIX
Definition: winuser.h:537
int widths[COLUMNS]
Definition: winefile.c:120
#define DT_CALCRECT
Definition: winuser.h:526
const WCHAR * str
#define DT_SINGLELINE
Definition: winuser.h:540
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17

Referenced by draw_item().

◆ calc_widths()

static BOOL calc_widths ( Pane pane,
BOOL  anyway 
)
static

Definition at line 2386 of file winefile.c.

2387 {
2388  int col, x, cx, spc=3*Globals.spaceSize.cx;
2389  int entries = SendMessageW(pane->hwnd, LB_GETCOUNT, 0, 0);
2390  int orgWidths[COLUMNS];
2391  int orgPositions[COLUMNS+1];
2392  HFONT hfontOld;
2393  HDC hdc;
2394  int cnt;
2395 
2396  if (!anyway) {
2397  memcpy(orgWidths, pane->widths, sizeof(orgWidths));
2398  memcpy(orgPositions, pane->positions, sizeof(orgPositions));
2399  }
2400 
2401  for(col=0; col<COLUMNS; col++)
2402  pane->widths[col] = 0;
2403 
2404  hdc = GetDC(pane->hwnd);
2405  hfontOld = SelectObject(hdc, Globals.hfont);
2406 
2407  for(cnt=0; cnt<entries; cnt++) {
2408  Entry* entry = (Entry*)SendMessageW(pane->hwnd, LB_GETITEMDATA, cnt, 0);
2409 
2410  DRAWITEMSTRUCT dis;
2411 
2412  dis.CtlType = 0;
2413  dis.CtlID = 0;
2414  dis.itemID = 0;
2415  dis.itemAction = 0;
2416  dis.itemState = 0;
2417  dis.hwndItem = pane->hwnd;
2418  dis.hDC = hdc;
2419  dis.rcItem.left = 0;
2420  dis.rcItem.top = 0;
2421  dis.rcItem.right = 0;
2422  dis.rcItem.bottom = 0;
2423  /*dis.itemData = 0; */
2424 
2425  draw_item(pane, &dis, entry, COLUMNS);
2426  }
2427 
2428  SelectObject(hdc, hfontOld);
2429  ReleaseDC(pane->hwnd, hdc);
2430 
2431  x = 0;
2432  for(col=0; col<COLUMNS; col++) {
2433  pane->positions[col] = x;
2434  cx = pane->widths[col];
2435 
2436  if (cx) {
2437  cx += spc;
2438 
2439  if (cx < IMAGE_WIDTH)
2440  cx = IMAGE_WIDTH;
2441 
2442  pane->widths[col] = cx;
2443  }
2444 
2445  x += cx;
2446  }
2447 
2448  pane->positions[COLUMNS] = x;
2449 
2451 
2452  /* no change? */
2453  if (!anyway && !memcmp(orgWidths, pane->widths, sizeof(orgWidths)))
2454  return FALSE;
2455 
2456  /* don't move, if only collapsing an entry */
2457  if (!anyway && pane->widths[0]<orgWidths[0] &&
2458  !memcmp(orgWidths+1, pane->widths+1, sizeof(orgWidths)-sizeof(int))) {
2459  pane->widths[0] = orgWidths[0];
2460  memcpy(pane->positions, orgPositions, sizeof(orgPositions));
2461 
2462  return FALSE;
2463  }
2464 
2465  InvalidateRect(pane->hwnd, 0, TRUE);
2466 
2467  return TRUE;
2468 }
#define TRUE
Definition: types.h:120
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define LB_SETHORIZONTALEXTENT
Definition: winuser.h:2046
HDC WINAPI GetDC(_In_opt_ HWND)
#define LB_GETITEMDATA
Definition: winuser.h:2023
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:307
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
int widths[COLUMNS]
Definition: winefile.c:120
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
LONG cx
Definition: windef.h:334
#define LB_GETCOUNT
Definition: winuser.h:2020
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
WINEFILE_GLOBALS Globals
Definition: winefile.c:161
HDC hdc
Definition: main.c:9
uint32_t entry
Definition: isohybrid.c:63
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define COLUMNS
Definition: winefile.c:119
HWND hwnd
Definition: winefile.c:116
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
_Out_opt_ int * cx
Definition: commctrl.h:581
static void draw_item(Pane *pane, LPDRAWITEMSTRUCT dis, Entry *entry, int calcWidthCol)
Definition: winefile.c:2908
LONG bottom
Definition: windef.h:309
#define IMAGE_WIDTH
Definition: pane.cpp:38
base of all file and directory entries
Definition: entries.h:82
int positions[COLUMNS+1]
Definition: winefile.c:121

Referenced by activate_entry(), create_tree_window(), expand_entry(), pane_command(), refresh_right_pane(), and scan_entry().

◆ CBTProc()

static LRESULT CALLBACK CBTProc ( int  code,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 1582 of file winefile.c.

1583 {
1584  if (code==HCBT_CREATEWND && newchild) {
1585  ChildWnd* child = newchild;
1586  newchild = NULL;
1587 
1588  child->hwnd = (HWND) wparam;
1590  }
1591 
1593 }
#define HCBT_CREATEWND
Definition: winuser.h:58
HANDLE HWND
Definition: compat.h:13
static HWND child
Definition: cursoricon.c:298
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define GWLP_USERDATA
Definition: treelist.c:63
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
static HHOOK hcbthook
Definition: winefile.c:1579
static ChildWnd * newchild
Definition: winefile.c:1580
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)
Definition: main.h:57
#define SetWindowLongPtrW
Definition: winuser.h:5321
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by create_child_window().

◆ CheckForFileInfo()

static void CheckForFileInfo ( struct PropertiesDialog dlg,
HWND  hwnd,
LPCWSTR  strFilename 
)
static

Definition at line 1766 of file winefile.c.

1767 {
1768  static const WCHAR sBackSlash[] = {'\\','\0'};
1769  static const WCHAR sTranslation[] = {'\\','V','a','r','F','i','l','e','I','n','f','o','\\','T','r','a','n','s','l','a','t','i','o','n','\0'};
1770  static const WCHAR sStringFileInfo[] = {'\\','S','t','r','i','n','g','F','i','l','e','I','n','f','o','\\',
1771  '%','0','4','x','%','0','4','x','\\','%','s','\0'};
1772  static const WCHAR sFmt[] = {'%','d','.','%','d','.','%','d','.','%','d','\0'};
1773  DWORD dwVersionDataLen = GetFileVersionInfoSizeW(strFilename, NULL);
1774 
1775  if (dwVersionDataLen) {
1776  dlg->pVersionData = HeapAlloc(GetProcessHeap(), 0, dwVersionDataLen);
1777 
1778  if (GetFileVersionInfoW(strFilename, 0, dwVersionDataLen, dlg->pVersionData)) {
1779  LPVOID pVal;
1780  UINT nValLen;
1781 
1782  if (VerQueryValueW(dlg->pVersionData, sBackSlash, &pVal, &nValLen)) {
1783  if (nValLen == sizeof(VS_FIXEDFILEINFO)) {
1784  VS_FIXEDFILEINFO* pFixedFileInfo = (VS_FIXEDFILEINFO*)pVal;
1786 
1787  sprintfW(buffer, sFmt,
1788  HIWORD(pFixedFileInfo->dwFileVersionMS), LOWORD(pFixedFileInfo->dwFileVersionMS),
1789  HIWORD(pFixedFileInfo->dwFileVersionLS), LOWORD(pFixedFileInfo->dwFileVersionLS));
1790 
1792  }
1793  }
1794 
1795  /* Read the list of languages and code pages. */
1796  if (VerQueryValueW(dlg->pVersionData, sTranslation, &pVal, &nValLen)) {
1797  struct LANGANDCODEPAGE* pTranslate = (struct LANGANDCODEPAGE*)pVal;
1798  struct LANGANDCODEPAGE* pEnd = (struct LANGANDCODEPAGE*)((LPBYTE)pVal+nValLen);
1799 
1801 
1802  /* Read the file description for each language and code page. */
1803  for(; pTranslate<pEnd; ++pTranslate) {
1804  LPCSTR* p;
1805 
1806  for(p=InfoStrings; *p; ++p) {
1807  WCHAR subblock[200];
1808  WCHAR infoStr[100];
1809  LPCWSTR pTxt;
1810  UINT nValLen;
1811 
1812  LPCSTR pInfoString = *p;
1813  MultiByteToWideChar(CP_ACP, 0, pInfoString, -1, infoStr, 100);
1814  wsprintfW(subblock, sStringFileInfo, pTranslate->wLanguage, pTranslate->wCodePage, infoStr);
1815 
1816  /* Retrieve file description for language and code page */
1817  if (VerQueryValueW(dlg->pVersionData, subblock, (PVOID)&pTxt, &nValLen)) {
1818  int idx = SendMessageW(hlbox, LB_ADDSTRING, 0L, (LPARAM)infoStr);
1819  SendMessageW(hlbox, LB_SETITEMDATA, idx, (LPARAM)pTxt);
1820  }
1821  }
1822  }
1823 
1824  SendMessageW(hlbox, LB_SETCURSEL, 0, 0);
1825 
1827  }
1828  }
1829  }
1830 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
#define LB_SETCURSEL
Definition: winuser.h:2045
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
void * pVersionData
Definition: winefile.c:1729
static void PropDlg_DisplayValue(HWND hlbox, HWND hedit)
Definition: winefile.c:1754
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define IDC_LIST_PROP_VERSION_TYPES
Definition: resource.h:99
#define LB_ADDSTRING
Definition: winuser.h:2013
#define CP_ACP
Definition: compat.h:99
DWORD dwFileVersionLS
Definition: compat.h:560
GLuint buffer
Definition: glext.h:5915
#define IDC_STATIC_PROP_VERSION
Definition: resource.h:91
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
#define BUFFER_LEN
Definition: utility.h:97
LONG_PTR LPARAM
Definition: windef.h:208
const char * LPCSTR
Definition: xmlstorage.h:183
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD dwFileVersionMS
Definition: compat.h:559
#define LB_SETITEMDATA
Definition: winuser.h:2047
static LPCSTR InfoStrings[]
Definition: winefile.c:1738
static const WCHAR L[]
Definition: oid.c:1250
DWORD WINAPI GetFileVersionInfoSizeW(LPCWSTR filename, LPDWORD handle)
Definition: version.c:611
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define sprintfW
Definition: unicode.h:58
unsigned int UINT
Definition: ndis.h:50
#define MultiByteToWideChar
Definition: compat.h:100
BOOL WINAPI GetFileVersionInfoW(LPCWSTR filename, DWORD handle, DWORD datasize, LPVOID data)
Definition: version.c:845
#define HIWORD(l)
Definition: typedefs.h:246
GLfloat GLfloat p
Definition: glext.h:8902
#define LOWORD(l)
Definition: pedump.c:82
BOOL WINAPI VerQueryValueW(LPCVOID pBlock, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen)
Definition: version.c:1049
#define IDC_LIST_PROP_VERSION_VALUES
Definition: resource.h:100

Referenced by PropertiesDialogDlgProc().

◆ ChildWndProc()

static LRESULT CALLBACK ChildWndProc ( HWND  hwnd,
UINT  nmsg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 3814 of file winefile.c.

3815 {
3817  ASSERT(child);
3818 
3819  switch(nmsg) {
3820  case WM_DRAWITEM: {
3822  Entry* entry = (Entry*) dis->itemData;
3823 
3824  if (dis->CtlID == IDW_TREE_LEFT)
3825  draw_item(&child->left, dis, entry, -1);
3826  else if (dis->CtlID == IDW_TREE_RIGHT)
3827  draw_item(&child->right, dis, entry, -1);
3828  else
3829  goto draw_menu_item;
3830 
3831  return TRUE;}
3832 
3833  case WM_CREATE:
3835  break;
3836 
3837  case WM_NCDESTROY:
3840  break;
3841 
3842  case WM_PAINT: {
3843  PAINTSTRUCT ps;
3844  HBRUSH lastBrush;
3845  RECT rt;
3846  GetClientRect(hwnd, &rt);
3847  BeginPaint(hwnd, &ps);
3848  rt.left = child->split_pos-SPLIT_WIDTH/2;
3849  rt.right = child->split_pos+SPLIT_WIDTH/2+1;
3850  lastBrush = SelectObject(ps.hdc, GetStockObject(COLOR_SPLITBAR));
3851  Rectangle(ps.hdc, rt.left, rt.top-1, rt.right, rt.bottom+1);
3852  SelectObject(ps.hdc, lastBrush);
3853  EndPaint(hwnd, &ps);
3854  break;}
3855 
3856  case WM_SETCURSOR:
3857  if (LOWORD(lparam) == HTCLIENT) {
3858  POINT pt;
3859  GetCursorPos(&pt);
3860  ScreenToClient(hwnd, &pt);
3861 
3862  if (pt.x>=child->split_pos-SPLIT_WIDTH/2 && pt.x<child->split_pos+SPLIT_WIDTH/2+1) {
3864  return TRUE;
3865  }
3866  }
3867  goto def;
3868 
3869  case WM_LBUTTONDOWN: {
3870  RECT rt;
3871  int x = (short)LOWORD(lparam);
3872 
3873  GetClientRect(hwnd, &rt);
3874 
3875  if (x>=child->split_pos-SPLIT_WIDTH/2 && x<child->split_pos+SPLIT_WIDTH/2+1) {
3876  last_split = child->split_pos;
3877  SetCapture(hwnd);
3878  }
3879 
3880  break;}
3881 
3882  case WM_LBUTTONUP:
3883  if (GetCapture() == hwnd)
3884  ReleaseCapture();
3885  break;
3886 
3887  case WM_KEYDOWN:
3888  if (wparam == VK_ESCAPE)
3889  if (GetCapture() == hwnd) {
3890  RECT rt;
3891  child->split_pos = last_split;
3892  GetClientRect(hwnd, &rt);
3893  resize_tree(child, rt.right, rt.bottom);
3894  last_split = -1;
3895  ReleaseCapture();
3897  }
3898  break;
3899 
3900  case WM_MOUSEMOVE:
3901  if (GetCapture() == hwnd) {
3902  RECT rt;
3903  int x = (short)LOWORD(lparam);
3904 
3905  GetClientRect(hwnd, &rt);
3906 
3907  if (x>=0 && x<rt.right) {
3908  child->split_pos = x;
3909  resize_tree(child, rt.right, rt.bottom);
3910  rt.left = x-SPLIT_WIDTH/2;
3911  rt.right = x+SPLIT_WIDTH/2+1;
3912  InvalidateRect(hwnd, &rt, FALSE);
3913  UpdateWindow(child->left.hwnd);
3914  UpdateWindow(hwnd);
3915  UpdateWindow(child->right.hwnd);
3916  }
3917  }
3918  break;
3919 
3920  case WM_GETMINMAXINFO:
3922 
3923  {LPMINMAXINFO lpmmi = (LPMINMAXINFO)lparam;
3924 
3925  lpmmi->ptMaxTrackSize.x <<= 1;/*2*GetSystemMetrics(SM_CXSCREEN) / SM_CXVIRTUALSCREEN */
3926  lpmmi->ptMaxTrackSize.y <<= 1;/*2*GetSystemMetrics(SM_CYSCREEN) / SM_CYVIRTUALSCREEN */
3927  break;}
3928 
3929  case WM_SETFOCUS:
3930  if (SetCurrentDirectoryW(child->path))
3931  set_space_status();
3932  SetFocus(child->focus_pane? child->right.hwnd: child->left.hwnd);
3933  break;
3934 
3935  case WM_DISPATCH_COMMAND: {
3936  Pane* pane = GetFocus()==child->left.hwnd? &child->left: &child->right;
3937 
3938  switch(LOWORD(wparam)) {
3939  case ID_WINDOW_NEW: {
3940  ChildWnd* new_child = alloc_child_window(child->path, NULL, hwnd);
3941 
3942  if (!create_child_window(new_child))
3943  HeapFree(GetProcessHeap(), 0, new_child);
3944 
3945  break;}
3946 
3947  case ID_REFRESH:
3948  refresh_drives();
3950  break;
3951 
3952  case ID_ACTIVATE:
3953  activate_entry(child, pane, hwnd);
3954  break;
3955 
3956  case ID_FILE_MOVE: {
3958 
3959  if (prompt_target(pane, source, target)) {
3961 
3962  source[lstrlenW(source)+1] = '\0';
3963  target[lstrlenW(target)+1] = '\0';
3964 
3965  if (!SHFileOperationW(&shfo))
3967  }
3968  break;}
3969 
3970  case ID_FILE_COPY: {
3972 
3973  if (prompt_target(pane, source, target)) {
3975 
3976  source[lstrlenW(source)+1] = '\0';
3977  target[lstrlenW(target)+1] = '\0';
3978 
3979  if (!SHFileOperationW(&shfo))
3981  }
3982  break;}
3983 
3984  case ID_FILE_DELETE: {
3987 
3988  get_path(pane->cur, path);
3989 
3990  path[lstrlenW(path)+1] = '\0';
3991 
3992  if (!SHFileOperationW(&shfo))
3994  break;}
3995 
3996  case ID_VIEW_SORT_NAME:
3998  break;
3999 
4000  case ID_VIEW_SORT_TYPE:
4002  break;
4003 
4004  case ID_VIEW_SORT_SIZE:
4006  break;
4007 
4008  case ID_VIEW_SORT_DATE:
4010  break;
4011 
4012  case ID_VIEW_FILTER: {
4013  struct FilterDialog dlg;
4014 
4015  memset(&dlg, 0, sizeof(struct FilterDialog));
4016  lstrcpyW(dlg.pattern, child->filter_pattern);
4017  dlg.flags = child->filter_flags;
4018 
4020  lstrcpyW(child->filter_pattern, dlg.pattern);
4021  child->filter_flags = dlg.flags;
4023  }
4024  break;}
4025 
4026  case ID_VIEW_SPLIT: {
4027  last_split = child->split_pos;
4028  SetCapture(hwnd);
4029  break;}
4030 
4031  case ID_EDIT_PROPERTIES:
4032  show_properties_dlg(pane->cur, child->hwnd);
4033  break;
4034 
4035  default:
4036  return pane_command(pane, LOWORD(wparam));
4037  }
4038 
4039  return TRUE;}
4040 
4041  case WM_COMMAND: {
4042  Pane* pane = GetFocus()==child->left.hwnd? &child->left: &child->right;
4043 
4044  switch(HIWORD(wparam)) {
4045  case LBN_SELCHANGE: {
4046  int idx = SendMessageW(pane->hwnd, LB_GETCURSEL, 0, 0);
4047  Entry* entry = (Entry*)SendMessageW(pane->hwnd, LB_GETITEMDATA, idx, 0);
4048 
4049  if (pane == &child->left)
4051  else
4052  pane->cur = entry;
4053  break;}
4054 
4055  case LBN_DBLCLK:
4056  activate_entry(child, pane, hwnd);
4057  break;
4058  }
4059  break;}
4060 
4061  case WM_NOTIFY: {
4062  NMHDR* pnmh = (NMHDR*) lparam;
4063  return pane_notify(pnmh->idFrom==IDW_HEADER_LEFT? &child->left: &child->right, pnmh);}
4064 
4065  case WM_CONTEXTMENU: {
4066  POINT pt, pt_clnt;
4067  Pane* pane;
4068  int idx;
4069 
4070  /* first select the current item in the listbox */
4071  HWND hpanel = (HWND) wparam;
4072  pt_clnt.x = pt.x = (short)LOWORD(lparam);
4073  pt_clnt.y = pt.y = (short)HIWORD(lparam);
4074  ScreenToClient(hpanel, &pt_clnt);
4075  SendMessageW(hpanel, WM_LBUTTONDOWN, 0, MAKELONG(pt_clnt.x, pt_clnt.y));
4076  SendMessageW(hpanel, WM_LBUTTONUP, 0, MAKELONG(pt_clnt.x, pt_clnt.y));
4077 
4078  /* now create the popup menu using shell namespace and IContextMenu */
4079  pane = GetFocus()==child->left.hwnd? &child->left: &child->right;
4080  idx = SendMessageW(pane->hwnd, LB_GETCURSEL, 0, 0);
4081 
4082  if (idx != -1) {
4083  Entry* entry = (Entry*)SendMessageW(pane->hwnd, LB_GETITEMDATA, idx, 0);
4084 
4086 
4087  if (pidl_abs) {
4088  IShellFolder* parentFolder;
4089  LPCITEMIDLIST pidlLast;
4090 
4091  /* get and use the parent folder to display correct context menu in all cases */
4092  if (SUCCEEDED(SHBindToParent(pidl_abs, &IID_IShellFolder, (LPVOID*)&parentFolder, &pidlLast))) {
4093  if (ShellFolderContextMenu(parentFolder, hwnd, 1, &pidlLast, pt.x, pt.y) == S_OK)
4095 
4096  IShellFolder_Release(parentFolder);
4097  }
4098 
4099  IMalloc_Free(Globals.iMalloc, pidl_abs);
4100  }
4101  }
4102  break;}
4103 
4104  case WM_MEASUREITEM:
4105  draw_menu_item:
4106  if (!wparam) /* Is the message menu-related? */
4107  if (CtxMenu_HandleMenuMsg(nmsg, wparam, lparam))
4108  return TRUE;
4109 
4110  break;
4111 
4112  case WM_INITMENUPOPUP:
4113  if (CtxMenu_HandleMenuMsg(nmsg, wparam, lparam))
4114  return 0;
4115 
4117  break;
4118 
4119  case WM_MENUCHAR: /* only supported by IContextMenu3 */
4120  if (s_pctxmenu3) {
4121  LRESULT lResult = 0;
4122 
4123  IContextMenu3_HandleMenuMsg2(s_pctxmenu3, nmsg, wparam, lparam, &lResult);
4124 
4125  return lResult;
4126  }
4127 
4128  break;
4129 
4130  case WM_SIZE:
4131  if (wparam != SIZE_MINIMIZED)
4133  /* fall through */
4134 
4135  default: def:
4136  return DefMDIChildProcW(hwnd, nmsg, wparam, lparam);
4137  }
4138 
4139  return 0;
4140 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define IDC_SIZEWE
Definition: winuser.h:689
static void get_path(Entry *dir, PWSTR path)
Definition: winefile.c:1373
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static HWND create_child_window(ChildWnd *child)
Definition: winefile.c:1595
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define ID_REFRESH
Definition: resource.h:18
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
static void InitChildWindow(ChildWnd *child)
Definition: winefile.c:2734
long y
Definition: polytest.cpp:48
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
long x
Definition: polytest.cpp:48
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
#define WM_MENUCHAR
Definition: winuser.h:1730
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
#define pt(x, y)
Definition: drawing.c:79
#define WM_INITMENUPOPUP
Definition: winuser.h:1728
GLsizei const GLchar ** path
Definition: glext.h:7234
#define FO_COPY
Definition: shellapi.h:134
#define LB_GETITEMDATA
Definition: winuser.h:2023
static BOOL pane_command(Pane *pane, UINT cmd)
Definition: winefile.c:3620
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
static void refresh_child(ChildWnd *child)
Definition: winefile.c:3412
static void free_child_window(ChildWnd *child)
Definition: winefile.c:1365
BOOL WINAPI UpdateWindow(_In_ HWND)
static void activate_entry(ChildWnd *child, Pane *pane, HWND hwnd)
Definition: winefile.c:3570
LONG top
Definition: windef.h:307
ULONG_PTR itemData
Definition: winuser.h:3068
#define FOF_ALLOWUNDO
Definition: shellapi.h:144
LRESULT WINAPI DefMDIChildProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HANDLE HWND
Definition: compat.h:13
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
HWND WINAPI SetFocus(_In_opt_ HWND)
#define GetWindowLongPtrW
Definition: winuser.h:4804
LONG left
Definition: windef.h:306
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define VK_ESCAPE
Definition: winuser.h:2189
#define ID_EDIT_PROPERTIES
Definition: resource.h:234
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2635
LONG right
Definition: windef.h:308
#define ID_VIEW_SORT_DATE
Definition: resource.h:60
#define lstrlenW
Definition: compat.h:415
#define LBN_SELCHANGE
Definition: winuser.h:2057
int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp)
Definition: shlfileop.cpp:1925
static HWND child
Definition: cursoricon.c:298
#define IDW_TREE_RIGHT
Definition: pane.h:30
#define SPLIT_WIDTH
Definition: eventvwr.c:62
#define FO_MOVE
Definition: shellapi.h:133
static void set_space_status(void)
Definition: winefile.c:2679
static int last_split
Definition: winefile.c:163
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
#define IDW_TREE_LEFT
Definition: pane.h:29
static void update_view_menu(ChildWnd *child)
Definition: winefile.c:3669
static void set_sort_order(ChildWnd *child, SORT_ORDER sortOrder)
Definition: winefile.c:3661
#define WM_SETCURSOR
Definition: winuser.h:1618
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
UINT_PTR idFrom
Definition: winuser.h:3133
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
HWND WINAPI GetCapture(void)
Definition: message.c:2879
unsigned int idx
Definition: utils.c:41
#define GWLP_USERDATA
Definition: treelist.c:63
#define MAKELONG(a, b)
Definition: typedefs.h:248
Entry * cur
Definition: winefile.c:126
smooth NULL
Definition: ftsmooth.c:416
#define BUFFER_LEN
Definition: utility.h:97
struct tagMINMAXINFO * LPMINMAXINFO
#define WM_KEYDOWN
Definition: winuser.h:1697
LONG_PTR LPARAM
Definition: windef.h:208
static void set_curdir(ChildWnd *child, Entry *entry, int idx, HWND hwnd)
Definition: winefile.c:3381
static void refresh_right_pane(ChildWnd *child)
Definition: winefile.c:3372
static LRESULT pane_notify(Pane *pane, NMHDR *pnmh)
Definition: winefile.c:3192
#define GetProcessHeap()
Definition: compat.h:403
#define ID_VIEW_SORT_SIZE
Definition: resource.h:59
#define ID_WINDOW_NEW
Definition: resource.h:227
if(!(yy_init))
Definition: macro.lex.yy.c:714
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WM_SIZE
Definition: winuser.h:1593
child window pane for displaying file lists
Definition: pane.h:66
#define WM_NCDESTROY
Definition: winuser.h:1666
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define COLOR_SPLITBAR
Definition: window.h:271
#define WM_MEASUREITEM
Definition: winuser.h:1628
#define ID_ACTIVATE
Definition: resource.h:60
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
#define SIZE_MINIMIZED
Definition: winuser.h:2481
#define LBN_DBLCLK
Definition: winuser.h:2053
#define WM_PAINT
Definition: winuser.h:1602
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
WINEFILE_GLOBALS Globals
Definition: winefile.c:161
#define ID_FILE_MOVE
Definition: resource.h:47
uint32_t entry
Definition: isohybrid.c:63
#define WM_COMMAND
Definition: winuser.h:1722
static HRESULT ShellFolderContextMenu(IShellFolder *shell_folder, HWND hwndParent, int cidl, LPCITEMIDLIST *apidl, int x, int y)
Definition: winefile.c:3768
HANDLE hInstance
Definition: winefile.h:102
#define ID_VIEW_SORT_TYPE
Definition: resource.h:58
#define ID_FILE_DELETE
Definition: resource.h:49
#define ID_VIEW_FILTER
Definition: resource.h:61
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define S_OK
Definition: intsafe.h:59
HWND WINAPI SetCapture(_In_ HWND hWnd)
static ChildWnd * alloc_child_window(LPCWSTR path, LPITEMIDLIST pidl, HWND hwnd)
Definition: winefile.c:1292
#define WM_DISPATCH_COMMAND
Definition: winefile.h:83
HWND hwnd
Definition: winefile.c:116
#define lstrcpyW
Definition: compat.h:414
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1323
#define ID_VIEW_SPLIT
Definition: resource.h:58
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
static INT_PTR CALLBACK FilterDialogDlgProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: winefile.c:1684
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
Definition: path.c:2248
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_LBUTTONUP
Definition: winuser.h:1759
static BOOL CtxMenu_HandleMenuMsg(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: winefile.c:3754
#define LB_GETCURSEL
Definition: winuser.h:2021
#define WM_MOUSEMOVE
Definition: winuser.h:1757
#define IDD_DIALOG_VIEW_TYPE
Definition: resource.h:39
static BOOL prompt_target(Pane *pane, LPWSTR source, LPWSTR target)
Definition: winefile.c:3689
#define WM_DRAWITEM
Definition: winuser.h:1627
HWND WINAPI GetFocus(void)
Definition: window.c:1905
#define IDC_ARROW
Definition: winuser.h:682
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2888
Definition: main.h:57
#define WM_CREATE
Definition: winuser.h:1590
static void draw_item(Pane *pane, LPDRAWITEMSTRUCT dis, Entry *entry, int calcWidthCol)
Definition: winefile.c:2908
#define HIWORD(l)
Definition: typedefs.h:246
GLenum target
Definition: glext.h:7315
static void resize_tree(ChildWnd *child, int cx, int cy)
Definition: winefile.c:2311
static IContextMenu3 * s_pctxmenu3
Definition: winefile.c:3728
LONG bottom
Definition: windef.h:309
#define ID_FILE_COPY
Definition: resource.h:48
#define SetWindowLongPtrW
Definition: winuser.h:5321
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
POINT ptMaxTrackSize
Definition: winuser.h:3606
#define WM_SETFOCUS
Definition: winuser.h:1595
#define HTCLIENT
Definition: winuser.h:2450
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
LONG_PTR LRESULT
Definition: windef.h:209
static void show_properties_dlg(Entry *entry, HWND hwnd)
Definition: winefile.c:1894
#define memset(x, y, z)
Definition: compat.h:39
static void refresh_drives(void)
Definition: winefile.c:3503
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
#define FO_DELETE
Definition: shellapi.h:135
#define ID_VIEW_SORT_NAME
Definition: resource.h:57
#define WM_GETMINMAXINFO
Definition: winuser.h:1622
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:402
base of all file and directory entries
Definition: entries.h:82
#define WM_NOTIFY
Definition: richedit.h:61
IMalloc * iMalloc
Definition: winefile.h:127
static LPITEMIDLIST get_to_absolute_pidl(Entry *entry, HWND hwnd)
Definition: winefile.c:713
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static UINT WPARAM wparam
Definition: combo.c:716
#define IDW_HEADER_LEFT
Definition: pane.h:31

Referenced by InitInstance().

◆ choose_font()

static void choose_font ( HWND  hwnd)
inlinestatic

Definition at line 234 of file winefile.c.

235 {
236  WCHAR dlg_name[BUFFER_LEN], dlg_info[BUFFER_LEN];
237  CHOOSEFONTW chFont;
238  LOGFONTW lFont;
239 
240  HDC hdc = GetDC(hwnd);
241 
242  GetObjectW(Globals.hfont, sizeof(LOGFONTW), &lFont);
243 
244  chFont.lStructSize = sizeof(CHOOSEFONTW);
245  chFont.hwndOwner = hwnd;
246  chFont.hDC = NULL;
247  chFont.lpLogFont = &lFont;
249  chFont.rgbColors = RGB(0,0,0);
250  chFont.lCustData = 0;
251  chFont.lpfnHook = NULL;
252  chFont.lpTemplateName = NULL;
253  chFont.hInstance = Globals.hInstance;
254  chFont.lpszStyle = NULL;
255  chFont.nFontType = SIMULATED_FONTTYPE;
256  chFont.nSizeMin = 0;
257  chFont.nSizeMax = 24;
258 
259  if (ChooseFontW(&chFont)) {
260  HWND childWnd;
261  HFONT hFontOld;
262 
265  hFontOld = SelectObject(hdc, Globals.hfont);
267 
268  /* change font in all open child windows */
269  for(childWnd=GetWindow(Globals.hmdiclient,GW_CHILD); childWnd; childWnd=GetNextWindow(childWnd,GW_HWNDNEXT)) {
275  InvalidateRect(child->left.hwnd, NULL, TRUE);
276  InvalidateRect(child->right.hwnd, NULL, TRUE);
277  }
278 
279  SelectObject(hdc, hFontOld);
280  }
281  else if (CommDlgExtendedError()) {
284  MessageBoxW(hwnd, dlg_info, dlg_name, MB_OK);
285  }
286 
287  ReleaseDC(hwnd, hdc);
288 }
#define GW_HWNDNEXT
Definition: winuser.h:756
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
static const WCHAR sSpace[]
Definition: winefile.c:167
#define IDS_FONT_SEL_ERROR
Definition: resource.h:113
#define IMAGE_HEIGHT
Definition: pane.cpp:39
#define GW_CHILD
Definition: winuser.h:758
#define GetNextWindow(h, c)
Definition: winuser.h:4702
HDC WINAPI GetDC(_In_opt_ HWND)
LPCWSTR lpTemplateName
Definition: commdlg.h:288
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
UINT_PTR WPARAM
Definition: windef.h:207
#define GetWindowLongPtrW
Definition: winuser.h:4804
#define IDS_FONT_SEL_DLG_NAME
Definition: resource.h:112
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
static HWND child
Definition: cursoricon.c:298
WORD nFontType
Definition: commdlg.h:291
#define LB_SETITEMHEIGHT
Definition: winuser.h:2048
HWND hwndOwner
Definition: commdlg.h:280
#define CF_LIMITSIZE
Definition: commdlg.h:75
#define CF_SCREENFONTS
Definition: commdlg.h:59
BOOL WINAPI ChooseFontW(LPCHOOSEFONTW lpChFont)
Definition: fontdlg.c:184
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define SIMULATED_FONTTYPE
Definition: commdlg.h:87
#define GWLP_USERDATA
Definition: treelist.c:63
LPLOGFONTW lpLogFont
Definition: commdlg.h:282
smooth NULL
Definition: ftsmooth.c:416
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
#define BUFFER_LEN
Definition: utility.h:97
#define CF_FORCEFONTEXIST
Definition: commdlg.h:78
#define CF_NOSCRIPTSEL
Definition: commdlg.h:85
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD rgbColors
Definition: commdlg.h:285
#define RGB(r, g, b)
Definition: wingdi.h:2939
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
DWORD Flags
Definition: commdlg.h:284
LPCFHOOKPROC lpfnHook
Definition: commdlg.h:287
WINEFILE_GLOBALS Globals
Definition: winefile.c:161
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
HDC hdc
Definition: main.c:9
HANDLE hInstance
Definition: winefile.h:102
DWORD lStructSize
Definition: commdlg.h:279
LPARAM lCustData
Definition: commdlg.h:286
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MB_OK
Definition: winuser.h:784
#define WM_SETFONT
Definition: winuser.h:1632
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
HINSTANCE hInstance
Definition: commdlg.h:289
Definition: main.h:57
struct tagCHOOSEFONTW CHOOSEFONTW
#define CF_NOVERTFONTS
Definition: commdlg.h:86
DWORD WINAPI CommDlgExtendedError(void)
Definition: cdlg32.c:139
LONG cy
Definition: windef.h:335
#define CF_INITTOLOGFONTSTRUCT
Definition: commdlg.h:66
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
LPWSTR lpszStyle
Definition: commdlg.h:290

Referenced by FrameWndProc().

◆ collapse_entry()

static void collapse_entry ( Pane pane,
Entry dir 
)
static

Definition at line 3346 of file winefile.c.

3347 {
3348  int idx;
3349 
3350  if (!dir) return;
3351  idx = SendMessageW(pane->hwnd, LB_FINDSTRING, 0, (LPARAM)dir);
3352 
3353  ShowWindow(pane->hwnd, SW_HIDE);
3354 
3355  /* hide sub entries */
3356  for(;;) {
3357  LRESULT res = SendMessageW(pane->hwnd, LB_GETITEMDATA, idx+1, 0);
3358  Entry* sub = (Entry*) res;
3359 
3360  if (res==LB_ERR || !sub || sub->level<=dir->level)
3361  break;
3362 
3363  SendMessageW(pane->hwnd, LB_DELETESTRING, idx+1, 0);
3364  }
3365 
3366  dir->expanded = FALSE;
3367 
3368  ShowWindow(pane->hwnd, SW_SHOW);
3369 }
#define SW_HIDE
Definition: winuser.h:762
#define LB_GETITEMDATA
Definition: winuser.h:2023
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define LB_ERR
Definition: winuser.h:2407
unsigned int idx
Definition: utils.c:41
LONG_PTR LPARAM
Definition: windef.h:208
unsigned int dir
Definition: maze.c:112
#define SW_SHOW
Definition: winuser.h:769
#define LB_FINDSTRING
Definition: winuser.h:2016
HWND hwnd
Definition: winefile.c:116
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLuint res
Definition: glext.h:9613
LONG_PTR LRESULT
Definition: windef.h:209
#define LB_DELETESTRING
Definition: winuser.h:2014
base of all file and directory entries
Definition: entries.h:82

Referenced by activate_entry().

◆ compareDate()

static int compareDate ( const void arg1,
const void arg2 
)
static

Definition at line 1102 of file winefile.c.

1103 {
1104  const WIN32_FIND_DATAW* fd1 = &(*(const Entry* const*)arg1)->data;
1105  const WIN32_FIND_DATAW* fd2 = &(*(const Entry* const*)arg2)->data;
1106 
1107  int cmp = compareType(fd1, fd2);
1108  if (cmp)
1109  return cmp;
1110 
1111  return CompareFileTime(&fd2->ftLastWriteTime, &fd1->ftLastWriteTime);
1112 }
#define cmp(status, error)
Definition: error.c:114
GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2
Definition: glext.h:9514
GLuint GLuint GLuint GLuint arg1
Definition: glext.h:9513
LONG WINAPI CompareFileTime(IN CONST FILETIME *lpFileTime1, IN CONST FILETIME *lpFileTime2)
Definition: time.c:106
base of all file and directory entries
Definition: entries.h:82
static int compareType(const WIN32_FIND_DATAW *fd1, const WIN32_FIND_DATAW *fd2)
Definition: winefile.c:1021

◆ compareExt()

static int compareExt ( const void arg1,
const void arg2 
)
static

Definition at line 1048 of file winefile.c.

1049 {
1050  const WIN32_FIND_DATAW* fd1 = &(*(const Entry* const*)arg1)->data;
1051  const WIN32_FIND_DATAW* fd2 = &(*(const Entry* const*)arg2)->data;
1052  const WCHAR *name1, *name2, *ext1, *ext2;
1053 
1054  int cmp = compareType(fd1, fd2);
1055  if (cmp)
1056  return cmp;
1057 
1058  name1 = fd1->cFileName;
1059  name2 = fd2->cFileName;
1060 
1061  ext1 = strrchrW(name1, '.');
1062  ext2 = strrchrW(name2, '.');
1063 
1064  if (ext1)
1065  ext1++;
1066  else
1067  ext1 = sEmpty;
1068 
1069  if (ext2)
1070  ext2++;
1071  else
1072  ext2 = sEmpty;
1073 
1074  cmp = lstrcmpiW(ext1, ext2);
1075  if (cmp)
1076  return cmp;
1077 
1078  return lstrcmpiW(name1, name2);
1079 }
#define cmp(status, error)
Definition: error.c:114
static WCHAR name1[]
Definition: record.c:34
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2
Definition: glext.h:9514
GLuint GLuint GLuint GLuint arg1
Definition: glext.h:9513
static const WCHAR sEmpty[]
Definition: winefile.c:166
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const BYTE ext1[]
Definition: encode.c:2697
static const BYTE ext2[]
Definition: encode.c:2699
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:254
static WCHAR name2[]
Definition: record.c:35
base of all file and directory entries
Definition: entries.h:82
static int compareType(const WIN32_FIND_DATAW *fd1, const WIN32_FIND_DATAW *fd2)
Definition: winefile.c:1021

◆ compareName()

static int compareName ( const void arg1,
const void arg2 
)
static

Definition at line 1036 of file winefile.c.

1037 {
1038  const WIN32_FIND_DATAW* fd1 = &(*(const Entry* const*)arg1)->data;
1039  const WIN32_FIND_DATAW* fd2 = &(*(const Entry* const*)arg2)->data;
1040 
1041  int cmp = compareType(fd1, fd2);
1042  if (cmp)
1043  return cmp;
1044 
1045  return lstrcmpiW(fd1->cFileName, fd2->cFileName);
1046 }
#define cmp(status, error)
Definition: error.c:114
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2
Definition: glext.h:9514
GLuint GLuint GLuint GLuint arg1
Definition: glext.h:9513
base of all file and directory entries
Definition: entries.h:82
static int compareType(const WIN32_FIND_DATAW *fd1, const WIN32_FIND_DATAW *fd2)
Definition: winefile.c:1021

◆ compareSize()

static int compareSize ( const void arg1,
const void arg2 
)
static

Definition at line 1081 of file winefile.c.

1082 {
1083  const WIN32_FIND_DATAW* fd1 = &(*(const Entry* const*)arg1)->data;
1084  const WIN32_FIND_DATAW* fd2 = &(*(const Entry* const*)arg2)->data;
1085 
1086  int cmp = compareType(fd1, fd2);
1087  if (cmp)
1088  return cmp;
1089 
1090  cmp = fd2->nFileSizeHigh - fd1->nFileSizeHigh;
1091 
1092  if (cmp < 0)
1093  return -1;
1094  else if (cmp > 0)
1095  return 1;
1096 
1097  cmp = fd2->nFileSizeLow - fd1->nFileSizeLow;
1098 
1099  return cmp<0? -1: cmp>0? 1: 0;
1100 }
#define cmp(status, error)
Definition: error.c:114
GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2
Definition: glext.h:9514
GLuint GLuint GLuint GLuint arg1
Definition: glext.h:9513
base of all file and directory entries
Definition: entries.h:82
static int compareType(const WIN32_FIND_DATAW *fd1, const WIN32_FIND_DATAW *fd2)
Definition: winefile.c:1021

◆ compareType()

static int compareType ( const WIN32_FIND_DATAW fd1,
const WIN32_FIND_DATAW fd2 
)
static

Definition at line 1021 of file winefile.c.

1022 {
1023  int order1 = fd1->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY? TO_DIR: TO_FILE;
1024  int order2 = fd2->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY? TO_DIR: TO_FILE;
1025 
1026  /* Handle "." and ".." as special case and move them at the very first beginning. */
1027  if (order1==TO_DIR && order2==TO_DIR) {
1028  order1 = TypeOrderFromDirname(fd1->cFileName);
1029  order2 = TypeOrderFromDirname(fd2->cFileName);
1030  }
1031 
1032  return order2==order1? 0: order1<order2? -1: 1;
1033 }
static int TypeOrderFromDirname(LPCWSTR name)
Definition: winefile.c:1007
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705

Referenced by compareDate(), compareExt(), compareName(), and compareSize().

◆ create_child_window()

static HWND create_child_window ( ChildWnd child)
static

Definition at line 1595 of file winefile.c.

1596 {
1598  int idx;
1599 
1600  mcs.szClass = sWINEFILETREE;
1601  mcs.szTitle = child->path;
1602  mcs.hOwner = Globals.hInstance;
1603  mcs.x = child->pos.rcNormalPosition.left;
1604  mcs.y = child->pos.rcNormalPosition.top;
1605  mcs.cx = child->pos.rcNormalPosition.right-child->pos.rcNormalPosition.left;
1606  mcs.cy = child->pos.rcNormalPosition.bottom-child->pos.rcNormalPosition.top;
1607  mcs.style = 0;
1608  mcs.lParam = 0;
1609 
1611 
1612  newchild = child;
1614  if (!child->hwnd) {
1616  return 0;
1617  }
1618 
1620 
1623 
1624  idx = SendMessageW(child->left.hwnd, LB_FINDSTRING, 0, (LPARAM)child->left.cur);
1625  SendMessageW(child->left.hwnd, LB_SETCURSEL, idx, 0);
1626 
1627  return child->hwnd;
1628 }
#define LB_SETCURSEL
Definition: winuser.h:2045
#define max(a, b)
Definition: svc.c:63
static LRESULT CALLBACK CBTProc(int code, WPARAM wparam, LPARAM lparam)
Definition: winefile.c:1582
#define IMAGE_HEIGHT
Definition: pane.cpp:39
HANDLE HWND
Definition: compat.h:13
static HWND child
Definition: cursoricon.c:298
#define LB_SETITEMHEIGHT
Definition: winuser.h:2048
static const WCHAR sWINEFILETREE[]
Definition: winefile.c:173
unsigned int idx
Definition: utils.c:41
LONG_PTR LPARAM
Definition: windef.h:208
#define WH_CBT
Definition: winuser.h:35
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:458
WINEFILE_GLOBALS Globals
Definition: winefile.c:161
static HHOOK hcbthook
Definition: winefile.c:1579
HANDLE hInstance
Definition: winefile.h:102
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)
static ChildWnd * newchild
Definition: winefile.c:1580
#define LB_FINDSTRING
Definition: winuser.h:2016
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_MDICREATE
Definition: winuser.h:1794
HHOOK WINAPI SetWindowsHookExW(_In_ int, _In_ HOOKPROC, _In_opt_ HINSTANCE, _In_ DWORD)
static struct myctx * mcs
Definition: adnstest.c:53
LONG cy
Definition: windef.h:335

Referenced by ChildWndProc(), FrameWndProc(), and show_frame().

◆ create_drive_bar()

static void create_drive_bar ( void  )
static

Definition at line 3448 of file winefile.c.

3449 {
3450  TBBUTTON drivebarBtn = {0, 0, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0};
3451  WCHAR b1[BUFFER_LEN];
3452  int btn = 1;
3453  PWSTR p;
3454 
3456 
3458  IDW_DRIVEBAR, 2, Globals.hInstance, IDB_DRIVEBAR, &drivebarBtn,
3459  0, 16, 13, 16, 13, sizeof(TBBUTTON));
3460 
3461 #ifdef __WINE__
3462  /* insert unix file system button */
3463  b1[0] = '/';
3464  b1[1] = '\0';
3465  b1[2] = '\0';
3467 
3468  drivebarBtn.idCommand = ID_DRIVE_UNIX_FS;
3469  SendMessageW(Globals.hdrivebar, TB_INSERTBUTTONW, btn++, (LPARAM)&drivebarBtn);
3470  drivebarBtn.iString++;
3471 #endif
3472  /* insert shell namespace button */
3473  load_string(b1, sizeof(b1)/sizeof(b1[0]), IDS_SHELL);
3474  b1[lstrlenW(b1)+1] = '\0';
3476 
3477  drivebarBtn.idCommand = ID_DRIVE_SHELL_NS;
3478  SendMessageW(Globals.hdrivebar, TB_INSERTBUTTONW, btn++, (LPARAM)&drivebarBtn);
3479  drivebarBtn.iString++;
3480 
3481  /* register windows drive root strings */
3483 
3484  drivebarBtn.idCommand = ID_DRIVE_FIRST;
3485 
3486  for(p=Globals.drives; *p; ) {
3487  switch(GetDriveTypeW(p)) {
3488  case DRIVE_REMOVABLE: drivebarBtn.iBitmap = 1; break;
3489  case DRIVE_CDROM: drivebarBtn.iBitmap = 3; break;
3490  case DRIVE_REMOTE: drivebarBtn.iBitmap = 4; break;
3491  case DRIVE_RAMDISK: drivebarBtn.iBitmap = 5; break;
3492  default:/*DRIVE_FIXED*/ drivebarBtn.iBitmap = 2;
3493  }
3494 
3495  SendMessageW(Globals.hdrivebar, TB_INSERTBUTTONW, btn++, (LPARAM)&drivebarBtn);
3496  drivebarBtn.idCommand++;
3497  drivebarBtn.iString++;
3498 
3499  while(*p++);
3500  }
3501 }
#define IDW_DRIVEBAR
Definition: explorer.h:55
#define TB_ADDSTRINGW
Definition: commctrl.h:1128
uint16_t * PWSTR
Definition: typedefs.h:54
#define DRIVE_RAMDISK
Definition: winbase.h:252
#define ID_DRIVE_SHELL_NS
Definition: resource.h:196
#define WS_CHILD
Definition: pedump.c:617
HWND WINAPI CreateToolbarEx(HWND hwnd, DWORD style, UINT wID, INT nBitmaps, HINSTANCE hBMInst, UINT_PTR wBMID, LPCTBBUTTON lpButtons, INT iNumButtons, INT dxButton, INT dyButton, INT dxBitmap, INT dyBitmap, UINT uStructSize)
Definition: commctrl.c:929
#define lstrlenW
Definition: compat.h:415
#define DRIVE_REMOVABLE
Definition: winbase.h:248
#define ID_DRIVE_UNIX_FS
Definition: resource.h:197
#define BTNS_BUTTON
Definition: commctrl.h:994
#define DRIVE_REMOTE
Definition: winbase.h:250
static CRYPT_DATA_BLOB b1[]
Definition: msg.c:573
#define ID_DRIVE_FIRST
Definition: resource.h:201
#define BUFFER_LEN
Definition: utility.h:97
LONG_PTR LPARAM
Definition: windef.h:208
INT_PTR iString
Definition: commctrl.h:955
int iBitmap
Definition: commctrl.h:945
WCHAR drives[BUFFER_LEN]
Definition: winefile.h:122
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDB_DRIVEBAR
Definition: resource.h:62
WINEFILE_GLOBALS Globals
Definition: winefile.c:161
int idCommand
Definition: commctrl.h:946
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
HANDLE hInstance
Definition: winefile.h:102
#define TB_INSERTBUTTONW
Definition: commctrl.h:1261
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define DRIVE_CDROM
Definition: winbase.h:251
#define TBSTATE_ENABLED
Definition: commctrl.h:970
#define CCS_NOMOVEY
Definition: commctrl.h:2239
#define IDS_SHELL
Definition: resource.h:120
GLfloat GLfloat p
Definition: glext.h:8902
#define WS_VISIBLE
Definition: pedump.c:620
#define TBSTYLE_LIST
Definition: commctrl.h:989
static LPWSTR load_string(LPWSTR buffer, DWORD size, UINT id)
Definition: winefile.c:189
DWORD WINAPI GetLogicalDriveStringsW(IN DWORD nBufferLength, IN LPWSTR lpBuffer)
Definition: disk.c:73

Referenced by refresh_drives(), and show_frame().

◆ create_header()

static HWND create_header ( HWND  parent,
Pane pane,
UINT  id 
)
static

Definition at line 2339 of file winefile.c.

2340 {
2341  HDITEMW hdi;
2342  int idx;
2343 
2344  HWND hwnd = CreateWindowW(WC_HEADERW, 0, WS_CHILD|WS_VISIBLE|HDS_HORZ|HDS_FULLDRAG/*TODO: |HDS_BUTTONS + sort orders*/,
2345  0, 0, 0, 0, parent, (HMENU)ULongToHandle(id), Globals.hInstance, 0);
2346  if (!hwnd)
2347  return 0;
2348 
2350 
2352 
2353  for(idx=0; idx<COLUMNS; idx++) {
2354  hdi.pszText = g_pos_names[idx];
2355  hdi.fmt = HDF_STRING | g_pos_align[idx];
2356  hdi.cxy = pane->widths[idx];
2358  }
2359 
2360  return hwnd;
2361 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define ULongToHandle(h)
Definition: basetsd.h:81
int cxy
Definition: commctrl.h:681
LPWSTR pszText
Definition: commctrl.h:682
UINT_PTR WPARAM
Definition: windef.h:207
#define WS_CHILD
Definition: pedump.c:617
#define HDI_TEXT
Definition: commctrl.h:700
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4291
static const int g_pos_align[]
Definition: winefile.c:2298
int widths[COLUMNS]
Definition: winefile.c:120
#define HDS_HORZ
Definition: commctrl.h:624
#define HDF_STRING
Definition: commctrl.h:716
static WCHAR g_pos_names[COLUMNS][40]
Definition: winefile.c:2294
#define HDI_FORMAT
Definition: commctrl.h:701
unsigned int idx
Definition: utils.c:41
#define HDM_INSERTITEMW
Definition: commctrl.h:733
LONG_PTR LPARAM
Definition: windef.h:208
r parent
Definition: btrfs.c:2869
#define DEFAULT_GUI_FONT
Definition: wingdi.h:908
WINEFILE_GLOBALS Globals
Definition: winefile.c:161
HANDLE hInstance
Definition: winefile.h:102
#define COLUMNS
Definition: winefile.c:119
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SETFONT
Definition: winuser.h:1632
UINT mask
Definition: commctrl.h:680
#define WC_HEADERW
Definition: commctrl.h:620
#define HDS_FULLDRAG
Definition: commctrl.h:629
#define HDI_WIDTH
Definition: commctrl.h:698
#define WS_VISIBLE
Definition: pedump.c:620
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
int fmt
Definition: commctrl.h:685

Referenced by create_tree_window().

◆ create_tree_window()

static void create_tree_window ( HWND  parent,
Pane pane,
UINT  id,
UINT  id_header,
LPCWSTR  pattern,
int  filter_flags 
)
static

Definition at line 2702 of file winefile.c.

2703 {
2704  static const WCHAR sListBox[] = {'L','i','s','t','B','o','x','\0'};
2705 
2706  static BOOL s_init = FALSE;
2707  Entry* entry = pane->root;
2708 
2711  0, 0, 0, 0, parent, (HMENU)ULongToHandle(id), Globals.hInstance, 0);
2712 
2713  SetWindowLongPtrW(pane->hwnd, GWLP_USERDATA, (LPARAM)pane);
2715 
2717 
2718  /* insert entries into listbox */
2719  if (entry)
2720  insert_entries(pane, entry, pattern, filter_flags, -1);
2721 
2722  /* calculate column widths */
2723  if (!s_init) {
2724  s_init = TRUE;
2725  init_output(pane->hwnd);
2726  }
2727 
2728  calc_widths(pane, TRUE);
2729 
2730  pane->hwndHeader = create_header(parent, pane, id_header);
2731 }
#define ULongToHandle(h)
Definition: basetsd.h:81
#define TRUE
Definition: types.h:120
static LRESULT CALLBACK TreeWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: winefile.c:4143
static BOOL calc_widths(Pane *pane, BOOL anyway)
Definition: winefile.c:2386
UINT_PTR WPARAM
Definition: windef.h:207
#define WS_CHILD
Definition: pedump.c:617
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4291
#define LBS_OWNERDRAWFIXED
Definition: pedump.c:682
static void init_output(HWND hwnd)
Definition: winefile.c:2363
#define LBS_NOINTEGRALHEIGHT
Definition: pedump.c:686
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GWLP_USERDATA
Definition: treelist.c:63
static const WCHAR sEmpty[]
Definition: winefile.c:166
LONG_PTR LPARAM
Definition: windef.h:208
r parent
Definition: btrfs.c:2869
static WNDPROC g_orgTreeWndProc
Definition: winefile.c:2700
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WS_HSCROLL
Definition: pedump.c:628
WINEFILE_GLOBALS Globals
Definition: winefile.c:161
uint32_t entry
Definition: isohybrid.c:63
static HWND create_header(HWND parent, Pane *pane, UINT id)
Definition: winefile.c:2339
HANDLE hInstance
Definition: winefile.h:102
#define GWLP_WNDPROC
Definition: treelist.c:66
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2881
#define LBS_NOTIFY
Definition: pedump.c:678
HWND hwnd
Definition: winefile.c:116
Entry * root
Definition: winefile.c:125
#define LBS_DISABLENOSCROLL
Definition: pedump.c:690
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WS_VSCROLL
Definition: pedump.c:627
#define WM_SETFONT
Definition: winuser.h:1632
static int insert_entries(Pane *pane, Entry *dir, LPCWSTR pattern, int filter_flags, int idx)
Definition: winefile.c:2579
#define SetWindowLongPtrW
Definition: winuser.h:5321
#define WS_VISIBLE
Definition: pedump.c:620
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
HWND hwndHeader
Definition: winefile.c:117
base of all file and directory entries
Definition: entries.h:82
GLubyte * pattern
Definition: glext.h:7787

Referenced by InitChildWindow().

◆ CtxMenu_HandleMenuMsg()

static BOOL CtxMenu_HandleMenuMsg ( UINT  nmsg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 3754 of file winefile.c.

3755 {
3756  if (s_pctxmenu3) {
3757  if (SUCCEEDED(IContextMenu3_HandleMenuMsg(s_pctxmenu3, nmsg, wparam, lparam)))
3758  return TRUE;
3759  }
3760 
3761  if (s_pctxmenu2)
3762  if (SUCCEEDED(IContextMenu2_HandleMenuMsg(s_pctxmenu2, nmsg, wparam, lparam)))
3763  return TRUE;
3764 
3765  return FALSE;
3766 }
#define TRUE
Definition: types.h:120
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
static IContextMenu2 * s_pctxmenu2
Definition: winefile.c:3727
static IContextMenu3 * s_pctxmenu3
Definition: winefile.c:3728
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by ChildWndProc().

◆ CtxMenu_query_interfaces()

static IContextMenu* CtxMenu_query_interfaces ( IContextMenu pcm1)
static

Definition at line 3736 of file winefile.c.

3737 {
3738  IContextMenu* pcm = NULL;
3739 
3740  CtxMenu_reset();
3741 
3742  if (IContextMenu_QueryInterface(pcm1, &IID_IContextMenu3, (void**)&pcm) == NOERROR)
3743  s_pctxmenu3 = (LPCONTEXTMENU3)pcm;
3744  else if (IContextMenu_QueryInterface(pcm1, &IID_IContextMenu2, (void**)&pcm) == NOERROR)
3745  s_pctxmenu2 = (LPCONTEXTMENU2)pcm;
3746 
3747  if (pcm) {
3748  IContextMenu_Release(pcm1);
3749  return pcm;
3750  } else
3751  return pcm1;
3752 }
#define NOERROR
Definition: winerror.h:2354
static void CtxMenu_reset(void)
Definition: winefile.c:3730
smooth NULL
Definition: ftsmooth.c:416
static IContextMenu2 * s_pctxmenu2
Definition: winefile.c:3727
static IContextMenu3 * s_pctxmenu3
Definition: winefile.c:3728

Referenced by ShellFolderContextMenu().

◆ CtxMenu_reset()

static void CtxMenu_reset ( void  )
static

Definition at line 3730 of file winefile.c.

3731 {
3732  s_pctxmenu2 = NULL;
3733  s_pctxmenu3 = NULL;
3734 }
smooth NULL
Definition: ftsmooth.c:416
static IContextMenu2 * s_pctxmenu2
Definition: winefile.c:3727
static IContextMenu3 * s_pctxmenu3
Definition: winefile.c:3728

Referenced by CtxMenu_query_interfaces(), and ShellFolderContextMenu().

◆ DestinationDlgProc()

static INT_PTR CALLBACK DestinationDlgProc ( HWND  hwnd,
UINT  nmsg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 1642 of file winefile.c.

1643 {
1645 
1646  switch(nmsg) {
1647  case WM_INITDIALOG:
1650  return 1;
1651 
1652  case WM_COMMAND: {
1653  int id = (int)wparam;
1654 
1655  switch(id) {
1656  case IDOK: {
1659  EndDialog(hwnd, id);
1660  break;}
1661 
1662  case IDCANCEL:
1663  EndDialog(hwnd, id);
1664  break;
1665 
1666  case 254:
1668  break;
1669  }
1670 
1671  return 1;
1672  }
1673  }
1674 
1675  return 0;
1676 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IDOK
Definition: winuser.h:824
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define GetWindowLongPtrW
Definition: winuser.h:4804
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
static CRYPT_DATA_BLOB b1[]
Definition: msg.c:573
#define GWLP_USERDATA
Definition: treelist.c:63
#define BUFFER_LEN
Definition: utility.h:97
#define IDS_NO_IMPL
Definition: cryptuires.h:181
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
#define IDS_WINEFILE
Definition: resource.h:115
#define WM_COMMAND
Definition: winuser.h:1722
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1408
#define MB_OK
Definition: winuser.h:784
#define RS(b, i)
Definition: winefile.c:195
static CRYPT_DATA_BLOB b2[]
Definition: msg.c:582
static char * dest
Definition: rtl.c:135
#define SetWindowLongPtrW
Definition: winuser.h:5321
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
static UINT WPARAM wparam
Definition: combo.c:716
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by prompt_target().

◆ display_error()

static void display_error ( HWND  hwnd,
DWORD  error 
)
static

Definition at line 199 of file winefile.c.

200 {
202  PWSTR msg;
203 
207  else
209 
210  LocalFree(msg);
211 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define error(str)
Definition: mkdosfs.c:1605
uint16_t * PWSTR
Definition: typedefs.h:54
#define LANG_NEUTRAL
Definition: nls.h:22
#define SUBLANG_DEFAULT
Definition: nls.h:168
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:400
static CRYPT_DATA_BLOB b1[]
Definition: msg.c:573
smooth NULL
Definition: ftsmooth.c:416
#define BUFFER_LEN
Definition: utility.h:97
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:404
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDS_WINEFILE
Definition: resource.h:115
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define MB_OK
Definition: winuser.h:784
#define RS(b, i)
Definition: winefile.c:195
#define msg(x)
Definition: auth_time.c:54
#define IDS_ERROR
Definition: resource.h:18
#define MAKELANGID(p, s)
Definition: nls.h:15
static CRYPT_DATA_BLOB b2[]
Definition: msg.c:582

Referenced by FrameWndProc(), launch_entry(), and launch_file().

◆ display_network_error()

static void display_network_error ( HWND  hwnd)
static

Definition at line 215 of file winefile.c.

216 {
217  WCHAR msg[BUFFER_LEN], provider[BUFFER_LEN], b2[BUFFER_LEN];
218  DWORD error;
219 
222 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define error(str)
Definition: mkdosfs.c:1605
#define NO_ERROR
Definition: dderror.h:5
DWORD WINAPI WNetGetLastErrorW(LPDWORD lpError, LPWSTR lpErrorBuf, DWORD nErrorBufSize, LPWSTR lpNameBuf, DWORD nNameBufSize)
Definition: wnet.c:3011
#define BUFFER_LEN
Definition: utility.h:97
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDS_WINEFILE
Definition: resource.h:115
#define MB_OK
Definition: winuser.h:784
#define RS(b, i)
Definition: winefile.c:195
#define msg(x)
Definition: auth_time.c:54
static CRYPT_DATA_BLOB b2[]
Definition: msg.c:582

Referenced by FrameWndProc().

◆ draw_item()

static void draw_item ( Pane pane,
LPDRAWITEMSTRUCT  dis,
Entry entry,
int  calcWidthCol 
)
static

Definition at line 2908 of file winefile.c.

2909 {
2911  DWORD attrs;
2912  int visible_cols = pane->visible_cols;
2913  COLORREF bkcolor, textcolor;
2914  RECT focusRect = dis->rcItem;
2915  HBRUSH hbrush;
2916  enum IMAGE img;
2917  int img_pos, cx;
2918  int col = 0;
2919 
2920  if (entry) {
2921  attrs = entry->data.dwFileAttributes;
2922 
2923  if (attrs & FILE_ATTRIBUTE_DIRECTORY) {
2924  if (entry->data.cFileName[0] == '.' && entry->data.cFileName[1] == '.'
2925  && entry->data.cFileName[2] == '\0')
2926  img = IMG_FOLDER_UP;
2927  else if (entry->data.cFileName[0] == '.' && entry->data.cFileName[1] == '\0')
2928  img = IMG_FOLDER_CUR;
2929  else if (pane->treePane && (dis->itemState&ODS_FOCUS))
2930  img = IMG_OPEN_FOLDER;
2931  else
2932  img = IMG_FOLDER;
2933  } else {
2934  switch(get_file_type(entry->data.cFileName)) {
2935  case FT_EXECUTABLE: img = IMG_EXECUTABLE; break;
2936  case FT_DOCUMENT: img = IMG_DOCUMENT; break;
2937  default: img = IMG_FILE;
2938  }
2939  }
2940  } else {
2941  attrs = 0;
2942  img = IMG_NONE;
2943  }
2944 
2945  if (pane->treePane) {
2946  if (entry) {
2947  img_pos = dis->rcItem.left + entry->level*(IMAGE_WIDTH+TREE_LINE_DX);
2948 
2949  if (calcWidthCol == -1) {
2950  int x;
2951  int y = dis->rcItem.top + IMAGE_HEIGHT/2;
2952  Entry* up;
2953  RECT rt_clip;
2954  HRGN hrgn_org = CreateRectRgn(0, 0, 0, 0);
2955  HRGN hrgn;
2956 
2957  rt_clip.left = dis->rcItem.left;
2958  rt_clip.top = dis->rcItem.top;
2959  rt_clip.right = dis->rcItem.left+pane->widths[col];
2960  rt_clip.bottom = dis->rcItem.bottom;
2961 
2962  hrgn = CreateRectRgnIndirect(&rt_clip);
2963 
2964  if (!GetClipRgn(dis->hDC, hrgn_org)) {
2965  DeleteObject(hrgn_org);
2966  hrgn_org = 0;
2967  }
2968 
2969  ExtSelectClipRgn(dis->hDC, hrgn, RGN_AND);
2970  DeleteObject(hrgn);
2971 
2972  if ((up=entry->up) != NULL) {
2973  MoveToEx(dis->hDC, img_pos-IMAGE_WIDTH/2, y, 0);
2974  LineTo(dis->hDC, img_pos-2, y);
2975 
2976  x = img_pos - IMAGE_WIDTH/2;
2977 
2978  do {
2980 
2981  if (up->next
2982  && (up->next->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
2983  ) {
2984  MoveToEx(dis->hDC, x, dis->rcItem.top, 0);
2985  LineTo(dis->hDC, x, dis->rcItem.bottom);
2986  }
2987  } while((up=up->up) != NULL);
2988  }
2989 
2990  x = img_pos - IMAGE_WIDTH/2;
2991 
2992  MoveToEx(dis->hDC, x, dis->rcItem.top, 0);
2993  LineTo(dis->hDC, x, y);
2994 
2995  if (entry->next
2996  && (entry->next->data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY))
2997  LineTo(dis->hDC, x, dis->rcItem.bottom);
2998 
2999  SelectClipRgn(dis->hDC, hrgn_org);
3000  if (hrgn_org) DeleteObject(hrgn_org);
3001  } else if (calcWidthCol==col || calcWidthCol==COLUMNS) {
3002  int right = img_pos + IMAGE_WIDTH - TREE_LINE_DX;
3003 
3004  if (right > pane->widths[col])
3005  pane->widths[col] = right;
3006  }
3007  } else {
3008  img_pos = dis->rcItem.left;
3009  }
3010  } else {
3011  img_pos = dis->rcItem.left;
3012 
3013  if (calcWidthCol==col || calcWidthCol==COLUMNS)
3014  pane->widths[col] = IMAGE_WIDTH;
3015  }
3016 
3017  if (calcWidthCol == -1) {
3018  focusRect.left = img_pos -2;
3019 
3020  if (attrs & FILE_ATTRIBUTE_COMPRESSED)
3021  textcolor = COLOR_COMPRESSED;
3022  else
3023  textcolor = RGB(0,0,0);
3024 
3025  if (dis->itemState & ODS_FOCUS) {
3026  textcolor = RGB(255,255,255);
3027  bkcolor = COLOR_SELECTION;
3028  } else {
3029  bkcolor = RGB(255,255,255);
3030  }
3031 
3032  hbrush = CreateSolidBrush(bkcolor);
3033  FillRect(dis->hDC, &focusRect, hbrush);
3035 
3036  SetBkMode(dis->hDC, TRANSPARENT);
3037  SetTextColor(dis->hDC, textcolor);
3038 
3039  cx = pane->widths[col];
3040 
3041  if (cx && img!=IMG_NONE) {
3042  if (cx > IMAGE_WIDTH)
3043  cx = IMAGE_WIDTH;
3044 
3045  if (entry->hicon && entry->hicon!=(HICON)-1)
3046  DrawIconEx(dis->hDC, img_pos, dis->rcItem.top, entry->hicon, cx, GetSystemMetrics(SM_CYSMICON), 0, 0, DI_NORMAL);
3047  else
3049  img_pos, dis->rcItem.top, cx,
3050  IMAGE_HEIGHT, bkcolor, CLR_DEFAULT, ILD_NORMAL);
3051  }
3052  }
3053 
3054  if (!entry)
3055  return;
3056 
3057  col++;
3058 
3059  /* output file name */
3060  if (calcWidthCol == -1)
3061  output_text(pane, dis, col, entry->data.cFileName, 0);
3062  else if (calcWidthCol==col || calcWidthCol==COLUMNS)
3063  calc_width(pane, dis, col, entry->data.cFileName);
3064 
3065  col++;
3066 
3067  /* display file size */
3068  if (visible_cols & COL_SIZE) {
3069  format_longlong( buffer, ((ULONGLONG)entry->data.nFileSizeHigh << 32) | entry->data.nFileSizeLow );
3070 
3071  if (calcWidthCol == -1)
3072  output_number(pane, dis, col, buffer);
3073  else if (calcWidthCol==col || calcWidthCol==COLUMNS)
3074  calc_width(pane, dis, col, buffer);/*TODO: not ever time enough */
3075 
3076  col++;
3077  }
3078 
3079  /* display file date */
3080  if (visible_cols & (COL_DATE|COL_TIME)) {
3081  format_date(&entry->data.ftCreationTime, buffer, visible_cols);
3082  if (calcWidthCol == -1)
3083  output_text(pane, dis, col, buffer, 0);
3084  else if (calcWidthCol==col || calcWidthCol==COLUMNS)
3085  calc_width(pane, dis, col, buffer);
3086  col++;
3087 
3088  format_date(&entry->data.ftLastAccessTime, buffer, visible_cols);
3089  if (calcWidthCol == -1)
3090  output_text(pane, dis, col, buffer, 0);
3091  else if (calcWidthCol==col || calcWidthCol==COLUMNS)
3092  calc_width(pane, dis, col, buffer);
3093  col++;
3094 
3095  format_date(&entry->data.ftLastWriteTime, buffer, visible_cols);
3096  if (calcWidthCol == -1)
3097  output_text(pane, dis, col, buffer, 0);
3098  else if (calcWidthCol==col || calcWidthCol==COLUMNS)
3099  calc_width(pane, dis, col, buffer);
3100  col++;
3101  }
3102 
3103  if (entry->bhfi_valid) {
3104  if (visible_cols & COL_INDEX) {
3105  static const WCHAR fmtlow[] = {'%','X',0};
3106  static const WCHAR fmthigh[] = {'%','X','%','0','8','X',0};
3107 
3108  if (entry->bhfi.nFileIndexHigh)
3109  wsprintfW(buffer, fmthigh,
3110  entry->bhfi.nFileIndexHigh, entry->bhfi.nFileIndexLow );
3111  else
3112  wsprintfW(buffer, fmtlow, entry->bhfi.nFileIndexLow );
3113 
3114  if (calcWidthCol == -1)
3115  output_text(pane, dis, col, buffer, DT_RIGHT);
3116  else if (calcWidthCol==col || calcWidthCol==COLUMNS)
3117  calc_width(pane, dis, col, buffer);
3118 
3119  col++;
3120  }
3121 
3122  if (visible_cols & COL_LINKS) {
3123  wsprintfW(buffer, sNumFmt, entry->bhfi.nNumberOfLinks);
3124 
3125  if (calcWidthCol == -1)
3126  output_text(pane, dis, col, buffer, DT_CENTER);
3127  else if (calcWidthCol==col || calcWidthCol==COLUMNS)
3128  calc_width(pane, dis, col, buffer);
3129 
3130  col++;
3131  }
3132  } else
3133  col += 2;
3134 
3135  /* show file attributes */
3136  if (visible_cols & COL_ATTRIBUTES) {
3137  static const WCHAR s11Tabs[] = {' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\0'};
3138  lstrcpyW(buffer, s11Tabs);
3139 
3140  if (attrs & FILE_ATTRIBUTE_NORMAL) buffer[ 0] = 'N';
3141  else {
3142  if (attrs & FILE_ATTRIBUTE_READONLY) buffer[ 2] = 'R';
3143  if (attrs & FILE_ATTRIBUTE_HIDDEN) buffer[ 4] = 'H';
3144  if (attrs & FILE_ATTRIBUTE_SYSTEM) buffer[ 6] = 'S';
3145  if (attrs & FILE_ATTRIBUTE_ARCHIVE) buffer[ 8] = 'A';
3146  if (attrs & FILE_ATTRIBUTE_COMPRESSED) buffer[10] = 'C';
3147  if (attrs & FILE_ATTRIBUTE_DIRECTORY) buffer[12] = 'D';
3148  if (attrs & FILE_ATTRIBUTE_ENCRYPTED) buffer[14] = 'E';
3149  if (attrs & FILE_ATTRIBUTE_TEMPORARY) buffer[16] = 'T';
3150  if (attrs & FILE_ATTRIBUTE_SPARSE_FILE) buffer[18] = 'P';
3151  if (attrs & FILE_ATTRIBUTE_REPARSE_POINT) buffer[20] = 'Q';
3152  if (attrs & FILE_ATTRIBUTE_OFFLINE) buffer[22] = 'O';
3153  if (attrs & FILE_ATTRIBUTE_NOT_CONTENT_INDEXED) buffer[24] = 'X';
3154  }
3155 
3156  if (calcWidthCol == -1)
3157  output_tabbed_text(pane, dis, col, buffer);
3158  else if (calcWidthCol==col || calcWidthCol==COLUMNS)
3159  calc_tabbed_width(pane, dis, col, buffer);
3160 
3161  col++;
3162  }
3163 }
static void calc_width(Pane *pane, LPDRAWITEMSTRUCT dis, int col, LPCWSTR str)
Definition: winefile.c:2776
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
static void format_date(const FILETIME *ft, WCHAR *buffer, int visible_cols)
Definition: winefile.c:2741
static HICON
Definition: imagelist.c:84
#define FILE_ATTRIBUTE_TEMPORARY
Definition: nt_native.h:708
static HBRUSH hbrush
#define FILE_ATTRIBUTE_SPARSE_FILE
Definition: ntifs_ex.h:380
#define IMAGE_HEIGHT
Definition: pane.cpp:39
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
HRGN WINAPI CreateRectRgnIndirect(_In_ LPCRECT)
#define COLOR_SELECTION
Definition: winefile.h:86
LONG top
Definition: windef.h:307
#define ODS_FOCUS
Definition: winuser.h:2524
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
GLuint buffer
Definition: glext.h:5915
#define SM_CYSMICON
Definition: winuser.h:1003
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define DT_RIGHT
Definition: winuser.h:538
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
Definition: ntifs_ex.h:384
#define TREE_LINE_DX
Definition: winefile.h:71
int widths[COLUMNS]
Definition: winefile.c:120
#define RGN_AND
Definition: wingdi.h:355
#define up(mutex)
Definition: glue.h:30
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
int WINAPI ExtSelectClipRgn(_In_ HDC, _In_opt_ HRGN, _In_ int)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1032
#define COLOR_COMPRESSED
Definition: winefile.h:85
#define TRANSPARENT
Definition: wingdi.h:949
smooth NULL
Definition: ftsmooth.c:416
#define BUFFER_LEN
Definition: utility.h:97
HIMAGELIST himl
Definition: winefile.h:120
#define FILE_ATTRIBUTE_REPARSE_POINT
Definition: ntifs_ex.h:381
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
static enum FILE_TYPE get_file_type(LPCWSTR filename)
Definition: winefile.c:2893
IMAGE
Definition: pane.cpp:31
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL WINAPI DrawIconEx(_In_ HDC, _In_ int, _In_ int, _In_ HICON, _In_ int, _In_ int, _In_ UINT, _In_opt_ HBRUSH, _In_ UINT)
Definition: cursoricon.c:1997
GLint GLvoid * img
Definition: gl.h:1956
DWORD COLORREF
Definition: windef.h:300
uint64_t ULONGLONG
Definition: typedefs.h:65
#define RGB(r, g, b)
Definition: wingdi.h:2939
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
int WINAPI GetSystemMetrics(_In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
static void output_number(Pane *pane, LPDRAWITEMSTRUCT dis, int col, LPCWSTR str)
Definition: winefile.c:2824
GLdouble GLdouble right
Definition: glext.h:10859
#define FILE_ATTRIBUTE_COMPRESSED
Definition: nt_native.h:711
#define FILE_ATTRIBUTE_ARCHIVE
Definition: nt_native.h:706
WINEFILE_GLOBALS Globals
Definition: winefile.c:161
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
int visible_cols
Definition: winefile.c:124
static HRGN hrgn
Definition: win.c:55
uint32_t entry
Definition: isohybrid.c:63
#define DI_NORMAL
Definition: wingdi.h:72
static void format_longlong(LPWSTR ret, ULONGLONG val)
Definition: winefile.c:175
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:888
#define COLUMNS
Definition: winefile.c:119
static void output_text(Pane *pane, LPDRAWITEMSTRUCT dis, int col, LPCWSTR str, DWORD flags)
Definition: winefile.c:2798
#define FILE_ATTRIBUTE_ENCRYPTED
Definition: ntifs_ex.h:385
#define lstrcpyW
Definition: compat.h:414
struct define * next
Definition: compiler.c:65
static void output_tabbed_text(Pane *pane, LPDRAWITEMSTRUCT dis, int col, LPCWSTR str)
Definition: winefile.c:2811
static void calc_tabbed_width(Pane *pane, LPDRAWITEMSTRUCT dis, int col, LPCWSTR str)
Definition: winefile.c:2786
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define CLR_DEFAULT
Definition: commctrl.h:316
static const WCHAR sNumFmt[]
Definition: winefile.c:168
_Out_opt_ int * cx
Definition: commctrl.h:581
LONG bottom
Definition: windef.h:309
#define DT_CENTER
Definition: winuser.h:527
int WINAPI GetClipRgn(_In_ HDC, _In_ HRGN)
#define ILD_NORMAL
Definition: commctrl.h:413
BOOL treePane
Definition: winefile.c:123
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define IMAGE_WIDTH
Definition: pane.cpp:38
base of all file and directory entries
Definition: entries.h:82
BOOL WINAPI ImageList_DrawEx(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, INT dx, INT dy, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle)
Definition: imagelist.c:1264
#define FILE_ATTRIBUTE_OFFLINE
Definition: nt_native.h:712

Referenced by calc_single_width(), calc_widths(), and ChildWndProc().

◆ ExitInstance()

static void ExitInstance ( void  )
static

Definition at line 4379 of file winefile.c.

4380 {
4381  IShellFolder_Release(Globals.iDesktop);
4382  IMalloc_Release(Globals.iMalloc);
4383  CoUninitialize();
4384 
4387 }
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
HIMAGELIST himl
Definition: winefile.h:120
WINEFILE_GLOBALS Globals
Definition: winefile.c:161
IShellFolder * iDesktop
Definition: winefile.h:126
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
IMalloc * iMalloc
Definition: winefile.h:127

Referenced by wWinMain().

◆ expand_entry()

static BOOL expand_entry ( ChildWnd child,
Entry dir 
)
static

Definition at line 3305 of file winefile.c.

3306 {
3307  int idx;
3308  Entry* p;
3309 
3310  if (!dir || dir->expanded || !dir->down)
3311  return FALSE;
3312 
3313  p = dir->down;
3314 
3315  if (p->data.cFileName[0]=='.' && p->data.cFileName[1]=='\0' && p->next) {
3316  p = p->next;
3317 
3318  if (p->data.cFileName[0]=='.' && p->data.cFileName[1]=='.' &&
3319  p->data.cFileName[2]=='\0' && p->next)
3320  p = p->next;
3321  }
3322 
3323  /* no subdirectories ? */
3324  if (!(p->data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY))
3325  return FALSE;
3326 
3327  idx = SendMessageW(child->left.hwnd, LB_FINDSTRING, 0, (LPARAM)dir);
3328 
3329  dir->expanded = TRUE;
3330 
3331  /* insert entries in left pane */
3332  insert_entries(&child->left, p, NULL, TF_ALL, idx);
3333 
3334  if (!child->header_wdths_ok) {
3335  if (calc_widths(&child->left, FALSE)) {
3336  set_header(&child->left);
3337 
3338  child->header_wdths_ok = TRUE;
3339  }
3340  }
3341 
3342  return TRUE;
3343 }
#define TRUE
Definition: types.h:120
static BOOL calc_widths(Pane *pane, BOOL anyway)
Definition: winefile.c:2386
static HWND child
Definition: cursoricon.c:298
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
unsigned int dir
Definition: maze.c:112
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define LB_FINDSTRING
Definition: winuser.h:2016
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static int insert_entries(Pane *pane, Entry *dir, LPCWSTR pattern, int filter_flags, int idx)
Definition: winefile.c:2579
GLfloat GLfloat p
Definition: glext.h:8902
base of all file and directory entries
Definition: entries.h:82
static void set_header(Pane *pane)
Definition: winefile.c:3165

Referenced by activate_entry().

◆ extract_icon()

static HICON extract_icon ( IShellFolder folder,
LPCITEMIDLIST  pidl 
)
static

Definition at line 737 of file winefile.c.

738 {
739  IExtractIconW* pExtract;
740 
741  if (SUCCEEDED(IShellFolder_GetUIObjectOf(folder, 0, 1, (LPCITEMIDLIST*)&pidl, &IID_IExtractIconW, 0, (LPVOID*)&pExtract))) {
743  unsigned flags;
744  HICON hicon;
745  int idx;
746 
747  if (SUCCEEDED(IExtractIconW_GetIconLocation(pExtract, GIL_FORSHELL, path, _MAX_PATH, &idx, &flags))) {
748  if (!(flags & GIL_NOTFILENAME)) {
749  if (idx == -1)
750  idx = 0; /* special case for some control panel applications */
751 
752  if ((int)ExtractIconExW(path, idx, 0, &hicon, 1) > 0)
753  flags &= ~GIL_DONTCACHE;
754  } else {
755  HICON hIconLarge = 0;
756 
757  HRESULT hr = IExtractIconW_Extract(pExtract, path, idx, &hIconLarge, &hicon, MAKELONG(0/*GetSystemMetrics(SM_CXICON)*/,GetSystemMetrics(SM_CXSMICON)));
758 
759  if (SUCCEEDED(hr))
760  DestroyIcon(hIconLarge);
761  }
762 
763  return hicon;
764  }
765  }
766 
767  return 0;
768 }
static HICON
Definition: imagelist.c:84
Definition: fci.c:115
#define _MAX_PATH
Definition: winefile.c:43
HRESULT hr
Definition: shlfolder.c:183
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
UINT WINAPI ExtractIconExW(LPCWSTR lpszFile, INT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIcons)
Definition: iconcache.cpp:873
unsigned int idx
Definition: utils.c:41
#define MAKELONG(a, b)
Definition: typedefs.h:248
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
int WINAPI GetSystemMetrics(_In_ int)
GLbitfield flags
Definition: glext.h:7161
#define SM_CXSMICON
Definition: winuser.h:1002
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by read_directory_shell().

◆ fill_w32fdata_shell()

static void fill_w32fdata_shell ( IShellFolder folder,
LPCITEMIDLIST  pidl,
SFGAOF  attribs,
WIN32_FIND_DATAW w32fdata 
)
static

Definition at line 836 of file winefile.c.

837 {
838  if (!(attribs & SFGAO_FILESYSTEM) ||
841  IDataObject* pDataObj;
842 
843  STGMEDIUM medium = {0, {0}, 0};
844  FORMATETC fmt = {Globals.cfStrFName, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
845 
846  HRESULT hr = IShellFolder_GetUIObjectOf(folder, 0, 1, &pidl, &IID_IDataObject, 0, (LPVOID*)&pDataObj);
847 
848  if (SUCCEEDED(hr)) {
849  hr = IDataObject_GetData(pDataObj, &fmt, &medium);
850 
851  IDataObject_Release(pDataObj);
852 
853  if (SUCCEEDED(hr)) {
854  LPCWSTR path = GlobalLock(medium.UNION_MEMBER(hGlobal));
856 
858  w32fdata->dwFileAttributes = fad.dwFileAttributes;
859  w32fdata->ftCreationTime = fad.ftCreationTime;
860  w32fdata->ftLastAccessTime = fad.ftLastAccessTime;
861  w32fdata->ftLastWriteTime = fad.ftLastWriteTime;
862 
864  w32fdata->nFileSizeLow = fad.nFileSizeLow;
865  w32fdata->nFileSizeHigh = fad.nFileSizeHigh;
866  }
867  }
868 
869  SetErrorMode(sem_org);
870 
871  GlobalUnlock(medium.UNION_MEMBER(hGlobal));
872  GlobalFree(medium.UNION_MEMBER(hGlobal));
873  }
874  }
875  }
876 
877  if (attribs & (SFGAO_FOLDER|SFGAO_HASSUBFOLDER))
878  w32fdata->dwFileAttributes |= FILE_ATTRIBUTE_DIRECTORY;
879 
880  if (attribs & SFGAO_READONLY)
881  w32fdata->dwFileAttributes |= FILE_ATTRIBUTE_READONLY;
882 
883  if (attribs & SFGAO_COMPRESSED)
884  w32fdata->dwFileAttributes |= FILE_ATTRIBUTE_COMPRESSED;
885 }
UINT WINAPI SetErrorMode(IN UINT uMode)
Definition: except.c:753
HRESULT WINAPI SHGetDataFromIDListW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, int nFormat, LPVOID dest, int len)
Definition: pidl.c:1194
Definition: fci.c:115
HRESULT hr
Definition: shlfolder.c:183
#define SEM_FAILCRITICALERRORS
Definition: rtltypes.h:69
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
const GLint * attribs
Definition: glext.h:10538
const GUID IID_IDataObject
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
if(!(yy_init))
Definition: macro.lex.yy.c:714
LONG HRESULT
Definition: typedefs.h:77
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
#define FILE_ATTRIBUTE_COMPRESSED
Definition: nt_native.h:711
#define SHGDFIL_FINDDATA
Definition: shlobj.h:1368
WINEFILE_GLOBALS Globals
Definition: winefile.c:161
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
unsigned int UINT
Definition: ndis.h:50
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
BOOL WINAPI GetFileAttributesExW(LPCWSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation)
Definition: fileinfo.c:702
Definition: dsound.c:943
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by read_directory_shell().

◆ FilterDialogDlgProc()

static INT_PTR CALLBACK FilterDialogDlgProc ( HWND  hwnd,
UINT  nmsg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 1684 of file winefile.c.

1685 {
1686  static struct FilterDialog* dlg;
1687 
1688  switch(nmsg) {
1689  case WM_INITDIALOG:
1690  dlg = (struct FilterDialog*) lparam;
1697  return 1;
1698 
1699  case WM_COMMAND: {
1700  int id = (int)wparam;
1701 
1702  if (id == IDOK) {
1703  int flags = 0;
1704 
1706 
1712 
1713  dlg->flags = flags;
1714 
1715  EndDialog(hwnd, id);
1716  } else if (id == IDCANCEL)
1717  EndDialog(hwnd, id);
1718 
1719  return 1;}
1720  }
1721 
1722  return 0;
1723 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IDOK
Definition: winuser.h:824
#define IDC_VIEW_TYPE_OTHERS
Definition: resource.h:85
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
static BOOL get_check(HWND hwnd, INT id)
Definition: winefile.c:224
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define IDC_VIEW_PATTERN
Definition: resource.h:81
#define IDC_VIEW_TYPE_DIRECTORIES
Definition: resource.h:82
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define MAX_PATH
Definition: compat.h:26
#define IDC_VIEW_TYPE_HIDDEN
Definition: resource.h:86
GLbitfield flags
Definition: glext.h:7161
#define IDC_VIEW_TYPE_DOCUMENTS
Definition: resource.h:84
#define WM_COMMAND
Definition: winuser.h:1722
#define IDC_VIEW_TYPE_PROGRAMS
Definition: resource.h:83
WCHAR pattern[MAX_PATH]
Definition: winefile.c:1680
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1408
static INT set_check(HWND hwnd, INT id, BOOL on)
Definition: winefile.c:229
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
static UINT WPARAM wparam
Definition: combo.c:716
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by ChildWndProc().

◆ find_entry_shell()

static Entry* find_entry_shell ( Entry dir,
LPCITEMIDLIST  pidl 
)
static

Definition at line 771 of file winefile.c.

772 {
773  Entry* entry;
774 
775  for(entry=dir->down; entry; entry=entry->next) {
776  if (entry->pidl->mkid.cb == pidl->mkid.cb &&
777  !memcmp(entry->pidl, pidl, entry->pidl->mkid.cb))
778  return entry;
779  }
780 
781  return 0;
782 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
unsigned int dir
Definition: maze.c:112
uint32_t entry
Definition: isohybrid.c:63
base of all file and directory entries
Definition: entries.h:82

Referenced by read_tree_shell().

◆ find_entry_win()

static Entry* find_entry_win ( Entry dir,
LPCWSTR  name 
)
static

Definition at line 403 of file winefile.c.

404 {
405  Entry* entry;
406 
407  for(entry=dir->down; entry; entry=entry->next) {
408  LPCWSTR p = name;
409  LPCWSTR q = entry->data.cFileName;
410 
411  do {
412  if (!*p || *p == '\\' || *p == '/')
413  return entry;
414  } while(tolower(*p++) == tolower(*q++));
415 
416  p = name;
417  q = entry->data.cAlternateFileName;
418 
419  do {
420  if (!*p || *p == '\\' || *p == '/')
421  return entry;
422  } while(tolower(*p++) == tolower(*q++));
423  }
424 
425  return 0;
426 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185