[ros-diffs] [dreimer] 43185: Sync WinFile to Wine 1.1.30

dreimer at svn.reactos.org dreimer at svn.reactos.org
Sun Sep 27 14:09:25 CEST 2009


Author: dreimer
Date: Sun Sep 27 14:09:24 2009
New Revision: 43185

URL: http://svn.reactos.org/svn/reactos?rev=43185&view=rev
Log:
Sync WinFile to Wine 1.1.30

Modified:
    trunk/rosapps/applications/winfile/It.rc
    trunk/rosapps/applications/winfile/splitpath.c
    trunk/rosapps/applications/winfile/winefile.c
    trunk/rosapps/applications/winfile/winefile.h

Modified: trunk/rosapps/applications/winfile/It.rc
URL: http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/winfile/It.rc?rev=43185&r1=43184&r2=43185&view=diff
==============================================================================
--- trunk/rosapps/applications/winfile/It.rc [iso-8859-1] (original)
+++ trunk/rosapps/applications/winfile/It.rc [iso-8859-1] Sun Sep 27 14:09:24 2009
@@ -164,7 +164,7 @@
 
 IDD_SELECT_DESTINATION DIALOG FIXED IMPURE 15, 13, 210, 63
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Select destination"
+CAPTION "Seleziona destinazione"
 FONT 8, "MS Shell Dlg"
 {
     CONTROL         "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10
@@ -177,6 +177,6 @@
 
 STRINGTABLE
 {
-    IDS_FONT_SEL_DLG_NAME   "Applica le impostazioni dei font"
-    IDS_FONT_SEL_ERROR      "Si è verificato un errore durante la selezione del nuovo font."
+    IDS_FONT_SEL_DLG_NAME   "Applica le impostazioni dei caratteri"
+    IDS_FONT_SEL_ERROR      "Si è verificato un errore durante la selezione del nuovo carattere."
 }

Modified: trunk/rosapps/applications/winfile/splitpath.c
URL: http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/winfile/splitpath.c?rev=43185&r1=43184&r2=43185&view=diff
==============================================================================
--- trunk/rosapps/applications/winfile/splitpath.c [iso-8859-1] (original)
+++ trunk/rosapps/applications/winfile/splitpath.c [iso-8859-1] Sun Sep 27 14:09:24 2009
@@ -18,9 +18,6 @@
 
 #include "winefile.h"
 
-
-#ifdef __WINE__
-#ifdef UNICODE
 
 void _wsplitpath(const WCHAR* path, WCHAR* drv, WCHAR* dir, WCHAR* name, WCHAR* ext)
 {
@@ -75,81 +72,23 @@
 	}
 }
 
-#else /* UNICODE */
-
-void _splitpath(const CHAR* path, CHAR* drv, CHAR* dir, CHAR* name, CHAR* ext)
-{
-        const CHAR* end; /* end of processed string */
-	const CHAR* p;	 /* search pointer */
-	const CHAR* s;	 /* copy pointer */
-
-	/* extract drive name */
-	if (path[0] && path[1]==':') {
-		if (drv) {
-			*drv++ = *path++;
-			*drv++ = *path++;
-			*drv = '\0';
-		}
-	} else if (drv)
-		*drv = '\0';
-
-	/* search for end of string or stream separator */
-	for(end=path; *end && *end!=':'; )
-		end++;
-
-	/* search for begin of file extension */
-	for(p=end; p>path && *--p!='\\' && *p!='/'; )
-		if (*p == '.') {
-			end = p;
-			break;
-		}
-
-	if (ext)
-		for(s=end; (*ext=*s++); )
-			ext++;
-
-	/* search for end of directory name */
-	for(p=end; p>path; )
-		if (*--p=='\\' || *p=='/') {
-			p++;
-			break;
-		}
-
-	if (name) {
-		for(s=p; s<end; )
-			*name++ = *s++;
-
-		*name = '\0';
-	}
-
-	if (dir) {
-		for(s=path; s<p; )
-			*dir++ = *s++;
-
-		*dir = '\0';
-	}
-}
-
-#endif /* UNICODE */
-#endif /* __WINE__ */
-
 
 /*
 void main()	// test splipath()
 {
-	TCHAR drv[_MAX_DRIVE+1], dir[_MAX_DIR], name[_MAX_FNAME], ext[_MAX_EXT];
+	WCHAR drv[_MAX_DRIVE+1], dir[_MAX_DIR], name[_MAX_FNAME], ext[_MAX_EXT];
 
-	_tsplitpath(L"x\\y", drv, dir, name, ext);
-	_tsplitpath(L"x\\", drv, dir, name, ext);
-	_tsplitpath(L"\\x", drv, dir, name, ext);
-	_tsplitpath(L"x", drv, dir, name, ext);
-	_tsplitpath(L"", drv, dir, name, ext);
-	_tsplitpath(L".x", drv, dir, name, ext);
-	_tsplitpath(L":x", drv, dir, name, ext);
-	_tsplitpath(L"a:x", drv, dir, name, ext);
-	_tsplitpath(L"a.b:x", drv, dir, name, ext);
-	_tsplitpath(L"W:\\/\\abc/Z:~", drv, dir, name, ext);
-	_tsplitpath(L"abc.EFGH:12345", drv, dir, name, ext);
-	_tsplitpath(L"C:/dos/command.com", drv, dir, name, ext);
+	_wsplitpath(L"x\\y", drv, dir, name, ext);
+	_wsplitpath(L"x\\", drv, dir, name, ext);
+	_wsplitpath(L"\\x", drv, dir, name, ext);
+	_wsplitpath(L"x", drv, dir, name, ext);
+	_wsplitpath(L"", drv, dir, name, ext);
+	_wsplitpath(L".x", drv, dir, name, ext);
+	_wsplitpath(L":x", drv, dir, name, ext);
+	_wsplitpath(L"a:x", drv, dir, name, ext);
+	_wsplitpath(L"a.b:x", drv, dir, name, ext);
+	_wsplitpath(L"W:\\/\\abc/Z:~", drv, dir, name, ext);
+	_wsplitpath(L"abc.EFGH:12345", drv, dir, name, ext);
+	_wsplitpath(L"C:/dos/command.com", drv, dir, name, ext);
 }
 */

Modified: trunk/rosapps/applications/winfile/winefile.c
URL: http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/winfile/winefile.c?rev=43185&r1=43184&r2=43185&view=diff
==============================================================================
--- trunk/rosapps/applications/winfile/winefile.c [iso-8859-1] (original)
+++ trunk/rosapps/applications/winfile/winefile.c [iso-8859-1] Sun Sep 27 14:09:24 2009
@@ -86,7 +86,7 @@
 	BOOL			scanned;
 	int				level;
 
-	WIN32_FIND_DATA	data;
+	WIN32_FIND_DATAW	data;
 
 #ifndef _NO_EXTENSIONS
 	BY_HANDLE_FILE_INFORMATION bhfi;
@@ -102,9 +102,9 @@
 
 typedef struct {
 	Entry	entry;
-	TCHAR	path[MAX_PATH];
-	TCHAR	volname[_MAX_FNAME];
-	TCHAR	fs[_MAX_DIR];
+	WCHAR	path[MAX_PATH];
+	WCHAR	volname[_MAX_FNAME];
+	WCHAR	fs[_MAX_DIR];
 	DWORD	drive_type;
 	DWORD	fs_flags;
 } Root;
@@ -160,8 +160,8 @@
 	int		split_pos;
 	BOOL	header_wdths_ok;
 
-	TCHAR	path[MAX_PATH];
-	TCHAR	filter_pattern[MAX_PATH];
+	WCHAR	path[MAX_PATH];
+	WCHAR	filter_pattern[MAX_PATH];
 	int		filter_flags;
 	Root	root;
 
@@ -170,12 +170,12 @@
 
 
 
-static void read_directory(Entry* dir, LPCTSTR path, SORT_ORDER sortOrder, HWND hwnd);
+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, PTSTR path);
-static void format_date(const FILETIME* ft, TCHAR* buffer, int visible_cols);
+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);
@@ -188,14 +188,14 @@
 static int last_split;
 
 /* some common string constants */
-static const TCHAR sEmpty[] = {'\0'};
+static const WCHAR sEmpty[] = {'\0'};
 static const WCHAR sSpace[] = {' ', '\0'};
-static const TCHAR sNumFmt[] = {'%','d','\0'};
-static const TCHAR sQMarks[] = {'?','?','?','\0'};
+static const WCHAR sNumFmt[] = {'%','d','\0'};
+static const WCHAR sQMarks[] = {'?','?','?','\0'};
 
 /* window class names */
-static const TCHAR sWINEFILEFRAME[] = {'W','F','S','_','F','r','a','m','e','\0'};
-static const TCHAR sWINEFILETREE[] = {'W','F','S','_','T','r','e','e','\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 void format_longlong(LPWSTR ret, ULONGLONG val)
 {
@@ -211,9 +211,9 @@
 
 
 /* load resource string */
-static LPTSTR load_string(LPTSTR buffer, DWORD size, UINT id)
-{
-	LoadString(Globals.hInstance, id, buffer, size);
+static LPWSTR load_string(LPWSTR buffer, DWORD size, UINT id)
+{
+	LoadStringW(Globals.hInstance, id, buffer, size);
 	return buffer;
 }
 
@@ -223,27 +223,27 @@
 /* display error message for the specified WIN32 error code */
 static void display_error(HWND hwnd, DWORD error)
 {
-	TCHAR b1[BUFFER_LEN], b2[BUFFER_LEN];
-	PTSTR msg;
-
-	if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
-		0, error, MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT), (PTSTR)&msg, 0, NULL))
-		MessageBox(hwnd, msg, RS(b2,IDS_WINEFILE), MB_OK);
+	WCHAR b1[BUFFER_LEN], b2[BUFFER_LEN];
+	PWSTR msg;
+
+	if (FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
+		0, error, MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT), (PWSTR)&msg, 0, NULL))
+		MessageBoxW(hwnd, msg, RS(b2,IDS_WINEFILE), MB_OK);
 	else
-		MessageBox(hwnd, RS(b1,IDS_ERROR), RS(b2,IDS_WINEFILE), MB_OK);
+		MessageBoxW(hwnd, RS(b1,IDS_ERROR), RS(b2,IDS_WINEFILE), MB_OK);
 
 	LocalFree(msg);
 }
 
 
-/* display network error message using WNetGetLastError() */
+/* display network error message using WNetGetLastErrorW() */
 static void display_network_error(HWND hwnd)
 {
-	TCHAR msg[BUFFER_LEN], provider[BUFFER_LEN], b2[BUFFER_LEN];
+	WCHAR msg[BUFFER_LEN], provider[BUFFER_LEN], b2[BUFFER_LEN];
 	DWORD error;
 
-	if (WNetGetLastError(&error, msg, BUFFER_LEN, provider, BUFFER_LEN) == NO_ERROR)
-		MessageBox(hwnd, msg, RS(b2,IDS_WINEFILE), MB_OK);
+	if (WNetGetLastErrorW(&error, msg, BUFFER_LEN, provider, BUFFER_LEN) == NO_ERROR)
+		MessageBoxW(hwnd, msg, RS(b2,IDS_WINEFILE), MB_OK);
 }
 
 static inline BOOL get_check(HWND hwnd, INT id)
@@ -263,7 +263,7 @@
         LOGFONTW lFont;
 
         HDC hdc = GetDC(hwnd);
-        chFont.lStructSize = sizeof(CHOOSEFONT);
+        chFont.lStructSize = sizeof(CHOOSEFONTW);
         chFont.hwndOwner = hwnd;
         chFont.hDC = NULL;
         chFont.lpLogFont = &lFont;
@@ -360,20 +360,20 @@
 }
 
 
-static void read_directory_win(Entry* dir, LPCTSTR path)
+static void read_directory_win(Entry* dir, LPCWSTR path)
 {
 	Entry* first_entry = NULL;
 	Entry* last = NULL;
 	Entry* entry;
 
 	int level = dir->level + 1;
-	WIN32_FIND_DATA w32fd;
+	WIN32_FIND_DATAW w32fd;
 	HANDLE hFind;
 #ifndef _NO_EXTENSIONS
 	HANDLE hFile;
 #endif
 
-	TCHAR buffer[MAX_PATH], *p;
+	WCHAR buffer[MAX_PATH], *p;
 	for(p=buffer; *path; )
 		*p++ = *path++;
 
@@ -381,14 +381,14 @@
 	p[0] = '*';
 	p[1] = '\0';
 
-	hFind = FindFirstFile(buffer, &w32fd);
+	hFind = FindFirstFileW(buffer, &w32fd);
 
 	if (hFind != INVALID_HANDLE_VALUE) {
 		do {
 #ifdef _NO_EXTENSIONS
 			/* hide directory entry "." */
 			if (w32fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
-				LPCTSTR name = w32fd.cFileName;
+				LPCWSTR name = w32fd.cFileName;
 
 				if (name[0]=='.' && name[1]=='\0')
 					continue;
@@ -402,7 +402,7 @@
 			if (last)
 				last->next = entry;
 
-			memcpy(&entry->data, &w32fd, sizeof(WIN32_FIND_DATA));
+			memcpy(&entry->data, &w32fd, sizeof(WIN32_FIND_DATAW));
 			entry->down = NULL;
 			entry->up = dir;
 			entry->expanded = FALSE;
@@ -413,9 +413,9 @@
 			entry->etype = ET_WINDOWS;
 			entry->bhfi_valid = FALSE;
 
-			lstrcpy(p, entry->data.cFileName);
-
-			hFile = CreateFile(buffer, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+			lstrcpyW(p, entry->data.cFileName);
+
+			hFile = CreateFileW(buffer, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
 								0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
 
 			if (hFile != INVALID_HANDLE_VALUE) {
@@ -427,7 +427,7 @@
 #endif
 
 			last = entry;
-		} while(FindNextFile(hFind, &w32fd));
+		} while(FindNextFileW(hFind, &w32fd));
 
 		if (last)
 			last->next = NULL;
@@ -440,13 +440,13 @@
 }
 
 
-static Entry* find_entry_win(Entry* dir, LPCTSTR name)
+static Entry* find_entry_win(Entry* dir, LPCWSTR name)
 {
 	Entry* entry;
 
 	for(entry=dir->down; entry; entry=entry->next) {
-		LPCTSTR p = name;
-		LPCTSTR q = entry->data.cFileName;
+		LPCWSTR p = name;
+		LPCWSTR q = entry->data.cFileName;
 
 		do {
 			if (!*p || *p == '\\' || *p == '/')
@@ -466,14 +466,14 @@
 }
 
 
-static Entry* read_tree_win(Root* root, LPCTSTR path, SORT_ORDER sortOrder, HWND hwnd)
-{
-	TCHAR buffer[MAX_PATH];
+static Entry* read_tree_win(Root* root, LPCWSTR path, SORT_ORDER sortOrder, HWND hwnd)
+{
+	WCHAR buffer[MAX_PATH];
 	Entry* entry = &root->entry;
-	LPCTSTR s = path;
-	PTSTR d = buffer;
-
-	HCURSOR old_cursor = SetCursor(LoadCursor(0, IDC_WAIT));
+	LPCWSTR s = path;
+	PWSTR d = buffer;
+
+	HCURSOR old_cursor = SetCursor(LoadCursorW(0, (LPCWSTR)IDC_WAIT));
 
 #ifndef _NO_EXTENSIONS
 	entry->etype = ET_WINDOWS;
@@ -527,7 +527,7 @@
 	return SystemTimeToFileTime(&stime, ftime);
 }
 
-static void read_directory_unix(Entry* dir, LPCTSTR path)
+static void read_directory_unix(Entry* dir, LPCWSTR path)
 {
 	Entry* first_entry = NULL;
 	Entry* last = NULL;
@@ -535,14 +535,9 @@
 	DIR* pdir;
 
 	int level = dir->level + 1;
-#ifdef UNICODE
 	char cpath[MAX_PATH];
 
 	WideCharToMultiByte(CP_UNIXCP, 0, path, -1, cpath, MAX_PATH, NULL, NULL);
-#else
-	const char* cpath = path;
-#endif
-
 	pdir = opendir(cpath);
 
 	if (pdir) {
@@ -569,11 +564,7 @@
 			entry->etype = ET_UNIX;
 
 			strcpy(p, ent->d_name);
-#ifdef UNICODE
 			MultiByteToWideChar(CP_UNIXCP, 0, p, -1, entry->data.cFileName, MAX_PATH);
-#else
-			lstrcpy(entry->data.cFileName, p);
-#endif
 
 			if (!stat(buffer, &st)) {
 				entry->data.dwFileAttributes = p[0]=='.'? FILE_ATTRIBUTE_HIDDEN: 0;
@@ -619,13 +610,13 @@
 	dir->scanned = TRUE;
 }
 
-static Entry* find_entry_unix(Entry* dir, LPCTSTR name)
+static Entry* find_entry_unix(Entry* dir, LPCWSTR name)
 {
 	Entry* entry;
 
 	for(entry=dir->down; entry; entry=entry->next) {
-		LPCTSTR p = name;
-		LPCTSTR q = entry->data.cFileName;
+		LPCWSTR p = name;
+		LPCWSTR q = entry->data.cFileName;
 
 		do {
 			if (!*p || *p == '/')
@@ -636,14 +627,14 @@
 	return 0;
 }
 
-static Entry* read_tree_unix(Root* root, LPCTSTR path, SORT_ORDER sortOrder, HWND hwnd)
-{
-	TCHAR buffer[MAX_PATH];
+static Entry* read_tree_unix(Root* root, LPCWSTR path, SORT_ORDER sortOrder, HWND hwnd)
+{
+	WCHAR buffer[MAX_PATH];
 	Entry* entry = &root->entry;
-	LPCTSTR s = path;
-	PTSTR d = buffer;
-
-	HCURSOR old_cursor = SetCursor(LoadCursor(0, IDC_WAIT));
+	LPCWSTR s = path;
+	PWSTR d = buffer;
+
+	HCURSOR old_cursor = SetCursor(LoadCursorW(0, (LPCWSTR)IDC_WAIT));
 
 	entry->etype = ET_UNIX;
 
@@ -678,68 +669,11 @@
 
 #ifdef _SHELL_FOLDERS
 
-#ifdef UNICODE
-#define	get_strret get_strretW
-#define	path_from_pidl path_from_pidlW
-#else
-#define	get_strret get_strretA
-#define	path_from_pidl path_from_pidlA
-#endif
-
-
 static void free_strret(STRRET* str)
 {
 	if (str->uType == STRRET_WSTR)
 		IMalloc_Free(Globals.iMalloc, str->UNION_MEMBER(pOleStr));
 }
-
-
-#ifndef UNICODE
-
-static LPSTR strcpyn(LPSTR dest, LPCSTR source, size_t count)
-{
- LPCSTR s;
- LPSTR d = dest;
-
- for(s=source; count&&(*d++=*s++); )
-  count--;
-
- return dest;
-}
-
-static void get_strretA(STRRET* str, const SHITEMID* shiid, LPSTR buffer, int len)
-{
- switch(str->uType) {
-  case STRRET_WSTR:
-	WideCharToMultiByte(CP_ACP, 0, str->UNION_MEMBER(pOleStr), -1, buffer, len, NULL, NULL);
-	break;
-
-  case STRRET_OFFSET:
-	strcpyn(buffer, (LPCSTR)shiid+str->UNION_MEMBER(uOffset), len);
-	break;
-
-  case STRRET_CSTR:
-	strcpyn(buffer, str->UNION_MEMBER(cStr), len);
- }
-}
-
-static HRESULT path_from_pidlA(IShellFolder* folder, LPITEMIDLIST pidl, LPSTR buffer, int len)
-{
-	STRRET str;
-
-	 /* SHGDN_FORPARSING: get full path of id list */
-	HRESULT hr = IShellFolder_GetDisplayNameOf(folder, pidl, SHGDN_FORPARSING, &str);
-
-	if (SUCCEEDED(hr)) {
-		get_strretA(&str, &pidl->mkid, buffer, len);
-		free_strret(&str);
-	} else
-		buffer[0] = '\0';
-
-	return hr;
-}
-
-#endif
 
 static LPWSTR wcscpyn(LPWSTR dest, LPCWSTR source, size_t count)
 {
@@ -769,28 +703,11 @@
 }
 
 
-static HRESULT name_from_pidl(IShellFolder* folder, LPITEMIDLIST pidl, LPTSTR buffer, int len, SHGDNF flags)
+static HRESULT name_from_pidl(IShellFolder* folder, LPITEMIDLIST pidl, LPWSTR buffer, int len, SHGDNF flags)
 {
 	STRRET str;
 
 	HRESULT hr = IShellFolder_GetDisplayNameOf(folder, pidl, flags, &str);
-
-	if (SUCCEEDED(hr)) {
-		get_strret(&str, &pidl->mkid, buffer, len);
-		free_strret(&str);
-	} else
-		buffer[0] = '\0';
-
-	return hr;
-}
-
-
-static HRESULT path_from_pidlW(IShellFolder* folder, LPITEMIDLIST pidl, LPWSTR buffer, int len)
-{
-	STRRET str;
-
-	 /* SHGDN_FORPARSING: get full path of id list */
-	HRESULT hr = IShellFolder_GetDisplayNameOf(folder, pidl, SHGDN_FORPARSING, &str);
 
 	if (SUCCEEDED(hr)) {
 		get_strretW(&str, &pidl->mkid, buffer, len);
@@ -802,20 +719,31 @@
 }
 
 
+static HRESULT path_from_pidlW(IShellFolder* folder, LPITEMIDLIST pidl, LPWSTR buffer, int len)
+{
+	STRRET str;
+
+	 /* SHGDN_FORPARSING: get full path of id list */
+	HRESULT hr = IShellFolder_GetDisplayNameOf(folder, pidl, SHGDN_FORPARSING, &str);
+
+	if (SUCCEEDED(hr)) {
+		get_strretW(&str, &pidl->mkid, buffer, len);
+		free_strret(&str);
+	} else
+		buffer[0] = '\0';
+
+	return hr;
+}
+
+
  /* create an item id list from a file system path */
 
-static LPITEMIDLIST get_path_pidl(LPTSTR path, HWND hwnd)
+static LPITEMIDLIST get_path_pidl(LPWSTR path, HWND hwnd)
 {
 	LPITEMIDLIST pidl;
 	HRESULT hr;
 	ULONG len;
-
-#ifdef UNICODE
 	LPWSTR buffer = path;
-#else
-	WCHAR buffer[MAX_PATH];
-	MultiByteToWideChar(CP_ACP, 0, path, -1, buffer, MAX_PATH);
-#endif
 
 	hr = IShellFolder_ParseDisplayName(Globals.iDesktop, hwnd, NULL, buffer, &len, &pidl, NULL);
 	if (FAILED(hr))
@@ -839,7 +767,7 @@
 
 		return idl;
 	} else if (entry->etype == ET_WINDOWS) {
-		TCHAR path[MAX_PATH];
+		WCHAR path[MAX_PATH];
 
 		get_path(entry, path);
 
@@ -853,10 +781,10 @@
 
 static HICON extract_icon(IShellFolder* folder, LPCITEMIDLIST pidl)
 {
-	IExtractIcon* pExtract;
-
-	if (SUCCEEDED(IShellFolder_GetUIObjectOf(folder, 0, 1, (LPCITEMIDLIST*)&pidl, &IID_IExtractIcon, 0, (LPVOID*)&pExtract))) {
-		TCHAR path[_MAX_PATH];
+	IExtractIconW* pExtract;
+
+	if (SUCCEEDED(IShellFolder_GetUIObjectOf(folder, 0, 1, (LPCITEMIDLIST*)&pidl, &IID_IExtractIconW, 0, (LPVOID*)&pExtract))) {
+		WCHAR path[_MAX_PATH];
 		unsigned flags;
 		HICON hicon;
 		int idx;
@@ -866,7 +794,7 @@
 				if (idx == -1)
 					idx = 0;	/* special case for some control panel applications */
 
-				if ((int)ExtractIconEx(path, idx, 0, &hicon, 1) > 0)
+				if ((int)ExtractIconExW(path, idx, 0, &hicon, 1) > 0)
 					flags &= ~GIL_DONTCACHE;
 			} else {
 				HICON hIconLarge = 0;
@@ -907,7 +835,7 @@
 	IShellFolder* child = NULL;
 	HRESULT hr;
 
-	HCURSOR old_cursor = SetCursor(LoadCursor(0, IDC_WAIT));
+	HCURSOR old_cursor = SetCursor(LoadCursorW(0, (LPCWSTR)IDC_WAIT));
 
 #ifndef _NO_EXTENSIONS
 	entry->etype = ET_SHELL;
@@ -953,10 +881,10 @@
 }
 
 
-static void fill_w32fdata_shell(IShellFolder* folder, LPCITEMIDLIST pidl, SFGAOF attribs, WIN32_FIND_DATA* w32fdata)
+static void fill_w32fdata_shell(IShellFolder* folder, LPCITEMIDLIST pidl, SFGAOF attribs, WIN32_FIND_DATAW* w32fdata)
 {
 	if (!(attribs & SFGAO_FILESYSTEM) ||
-		  FAILED(SHGetDataFromIDList(folder, pidl, SHGDFIL_FINDDATA, w32fdata, sizeof(WIN32_FIND_DATA)))) {
+			FAILED(SHGetDataFromIDListW(folder, pidl, SHGDFIL_FINDDATA, w32fdata, sizeof(WIN32_FIND_DATAW)))) {
 		WIN32_FILE_ATTRIBUTE_DATA fad;
 		IDataObject* pDataObj;
 
@@ -971,10 +899,10 @@
 			IDataObject_Release(pDataObj);
 
 			if (SUCCEEDED(hr)) {
-				LPCTSTR path = (LPCTSTR)GlobalLock(medium.UNION_MEMBER(hGlobal));
+				LPCWSTR path = GlobalLock(medium.UNION_MEMBER(hGlobal));
 				UINT sem_org = SetErrorMode(SEM_FAILCRITICALERRORS);
 
-				if (GetFileAttributesEx(path, GetFileExInfoStandard, &fad)) {
+				if (GetFileAttributesExW(path, GetFileExInfoStandard, &fad)) {
 					w32fdata->dwFileAttributes = fad.dwFileAttributes;
 					w32fdata->ftCreationTime = fad.ftCreationTime;
 					w32fdata->ftLastAccessTime = fad.ftLastAccessTime;
@@ -1049,7 +977,7 @@
 				if (last)
 					last->next = entry;
 
-				memset(&entry->data, 0, sizeof(WIN32_FIND_DATA));
+				memset(&entry->data, 0, sizeof(WIN32_FIND_DATAW));
 				entry->bhfi_valid = FALSE;
 
 				attribs = ~SFGAO_FILESYSTEM;	/*SFGAO_HASSUBFOLDER|SFGAO_FOLDER; SFGAO_FILESYSTEM sorgt dafür, daß "My Documents" anstatt von "Martin's Documents" angezeigt wird */
@@ -1129,7 +1057,7 @@
 };
 
 /* distinguish between ".", ".." and any other directory names */
-static int TypeOrderFromDirname(LPCTSTR name)
+static int TypeOrderFromDirname(LPCWSTR name)
 {
 	if (name[0] == '.') {
 		if (name[1] == '\0')
@@ -1143,7 +1071,7 @@
 }
 
 /* directories first... */
-static int compareType(const WIN32_FIND_DATA* fd1, const WIN32_FIND_DATA* fd2)
+static int compareType(const WIN32_FIND_DATAW* fd1, const WIN32_FIND_DATAW* fd2)
 {
 	int order1 = fd1->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY? TO_DIR: TO_FILE;
 	int order2 = fd2->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY? TO_DIR: TO_FILE;
@@ -1160,21 +1088,21 @@
 
 static int compareName(const void* arg1, const void* arg2)
 {
-	const WIN32_FIND_DATA* fd1 = &(*(const Entry* const*)arg1)->data;
-	const WIN32_FIND_DATA* fd2 = &(*(const Entry* const*)arg2)->data;
+	const WIN32_FIND_DATAW* fd1 = &(*(const Entry* const*)arg1)->data;
+	const WIN32_FIND_DATAW* fd2 = &(*(const Entry* const*)arg2)->data;
 
 	int cmp = compareType(fd1, fd2);
 	if (cmp)
 		return cmp;
 
-	return lstrcmpi(fd1->cFileName, fd2->cFileName);
+	return lstrcmpiW(fd1->cFileName, fd2->cFileName);
 }
 
 static int compareExt(const void* arg1, const void* arg2)
 {
-	const WIN32_FIND_DATA* fd1 = &(*(const Entry* const*)arg1)->data;
-	const WIN32_FIND_DATA* fd2 = &(*(const Entry* const*)arg2)->data;
-	const TCHAR *name1, *name2, *ext1, *ext2;
+	const WIN32_FIND_DATAW* fd1 = &(*(const Entry* const*)arg1)->data;
+	const WIN32_FIND_DATAW* fd2 = &(*(const Entry* const*)arg2)->data;
+	const WCHAR *name1, *name2, *ext1, *ext2;
 
 	int cmp = compareType(fd1, fd2);
 	if (cmp)
@@ -1196,17 +1124,17 @@
 	else
 		ext2 = sEmpty;
 
-	cmp = lstrcmpi(ext1, ext2);
+	cmp = lstrcmpiW(ext1, ext2);
 	if (cmp)
 		return cmp;
 
-	return lstrcmpi(name1, name2);
+	return lstrcmpiW(name1, name2);
 }
 
 static int compareSize(const void* arg1, const void* arg2)
 {
-	const WIN32_FIND_DATA* fd1 = &(*(const Entry* const*)arg1)->data;
-	const WIN32_FIND_DATA* fd2 = &(*(const Entry* const*)arg2)->data;
+	const WIN32_FIND_DATAW* fd1 = &(*(const Entry* const*)arg1)->data;
+	const WIN32_FIND_DATAW* fd2 = &(*(const Entry* const*)arg2)->data;
 
 	int cmp = compareType(fd1, fd2);
 	if (cmp)
@@ -1226,8 +1154,8 @@
 
 static int compareDate(const void* arg1, const void* arg2)
 {
-	const WIN32_FIND_DATA* fd1 = &(*(const Entry* const*)arg1)->data;
-	const WIN32_FIND_DATA* fd2 = &(*(const Entry* const*)arg2)->data;
+	const WIN32_FIND_DATAW* fd1 = &(*(const Entry* const*)arg1)->data;
+	const WIN32_FIND_DATAW* fd2 = &(*(const Entry* const*)arg2)->data;
 
 	int cmp = compareType(fd1, fd2);
 	if (cmp)
@@ -1277,12 +1205,12 @@
 }
 
 
-static void read_directory(Entry* dir, LPCTSTR path, SORT_ORDER sortOrder, HWND hwnd)
-{
-	TCHAR buffer[MAX_PATH];
+static void read_directory(Entry* dir, LPCWSTR path, SORT_ORDER sortOrder, HWND hwnd)
+{
+	WCHAR buffer[MAX_PATH];
 	Entry* entry;
-	LPCTSTR s;
-	PTSTR d;
+	LPCWSTR s;
+	PWSTR d;
 
 #ifdef _SHELL_FOLDERS
 	if (dir->etype == ET_SHELL)
@@ -1323,7 +1251,7 @@
 
 			for(entry=dir->down; entry; entry=entry->next)
 				if (entry->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
-					lstrcpy(d, entry->data.cFileName);
+					lstrcpyW(d, entry->data.cFileName);
 					read_directory_unix(entry, buffer);
 					SortDirectory(entry, sortOrder);
 				}
@@ -1345,7 +1273,7 @@
 
 			for(entry=dir->down; entry; entry=entry->next)
 				if (entry->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
-					lstrcpy(d, entry->data.cFileName);
+					lstrcpyW(d, entry->data.cFileName);
 					read_directory_win(entry, buffer);
 					SortDirectory(entry, sortOrder);
 				}
@@ -1356,12 +1284,12 @@
 }
 
 
-static Entry* read_tree(Root* root, LPCTSTR path, LPITEMIDLIST pidl, LPTSTR drv, SORT_ORDER sortOrder, HWND hwnd)
+static Entry* read_tree(Root* root, LPCWSTR path, LPITEMIDLIST pidl, LPWSTR drv, SORT_ORDER sortOrder, HWND hwnd)
 {
 #if !defined(_NO_EXTENSIONS) && defined(__WINE__)
-	static const TCHAR sSlash[] = {'/', '\0'};
-#endif
-	static const TCHAR sBackslash[] = {'\\', '\0'};
+	static const WCHAR sSlash[] = {'/', '\0'};
+#endif
+	static const WCHAR sBackslash[] = {'\\', '\0'};
 
 #ifdef _SHELL_FOLDERS
 	if (pidl)
@@ -1381,27 +1309,27 @@
 #if !defined(_NO_EXTENSIONS) && defined(__WINE__)
 	if (*path == '/')
 	{
-		 /* read unix file system tree */
-		root->drive_type = GetDriveType(path);
-
-		lstrcat(drv, sSlash);
+		/* read unix file system tree */
+		root->drive_type = GetDriveTypeW(path);
+
+		lstrcatW(drv, sSlash);
 		load_string(root->volname, sizeof(root->volname)/sizeof(root->volname[0]), IDS_ROOT_FS);
 		root->fs_flags = 0;
 		load_string(root->fs, sizeof(root->fs)/sizeof(root->fs[0]), IDS_UNIXFS);
 
-		lstrcpy(root->path, sSlash);
+		lstrcpyW(root->path, sSlash);
 
 		return read_tree_unix(root, path, sortOrder, hwnd);
 	}
 #endif
 
 	 /* read WIN32 file system tree */
-	root->drive_type = GetDriveType(path);
-
-	lstrcat(drv, sBackslash);
-	GetVolumeInformation(drv, root->volname, _MAX_FNAME, 0, 0, &root->fs_flags, root->fs, _MAX_DIR);
-
-	lstrcpy(root->path, drv);
+       root->drive_type = GetDriveTypeW(path);
+
+	lstrcatW(drv, sBackslash);
+	GetVolumeInformationW(drv, root->volname, _MAX_FNAME, 0, 0, &root->fs_flags, root->fs, _MAX_DIR);
+
+	lstrcpyW(root->path, drv);
 
 	return read_tree_win(root, path, sortOrder, hwnd);
 }
@@ -1418,12 +1346,12 @@
 };
 
 
-static ChildWnd* alloc_child_window(LPCTSTR path, LPITEMIDLIST pidl, HWND hwnd)
-{
-	TCHAR drv[_MAX_DRIVE+1], dir[_MAX_DIR], name[_MAX_FNAME], ext[_MAX_EXT];
-	TCHAR dir_path[MAX_PATH];
-	TCHAR b1[BUFFER_LEN];
-	static const TCHAR sAsterics[] = {'*', '\0'};
+static ChildWnd* alloc_child_window(LPCWSTR path, LPITEMIDLIST pidl, HWND hwnd)
+{
+	WCHAR drv[_MAX_DRIVE+1], dir[_MAX_DIR], name[_MAX_FNAME], ext[_MAX_EXT];
+	WCHAR dir_path[MAX_PATH];
+	WCHAR b1[BUFFER_LEN];
+	static const WCHAR sAsterics[] = {'*', '\0'};
 
 	ChildWnd* child = HeapAlloc(GetProcessHeap(), 0, sizeof(ChildWnd));
 	Root* root = &child->root;
@@ -1456,18 +1384,18 @@
 
 	if (path)
 	{
-		lstrcpy(child->path, path);
-
-		_tsplitpath(path, drv, dir, name, ext);
-	}
-
-	lstrcpy(child->filter_pattern, sAsterics);
+		lstrcpyW(child->path, path);
+
+		_wsplitpath(path, drv, dir, name, ext);
+	}
+
+	lstrcpyW(child->filter_pattern, sAsterics);
 	child->filter_flags = TF_ALL;
 
 	root->entry.level = 0;
 
-	lstrcpy(dir_path, drv);
-	lstrcat(dir_path, dir);
+	lstrcpyW(dir_path, drv);
+	lstrcatW(dir_path, dir);
 	entry = read_tree(root, dir_path, pidl, drv, child->sortOrder, hwnd);
 
 #ifdef _SHELL_FOLDERS
@@ -1475,7 +1403,7 @@
 		load_string(root->entry.data.cFileName, sizeof(root->entry.data.cFileName)/sizeof(root->entry.data.cFileName[0]), IDS_DESKTOP);
 	else
 #endif
-		wsprintf(root->entry.data.cFileName, RS(b1,IDS_TITLEFMT), drv, root->fs);
+		wsprintfW(root->entry.data.cFileName, RS(b1,IDS_TITLEFMT), drv, root->fs);
 
 	root->entry.data.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;
 
@@ -1497,7 +1425,7 @@
 
 
 /* get full path of specified directory entry */
-static void get_path(Entry* dir, PTSTR path)
+static void get_path(Entry* dir, PWSTR path)
 {
 	Entry* entry;
 	int len = 0;
@@ -1519,18 +1447,18 @@
 		if (SUCCEEDED(hr) && (attribs&SFGAO_FILESYSTEM)) {
 			IShellFolder* parent = dir->up? dir->up->folder: Globals.iDesktop;
 
-			hr = path_from_pidl(parent, dir->pidl, path, MAX_PATH);
+			hr = path_from_pidlW(parent, dir->pidl, path, MAX_PATH);
 		}
 	}
 	else
 #endif
 	{
 		for(entry=dir; entry; level++) {
-			LPCTSTR name;
+			LPCWSTR name;
 			int l;
 
 			{
-				LPCTSTR s;
+				LPCWSTR s;
 				name = entry->data.cFileName;
 				s = name;
 
@@ -1540,8 +1468,8 @@
 
 			if (entry->up) {
 				if (l > 0) {
-					memmove(path+l+1, path, len*sizeof(TCHAR));
-					memcpy(path+1, name, l*sizeof(TCHAR));
+					memmove(path+l+1, path, len*sizeof(WCHAR));
+					memcpy(path+1, name, l*sizeof(WCHAR));
 					len += l+1;
 
 #ifndef _NO_EXTENSIONS
@@ -1554,8 +1482,8 @@
 
 				entry = entry->up;
 			} else {
-				memmove(path+l, path, len*sizeof(TCHAR));
-				memcpy(path, name, l*sizeof(TCHAR));
+				memmove(path+l, path, len*sizeof(WCHAR));
+				memcpy(path, name, l*sizeof(WCHAR));
 				len += l;
 				break;
 			}
@@ -1580,7 +1508,7 @@
 	DWORD type;
 	HKEY hKey;
 	windowOptions opts;
-	LOGFONT logfont;
+	LOGFONTW logfont;
 
         RegOpenKeyExW( HKEY_CURRENT_USER, registry_key,
                        0, KEY_QUERY_VALUE, &hKey );
@@ -1605,11 +1533,11 @@
 	size=sizeof(logfont);
 	if( RegQueryValueExW( hKey, reg_logfont, NULL, &type,
                               (LPBYTE) &logfont, &size ) != ERROR_SUCCESS )
-		GetObject(GetStockObject(DEFAULT_GUI_FONT),sizeof(logfont),&logfont);
+		GetObjectW(GetStockObject(DEFAULT_GUI_FONT),sizeof(logfont),&logfont);
 
 	RegCloseKey( hKey );
 
-	Globals.hfont = CreateFontIndirect(&logfont);
+	Globals.hfont = CreateFontIndirectW(&logfont);
 	return opts;
 }
 
@@ -1618,7 +1546,7 @@
 	WINDOWINFO wi;
 	HKEY hKey;
 	INT width, height;
-	LOGFONT logfont;
+	LOGFONTW logfont;
 
 	wi.cbSize = sizeof( WINDOWINFO );
 	GetWindowInfo(Globals.hMainWnd, &wi);
@@ -1646,9 +1574,9 @@
                         (LPBYTE) &width, sizeof(DWORD) );
         RegSetValueExW( hKey, reg_height, 0, REG_DWORD,
                         (LPBYTE) &height, sizeof(DWORD) );
-        GetObject(Globals.hfont, sizeof(logfont), &logfont);
+        GetObjectW(Globals.hfont, sizeof(logfont), &logfont);
         RegSetValueExW( hKey, reg_logfont, 0, REG_BINARY,
-                        (LPBYTE) &logfont, sizeof(LOGFONT) );
+                        (LPBYTE)&logfont, sizeof(LOGFONTW) );
 
 	/* TODO: Save more settings here (List vs. Detailed View, etc.) */
 	RegCloseKey( hKey );
@@ -1660,14 +1588,14 @@
 	RECT rt;
 
 	if (IsWindowVisible(Globals.htoolbar)) {
-		SendMessage(Globals.htoolbar, WM_SIZE, 0, 0);
+		SendMessageW(Globals.htoolbar, WM_SIZE, 0, 0);
 		GetClientRect(Globals.htoolbar, &rt);
 		prect->top = rt.bottom+3;
 		prect->bottom -= rt.bottom+3;
 	}
 
 	if (IsWindowVisible(Globals.hdrivebar)) {
-		SendMessage(Globals.hdrivebar, WM_SIZE, 0, 0);
+		SendMessageW(Globals.hdrivebar, WM_SIZE, 0, 0);
 		GetClientRect(Globals.hdrivebar, &rt);
 		new_top = --prect->top + rt.bottom+3;
 		MoveWindow(Globals.hdrivebar, 0, prect->top, rt.right, new_top, TRUE);
@@ -1678,8 +1606,8 @@
 	if (IsWindowVisible(Globals.hstatusbar)) {
 		int parts[] = {300, 500};
 
-		SendMessage(Globals.hstatusbar, WM_SIZE, 0, 0);
-		SendMessage(Globals.hstatusbar, SB_SETPARTS, 2, (LPARAM)&parts);
+		SendMessageW(Globals.hstatusbar, WM_SIZE, 0, 0);
+		SendMessageW(Globals.hstatusbar, SB_SETPARTS, 2, (LPARAM)&parts);
 		GetClientRect(Globals.hstatusbar, &rt);
 		prect->bottom -= rt.bottom;
 	}
@@ -1719,7 +1647,7 @@
 		newchild = NULL;
 
 		child->hwnd = (HWND) wparam;
-		SetWindowLongPtr(child->hwnd, GWLP_USERDATA, (LPARAM)child);
+		SetWindowLongPtrW(child->hwnd, GWLP_USERDATA, (LPARAM)child);
 	}
 
 	return CallNextHookEx(hcbthook, code, wparam, lparam);
@@ -1727,11 +1655,11 @@
 
 static HWND create_child_window(ChildWnd* child)
 {
-	MDICREATESTRUCT mcs;
+	MDICREATESTRUCTW mcs;
 	int idx;
 
 	mcs.szClass = sWINEFILETREE;
-	mcs.szTitle = (LPTSTR)child->path;
+	mcs.szTitle = child->path;
 	mcs.hOwner  = Globals.hInstance;
 	mcs.x       = child->pos.rcNormalPosition.left;
 	mcs.y       = child->pos.rcNormalPosition.top;
@@ -1740,10 +1668,10 @@
 	mcs.style   = 0;
 	mcs.lParam  = 0;
 
-	hcbthook = SetWindowsHookEx(WH_CBT, CBTProc, 0, GetCurrentThreadId());
+	hcbthook = SetWindowsHookExW(WH_CBT, CBTProc, 0, GetCurrentThreadId());
 
 	newchild = child;
-	child->hwnd = (HWND) SendMessage(Globals.hmdiclient, WM_MDICREATE, 0, (LPARAM)&mcs);
+	child->hwnd = (HWND)SendMessageW(Globals.hmdiclient, WM_MDICREATE, 0, (LPARAM)&mcs);
 	if (!child->hwnd) {
 		UnhookWindowsHookEx(hcbthook);
 		return 0;
@@ -1751,18 +1679,18 @@
 
 	UnhookWindowsHookEx(hcbthook);
 
-	SendMessage(child->left.hwnd, LB_SETITEMHEIGHT, 1, max(Globals.spaceSize.cy,IMAGE_HEIGHT+3));
-	SendMessage(child->right.hwnd, LB_SETITEMHEIGHT, 1, max(Globals.spaceSize.cy,IMAGE_HEIGHT+3));
-
-	idx = SendMessage(child->left.hwnd, LB_FINDSTRING, 0, (LPARAM)child->left.cur);
-	SendMessage(child->left.hwnd, LB_SETCURSEL, idx, 0);
+	SendMessageW(child->left.hwnd, LB_SETITEMHEIGHT, 1, max(Globals.spaceSize.cy,IMAGE_HEIGHT+3));
+	SendMessageW(child->right.hwnd, LB_SETITEMHEIGHT, 1, max(Globals.spaceSize.cy,IMAGE_HEIGHT+3));
+
+	idx = SendMessageW(child->left.hwnd, LB_FINDSTRING, 0, (LPARAM)child->left.cur);
+	SendMessageW(child->left.hwnd, LB_SETCURSEL, idx, 0);
 
 	return child->hwnd;
 }
 
 
 struct ExecuteDialog {
-	TCHAR	cmd[MAX_PATH];
+	WCHAR	cmd[MAX_PATH];
 	int		cmdshow;
 };
 
@@ -1779,7 +1707,7 @@
 			int id = (int)wparam;
 
 			if (id == IDOK) {
-				GetWindowText(GetDlgItem(hwnd, 201), dlg->cmd, MAX_PATH);
+				GetWindowTextW(GetDlgItem(hwnd, 201), dlg->cmd, MAX_PATH);
 				dlg->cmdshow = get_check(hwnd,214) ? SW_SHOWMINIMIZED : SW_SHOWNORMAL;
 				EndDialog(hwnd, id);
 			} else if (id == IDCANCEL)
@@ -1794,12 +1722,12 @@
 
 static INT_PTR CALLBACK DestinationDlgProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
 {
-	TCHAR b1[BUFFER_LEN], b2[BUFFER_LEN];
+	WCHAR b1[BUFFER_LEN], b2[BUFFER_LEN];
 
 	switch(nmsg) {
 		case WM_INITDIALOG:
-			SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam);
-			SetWindowText(GetDlgItem(hwnd, 201), (LPCTSTR)lparam);
+			SetWindowLongPtrW(hwnd, GWLP_USERDATA, lparam);
+			SetWindowTextW(GetDlgItem(hwnd, 201), (LPCWSTR)lparam);
 			return 1;
 
 		case WM_COMMAND: {
@@ -1807,8 +1735,8 @@
 
 			switch(id) {
 			  case IDOK: {
-				LPTSTR dest = (LPTSTR) GetWindowLongPtr(hwnd, GWLP_USERDATA);
-				GetWindowText(GetDlgItem(hwnd, 201), dest, MAX_PATH);
+				LPWSTR dest = (LPWSTR)GetWindowLongPtrW(hwnd, GWLP_USERDATA);
+				GetWindowTextW(GetDlgItem(hwnd, 201), dest, MAX_PATH);
 				EndDialog(hwnd, id);
 				break;}
 
@@ -1817,7 +1745,7 @@
 				break;
 
 			  case 254:
-				MessageBox(hwnd, RS(b1,IDS_NO_IMPL), RS(b2,IDS_WINEFILE), MB_OK);
+				MessageBoxW(hwnd, RS(b1,IDS_NO_IMPL), RS(b2,IDS_WINEFILE), MB_OK);
 				break;
 			}
 
@@ -1830,7 +1758,7 @@
 
 
 struct FilterDialog {
-	TCHAR	pattern[MAX_PATH];
+	WCHAR	pattern[MAX_PATH];
 	int		flags;
 };
 
@@ -1841,7 +1769,7 @@
 	switch(nmsg) {
 		case WM_INITDIALOG:
 			dlg = (struct FilterDialog*) lparam;
-			SetWindowText(GetDlgItem(hwnd, IDC_VIEW_PATTERN), dlg->pattern);
+			SetWindowTextW(GetDlgItem(hwnd, IDC_VIEW_PATTERN), dlg->pattern);
 			set_check(hwnd, IDC_VIEW_TYPE_DIRECTORIES, dlg->flags&TF_DIRECTORIES);
 			set_check(hwnd, IDC_VIEW_TYPE_PROGRAMS, dlg->flags&TF_PROGRAMS);
 			set_check(hwnd, IDC_VIEW_TYPE_DOCUMENTS, dlg->flags&TF_DOCUMENTS);
@@ -1855,7 +1783,7 @@
 			if (id == IDOK) {
 				int flags = 0;
 
-				GetWindowText(GetDlgItem(hwnd, IDC_VIEW_PATTERN), dlg->pattern, MAX_PATH);
+				GetWindowTextW(GetDlgItem(hwnd, IDC_VIEW_PATTERN), dlg->pattern, MAX_PATH);
 
 				flags |= get_check(hwnd, IDC_VIEW_TYPE_DIRECTORIES) ? TF_DIRECTORIES : 0;
 				flags |= get_check(hwnd, IDC_VIEW_TYPE_PROGRAMS) ? TF_PROGRAMS : 0;
@@ -1877,7 +1805,7 @@
 
 
 struct PropertiesDialog {
-	TCHAR	path[MAX_PATH];
+	WCHAR	path[MAX_PATH];
 	Entry	entry;
 	void*	pVersionData;
 };
@@ -1906,32 +1834,32 @@
 
 static void PropDlg_DisplayValue(HWND hlbox, HWND hedit)
 {
-	int idx = SendMessage(hlbox, LB_GETCURSEL, 0, 0);
+	int idx = SendMessageW(hlbox, LB_GETCURSEL, 0, 0);
 
 	if (idx != LB_ERR) {
-		LPCTSTR pValue = (LPCTSTR) SendMessage(hlbox, LB_GETITEMDATA, idx, 0);
+		LPCWSTR pValue = (LPCWSTR)SendMessageW(hlbox, LB_GETITEMDATA, idx, 0);
 
 		if (pValue)
-			SetWindowText(hedit, pValue);
-	}
-}
-
-static void CheckForFileInfo(struct PropertiesDialog* dlg, HWND hwnd, LPCTSTR strFilename)
-{
-	static TCHAR sBackSlash[] = {'\\','\0'};
-	static TCHAR sTranslation[] = {'\\','V','a','r','F','i','l','e','I','n','f','o','\\','T','r','a','n','s','l','a','t','i','o','n','\0'};
-	static TCHAR sStringFileInfo[] = {'\\','S','t','r','i','n','g','F','i','l','e','I','n','f','o','\\',
+			SetWindowTextW(hedit, pValue);
+	}
+}
+
+static void CheckForFileInfo(struct PropertiesDialog* dlg, HWND hwnd, LPCWSTR strFilename)
+{
+	static WCHAR sBackSlash[] = {'\\','\0'};
+	static 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'};
+	static WCHAR sStringFileInfo[] = {'\\','S','t','r','i','n','g','F','i','l','e','I','n','f','o','\\',
 										'%','0','4','x','%','0','4','x','\\','%','s','\0'};
-	DWORD dwVersionDataLen = GetFileVersionInfoSize(strFilename, NULL);
+	DWORD dwVersionDataLen = GetFileVersionInfoSizeW(strFilename, NULL);
 
 	if (dwVersionDataLen) {
 		dlg->pVersionData = HeapAlloc(GetProcessHeap(), 0, dwVersionDataLen);
 
-		if (GetFileVersionInfo(strFilename, 0, dwVersionDataLen, dlg->pVersionData)) {
+		if (GetFileVersionInfoW(strFilename, 0, dwVersionDataLen, dlg->pVersionData)) {
 			LPVOID pVal;
 			UINT nValLen;
 
-			if (VerQueryValue(dlg->pVersionData, sBackSlash, &pVal, &nValLen)) {
+			if (VerQueryValueW(dlg->pVersionData, sBackSlash, &pVal, &nValLen)) {
 				if (nValLen == sizeof(VS_FIXEDFILEINFO)) {
 					VS_FIXEDFILEINFO* pFixedFileInfo = (VS_FIXEDFILEINFO*)pVal;
 					char buffer[BUFFER_LEN];
@@ -1945,7 +1873,7 @@
 			}
 
 			/* Read the list of languages and code pages. */
-			if (VerQueryValue(dlg->pVersionData, sTranslation, &pVal, &nValLen)) {
+			if (VerQueryValueW(dlg->pVersionData, sTranslation, &pVal, &nValLen)) {
 				struct LANGANDCODEPAGE* pTranslate = (struct LANGANDCODEPAGE*)pVal;
 				struct LANGANDCODEPAGE* pEnd = (struct LANGANDCODEPAGE*)((LPBYTE)pVal+nValLen);
 
@@ -1956,30 +1884,24 @@
 					LPCSTR* p;
 
 					for(p=InfoStrings; *p; ++p) {
-						TCHAR subblock[200];
-#ifdef UNICODE
-						TCHAR infoStr[100];
-#endif
-						LPCTSTR pTxt;
+						WCHAR subblock[200];
+						WCHAR infoStr[100];
+						LPCWSTR pTxt;
 						UINT nValLen;
 
 						LPCSTR pInfoString = *p;
-#ifdef UNICODE
 						MultiByteToWideChar(CP_ACP, 0, pInfoString, -1, infoStr, 100);
-#else
-#define	infoStr pInfoString
-#endif
-						wsprintf(subblock, sStringFileInfo, pTranslate->wLanguage, pTranslate->wCodePage, infoStr);
+						wsprintfW(subblock, sStringFileInfo, pTranslate->wLanguage, pTranslate->wCodePage, infoStr);
 
 						/* Retrieve file description for language and code page */
-						if (VerQueryValue(dlg->pVersionData, subblock, (PVOID)&pTxt, &nValLen)) {
-							int idx = SendMessage(hlbox, LB_ADDSTRING, 0L, (LPARAM)infoStr);
-							SendMessage(hlbox, LB_SETITEMDATA, idx, (LPARAM) pTxt);
+						if (VerQueryValueW(dlg->pVersionData, subblock, (PVOID)&pTxt, &nValLen)) {
+							int idx = SendMessageW(hlbox, LB_ADDSTRING, 0L, (LPARAM)infoStr);
+							SendMessageW(hlbox, LB_SETITEMDATA, idx, (LPARAM)pTxt);
 						}
 					}
 				}
 
-				SendMessage(hlbox, LB_SETCURSEL, 0, 0);
+				SendMessageW(hlbox, LB_SETCURSEL, 0, 0);
 
 				PropDlg_DisplayValue(hlbox, GetDlgItem(hwnd,IDC_LIST_PROP_VERSION_VALUES));
 			}
@@ -1993,26 +1915,26 @@
 
 	switch(nmsg) {
 		case WM_INITDIALOG: {
-			static const TCHAR sByteFmt[] = {'%','s',' ','B','y','t','e','s','\0'};
-			TCHAR b1[BUFFER_LEN], b2[BUFFER_LEN];
-			LPWIN32_FIND_DATA pWFD;
+			static const WCHAR sByteFmt[] = {'%','s',' ','B','y','t','e','s','\0'};
+			WCHAR b1[BUFFER_LEN], b2[BUFFER_LEN];
+			LPWIN32_FIND_DATAW pWFD;
 
 			dlg = (struct PropertiesDialog*) lparam;
-			pWFD = (LPWIN32_FIND_DATA) &dlg->entry.data;
-
-			GetWindowText(hwnd, b1, MAX_PATH);
-			wsprintf(b2, b1, pWFD->cFileName);
-			SetWindowText(hwnd, b2);
+			pWFD = (LPWIN32_FIND_DATAW)&dlg->entry.data;
+
+			GetWindowTextW(hwnd, b1, MAX_PATH);
+			wsprintfW(b2, b1, pWFD->cFileName);
+			SetWindowTextW(hwnd, b2);
 
 			format_date(&pWFD->ftLastWriteTime, b1, COL_DATE|COL_TIME);
-			SetWindowText(GetDlgItem(hwnd, IDC_STATIC_PROP_LASTCHANGE), b1);
+			SetWindowTextW(GetDlgItem(hwnd, IDC_STATIC_PROP_LASTCHANGE), b1);
 
                         format_longlong( b1, ((ULONGLONG)pWFD->nFileSizeHigh << 32) | pWFD->nFileSizeLow );
-			wsprintf(b2, sByteFmt, b1);
-			SetWindowText(GetDlgItem(hwnd, IDC_STATIC_PROP_SIZE), b2);
-
-			SetWindowText(GetDlgItem(hwnd, IDC_STATIC_PROP_FILENAME), pWFD->cFileName);
-			SetWindowText(GetDlgItem(hwnd, IDC_STATIC_PROP_PATH), dlg->path);
+			wsprintfW(b2, sByteFmt, b1);
+			SetWindowTextW(GetDlgItem(hwnd, IDC_STATIC_PROP_SIZE), b2);
+
+			SetWindowTextW(GetDlgItem(hwnd, IDC_STATIC_PROP_FILENAME), pWFD->cFileName);
+			SetWindowTextW(GetDlgItem(hwnd, IDC_STATIC_PROP_PATH), dlg->path);
 
 			set_check(hwnd, IDC_CHECK_READONLY, pWFD->dwFileAttributes&FILE_ATTRIBUTE_READONLY);
 			set_check(hwnd, IDC_CHECK_ARCHIVE, pWFD->dwFileAttributes&FILE_ATTRIBUTE_ARCHIVE);
@@ -2057,7 +1979,7 @@
 	get_path(entry, dlg.path);
 	memcpy(&dlg.entry, entry, sizeof(Entry));
 
-	DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_DIALOG_PROPERTIES), hwnd, PropertiesDialogDlgProc, (LPARAM)&dlg);
+	DialogBoxParamW(Globals.hInstance, MAKEINTRESOURCEW(IDD_DIALOG_PROPERTIES), hwnd, PropertiesDialogDlgProc, (LPARAM)&dlg);
 }
 
 
@@ -2174,22 +2096,22 @@
 	resize_frame_client(hwnd);
 }
 
-static BOOL activate_drive_window(LPCTSTR path)
-{
-	TCHAR drv1[_MAX_DRIVE], drv2[_MAX_DRIVE];
+static BOOL activate_drive_window(LPCWSTR path)
+{
+	WCHAR drv1[_MAX_DRIVE], drv2[_MAX_DRIVE];
 	HWND child_wnd;
 
-	_tsplitpath(path, drv1, 0, 0, 0);
+	_wsplitpath(path, drv1, 0, 0, 0);
 
 	/* search for a already open window for the same drive */
 	for(child_wnd=GetNextWindow(Globals.hmdiclient,GW_CHILD); child_wnd; child_wnd=GetNextWindow(child_wnd, GW_HWNDNEXT)) {
-		ChildWnd* child = (ChildWnd*) GetWindowLongPtr(child_wnd, GWLP_USERDATA);
+		ChildWnd* child = (ChildWnd*)GetWindowLongPtrW(child_wnd, GWLP_USERDATA);
 
 		if (child) {
-			_tsplitpath(child->root.path, drv2, 0, 0, 0);
-
-			if (!lstrcmpi(drv2, drv1)) {
-				SendMessage(Globals.hmdiclient, WM_MDIACTIVATE, (WPARAM)child_wnd, 0);
+			_wsplitpath(child->root.path, drv2, 0, 0, 0);
+
+			if (!lstrcmpiW(drv2, drv1)) {
+				SendMessageW(Globals.hmdiclient, WM_MDIACTIVATE, (WPARAM)child_wnd, 0);
 
 				if (IsIconic(child_wnd))
 					ShowWindow(child_wnd, SW_SHOWNORMAL);
@@ -2202,17 +2124,17 @@
 	return FALSE;
 }
 
-static BOOL activate_fs_window(LPCTSTR filesys)
+static BOOL activate_fs_window(LPCWSTR filesys)
 {
 	HWND child_wnd;
 
 	/* search for a already open window of the given file system name */
 	for(child_wnd=GetNextWindow(Globals.hmdiclient,GW_CHILD); child_wnd; child_wnd=GetNextWindow(child_wnd, GW_HWNDNEXT)) {
-		ChildWnd* child = (ChildWnd*) GetWindowLongPtr(child_wnd, GWLP_USERDATA);
+		ChildWnd* child = (ChildWnd*) GetWindowLongPtrW(child_wnd, GWLP_USERDATA);
 
 		if (child) {
-			if (!lstrcmpi(child->root.fs, filesys)) {
-				SendMessage(Globals.hmdiclient, WM_MDIACTIVATE, (WPARAM)child_wnd, 0);
+			if (!lstrcmpiW(child->root.fs, filesys)) {
+				SendMessageW(Globals.hmdiclient, WM_MDIACTIVATE, (WPARAM)child_wnd, 0);
 
 				if (IsIconic(child_wnd))
 					ShowWindow(child_wnd, SW_SHOWNORMAL);
@@ -2227,7 +2149,7 @@
 
 static LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
 {
-	TCHAR b1[BUFFER_LEN], b2[BUFFER_LEN];
+	WCHAR b1[BUFFER_LEN], b2[BUFFER_LEN];
 
 	switch(nmsg) {
 		case WM_CLOSE:
@@ -2250,23 +2172,23 @@
 			break;
 
 		case WM_INITMENUPOPUP: {
-			HWND hwndClient = (HWND) SendMessage(Globals.hmdiclient, WM_MDIGETACTIVE, 0, 0);
-
-			if (!SendMessage(hwndClient, WM_INITMENUPOPUP, wparam, lparam))
+			HWND hwndClient = (HWND)SendMessageW(Globals.hmdiclient, WM_MDIGETACTIVE, 0, 0);
+
+			if (!SendMessageW(hwndClient, WM_INITMENUPOPUP, wparam, lparam))
 				return 0;
 			break;}
 
 		case WM_COMMAND: {
 			UINT cmd = LOWORD(wparam);
-			HWND hwndClient = (HWND) SendMessage(Globals.hmdiclient, WM_MDIGETACTIVE, 0, 0);
-
-			if (SendMessage(hwndClient, WM_DISPATCH_COMMAND, wparam, lparam))
+			HWND hwndClient = (HWND)SendMessageW(Globals.hmdiclient, WM_MDIGETACTIVE, 0, 0);
+
+			if (SendMessageW(hwndClient, WM_DISPATCH_COMMAND, wparam, lparam))
 				break;
 
 			if (cmd>=ID_DRIVE_FIRST && cmd<=ID_DRIVE_FIRST+0xFF) {
-				TCHAR drv[_MAX_DRIVE], path[MAX_PATH];
+				WCHAR drv[_MAX_DRIVE], path[MAX_PATH];
 				ChildWnd* child;
-				LPCTSTR root = Globals.drives;
+				LPCWSTR root = Globals.drives;
 				int i;
 
 				for(i=cmd-ID_DRIVE_FIRST; i--; root++)
@@ -2276,28 +2198,28 @@
 				if (activate_drive_window(root))
 					return 0;
 
-				_tsplitpath(root, drv, 0, 0, 0);
-
-				if (!SetCurrentDirectory(drv)) {
+				_wsplitpath(root, drv, 0, 0, 0);
+
+				if (!SetCurrentDirectoryW(drv)) {
 					display_error(hwnd, GetLastError());
 					return 0;
 				}
 
-				GetCurrentDirectory(MAX_PATH, path); /*TODO: store last directory per drive */
+				GetCurrentDirectoryW(MAX_PATH, path); /*TODO: store last directory per drive */
 				child = alloc_child_window(path, NULL, hwnd);
 
 				if (!create_child_window(child))
 					HeapFree(GetProcessHeap(), 0, child);
 			} else switch(cmd) {
 				case ID_FILE_EXIT:
-					SendMessage(hwnd, WM_CLOSE, 0, 0);
+					SendMessageW(hwnd, WM_CLOSE, 0, 0);
 					break;
 
 				case ID_WINDOW_NEW: {
-					TCHAR path[MAX_PATH];
+					WCHAR path[MAX_PATH];
 					ChildWnd* child;
 
-					GetCurrentDirectory(MAX_PATH, path);
+					GetCurrentDirectoryW(MAX_PATH, path);
 					child = alloc_child_window(path, NULL, hwnd);
 
 					if (!create_child_window(child))
@@ -2309,19 +2231,19 @@
 					break;
 
 				case ID_WINDOW_CASCADE:
-					SendMessage(Globals.hmdiclient, WM_MDICASCADE, 0, 0);
+					SendMessageW(Globals.hmdiclient, WM_MDICASCADE, 0, 0);
 					break;
 
 				case ID_WINDOW_TILE_HORZ:
-					SendMessage(Globals.hmdiclient, WM_MDITILE, MDITILE_HORIZONTAL, 0);
+					SendMessageW(Globals.hmdiclient, WM_MDITILE, MDITILE_HORIZONTAL, 0);
 					break;
 
 				case ID_WINDOW_TILE_VERT:
-					SendMessage(Globals.hmdiclient, WM_MDITILE, MDITILE_VERTICAL, 0);
+					SendMessageW(Globals.hmdiclient, WM_MDITILE, MDITILE_VERTICAL, 0);
 					break;
 
 				case ID_WINDOW_ARRANGE:
-					SendMessage(Globals.hmdiclient, WM_MDIICONARRANGE, 0, 0);
+					SendMessageW(Globals.hmdiclient, WM_MDIICONARRANGE, 0, 0);
 					break;
 
 				case ID_SELECT_FONT:
@@ -2351,8 +2273,8 @@
 
 					memset(&dlg, 0, sizeof(struct ExecuteDialog));
 
-					if (DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_EXECUTE), hwnd, ExecuteDialogDlgProc, (LPARAM)&dlg) == IDOK) {
-						HINSTANCE hinst = ShellExecute(hwnd, NULL/*operation*/, dlg.cmd/*file*/, NULL/*parameters*/, NULL/*dir*/, dlg.cmdshow);
+					if (DialogBoxParamW(Globals.hInstance, MAKEINTRESOURCEW(IDD_EXECUTE), hwnd, ExecuteDialogDlgProc, (LPARAM)&dlg) == IDOK) {
+						HINSTANCE hinst = ShellExecuteW(hwnd, NULL/*operation*/, dlg.cmd/*file*/, NULL/*parameters*/, NULL/*dir*/, dlg.cmdshow);
 
 						if (PtrToUlong(hinst) <= 32)
 							display_error(hwnd, GetLastError());
@@ -2391,7 +2313,7 @@
 					break;}
 
 				case ID_HELP:
-					WinHelp(hwnd, RS(b1,IDS_WINEFILE), HELP_INDEX, 0);
+					WinHelpW(hwnd, RS(b1,IDS_WINEFILE), HELP_INDEX, 0);
 					break;
 
 #ifndef _NO_EXTENSIONS
@@ -2401,21 +2323,15 @@
 
 #ifdef __WINE__
 				case ID_DRIVE_UNIX_FS: {
-					TCHAR path[MAX_PATH];
-#ifdef UNICODE
+					WCHAR path[MAX_PATH];
 					char cpath[MAX_PATH];
-#endif
 					ChildWnd* child;
 
 					if (activate_fs_window(RS(b1,IDS_UNIXFS)))
 						break;
 
-#ifdef UNICODE
 					getcwd(cpath, MAX_PATH);
 					MultiByteToWideChar(CP_UNIXCP, 0, cpath, -1, path, MAX_PATH);
-#else
-					getcwd(path, MAX_PATH);
-#endif
 					child = alloc_child_window(path, NULL, hwnd);
 
 					if (!create_child_window(child))
@@ -2424,13 +2340,13 @@
 #endif
 #ifdef _SHELL_FOLDERS
 				case ID_DRIVE_SHELL_NS: {
-					TCHAR path[MAX_PATH];
+					WCHAR path[MAX_PATH];
 					ChildWnd* child;
 
 					if (activate_fs_window(RS(b1,IDS_SHELL)))
 						break;
 
-					GetCurrentDirectory(MAX_PATH, path);
+					GetCurrentDirectoryW(MAX_PATH, path);
 					child = alloc_child_window(path, get_path_pidl(path,hwnd), hwnd);
 
 					if (!create_child_window(child))
@@ -2442,8 +2358,8 @@
 				/*TODO: There are even more menu items! */
 
 				case ID_ABOUT:
-                                        ShellAbout(hwnd, RS(b1,IDS_WINEFILE), NULL,
-                                                   LoadImage( Globals.hInstance, MAKEINTRESOURCE(IDI_WINEFILE),
+                                        ShellAboutW(hwnd, RS(b1,IDS_WINEFILE), NULL,
+                                                   LoadImageW( Globals.hInstance, MAKEINTRESOURCEW(IDI_WINEFILE),
                                                               IMAGE_ICON, 48, 48, LR_SHARED ));
 					break;
 
@@ -2452,18 +2368,18 @@
 						STRING_SelectLanguageByNumber(wParam - PM_FIRST_LANGUAGE);
 					else */if ((cmd<IDW_FIRST_CHILD || cmd>=IDW_FIRST_CHILD+0x100) &&
 						(cmd<SC_SIZE || cmd>SC_RESTORE))
-						MessageBox(hwnd, RS(b2,IDS_NO_IMPL), RS(b1,IDS_WINEFILE), MB_OK);
-
-					return DefFrameProc(hwnd, Globals.hmdiclient, nmsg, wparam, lparam);
+						MessageBoxW(hwnd, RS(b2,IDS_NO_IMPL), RS(b1,IDS_WINEFILE), MB_OK);
+
+					return DefFrameProcW(hwnd, Globals.hmdiclient, nmsg, wparam, lparam);
 			}
 			break;}
 
 		case WM_SIZE:
 			resize_frame(hwnd, LOWORD(lparam), HIWORD(lparam));
-			break;	/* do not pass message to DefFrameProc */
+			break;	/* do not pass message to DefFrameProcW */
 
 		case WM_DEVICECHANGE:
-			SendMessage(hwnd, WM_COMMAND, MAKELONG(ID_REFRESH,0), 0);
+			SendMessageW(hwnd, WM_COMMAND, MAKELONG(ID_REFRESH,0), 0);
 			break;
 
 #ifndef _NO_EXTENSIONS
@@ -2480,14 +2396,14 @@
 #endif /* _NO_EXTENSIONS */
 
 		default:
-			return DefFrameProc(hwnd, Globals.hmdiclient, nmsg, wparam, lparam);
+			return DefFrameProcW(hwnd, Globals.hmdiclient, nmsg, wparam, lparam);
 	}
 
 	return 0;
 }
 
 
-static TCHAR g_pos_names[COLUMNS][20] = {
+static WCHAR g_pos_names[COLUMNS][20] = {
 	{'\0'}	/* symbol */
 };
 
@@ -2528,7 +2444,7 @@
 		hdl.prc   = &rt;
 		hdl.pwpos = &wp;
 
-		SendMessage(child->left.hwndHeader, HDM_LAYOUT, 0, (LPARAM)&hdl);
+		SendMessageW(child->left.hwndHeader, HDM_LAYOUT, 0, (LPARAM)&hdl);
 
 		DeferWindowPos(hdwp, child->left.hwndHeader, wp.hwndInsertAfter,
 						wp.x-1, wp.y, child->split_pos-SPLIT_WIDTH/2+1, wp.cy, wp.flags);
@@ -2548,15 +2464,15 @@
 
 static HWND create_header(HWND parent, Pane* pane, UINT id)
 {
-	HD_ITEM hdi;
+	HDITEMW hdi;
 	int idx;
 
-	HWND hwnd = CreateWindow(WC_HEADER, 0, WS_CHILD|WS_VISIBLE|HDS_HORZ|HDS_FULLDRAG/*TODO: |HDS_BUTTONS + sort orders*/,
+	HWND hwnd = CreateWindowW(WC_HEADERW, 0, WS_CHILD|WS_VISIBLE|HDS_HORZ|HDS_FULLDRAG/*TODO: |HDS_BUTTONS + sort orders*/,
                                  0, 0, 0, 0, parent, (HMENU)ULongToHandle(id), Globals.hInstance, 0);
 	if (!hwnd)
 		return 0;
 
-	SendMessage(hwnd, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), FALSE);
+	SendMessageW(hwnd, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), FALSE);
 
 	hdi.mask = HDI_TEXT|HDI_WIDTH|HDI_FORMAT;
 
@@ -2564,7 +2480,7 @@
 		hdi.pszText = g_pos_names[idx];
 		hdi.fmt = HDF_STRING | g_pos_align[idx];
 		hdi.cxy = pane->widths[idx];
-		SendMessage(hwnd, HDM_INSERTITEM, idx, (LPARAM) &hdi);
+		SendMessageW(hwnd, HDM_INSERTITEMW, idx, (LPARAM)&hdi);
 	}
 
 	return hwnd;
@@ -2599,7 +2515,7 @@
 static BOOL calc_widths(Pane* pane, BOOL anyway)
 {
 	int col, x, cx, spc=3*Globals.spaceSize.cx;
-	int entries = SendMessage(pane->hwnd, LB_GETCOUNT, 0, 0);
+	int entries = SendMessageW(pane->hwnd, LB_GETCOUNT, 0, 0);
 	int orgWidths[COLUMNS];
 	int orgPositions[COLUMNS+1];
 	HFONT hfontOld;
@@ -2618,7 +2534,7 @@
 	hfontOld = SelectObject(hdc, Globals.hfont);
 
 	for(cnt=0; cnt<entries; cnt++) {
-		Entry* entry = (Entry*) SendMessage(pane->hwnd, LB_GETITEMDATA, cnt, 0);
+		Entry* entry = (Entry*)SendMessageW(pane->hwnd, LB_GETITEMDATA, cnt, 0);
 
 		DRAWITEMSTRUCT dis;
 
@@ -2660,7 +2576,7 @@
 
 	pane->positions[COLUMNS] = x;
 
-	SendMessage(pane->hwnd, LB_SETHORIZONTALEXTENT, x, 0);
+	SendMessageW(pane->hwnd, LB_SETHORIZONTALEXTENT, x, 0);
 
 	/* no change? */
 	if (!anyway && !memcmp(orgWidths, pane->widths, sizeof(orgWidths)))
@@ -2687,7 +2603,7 @@
 {
 	HFONT hfontOld;
 	int x, cx;
-	int entries = SendMessage(pane->hwnd, LB_GETCOUNT, 0, 0);
+	int entries = SendMessageW(pane->hwnd, LB_GETCOUNT, 0, 0);
 	int cnt;
 	HDC hdc;
 
@@ -2697,7 +2613,7 @@
 	hfontOld = SelectObject(hdc, Globals.hfont);
 
 	for(cnt=0; cnt<entries; cnt++) {
-		Entry* entry = (Entry*) SendMessage(pane->hwnd, LB_GETITEMDATA, cnt, 0);
+		Entry* entry = (Entry*)SendMessageW(pane->hwnd, LB_GETITEMDATA, cnt, 0);
 		DRAWITEMSTRUCT dis;
 
 		dis.CtlType		  = 0;
@@ -2737,11 +2653,11 @@
 		x += pane->widths[col];
 	}
 
-	SendMessage(pane->hwnd, LB_SETHORIZONTALEXTENT, x, 0);
-}
-
-
-static BOOL pattern_match(LPCTSTR str, LPCTSTR pattern)
+	SendMessageW(pane->hwnd, LB_SETHORIZONTALEXTENT, x, 0);
+}
+
+
+static BOOL pattern_match(LPCWSTR str, LPCWSTR pattern)
 {
 	for( ; *str&&*pattern; str++,pattern++) {
 		if (*pattern == '*') {
@@ -2768,14 +2684,14 @@
 	return TRUE;
 }
 
-static BOOL pattern_imatch(LPCTSTR str, LPCTSTR pattern)
-{
-	TCHAR b1[BUFFER_LEN], b2[BUFFER_LEN];
-
-	lstrcpy(b1, str);
-	lstrcpy(b2, pattern);
-	CharUpper(b1);
-	CharUpper(b2);
+static BOOL pattern_imatch(LPCWSTR str, LPCWSTR pattern)
+{
+	WCHAR b1[BUFFER_LEN], b2[BUFFER_LEN];
+
+	lstrcpyW(b1, str);
+	lstrcpyW(b2, pattern);
+	CharUpperW(b1);
+	CharUpperW(b2);
 
 	return pattern_match(b1, b2);
 }
@@ -2787,12 +2703,12 @@
 	FT_DOCUMENT		= 2
 };
 
-static enum FILE_TYPE get_file_type(LPCTSTR filename);
+static enum FILE_TYPE get_file_type(LPCWSTR filename);
 
 
 /* insert listbox entries after index idx */
 
-static int insert_entries(Pane* pane, Entry* dir, LPCTSTR pattern, int filter_flags, int idx)
+static int insert_entries(Pane* pane, Entry* dir, LPCWSTR pattern, int filter_flags, int idx)
 {
 	Entry* entry = dir;
 
@@ -2852,7 +2768,7 @@
 		if (idx != -1)
 			idx++;
 
-		SendMessage(pane->hwnd, LB_INSERTSTRING, idx, (LPARAM) entry);
+		SendMessageW(pane->hwnd, LB_INSERTSTRING, idx, (LPARAM)entry);
 
 		if (pane->treePane && entry->expanded)
 			idx = insert_entries(pane, entry->down, pattern, filter_flags, idx);
@@ -2864,12 +2780,12 @@
 }
 
 
-static void format_bytes(LPTSTR buffer, LONGLONG bytes)
-{
-	static const TCHAR sFmtGB[] = {'%', '.', '1', 'f', ' ', 'G', 'B', '\0'};
-	static const TCHAR sFmtMB[] = {'%', '.', '1', 'f', ' ', 'M', 'B', '\0'};
-	static const TCHAR sFmtkB[] = {'%', '.', '1', 'f', ' ', 'k', 'B', '\0'};
-	static const TCHAR sFmtB[]  = {'%', 'u', 0};
+static void format_bytes(LPWSTR buffer, LONGLONG bytes)
+{
+	static const WCHAR sFmtGB[] = {'%', '.', '1', 'f', ' ', 'G', 'B', '\0'};
+	static const WCHAR sFmtMB[] = {'%', '.', '1', 'f', ' ', 'M', 'B', '\0'};
+	static const WCHAR sFmtkB[] = {'%', '.', '1', 'f', ' ', 'k', 'B', '\0'};
+	static const WCHAR sFmtB[]  = {'%', 'u', 0};
 
 	float fBytes = (float)bytes;
 
@@ -2886,36 +2802,36 @@
 static void set_space_status(void)
 {
 	ULARGE_INTEGER ulFreeBytesToCaller, ulTotalBytes, ulFreeBytes;
-	TCHAR fmt[64], b1[64], b2[64], buffer[BUFFER_LEN];
-
-	if (GetDiskFreeSpaceEx(NULL, &ulFreeBytesToCaller, &ulTotalBytes, &ulFreeBytes)) {
+	WCHAR fmt[64], b1[64], b2[64], buffer[BUFFER_LEN];
+
+	if (GetDiskFreeSpaceExW(NULL, &ulFreeBytesToCaller, &ulTotalBytes, &ulFreeBytes)) {
 		format_bytes(b1, ulFreeBytesToCaller.QuadPart);
 		format_bytes(b2, ulTotalBytes.QuadPart);
-		wsprintf(buffer, RS(fmt,IDS_FREE_SPACE_FMT), b1, b2);
+		wsprintfW(buffer, RS(fmt,IDS_FREE_SPACE_FMT), b1, b2);
 	} else
-		lstrcpy(buffer, sQMarks);
-
-	SendMessage(Globals.hstatusbar, SB_SETTEXT, 0, (LPARAM)buffer);
+		lstrcpyW(buffer, sQMarks);
+
+	SendMessageW(Globals.hstatusbar, SB_SETTEXTW, 0, (LPARAM)buffer);
 }
 
 
 static WNDPROC g_orgTreeWndProc;
 
-static void create_tree_window(HWND parent, Pane* pane, UINT id, UINT id_header, LPCTSTR pattern, int filter_flags)
-{
-	static const TCHAR sListBox[] = {'L','i','s','t','B','o','x','\0'};
+static void create_tree_window(HWND parent, Pane* pane, UINT id, UINT id_header, LPCWSTR pattern, int filter_flags)
+{
+	static const WCHAR sListBox[] = {'L','i','s','t','B','o','x','\0'};
 
 	static int s_init = 0;
 	Entry* entry = pane->root;
 
-	pane->hwnd = CreateWindow(sListBox, sEmpty, WS_CHILD|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL|
+	pane->hwnd = CreateWindowW(sListBox, sEmpty, WS_CHILD|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL|
                                   LBS_DISABLENOSCROLL|LBS_NOINTEGRALHEIGHT|LBS_OWNERDRAWFIXED|LBS_NOTIFY,
                                   0, 0, 0, 0, parent, (HMENU)ULongToHandle(id), Globals.hInstance, 0);
 
-	SetWindowLongPtr(pane->hwnd, GWLP_USERDATA, (LPARAM)pane);
-	g_orgTreeWndProc = (WNDPROC) SetWindowLongPtr(pane->hwnd, GWLP_WNDPROC, (LPARAM)TreeWndProc);
-
-	SendMessage(pane->hwnd, WM_SETFONT, (WPARAM)Globals.hfont, FALSE);
+	SetWindowLongPtrW(pane->hwnd, GWLP_USERDATA, (LPARAM)pane);
+	g_orgTreeWndProc = (WNDPROC)SetWindowLongPtrW(pane->hwnd, GWLP_WNDPROC, (LPARAM)TreeWndProc);
+
+	SendMessageW(pane->hwnd, WM_SETFONT, (WPARAM)Globals.hfont, FALSE);
 
 	/* insert entries into listbox */
 	if (entry)
@@ -2942,7 +2858,7 @@
 }
 
 
-static void format_date(const FILETIME* ft, TCHAR* buffer, int visible_cols)
+static void format_date(const FILETIME* ft, WCHAR* buffer, int visible_cols)
 {
 	SYSTEMTIME systime;
 	FILETIME lft;
@@ -2954,13 +2870,13 @@
 		return;
 
 	if (!FileTimeToLocalFileTime(ft, &lft))
-		{err: lstrcpy(buffer,sQMarks); return;}
+		{err: lstrcpyW(buffer,sQMarks); return;}
 
 	if (!FileTimeToSystemTime(&lft, &systime))
 		goto err;
 
 	if (visible_cols & COL_DATE) {
-		len = GetDateFormat(LOCALE_USER_DEFAULT, 0, &systime, 0, buffer, BUFFER_LEN);
+		len = GetDateFormatW(LOCALE_USER_DEFAULT, 0, &systime, 0, buffer, BUFFER_LEN);
 		if (!len)
 			goto err;
 	}
@@ -2971,30 +2887,30 @@
 
 		buffer[len++] = ' ';
 
-		if (!GetTimeFormat(LOCALE_USER_DEFAULT, 0, &systime, 0, buffer+len, BUFFER_LEN-len))
+		if (!GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &systime, 0, buffer+len, BUFFER_LEN-len))
 			buffer[len] = '\0';
 	}
 }
 
 
-static void calc_width(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCTSTR str)
+static void calc_width(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCWSTR str)
 {
 	RECT rt = {0, 0, 0, 0};
 
-	DrawText(dis->hDC, str, -1, &rt, DT_CALCRECT|DT_SINGLELINE|DT_NOPREFIX);
+	DrawTextW(dis->hDC, str, -1, &rt, DT_CALCRECT|DT_SINGLELINE|DT_NOPREFIX);
 
 	if (rt.right > pane->widths[col])
 		pane->widths[col] = rt.right;
 }
 
-static void calc_tabbed_width(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCTSTR str)
+static void calc_tabbed_width(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCWSTR str)
 {
 	RECT rt = {0, 0, 0, 0};
 
 /*	DRAWTEXTPARAMS dtp = {sizeof(DRAWTEXTPARAMS), 2};
-	DrawTextEx(dis->hDC, (LPTSTR)str, -1, &rt, DT_CALCRECT|DT_SINGLELINE|DT_NOPREFIX|DT_EXPANDTABS|DT_TABSTOP, &dtp);*/
-
-	DrawText(dis->hDC, str, -1, &rt, DT_CALCRECT|DT_SINGLELINE|DT_EXPANDTABS|DT_TABSTOP|(2<<8));
+	DrawTextExW(dis->hDC, (LPWSTR)str, -1, &rt, DT_CALCRECT|DT_SINGLELINE|DT_NOPREFIX|DT_EXPANDTABS|DT_TABSTOP, &dtp);*/
+
+	DrawTextW(dis->hDC, str, -1, &rt, DT_CALCRECT|DT_SINGLELINE|DT_EXPANDTABS|DT_TABSTOP|(2<<8));
 	/*FIXME rt (0,0) ??? */
 
 	if (rt.right > pane->widths[col])
@@ -3002,7 +2918,7 @@
 }
 
 
-static void output_text(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCTSTR str, DWORD flags)
+static void output_text(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCWSTR str, DWORD flags)
 {
 	int x = dis->rcItem.left;
 	RECT rt;
@@ -3012,10 +2928,10 @@
 	rt.right  = x+pane->positions[col+1]-Globals.spaceSize.cx;
 	rt.bottom = dis->rcItem.bottom;
 
-	DrawText(dis->hDC, str, -1, &rt, DT_SINGLELINE|DT_NOPREFIX|flags);
-}
-
-static void output_tabbed_text(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCTSTR str)
+	DrawTextW(dis->hDC, str, -1, &rt, DT_SINGLELINE|DT_NOPREFIX|flags);
+}
+
+static void output_tabbed_text(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCWSTR str)
 {
 	int x = dis->rcItem.left;
 	RECT rt;
@@ -3026,18 +2942,18 @@
 	rt.bottom = dis->rcItem.bottom;
 
 /*	DRAWTEXTPARAMS dtp = {sizeof(DRAWTEXTPARAMS), 2};
-	DrawTextEx(dis->hDC, (LPTSTR)str, -1, &rt, DT_SINGLELINE|DT_NOPREFIX|DT_EXPANDTABS|DT_TABSTOP, &dtp);*/
-
-	DrawText(dis->hDC, str, -1, &rt, DT_SINGLELINE|DT_EXPANDTABS|DT_TABSTOP|(2<<8));
-}
-
-static void output_number(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCTSTR str)
+	DrawTextExW(dis->hDC, (LPWSTR)str, -1, &rt, DT_SINGLELINE|DT_NOPREFIX|DT_EXPANDTABS|DT_TABSTOP, &dtp);*/
+
+	DrawTextW(dis->hDC, str, -1, &rt, DT_SINGLELINE|DT_EXPANDTABS|DT_TABSTOP|(2<<8));
+}
+
+static void output_number(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCWSTR str)
 {
 	int x = dis->rcItem.left;
 	RECT rt;
-	LPCTSTR s = str;
-	TCHAR b[128];
-	LPTSTR d = b;
+	LPCWSTR s = str;
+	WCHAR b[128];
+	LPWSTR d = b;
 	int pos;
 
 	rt.left   = x+pane->positions[col]+Globals.spaceSize.cx;
@@ -3049,7 +2965,7 @@
 		*d++ = *s++;
 
 	/* insert number separator characters */
-	pos = lstrlen(s) % 3;
+	pos = lstrlenW(s) % 3;
 
 	while(*s)
 		if (pos--)
@@ -3059,13 +2975,13 @@
 			pos = 3;
 		}
 
-	DrawText(dis->hDC, b, d-b, &rt, DT_RIGHT|DT_SINGLELINE|DT_NOPREFIX|DT_END_ELLIPSIS);
-}
-
-
-static BOOL is_exe_file(LPCTSTR ext)
-{
-	static const TCHAR executable_extensions[][4] = {
+	DrawTextW(dis->hDC, b, d-b, &rt, DT_RIGHT|DT_SINGLELINE|DT_NOPREFIX|DT_END_ELLIPSIS);
+}
+
+
+static BOOL is_exe_file(LPCWSTR ext)
+{
+	static const WCHAR executable_extensions[][4] = {
 		{'C','O','M','\0'},
 		{'E','X','E','\0'},
 		{'B','A','T','\0'},
@@ -3078,33 +2994,33 @@
 		{'\0'}
 	};
 
-	TCHAR ext_buffer[_MAX_EXT];
-	const TCHAR (*p)[4];
-	LPCTSTR s;
-	LPTSTR d;
+	WCHAR ext_buffer[_MAX_EXT];
+	const WCHAR (*p)[4];
+	LPCWSTR s;
+	LPWSTR d;
 
 	for(s=ext+1,d=ext_buffer; (*d=tolower(*s)); s++)
 		d++;
 
 	for(p=executable_extensions; (*p)[0]; p++)
-		if (!lstrcmpi(ext_buffer, *p))
+		if (!lstrcmpiW(ext_buffer, *p))
 			return TRUE;
 
 	return FALSE;
 }
 
-static BOOL is_registered_type(LPCTSTR ext)
+static BOOL is_registered_type(LPCWSTR ext)
 {
 	/* check if there exists a classname for this file extension in the registry */
-	if (!RegQueryValue(HKEY_CLASSES_ROOT, ext, NULL, NULL))
+	if (!RegQueryValueW(HKEY_CLASSES_ROOT, ext, NULL, NULL))
 		return TRUE;
 
 	return FALSE;
 }
 
-static enum FILE_TYPE get_file_type(LPCTSTR filename)
-{
-	LPCTSTR ext = strrchrW(filename, '.');
+static enum FILE_TYPE get_file_type(LPCWSTR filename)
+{
+	LPCWSTR ext = strrchrW(filename, '.');
 	if (!ext)
 		ext = sEmpty;
 
@@ -3119,7 +3035,7 @@
 
 static void draw_item(Pane* pane, LPDRAWITEMSTRUCT dis, Entry* entry, int calcWidthCol)
 {
-	TCHAR buffer[BUFFER_LEN];
+	WCHAR buffer[BUFFER_LEN];
 	DWORD attrs;
 	int visible_cols = pane->visible_cols;
 	COLORREF bkcolor, textcolor;
@@ -3246,7 +3162,7 @@
 		if (pane->treePane && entry) {
 			RECT rt = {0};
 
-			DrawText(dis->hDC, entry->data.cFileName, -1, &rt, DT_CALCRECT|DT_SINGLELINE|DT_NOPREFIX);
+			DrawTextW(dis->hDC, entry->data.cFileName, -1, &rt, DT_CALCRECT|DT_SINGLELINE|DT_NOPREFIX);
 
 			focusRect.right = dis->rcItem.left+pane->positions[col+1]+TREE_LINE_DX + rt.right +2;
 		}
@@ -3357,14 +3273,14 @@
 #ifndef _NO_EXTENSIONS
 	if (entry->bhfi_valid) {
 		if (visible_cols & COL_INDEX) {
-                        static const TCHAR fmtlow[] = {'%','X',0};
-                        static const TCHAR fmthigh[] = {'%','X','%','0','8','X',0};
+                        static const WCHAR fmtlow[] = {'%','X',0};
+                        static const WCHAR fmthigh[] = {'%','X','%','0','8','X',0};
 
                         if (entry->bhfi.nFileIndexHigh)
-                            wsprintf(buffer, fmthigh,
+                            wsprintfW(buffer, fmthigh,
                                      entry->bhfi.nFileIndexHigh, entry->bhfi.nFileIndexLow );
                         else
-                            wsprintf(buffer, fmtlow, entry->bhfi.nFileIndexLow );
+                            wsprintfW(buffer, fmtlow, entry->bhfi.nFileIndexLow );
 
 			if (calcWidthCol == -1)
 				output_text(pane, dis, col, buffer, DT_RIGHT);
@@ -3375,7 +3291,7 @@
 		}
 
 		if (visible_cols & COL_LINKS) {
-			wsprintf(buffer, sNumFmt, entry->bhfi.nNumberOfLinks);
+			wsprintfW(buffer, sNumFmt, entry->bhfi.nNumberOfLinks);
 
 			if (calcWidthCol == -1)
 				output_text(pane, dis, col, buffer, DT_CENTER);
@@ -3391,11 +3307,11 @@
 	/* show file attributes */
 	if (visible_cols & COL_ATTRIBUTES) {
 #ifdef _NO_EXTENSIONS
-		static const TCHAR s4Tabs[] = {' ','\t',' ','\t',' ','\t',' ','\t',' ','\0'};
-		lstrcpy(buffer, s4Tabs);
+		static const WCHAR s4Tabs[] = {' ','\t',' ','\t',' ','\t',' ','\t',' ','\0'};
+		lstrcpyW(buffer, s4Tabs);
 #else
-		static const TCHAR s11Tabs[] = {' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\0'};
-		lstrcpy(buffer, s11Tabs);
+		static const WCHAR s11Tabs[] = {' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\0'};
+		lstrcpyW(buffer, s11Tabs);
 #endif
 
 		if (attrs & FILE_ATTRIBUTE_NORMAL)					buffer[ 0] = 'N';
@@ -3426,7 +3342,7 @@
 
 /*TODO
 	if (flags.security) {
-		static const TCHAR sSecTabs[] = {
+		static const WCHAR sSecTabs[] = {
 			' ','\t',' ','\t',' ','\t',' ',
 			' ','\t',' ',
 			' ','\t',' ','\t',' ','\t',' ',
@@ -3437,7 +3353,7 @@
 
 		DWORD rights = get_access_mask();
 
-		lstrcpy(buffer, sSecTabs);
+		lstrcpyW(buffer, sSecTabs);
 
 		if (rights & FILE_READ_DATA)			buffer[ 0] = 'R';
 		if (rights & FILE_WRITE_DATA)			buffer[ 2] = 'W';
@@ -3514,7 +3430,7 @@
 
 static void set_header(Pane* pane)
 {
-	HD_ITEM item;
+	HDITEMW item;
 	int scroll_pos = GetScrollPos(pane->hwnd, SB_HORZ);
 	int i=0, x=0;
 
@@ -3523,18 +3439,18 @@
 
 	for(; x+pane->widths[i]<scroll_pos && i<COLUMNS; i++) {
 		x += pane->widths[i];
-		SendMessage(pane->hwndHeader, HDM_SETITEM, i, (LPARAM) &item);
+		SendMessageW(pane->hwndHeader, HDM_SETITEMW, i, (LPARAM)&item);
 	}
 
 	if (i < COLUMNS) {
 		x += pane->widths[i];
 		item.cxy = x - scroll_pos;
-		SendMessage(pane->hwndHeader, HDM_SETITEM, i++, (LPARAM) &item);
+		SendMessageW(pane->hwndHeader, HDM_SETITEMW, i++, (LPARAM)&item);
 
 		for(; i<COLUMNS; i++) {
 			item.cxy = pane->widths[i];
 			x += pane->widths[i];
-			SendMessage(pane->hwndHeader, HDM_SETITEM, i, (LPARAM) &item);
+			SendMessageW(pane->hwndHeader, HDM_SETITEMW, i, (LPARAM)&item);
 		}
 	}
 }
@@ -3542,8 +3458,8 @@
 static LRESULT pane_notify(Pane* pane, NMHDR* pnmh)
 {
 	switch(pnmh->code) {
-		case HDN_ITEMCHANGED: {
-			HD_NOTIFY* phdn = (HD_NOTIFY*) pnmh;
+		case HDN_ITEMCHANGEDW: {
+			LPNMHEADERW phdn = (LPNMHEADERW)pnmh;
 			int idx = phdn->iItem;
 			int dx = phdn->pitem->cxy - pane->widths[idx];
 			int i;
@@ -3579,8 +3495,8 @@
 				rt_clip.right = pane->positions[idx+1];
 				RedrawWindow(pane->hwnd, &rt_clip, 0, RDW_INVALIDATE|RDW_UPDATENOW);
 
-				if (pnmh->code == HDN_ENDTRACK) {
-					SendMessage(pane->hwnd, LB_SETHORIZONTALEXTENT, pane->positions[COLUMNS], 0);
+				if (pnmh->code == HDN_ENDTRACKW) {
+					SendMessageW(pane->hwnd, LB_SETHORIZONTALEXTENT, pane->positions[COLUMNS], 0);
 
 					if (GetScrollPos(pane->hwnd, SB_HORZ) != scroll_pos)
 						set_header(pane);
@@ -3590,15 +3506,15 @@
 			return FALSE;
 		}
 
-		case HDN_DIVIDERDBLCLICK: {
-			HD_NOTIFY* phdn = (HD_NOTIFY*) pnmh;
-			HD_ITEM item;
+		case HDN_DIVIDERDBLCLICKW: {
+			LPNMHEADERW phdn = (LPNMHEADERW)pnmh;
+			HDITEMW item;
 
 			calc_single_width(pane, phdn->iItem);
 			item.mask = HDI_WIDTH;
 			item.cxy = pane->widths[phdn->iItem];
 
-			SendMessage(pane->hwndHeader, HDM_SETITEM, phdn->iItem, (LPARAM) &item);
+			SendMessageW(pane->hwndHeader, HDM_SETITEMW, phdn->iItem, (LPARAM)&item);
 			InvalidateRect(pane->hwnd, 0, TRUE);
 			break;}
 	}
@@ -3611,22 +3527,22 @@
 
 static void scan_entry(ChildWnd* child, Entry* entry, int idx, HWND hwnd)
 {
-	TCHAR path[MAX_PATH];
-	HCURSOR old_cursor = SetCursor(LoadCursor(0, IDC_WAIT));
+	WCHAR path[MAX_PATH];
+	HCURSOR old_cursor = SetCursor(LoadCursorW(0, (LPCWSTR)IDC_WAIT));
 
 	/* delete sub entries in left pane */
 	for(;;) {
-		LRESULT res = SendMessage(child->left.hwnd, LB_GETITEMDATA, idx+1, 0);
+		LRESULT res = SendMessageW(child->left.hwnd, LB_GETITEMDATA, idx+1, 0);
 		Entry* sub = (Entry*) res;
 
 		if (res==LB_ERR || !sub || sub->level<=entry->level)
 			break;
 
-		SendMessage(child->left.hwnd, LB_DELETESTRING, idx+1, 0);
+		SendMessageW(child->left.hwnd, LB_DELETESTRING, idx+1, 0);
 	}
 
 	/* empty right pane */
-	SendMessage(child->right.hwnd, LB_RESETCONTENT, 0, 0);
+	SendMessageW(child->right.hwnd, LB_RESETCONTENT, 0, 0);
 
 	/* release memory */
 	free_entries(entry);
@@ -3681,7 +3597,7 @@
 	if (!(p->data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY))
 		return FALSE;
 
-	idx = SendMessage(child->left.hwnd, LB_FINDSTRING, 0, (LPARAM)dir);
+	idx = SendMessageW(child->left.hwnd, LB_FINDSTRING, 0, (LPARAM)dir);
 
 	dir->expanded = TRUE;
 
@@ -3704,19 +3620,19 @@
 
 static void collapse_entry(Pane* pane, Entry* dir)
 {
-	int idx = SendMessage(pane->hwnd, LB_FINDSTRING, 0, (LPARAM)dir);
+	int idx = SendMessageW(pane->hwnd, LB_FINDSTRING, 0, (LPARAM)dir);
 
 	ShowWindow(pane->hwnd, SW_HIDE);
 
 	/* hide sub entries */
 	for(;;) {
-		LRESULT res = SendMessage(pane->hwnd, LB_GETITEMDATA, idx+1, 0);
+		LRESULT res = SendMessageW(pane->hwnd, LB_GETITEMDATA, idx+1, 0);
 		Entry* sub = (Entry*) res;
 
 		if (res==LB_ERR || !sub || sub->level<=dir->level)
 			break;
 
-		SendMessage(pane->hwnd, LB_DELETESTRING, idx+1, 0);
+		SendMessageW(pane->hwnd, LB_DELETESTRING, idx+1, 0);
 	}
 
 	dir->expanded = FALSE;
@@ -3727,7 +3643,7 @@
 
 static void refresh_right_pane(ChildWnd* child)
 {
-	SendMessage(child->right.hwnd, LB_RESETCONTENT, 0, 0);
+	SendMessageW(child->right.hwnd, LB_RESETCONTENT, 0, 0);
 	insert_entries(&child->right, child->right.root, child->filter_pattern, child->filter_flags, -1);
 	calc_widths(&child->right, FALSE);
 
@@ -3738,7 +3654,7 @@
 
 static void set_curdir(ChildWnd* child, Entry* entry, int idx, HWND hwnd)
 {
-	TCHAR path[MAX_PATH];
+	WCHAR path[MAX_PATH];
 
 	if (!entry)
 		return;
@@ -3756,25 +3672,25 @@
 		refresh_right_pane(child);
 
 	get_path(entry, path);
-	lstrcpy(child->path, path);
+	lstrcpyW(child->path, path);
 
 	if (child->hwnd)	/* only change window title, if the window already exists */
-		SetWindowText(child->hwnd, path);
+		SetWindowTextW(child->hwnd, path);
 
 	if (path[0])
-		if (SetCurrentDirectory(path))
+		if (SetCurrentDirectoryW(path))
 			set_space_status();
 }
 
 
 static void refresh_child(ChildWnd* child)
 {
-	TCHAR path[MAX_PATH], drv[_MAX_DRIVE+1];
+	WCHAR path[MAX_PATH], drv[_MAX_DRIVE+1];
 	Entry* entry;
 	int idx;
 
 	get_path(child->left.cur, path);
-	_tsplitpath(path, drv, NULL, NULL, NULL);
+	_wsplitpath(path, drv, NULL, NULL, NULL);
 
 	child->right.root = NULL;
 
@@ -3801,8 +3717,8 @@
 
 	set_curdir(child, entry, 0, child->hwnd);
 
-	idx = SendMessage(child->left.hwnd, LB_FINDSTRING, 0, (LPARAM)child->left.cur);
-	SendMessage(child->left.hwnd, LB_SETCURSEL, idx, 0);
+	idx = SendMessageW(child->left.hwnd, LB_FINDSTRING, 0, (LPARAM)child->left.cur);
+	SendMessageW(child->left.hwnd, LB_SETCURSEL, idx, 0);
 }
 
 
@@ -3810,12 +3726,12 @@
 {
 	TBBUTTON drivebarBtn = {0, 0, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0};
 #ifndef _NO_EXTENSIONS
-	TCHAR b1[BUFFER_LEN];
+	WCHAR b1[BUFFER_LEN];
 #endif
 	int btn = 1;
-	PTSTR p;
-
-	GetLogicalDriveStrings(BUFFER_LEN, Globals.drives);
+	PWSTR p;
+
+	GetLogicalDriveStringsW(BUFFER_LEN, Globals.drives);
 
 	Globals.hdrivebar = CreateToolbarEx(Globals.hMainWnd, WS_CHILD|WS_VISIBLE|CCS_NOMOVEY|TBSTYLE_LIST,
 				IDW_DRIVEBAR, 2, Globals.hInstance, IDB_DRIVEBAR, &drivebarBtn,
@@ -3827,25 +3743,25 @@
 	b1[0] = '/';
 	b1[1] = '\0';
 	b1[2] = '\0';
-	SendMessage(Globals.hdrivebar, TB_ADDSTRING, 0, (LPARAM)b1);
+	SendMessageW(Globals.hdrivebar, TB_ADDSTRINGW, 0, (LPARAM)b1);
 
 	drivebarBtn.idCommand = ID_DRIVE_UNIX_FS;
-	SendMessage(Globals.hdrivebar, TB_INSERTBUTTON, btn++, (LPARAM)&drivebarBtn);
+	SendMessageW(Globals.hdrivebar, TB_INSERTBUTTONW, btn++, (LPARAM)&drivebarBtn);
 	drivebarBtn.iString++;
 #endif
 #ifdef _SHELL_FOLDERS
 	/* insert shell namespace button */
 	load_string(b1, sizeof(b1)/sizeof(b1[0]), IDS_SHELL);
-	b1[lstrlen(b1)+1] = '\0';
-	SendMessage(Globals.hdrivebar, TB_ADDSTRING, 0, (LPARAM)b1);
+	b1[lstrlenW(b1)+1] = '\0';
+	SendMessageW(Globals.hdrivebar, TB_ADDSTRINGW, 0, (LPARAM)b1);
 
 	drivebarBtn.idCommand = ID_DRIVE_SHELL_NS;
-	SendMessage(Globals.hdrivebar, TB_INSERTBUTTON, btn++, (LPARAM)&drivebarBtn);
+	SendMessageW(Globals.hdrivebar, TB_INSERTBUTTONW, btn++, (LPARAM)&drivebarBtn);
 	drivebarBtn.iString++;
 #endif
 
 	/* register windows drive root strings */
-	SendMessage(Globals.hdrivebar, TB_ADDSTRING, 0, (LPARAM)Globals.drives);
+	SendMessageW(Globals.hdrivebar, TB_ADDSTRINGW, 0, (LPARAM)Globals.drives);
 #endif
 
 	drivebarBtn.idCommand = ID_DRIVE_FIRST;
@@ -3853,10 +3769,10 @@
 	for(p=Globals.drives; *p; ) {
 #ifdef _NO_EXTENSIONS
 		/* insert drive letter */
-		TCHAR b[3] = {tolower(*p)};
-		SendMessage(Globals.hdrivebar, TB_ADDSTRING, 0, (LPARAM)b);
-#endif
-		switch(GetDriveType(p)) {
+		WCHAR b[3] = {tolower(*p)};
+		SendMessageW(Globals.hdrivebar, TB_ADDSTRINGW, 0, (LPARAM)b);
+#endif
+		switch(GetDriveTypeW(p)) {
 			case DRIVE_REMOVABLE:	drivebarBtn.iBitmap = 1;	break;
 			case DRIVE_CDROM:		drivebarBtn.iBitmap = 3;	break;
 			case DRIVE_REMOTE:		drivebarBtn.iBitmap = 4;	break;
@@ -3864,7 +3780,7 @@
 			default:/*DRIVE_FIXED*/	drivebarBtn.iBitmap = 2;
 		}
 
-		SendMessage(Globals.hdrivebar, TB_INSERTBUTTON, btn++, (LPARAM)&drivebarBtn);
+		SendMessageW(Globals.hdrivebar, TB_INSERTBUTTONW, btn++, (LPARAM)&drivebarBtn);
 		drivebarBtn.idCommand++;
 		drivebarBtn.iString++;
 
@@ -3885,13 +3801,13 @@
 
 	/* update window layout */
 	GetClientRect(Globals.hMainWnd, &rect);
-	SendMessage(Globals.hMainWnd, WM_SIZE, 0, MAKELONG(rect.right, rect.bottom));
-}
-
-
-static BOOL launch_file(HWND hwnd, LPCTSTR cmd, UINT nCmdShow)
-{
-	HINSTANCE hinst = ShellExecute(hwnd, NULL/*operation*/, cmd, NULL/*parameters*/, NULL/*dir*/, nCmdShow);
+	SendMessageW(Globals.hMainWnd, WM_SIZE, 0, MAKELONG(rect.right, rect.bottom));
+}
+
+
+static BOOL launch_file(HWND hwnd, LPCWSTR cmd, UINT nCmdShow)
+{
+	HINSTANCE hinst = ShellExecuteW(hwnd, NULL/*operation*/, cmd, NULL/*parameters*/, NULL/*dir*/, nCmdShow);
 
 	if (PtrToUlong(hinst) <= 32) {
 		display_error(hwnd, GetLastError());
@@ -3904,15 +3820,15 @@
 
 static BOOL launch_entry(Entry* entry, HWND hwnd, UINT nCmdShow)
 {
-	TCHAR cmd[MAX_PATH];
+	WCHAR cmd[MAX_PATH];
 
 #ifdef _SHELL_FOLDERS
 	if (entry->etype == ET_SHELL) {
 		BOOL ret = TRUE;
 
-		SHELLEXECUTEINFO shexinfo;
-
-		shexinfo.cbSize = sizeof(SHELLEXECUTEINFO);
+		SHELLEXECUTEINFOW shexinfo;
+
+		shexinfo.cbSize = sizeof(SHELLEXECUTEINFOW);
 		shexinfo.fMask = SEE_MASK_IDLIST;
 		shexinfo.hwnd = hwnd;
 		shexinfo.lpVerb = NULL;
@@ -3922,7 +3838,7 @@
 		shexinfo.nShow = nCmdShow;
 		shexinfo.lpIDList = get_to_absolute_pidl(entry, hwnd);
 
-		if (!ShellExecuteEx(&shexinfo)) {
+		if (!ShellExecuteExW(&shexinfo)) {
 			display_error(hwnd, GetLastError());
 			ret = FALSE;
 		}
@@ -3953,7 +3869,7 @@
 
 		if (!scanned_old)
 		{
-			int idx = SendMessage(child->left.hwnd, LB_GETCURSEL, 0, 0);
+			int idx = SendMessageW(child->left.hwnd, LB_GETCURSEL, 0, 0);
 			scan_entry(child, entry, idx, hwnd);
 		}
 
@@ -3972,9 +3888,9 @@
 			expand_entry(child, child->left.cur);
 
 			if (!pane->treePane) focus_entry: {
-				int idxstart = SendMessage(child->left.hwnd, LB_GETCURSEL, 0, 0);
-				int idx = SendMessage(child->left.hwnd, LB_FINDSTRING, idxstart, (LPARAM)entry);
-				SendMessage(child->left.hwnd, LB_SETCURSEL, idx, 0);
+				int idxstart = SendMessageW(child->left.hwnd, LB_GETCURSEL, 0, 0);
+				int idx = SendMessageW(child->left.hwnd, LB_FINDSTRING, idxstart, (LPARAM)entry);
+				SendMessageW(child->left.hwnd, LB_SETCURSEL, idx, 0);
 				set_curdir(child, entry, idx, hwnd);
 			}
 		}
@@ -4061,25 +3977,25 @@
 }
 
 
-static BOOL is_directory(LPCTSTR target)
+static BOOL is_directory(LPCWSTR target)
 {
 	/*TODO correctly handle UNIX paths */
-	DWORD target_attr = GetFileAttributes(target);
+	DWORD target_attr = GetFileAttributesW(target);
 
 	if (target_attr == INVALID_FILE_ATTRIBUTES)
 		return FALSE;
 
 	return target_attr&FILE_ATTRIBUTE_DIRECTORY? TRUE: FALSE;
 }
-	
-static BOOL prompt_target(Pane* pane, LPTSTR source, LPTSTR target)
-{
-	TCHAR path[MAX_PATH];
+
+static BOOL prompt_target(Pane* pane, LPWSTR source, LPWSTR target)
+{
+	WCHAR path[MAX_PATH];
 	int len;
 
 	get_path(pane->cur, path);
 
-	if (DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_SELECT_DESTINATION), pane->hwnd, DestinationDlgProc, (LPARAM)path) != IDOK)
+	if (DialogBoxParamW(Globals.hInstance, MAKEINTRESOURCEW(IDD_SELECT_DESTINATION), pane->hwnd, DestinationDlgProc, (LPARAM)path) != IDOK)
 		return FALSE;
 
 	get_path(pane->cur, source);
@@ -4087,23 +4003,23 @@
 	/* convert relative targets to absolute paths */
 	if (path[0]!='/' && path[1]!=':') {
 		get_path(pane->cur->up, target);
-		len = lstrlen(target);
+		len = lstrlenW(target);
 
 		if (target[len-1]!='\\' && target[len-1]!='/')
 			target[len++] = '/';
 
-		lstrcpy(target+len, path);
+		lstrcpyW(target+len, path);
 	} else
-		lstrcpy(target, path);
+		lstrcpyW(target, path);
 
 	/* If the target already exists as directory, create a new target below this. */
 	if (is_directory(path)) {
-		TCHAR fname[_MAX_FNAME], ext[_MAX_EXT];
-		static const TCHAR sAppend[] = {'%','s','/','%','s','%','s','\0'};
-
-		_tsplitpath(source, NULL, NULL, fname, ext);
-
-		wsprintf(target, sAppend, path, fname, ext);
+		WCHAR fname[_MAX_FNAME], ext[_MAX_EXT];
+		static const WCHAR sAppend[] = {'%','s','/','%','s','%','s','\0'};
+
+		_wsplitpath(source, NULL, NULL, fname, ext);
+
+		wsprintfW(target, sAppend, path, fname, ext);
 	}
 
 	return TRUE;
@@ -4202,7 +4118,7 @@
 
 static LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
 {
-	ChildWnd* child = (ChildWnd*) GetWindowLongPtr(hwnd, GWLP_USERDATA);
+	ChildWnd* child = (ChildWnd*)GetWindowLongPtrW(hwnd, GWLP_USERDATA);
 	ASSERT(child);
 
 	switch(nmsg) {
@@ -4225,7 +4141,7 @@
 
 		case WM_NCDESTROY:
 			free_child_window(child);
-			SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
+			SetWindowLongPtrW(hwnd, GWLP_USERDATA, 0);
 			break;
 
 		case WM_PAINT: {
@@ -4253,7 +4169,7 @@
 				ScreenToClient(hwnd, &pt);
 
 				if (pt.x>=child->split_pos-SPLIT_WIDTH/2 && pt.x<child->split_pos+SPLIT_WIDTH/2+1) {
-					SetCursor(LoadCursor(0, IDC_SIZEWE));
+					SetCursor(LoadCursorW(0, (LPCWSTR)IDC_SIZEWE));
 					return TRUE;
 				}
 			}
@@ -4310,7 +4226,7 @@
 					resize_tree(child, rt.right, rt.bottom);
 					last_split = -1;
 					ReleaseCapture();
-					SetCursor(LoadCursor(0, IDC_ARROW));
+					SetCursor(LoadCursorW(0, (LPCWSTR)IDC_ARROW));
 				}
 			break;
 
@@ -4352,7 +4268,7 @@
 
 #ifndef _NO_EXTENSIONS
 		case WM_GETMINMAXINFO:
-			DefMDIChildProc(hwnd, nmsg, wparam, lparam);
+			DefMDIChildProcW(hwnd, nmsg, wparam, lparam);
 
 			{LPMINMAXINFO lpmmi = (LPMINMAXINFO)lparam;
 
@@ -4362,7 +4278,7 @@
 #endif /* _NO_EXTENSIONS */
 
 		case WM_SETFOCUS:
-			if (SetCurrentDirectory(child->path))
+			if (SetCurrentDirectoryW(child->path))
 				set_space_status();
 			SetFocus(child->focus_pane? child->right.hwnd: child->left.hwnd);
 			break;
@@ -4389,42 +4305,42 @@
 					break;
 
 				case ID_FILE_MOVE: {
-					TCHAR source[BUFFER_LEN], target[BUFFER_LEN];
+					WCHAR source[BUFFER_LEN], target[BUFFER_LEN];
 
 					if (prompt_target(pane, source, target)) {
-						SHFILEOPSTRUCT shfo = {hwnd, FO_MOVE, source, target};
-
-						source[lstrlen(source)+1] = '\0';
-						target[lstrlen(target)+1] = '\0';
-
-						if (!SHFileOperation(&shfo))
+						SHFILEOPSTRUCTW shfo = {hwnd, FO_MOVE, source, target};
+
+						source[lstrlenW(source)+1] = '\0';
+						target[lstrlenW(target)+1] = '\0';
+
+						if (!SHFileOperationW(&shfo))
 							refresh_child(child);
 					}
 					break;}
 
 				case ID_FILE_COPY: {
-					TCHAR source[BUFFER_LEN], target[BUFFER_LEN];
+					WCHAR source[BUFFER_LEN], target[BUFFER_LEN];
 
 					if (prompt_target(pane, source, target)) {
-						SHFILEOPSTRUCT shfo = {hwnd, FO_COPY, source, target};
-
-						source[lstrlen(source)+1] = '\0';
-						target[lstrlen(target)+1] = '\0';
-
-						if (!SHFileOperation(&shfo))
+						SHFILEOPSTRUCTW shfo = {hwnd, FO_COPY, source, target};
+
+						source[lstrlenW(source)+1] = '\0';
+						target[lstrlenW(target)+1] = '\0';
+
+						if (!SHFileOperationW(&shfo))
 							refresh_child(child);
 					}
 					break;}
 
 				case ID_FILE_DELETE: {
-					TCHAR path[BUFFER_LEN];
-                                        SHFILEOPSTRUCT shfo = {hwnd, FO_DELETE, path, NULL, FOF_ALLOWUNDO};
+					WCHAR path[BUFFER_LEN];
+					SHFILEOPSTRUCTW shfo = {hwnd, FO_DELETE, path, NULL, FOF_ALLOWUNDO};
 
 					get_path(pane->cur, path);
 
-					path[lstrlen(path)+1] = '\0';
-
-					if (!SHFileOperation(&shfo))
+					path[lstrlenW(path)+1] = '\0';
+
+					if (!SHFileOperationW(&shfo))
 						refresh_child(child);
 					break;}
 
@@ -4448,11 +4364,11 @@
 					struct FilterDialog dlg;
 
 					memset(&dlg, 0, sizeof(struct FilterDialog));
-					lstrcpy(dlg.pattern, child->filter_pattern);
+					lstrcpyW(dlg.pattern, child->filter_pattern);
 					dlg.flags = child->filter_flags;
 
-					if (DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_DIALOG_VIEW_TYPE), hwnd, FilterDialogDlgProc, (LPARAM)&dlg) == IDOK) {
-						lstrcpy(child->filter_pattern, dlg.pattern);
+					if (DialogBoxParamW(Globals.hInstance, MAKEINTRESOURCEW(IDD_DIALOG_VIEW_TYPE), hwnd, FilterDialogDlgProc, (LPARAM)&dlg) == IDOK) {
+						lstrcpyW(child->filter_pattern, dlg.pattern);
 						child->filter_flags = dlg.flags;
 						refresh_right_pane(child);
 					}
@@ -4481,8 +4397,8 @@
 
 			switch(HIWORD(wparam)) {
 				case LBN_SELCHANGE: {
-					int idx = SendMessage(pane->hwnd, LB_GETCURSEL, 0, 0);
-					Entry* entry = (Entry*) SendMessage(pane->hwnd, LB_GETITEMDATA, idx, 0);
+					int idx = SendMessageW(pane->hwnd, LB_GETCURSEL, 0, 0);
+					Entry* entry = (Entry*)SendMessageW(pane->hwnd, LB_GETITEMDATA, idx, 0);
 
 					if (pane == &child->left)
 						set_curdir(child, entry, idx, hwnd);
@@ -4513,15 +4429,15 @@
 			pt_clnt.x = pt.x = (short)LOWORD(lparam);
 			pt_clnt.y = pt.y = (short)HIWORD(lparam);
 			ScreenToClient(hpanel, &pt_clnt);
-			SendMessage(hpanel, WM_LBUTTONDOWN, 0, MAKELONG(pt_clnt.x, pt_clnt.y));
-			SendMessage(hpanel, WM_LBUTTONUP, 0, MAKELONG(pt_clnt.x, pt_clnt.y));
+			SendMessageW(hpanel, WM_LBUTTONDOWN, 0, MAKELONG(pt_clnt.x, pt_clnt.y));
+			SendMessageW(hpanel, WM_LBUTTONUP, 0, MAKELONG(pt_clnt.x, pt_clnt.y));
 
 			 /* now create the popup menu using shell namespace and IContextMenu */
 			pane = GetFocus()==child->left.hwnd? &child->left: &child->right;
-			idx = SendMessage(pane->hwnd, LB_GETCURSEL, 0, 0);
+			idx = SendMessageW(pane->hwnd, LB_GETCURSEL, 0, 0);
 
 			if (idx != -1) {
-				Entry* entry = (Entry*) SendMessage(pane->hwnd, LB_GETITEMDATA, idx, 0);
+				Entry* entry = (Entry*)SendMessageW(pane->hwnd, LB_GETITEMDATA, idx, 0);
 
 				LPITEMIDLIST pidl_abs = get_to_absolute_pidl(entry, hwnd);
 
@@ -4575,7 +4491,7 @@
 			/* fall through */
 
 		default: def:
-			return DefMDIChildProc(hwnd, nmsg, wparam, lparam);
+			return DefMDIChildProcW(hwnd, nmsg, wparam, lparam);
 	}
 
 	return 0;
@@ -4584,8 +4500,8 @@
 
 static LRESULT CALLBACK TreeWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
 {
-	ChildWnd* child = (ChildWnd*) GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
-	Pane* pane = (Pane*) GetWindowLongPtr(hwnd, GWLP_USERDATA);
+	ChildWnd* child = (ChildWnd*)GetWindowLongPtrW(GetParent(hwnd), GWLP_USERDATA);
+	Pane* pane = (Pane*)GetWindowLongPtrW(hwnd, GWLP_USERDATA);
 	ASSERT(child);
 
 	switch(nmsg) {
@@ -4597,7 +4513,7 @@
 
 		case WM_SETFOCUS:
 			child->focus_pane = pane==&child->right? 1: 0;
-			SendMessage(hwnd, LB_SETSEL, TRUE, 1);
+			SendMessageW(hwnd, LB_SETSEL, TRUE, 1);
 			/*TODO: check menu items */
 			break;
 
@@ -4608,16 +4524,16 @@
 			}
 	}
 
-	return CallWindowProc(g_orgTreeWndProc, hwnd, nmsg, wparam, lparam);
+	return CallWindowProcW(g_orgTreeWndProc, hwnd, nmsg, wparam, lparam);
 }
 
 
 static void InitInstance(HINSTANCE hinstance)
 {
-	static const TCHAR sFont[] = {'M','i','c','r','o','s','o','f','t',' ','S','a','n','s',' ','S','e','r','i','f','\0'};
-
-	WNDCLASSEX wcFrame;
-	WNDCLASS wcChild;
+	static const WCHAR sFont[] = {'M','i','c','r','o','s','o','f','t',' ','S','a','n','s',' ','S','e','r','i','f','\0'};
+
+	WNDCLASSEXW wcFrame;
+	WNDCLASSW wcChild;
 	ATOM hChildClass;
 	int col;
 
@@ -4635,25 +4551,20 @@
 
 	/* register frame window class */
 
-	wcFrame.cbSize        = sizeof(WNDCLASSEX);
+	wcFrame.cbSize        = sizeof(WNDCLASSEXW);
 	wcFrame.style         = 0;
 	wcFrame.lpfnWndProc   = FrameWndProc;
 	wcFrame.cbClsExtra    = 0;
 	wcFrame.cbWndExtra    = 0;
 	wcFrame.hInstance     = hinstance;
-	wcFrame.hIcon         = LoadIcon(hinstance, MAKEINTRESOURCE(IDI_WINEFILE));
-	wcFrame.hCursor       = LoadCursor(0, IDC_ARROW);
+	wcFrame.hIcon         = LoadIconW(hinstance, MAKEINTRESOURCEW(IDI_WINEFILE));
+	wcFrame.hCursor       = LoadCursorW(0, (LPCWSTR)IDC_ARROW);
 	wcFrame.hbrBackground = 0;
 	wcFrame.lpszMenuName  = 0;
 	wcFrame.lpszClassName = sWINEFILEFRAME;
-	wcFrame.hIconSm       = (HICON)LoadImage(hinstance,
-											 MAKEINTRESOURCE(IDI_WINEFILE),
-											 IMAGE_ICON,
-											 GetSystemMetrics(SM_CXSMICON),
-											 GetSystemMetrics(SM_CYSMICON),
-											 LR_SHARED);
-
-	Globals.hframeClass = RegisterClassEx(&wcFrame);
+	wcFrame.hIconSm       = LoadImageW(hinstance, MAKEINTRESOURCEW(IDI_WINEFILE), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED);
+
+	Globals.hframeClass = RegisterClassExW(&wcFrame);
 
 
 	/* register tree windows class */
@@ -4664,17 +4575,17 @@
 	wcChild.cbWndExtra    = 0;
 	wcChild.hInstance     = hinstance;
 	wcChild.hIcon         = 0;
-	wcChild.hCursor       = LoadCursor(0, IDC_ARROW);
+	wcChild.hCursor       = LoadCursorW(0, (LPCWSTR)IDC_ARROW);
 	wcChild.hbrBackground = 0;
 	wcChild.lpszMenuName  = 0;
 	wcChild.lpszClassName = sWINEFILETREE;
 
-	hChildClass = RegisterClass(&wcChild);
-
-
-	Globals.haccel = LoadAccelerators(hinstance, MAKEINTRESOURCE(IDA_WINEFILE));
-
-	Globals.hfont = CreateFont(-MulDiv(8,GetDeviceCaps(hdc,LOGPIXELSY),72), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, sFont);
+	hChildClass = RegisterClassW(&wcChild);
+
+
+	Globals.haccel = LoadAcceleratorsW(hinstance, MAKEINTRESOURCEW(IDA_WINEFILE));
+
+	Globals.hfont = CreateFontW(-MulDiv(8,GetDeviceCaps(hdc,LOGPIXELSY),72), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, sFont);
 
 	ReleaseDC(0, hdc);
 
@@ -4684,7 +4595,7 @@
 	CoInitialize(NULL);
 	CoGetMalloc(MEMCTX_TASK, &Globals.iMalloc);
 	SHGetDesktopFolder(&Globals.iDesktop);
-	Globals.cfStrFName = RegisterClipboardFormat(CFSTR_FILENAME);
+	Globals.cfStrFName = RegisterClipboardFormatW(CFSTR_FILENAMEW);
 #endif
 
 	/* load column strings */
@@ -4706,11 +4617,11 @@
 }
 
 
-static BOOL show_frame(HWND hwndParent, int cmdshow, LPCTSTR path)
-{
-	static const TCHAR sMDICLIENT[] = {'M','D','I','C','L','I','E','N','T','\0'};
-
-	TCHAR buffer[MAX_PATH], b1[BUFFER_LEN];
+static BOOL show_frame(HWND hwndParent, int cmdshow, LPCWSTR path)
+{
+	static const WCHAR sMDICLIENT[] = {'M','D','I','C','L','I','E','N','T','\0'};
+
+	WCHAR buffer[MAX_PATH], b1[BUFFER_LEN];
 	ChildWnd* child;
 	HMENU hMenuFrame, hMenuWindow;
 	windowOptions opts;
@@ -4721,7 +4632,7 @@
 		return TRUE;
 
 	opts = load_registry_settings();
-	hMenuFrame = LoadMenu(Globals.hInstance, MAKEINTRESOURCE(IDM_WINEFILE));
+	hMenuFrame = LoadMenuW(Globals.hInstance, MAKEINTRESOURCEW(IDM_WINEFILE));
 	hMenuWindow = GetSubMenu(hMenuFrame, GetMenuItemCount(hMenuFrame)-2);
 
 	Globals.hMenuFrame = hMenuFrame;
@@ -4733,12 +4644,12 @@
 
 
 	/* create main window */
-	Globals.hMainWnd = CreateWindowEx(0, MAKEINTRESOURCE(Globals.hframeClass), RS(b1,IDS_WINE_FILE), WS_OVERLAPPEDWINDOW,
+	Globals.hMainWnd = CreateWindowExW(0, MAKEINTRESOURCEW(Globals.hframeClass), RS(b1,IDS_WINE_FILE), WS_OVERLAPPEDWINDOW,
 					opts.start_x, opts.start_y, opts.width, opts.height,
 					hwndParent, Globals.hMenuFrame, Globals.hInstance, 0/*lpParam*/);
 
 
-	Globals.hmdiclient = CreateWindowEx(0, sMDICLIENT, NULL,
+	Globals.hmdiclient = CreateWindowExW(0, sMDICLIENT, NULL,
 					WS_CHILD|WS_CLIPCHILDREN|WS_VSCROLL|WS_HSCROLL|WS_VISIBLE|WS_BORDER,
 					0, 0, 0, 0,
 					Globals.hMainWnd, 0, Globals.hInstance, &ccs);
@@ -4766,18 +4677,18 @@
 		CheckMenuItem(Globals.hMenuOptions, ID_VIEW_TOOL_BAR, MF_BYCOMMAND|MF_CHECKED);
 	}
 
-	Globals.hstatusbar = CreateStatusWindow(WS_CHILD|WS_VISIBLE, 0, Globals.hMainWnd, IDW_STATUSBAR);
+	Globals.hstatusbar = CreateStatusWindowW(WS_CHILD|WS_VISIBLE, 0, Globals.hMainWnd, IDW_STATUSBAR);
 	CheckMenuItem(Globals.hMenuOptions, ID_VIEW_STATUSBAR, MF_BYCOMMAND|MF_CHECKED);
 
-/* CreateStatusWindow does not accept WS_BORDER
-	Globals.hstatusbar = CreateWindowEx(WS_EX_NOPARENTNOTIFY, STATUSCLASSNAME, 0,
+/* CreateStatusWindowW does not accept WS_BORDER
+	Globals.hstatusbar = CreateWindowExW(WS_EX_NOPARENTNOTIFY, STATUSCLASSNAME, 0,
 					WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_BORDER|CCS_NODIVIDER, 0,0,0,0,
 					Globals.hMainWnd, (HMENU)IDW_STATUSBAR, hinstance, 0);*/
 
 	/*TODO: read paths from registry */
 
 	if (!path || !*path) {
-		GetCurrentDirectory(MAX_PATH, buffer);
+		GetCurrentDirectoryW(MAX_PATH, buffer);
 		path = buffer;
 	}
 
@@ -4803,7 +4714,7 @@
 
 	SetWindowPlacement(child->hwnd, &child->pos);
 
-	Globals.himl = ImageList_LoadBitmap(Globals.hInstance, MAKEINTRESOURCE(IDB_IMAGES), 16, 0, RGB(0,255,0));
+	Globals.himl = ImageList_LoadImageW(Globals.hInstance, MAKEINTRESOURCEW(IDB_IMAGES), 16, 0, RGB(0,255,0), IMAGE_BITMAP, 0);
 
 	Globals.prescan_node = FALSE;
 
@@ -4812,25 +4723,25 @@
 	if (child->hwnd && path && path[0])
 	{
 		int index,count;
-		TCHAR drv[_MAX_DRIVE+1], dir[_MAX_DIR], name[_MAX_FNAME], ext[_MAX_EXT];
-		TCHAR fullname[_MAX_FNAME+_MAX_EXT+1];
+		WCHAR drv[_MAX_DRIVE+1], dir[_MAX_DIR], name[_MAX_FNAME], ext[_MAX_EXT];
+		WCHAR fullname[_MAX_FNAME+_MAX_EXT+1];
 
 		memset(name,0,sizeof(name));
 		memset(name,0,sizeof(ext));
-		_tsplitpath(path, drv, dir, name, ext);
+		_wsplitpath(path, drv, dir, name, ext);
 		if (name[0])
 		{
-			count = SendMessage(child->right.hwnd, LB_GETCOUNT, 0, 0);
-			lstrcpy(fullname,name);
-			lstrcat(fullname,ext);
+			count = SendMessageW(child->right.hwnd, LB_GETCOUNT, 0, 0);
+			lstrcpyW(fullname,name);
+			lstrcatW(fullname,ext);
 
 			for (index = 0; index < count; index ++)
 			{
-				Entry* entry = (Entry*) SendMessage(child->right.hwnd, LB_GETITEMDATA, index, 0);
-				if (lstrcmp(entry->data.cFileName,fullname)==0 ||
-						lstrcmp(entry->data.cAlternateFileName,fullname)==0)
+				Entry* entry = (Entry*)SendMessageW(child->right.hwnd, LB_GETITEMDATA, index, 0);
+				if (lstrcmpW(entry->data.cFileName,fullname)==0 ||
+						lstrcmpW(entry->data.cAlternateFileName,fullname)==0)
 				{
-					SendMessage(child->right.hwnd, LB_SETCURSEL, index, 0);
+					SendMessageW(child->right.hwnd, LB_SETCURSEL, index, 0);
 					SetFocus(child->right.hwnd);
 					break;
 				}
@@ -4860,11 +4771,11 @@
 
 static BOOL CALLBACK EnumWndProc(HWND hwnd, LPARAM lparam)
 {
-	TCHAR cls[128];
+	WCHAR cls[128];
 
 	GetClassName(hwnd, cls, 128);
 
-	if (!lstrcmp(cls, (LPCTSTR)lparam)) {
+	if (!lstrcmpW(cls, (LPCWSTR)lparam)) {
 		g_foundPrevInstance++;
 		return FALSE;
 	}
@@ -4873,7 +4784,7 @@
 }
 
 /* search for window of given class name to allow only one running instance */
-static int find_window_class(LPCTSTR classname)
+static int find_window_class(LPCWSTR classname)
 {
 	EnumWindows(EnumWndProc, (LPARAM)classname);
 
@@ -4885,10 +4796,10 @@
 
 #endif
 
-static int winefile_main(HINSTANCE hinstance, int cmdshow, LPCTSTR path)
+static int winefile_main(HINSTANCE hinstance, int cmdshow, LPCWSTR path)
 {
 	MSG msg;
-  
+
 	InitInstance(hinstance);
 
 	if( !show_frame(0, cmdshow, path) )
@@ -4897,15 +4808,15 @@
 		return 1;
 	}
 
-	while(GetMessage(&msg, 0, 0, 0)) {
+	while(GetMessageW(&msg, 0, 0, 0)) {
 		if (Globals.hmdiclient && TranslateMDISysAccel(Globals.hmdiclient, &msg))
 			continue;
 
-		if (Globals.hMainWnd && TranslateAccelerator(Globals.hMainWnd, Globals.haccel, &msg))
+		if (Globals.hMainWnd && TranslateAcceleratorW(Globals.hMainWnd, Globals.haccel, &msg))
 			continue;
 
 		TranslateMessage(&msg);
-		DispatchMessage(&msg);
+		DispatchMessageW(&msg);
 	}
 
 	ExitInstance();
@@ -4914,7 +4825,7 @@
 }
 
 
-#if defined(UNICODE) && defined(_MSC_VER)
+#if defined(_MSC_VER)
 int APIENTRY wWinMain(HINSTANCE hinstance, HINSTANCE previnstance, LPWSTR cmdline, int cmdshow)
 #else
 int APIENTRY WinMain(HINSTANCE hinstance, HINSTANCE previnstance, LPSTR cmdline, int cmdshow)
@@ -4925,15 +4836,11 @@
 		return 1;
 #endif
 
-#if defined(UNICODE) && !defined(_MSC_VER)
 	{ /* convert ANSI cmdline into WCS path string */
-	TCHAR buffer[MAX_PATH];
+	WCHAR buffer[MAX_PATH];
 	MultiByteToWideChar(CP_ACP, 0, cmdline, -1, buffer, MAX_PATH);
 	winefile_main(hinstance, cmdshow, buffer);
 	}
-#else
-	winefile_main(hinstance, cmdshow, cmdline);
-#endif
 
 	return 0;
 }

Modified: trunk/rosapps/applications/winfile/winefile.h
URL: http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/winfile/winefile.h?rev=43185&r1=43184&r2=43185&view=diff
==============================================================================
--- trunk/rosapps/applications/winfile/winefile.h [iso-8859-1] (original)
+++ trunk/rosapps/applications/winfile/winefile.h [iso-8859-1] Sun Sep 27 14:09:24 2009
@@ -43,7 +43,7 @@
 #include <locale.h>
 #include <time.h>
 
-#include <shellapi.h>   /* for ShellExecute() */
+#include <shellapi.h>   /* for ShellExecuteW() */
 #include <shlobj.h>     /* for SHFormatDrive() */
 
 #ifndef _NO_EXTENSIONS
@@ -128,11 +128,11 @@
   HWND      hdrivebar;
   HFONT     hfont;
 
-  TCHAR     num_sep;
+  WCHAR     num_sep;
   SIZE      spaceSize;
   HIMAGELIST himl;
 
-  TCHAR     drives[BUFFER_LEN];
+  WCHAR     drives[BUFFER_LEN];
   BOOL      prescan_node;   /*TODO*/
   BOOL      saveSettings;
   
@@ -145,18 +145,4 @@
 
 extern WINEFILE_GLOBALS Globals;
 
-#ifdef __WINE__
-
-#ifdef UNICODE
 extern void _wsplitpath(const WCHAR* path, WCHAR* drv, WCHAR* dir, WCHAR* name, WCHAR* ext);
-#define _tsplitpath _wsplitpath
-#else
-extern void _splitpath(const CHAR* path, CHAR* drv, CHAR* dir, CHAR* name, CHAR* ext);
-#define _tsplitpath _splitpath
-#endif
-
-#else
-
-#include <tchar.h>	/* for _tsplitpath() */
-
-#endif




More information about the Ros-diffs mailing list