#include "winefile.h"
#include "resource.h"
+#include "wine/unicode.h"
#ifdef _NO_EXTENSIONS
#undef _LEFT_FILES
BOOL scanned;
int level;
- WIN32_FIND_DATA data;
+ WIN32_FIND_DATAW data;
#ifndef _NO_EXTENSIONS
BY_HANDLE_FILE_INFORMATION bhfi;
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;
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;
-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);
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 const TCHAR sLongHexFmt[] = {'%','I','6','4','X','\0'};
-static const TCHAR sLongNumFmt[] = {'%','I','6','4','u','\0'};
+static void format_longlong(LPWSTR ret, ULONGLONG val)
+{
+ WCHAR buffer[65], *p = &buffer[64];
+
+ *p = 0;
+ do {
+ *(--p) = '0' + val % 10;
+ val /= 10;
+ } while (val);
+ lstrcpyW( ret, p );
+}
/* load resource string */
-static LPTSTR load_string(LPTSTR buffer, UINT id)
+static LPWSTR load_string(LPWSTR buffer, DWORD size, UINT id)
{
- LoadString(Globals.hInstance, id, buffer, BUFFER_LEN);
-
+ LoadStringW(Globals.hInstance, id, buffer, size);
return buffer;
}
-#define RS(b, i) load_string(b, i)
+#define RS(b, i) load_string(b, sizeof(b)/sizeof(b[0]), i)
/* 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;
+ WCHAR b1[BUFFER_LEN], b2[BUFFER_LEN];
+ PWSTR 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);
+ 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)
LOGFONTW lFont;
HDC hdc = GetDC(hwnd);
- chFont.lStructSize = sizeof(CHOOSEFONT);
+ chFont.lStructSize = sizeof(CHOOSEFONTW);
chFont.hwndOwner = hwnd;
chFont.hDC = NULL;
chFont.lpLogFont = &lFont;
ReleaseDC(hwnd, hdc);
}
-#ifdef __WINE__
-
-#ifdef UNICODE
-
-/* call vswprintf() in msvcrt.dll */
-/*TODO: fix swprintf() in non-msvcrt mode, so that this dynamic linking function can be removed */
-static int msvcrt_swprintf(WCHAR* buffer, const WCHAR* fmt, ...)
-{
- static int (__cdecl *pvswprintf)(WCHAR*, const WCHAR*, va_list) = NULL;
- va_list ap;
- int ret;
-
- if (!pvswprintf) {
- HMODULE hModMsvcrt = LoadLibraryA("msvcrt");
- pvswprintf = (int(__cdecl*)(WCHAR*,const WCHAR*,va_list)) GetProcAddress(hModMsvcrt, "vswprintf");
- }
-
- va_start(ap, fmt);
- ret = (*pvswprintf)(buffer, fmt, ap);
- va_end(ap);
-
- return ret;
-}
-
-static LPCWSTR my_wcsrchr(LPCWSTR str, WCHAR c)
-{
- LPCWSTR p = str;
-
- while(*p)
- ++p;
-
- do {
- if (--p < str)
- return NULL;
- } while(*p != c);
-
- return p;
-}
-
-#define _tcsrchr my_wcsrchr
-#else /* UNICODE */
-#define _tcsrchr strrchr
-#endif /* UNICODE */
-
-#endif /* __WINE__ */
-
/* allocate and initialise a directory entry */
static Entry* alloc_entry(void)
}
-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++;
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;
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;
entry->etype = ET_WINDOWS;
entry->bhfi_valid = FALSE;
- lstrcpy(p, entry->data.cFileName);
+ lstrcpyW(p, entry->data.cFileName);
- hFile = CreateFile(buffer, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+ 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) {
#endif
last = entry;
- } while(FindNextFile(hFind, &w32fd));
+ } while(FindNextFileW(hFind, &w32fd));
if (last)
last->next = NULL;
}
-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 == '/')
}
-static Entry* read_tree_win(Root* root, LPCTSTR path, SORT_ORDER sortOrder, HWND hwnd)
+static Entry* read_tree_win(Root* root, LPCWSTR path, SORT_ORDER sortOrder, HWND hwnd)
{
- TCHAR buffer[MAX_PATH];
+ WCHAR buffer[MAX_PATH];
Entry* entry = &root->entry;
- LPCTSTR s = path;
- PTSTR d = buffer;
+ LPCWSTR s = path;
+ PWSTR d = buffer;
- HCURSOR old_cursor = SetCursor(LoadCursor(0, IDC_WAIT));
+ HCURSOR old_cursor = SetCursor(LoadCursorW(0, (LPCWSTR)IDC_WAIT));
#ifndef _NO_EXTENSIONS
entry->etype = ET_WINDOWS;
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;
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) {
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;
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 == '/')
return 0;
}
-static Entry* read_tree_unix(Root* root, LPCTSTR path, SORT_ORDER sortOrder, HWND hwnd)
+static Entry* read_tree_unix(Root* root, LPCWSTR path, SORT_ORDER sortOrder, HWND hwnd)
{
- TCHAR buffer[MAX_PATH];
+ WCHAR buffer[MAX_PATH];
Entry* entry = &root->entry;
- LPCTSTR s = path;
- PTSTR d = buffer;
+ LPCWSTR s = path;
+ PWSTR d = buffer;
- HCURSOR old_cursor = SetCursor(LoadCursor(0, IDC_WAIT));
+ HCURSOR old_cursor = SetCursor(LoadCursorW(0, (LPCWSTR)IDC_WAIT));
entry->etype = ET_UNIX;
#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)
{
LPCWSTR s;
}
-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);
+ get_strretW(&str, &pidl->mkid, buffer, len);
free_strret(&str);
} else
buffer[0] = '\0';
/* 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))
static LPITEMIDLIST get_to_absolute_pidl(Entry* entry, HWND hwnd)
{
if (entry->up && entry->up->etype==ET_SHELL) {
- IShellFolder* folder = entry->up->folder;
- WCHAR buffer[MAX_PATH];
-
- HRESULT hr = path_from_pidlW(folder, entry->pidl, buffer, MAX_PATH);
-
- if (SUCCEEDED(hr)) {
- LPITEMIDLIST pidl;
- ULONG len;
-
- hr = IShellFolder_ParseDisplayName(Globals.iDesktop, hwnd, NULL, buffer, &len, &pidl, NULL);
+ LPITEMIDLIST idl = NULL;
- if (SUCCEEDED(hr))
- return pidl;
+ while (entry->up) {
+ idl = ILCombine(ILClone(entry->pidl), idl);
+ entry = entry->up;
}
+
+ return idl;
} else if (entry->etype == ET_WINDOWS) {
- TCHAR path[MAX_PATH];
+ WCHAR path[MAX_PATH];
get_path(entry, path);
static HICON extract_icon(IShellFolder* folder, LPCITEMIDLIST pidl)
{
- IExtractIcon* pExtract;
+ IExtractIconW* pExtract;
- if (SUCCEEDED(IShellFolder_GetUIObjectOf(folder, 0, 1, (LPCITEMIDLIST*)&pidl, &IID_IExtractIcon, 0, (LPVOID*)&pExtract))) {
- TCHAR path[_MAX_PATH];
+ if (SUCCEEDED(IShellFolder_GetUIObjectOf(folder, 0, 1, (LPCITEMIDLIST*)&pidl, &IID_IExtractIconW, 0, (LPVOID*)&pExtract))) {
+ WCHAR path[_MAX_PATH];
unsigned flags;
HICON hicon;
int idx;
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;
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;
((LPITEMIDLIST)((LPBYTE)next_pidl+pidl->mkid.cb))->mkid.cb = 0;
hr = IShellFolder_BindToObject(folder, next_pidl, 0, &IID_IShellFolder, (void**)&child);
- if (!SUCCEEDED(hr))
+ if (FAILED(hr))
break;
read_directory(entry, NULL, sortOrder, hwnd);
}
-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;
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;
memset(pidls, 0, sizeof(pidls));
hr = IEnumIDList_Next(idlist, FETCH_ITEM_COUNT, pidls, &cnt);
- if (!SUCCEEDED(hr))
+ if (FAILED(hr))
break;
if (hr == S_FALSE)
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 */
+ attribs = ~SFGAO_FILESYSTEM; /*SFGAO_HASSUBFOLDER|SFGAO_FOLDER; SFGAO_FILESYSTEM sorgt dafür, daß "My Documents" anstatt von "Martin's Documents" angezeigt wird */
hr = IShellFolder_GetAttributesOf(folder, 1, (LPCITEMIDLIST*)&pidls[n], &attribs);
};
/* distinguish between ".", ".." and any other directory names */
-static int TypeOrderFromDirname(LPCTSTR name)
+static int TypeOrderFromDirname(LPCWSTR name)
{
if (name[0] == '.') {
if (name[1] == '\0')
}
/* 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;
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)
name1 = fd1->cFileName;
name2 = fd2->cFileName;
- ext1 = _tcsrchr(name1, '.');
- ext2 = _tcsrchr(name2, '.');
+ ext1 = strrchrW(name1, '.');
+ ext2 = strrchrW(name2, '.');
if (ext1)
ext1++;
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)
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)
}
-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)
{
- TCHAR buffer[MAX_PATH];
+ WCHAR buffer[MAX_PATH];
Entry* entry;
- LPCTSTR s;
- PTSTR d;
+ LPCWSTR s;
+ PWSTR d;
#ifdef _SHELL_FOLDERS
if (dir->etype == ET_SHELL)
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);
}
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);
}
}
-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'};
+ static const WCHAR sSlash[] = {'/', '\0'};
#endif
- static const TCHAR sBackslash[] = {'\\', '\0'};
+ static const WCHAR sBackslash[] = {'\\', '\0'};
#ifdef _SHELL_FOLDERS
if (pidl)
root->drive_type = DRIVE_UNKNOWN;
drv[0] = '\\';
drv[1] = '\0';
- load_string(root->volname, IDS_DESKTOP);
+ load_string(root->volname, sizeof(root->volname)/sizeof(root->volname[0]), IDS_DESKTOP);
root->fs_flags = 0;
- load_string(root->fs, IDS_SHELL);
+ load_string(root->fs, sizeof(root->fs)/sizeof(root->fs[0]), IDS_SHELL);
return read_tree_shell(root, pidl, sortOrder, hwnd);
}
if (*path == '/')
{
/* read unix file system tree */
- root->drive_type = GetDriveType(path);
+ root->drive_type = GetDriveTypeW(path);
- lstrcat(drv, sSlash);
- load_string(root->volname, IDS_ROOT_FS);
+ 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, IDS_UNIXFS);
+ 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);
+ root->drive_type = GetDriveTypeW(path);
- lstrcat(drv, sBackslash);
- GetVolumeInformation(drv, root->volname, _MAX_FNAME, 0, 0, &root->fs_flags, root->fs, _MAX_DIR);
+ lstrcatW(drv, sBackslash);
+ GetVolumeInformationW(drv, root->volname, _MAX_FNAME, 0, 0, &root->fs_flags, root->fs, _MAX_DIR);
- lstrcpy(root->path, drv);
+ lstrcpyW(root->path, drv);
return read_tree_win(root, path, sortOrder, hwnd);
}
};
-static ChildWnd* alloc_child_window(LPCTSTR path, LPITEMIDLIST pidl, HWND hwnd)
+static ChildWnd* alloc_child_window(LPCWSTR 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'};
+ 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;
if (path)
{
- lstrcpy(child->path, path);
+ lstrcpyW(child->path, path);
- _tsplitpath(path, drv, dir, name, ext);
+ _wsplitpath(path, drv, dir, name, ext);
}
- lstrcpy(child->filter_pattern, sAsterics);
+ 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
if (root->entry.etype == ET_SHELL)
- load_string(root->entry.data.cFileName, IDS_DESKTOP);
+ 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;
/* 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;
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;
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
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;
}
DWORD type;
HKEY hKey;
windowOptions opts;
- LOGFONT logfont;
+ LOGFONTW logfont;
RegOpenKeyExW( HKEY_CURRENT_USER, registry_key,
0, KEY_QUERY_VALUE, &hKey );
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;
}
WINDOWINFO wi;
HKEY hKey;
INT width, height;
- LOGFONT logfont;
+ LOGFONTW logfont;
wi.cbSize = sizeof( WINDOWINFO );
GetWindowInfo(Globals.hMainWnd, &wi);
(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 );
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);
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;
}
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);
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;
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;
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));
+ 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 = 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);
return child->hwnd;
}
struct ExecuteDialog {
- TCHAR cmd[MAX_PATH];
+ WCHAR cmd[MAX_PATH];
int cmdshow;
};
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)
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: {
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;}
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;
}
struct FilterDialog {
- TCHAR pattern[MAX_PATH];
+ WCHAR pattern[MAX_PATH];
int flags;
};
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);
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;
struct PropertiesDialog {
- TCHAR path[MAX_PATH];
+ WCHAR path[MAX_PATH];
Entry entry;
void* pVersionData;
};
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);
+ SetWindowTextW(hedit, pValue);
}
}
-static void CheckForFileInfo(struct PropertiesDialog* dlg, HWND hwnd, LPCTSTR strFilename)
+static void CheckForFileInfo(struct PropertiesDialog* dlg, HWND hwnd, LPCWSTR 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','\\',
+ 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];
}
/* 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);
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));
}
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;
- ULONGLONG size;
+ 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;
+ pWFD = (LPWIN32_FIND_DATAW)&dlg->entry.data;
- GetWindowText(hwnd, b1, MAX_PATH);
- wsprintf(b2, b1, pWFD->cFileName);
- SetWindowText(hwnd, b2);
+ 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);
- size = ((ULONGLONG)pWFD->nFileSizeHigh << 32) | pWFD->nFileSizeLow;
- _stprintf(b1, sLongNumFmt, size);
- wsprintf(b2, sByteFmt, b1);
- SetWindowText(GetDlgItem(hwnd, IDC_STATIC_PROP_SIZE), b2);
+ format_longlong( b1, ((ULONGLONG)pWFD->nFileSizeHigh << 32) | pWFD->nFileSizeLow );
+ wsprintfW(b2, sByteFmt, b1);
+ SetWindowTextW(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);
+ 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);
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);
}
resize_frame_client(hwnd);
}
-static BOOL activate_drive_window(LPCTSTR path)
+static BOOL activate_drive_window(LPCWSTR path)
{
- TCHAR drv1[_MAX_DRIVE], drv2[_MAX_DRIVE];
+ 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);
+ _wsplitpath(child->root.path, drv2, 0, 0, 0);
- if (!lstrcmpi(drv2, drv1)) {
- SendMessage(Globals.hmdiclient, WM_MDIACTIVATE, (WPARAM)child_wnd, 0);
+ if (!lstrcmpiW(drv2, drv1)) {
+ SendMessageW(Globals.hmdiclient, WM_MDIACTIVATE, (WPARAM)child_wnd, 0);
if (IsIconic(child_wnd))
ShowWindow(child_wnd, SW_SHOWNORMAL);
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);
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:
break;
case WM_INITMENUPOPUP: {
- HWND hwndClient = (HWND) SendMessage(Globals.hmdiclient, WM_MDIGETACTIVE, 0, 0);
+ HWND hwndClient = (HWND)SendMessageW(Globals.hmdiclient, WM_MDIGETACTIVE, 0, 0);
- if (!SendMessage(hwndClient, WM_INITMENUPOPUP, wparam, lparam))
+ 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);
+ HWND hwndClient = (HWND)SendMessageW(Globals.hmdiclient, WM_MDIGETACTIVE, 0, 0);
- if (SendMessage(hwndClient, WM_DISPATCH_COMMAND, wparam, lparam))
+ 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++)
if (activate_drive_window(root))
return 0;
- _tsplitpath(root, drv, 0, 0, 0);
+ _wsplitpath(root, drv, 0, 0, 0);
- if (!SetCurrentDirectory(drv)) {
+ 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))
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:
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());
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
#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))
#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))
/*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;
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);
+ MessageBoxW(hwnd, RS(b2,IDS_NO_IMPL), RS(b1,IDS_WINEFILE), MB_OK);
- return DefFrameProc(hwnd, Globals.hmdiclient, nmsg, wparam, lparam);
+ 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
#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 */
};
hdl.prc = &rt;
hdl.pwpos = ℘
- 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);
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;
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;
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;
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;
pane->positions[COLUMNS] = x;
- SendMessage(pane->hwnd, LB_SETHORIZONTALEXTENT, x, 0);
+ SendMessageW(pane->hwnd, LB_SETHORIZONTALEXTENT, x, 0);
/* no change? */
- if (!memcmp(orgWidths, pane->widths, sizeof(orgWidths)))
+ if (!anyway && !memcmp(orgWidths, pane->widths, sizeof(orgWidths)))
return FALSE;
/* don't move, if only collapsing an entry */
{
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;
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;
x = pane->positions[col] + cx;
- for(; col<COLUMNS; ) {
+ for(; col<COLUMNS-1; ) {
pane->positions[++col] = x;
x += pane->widths[col];
}
- SendMessage(pane->hwnd, LB_SETHORIZONTALEXTENT, x, 0);
+ SendMessageW(pane->hwnd, LB_SETHORIZONTALEXTENT, x, 0);
}
-static BOOL pattern_match(LPCTSTR str, LPCTSTR pattern)
+static BOOL pattern_match(LPCWSTR str, LPCWSTR pattern)
{
for( ; *str&&*pattern; str++,pattern++) {
if (*pattern == '*') {
return TRUE;
}
-static BOOL pattern_imatch(LPCTSTR str, LPCTSTR pattern)
+static BOOL pattern_imatch(LPCWSTR str, LPCWSTR pattern)
{
- TCHAR b1[BUFFER_LEN], b2[BUFFER_LEN];
+ WCHAR b1[BUFFER_LEN], b2[BUFFER_LEN];
- lstrcpy(b1, str);
- lstrcpy(b2, pattern);
- CharUpper(b1);
- CharUpper(b2);
+ lstrcpyW(b1, str);
+ lstrcpyW(b2, pattern);
+ CharUpperW(b1);
+ CharUpperW(b2);
return pattern_match(b1, b2);
}
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;
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);
}
-static void format_bytes(LPTSTR buffer, LONGLONG bytes)
+static void format_bytes(LPWSTR 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 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;
if (bytes >= 1073741824) /* 1 GB */
- _stprintf(buffer, sFmtGB, fBytes/1073741824.f+.5f);
+ sprintfW(buffer, sFmtGB, fBytes/1073741824.f+.5f);
else if (bytes >= 1048576) /* 1 MB */
- _stprintf(buffer, sFmtMB, fBytes/1048576.f+.5f);
+ sprintfW(buffer, sFmtMB, fBytes/1048576.f+.5f);
else if (bytes >= 1024) /* 1 kB */
- _stprintf(buffer, sFmtkB, fBytes/1024.f+.5f);
+ sprintfW(buffer, sFmtkB, fBytes/1024.f+.5f);
else
- _stprintf(buffer, sLongNumFmt, bytes);
+ sprintfW(buffer, sFmtB, (DWORD)bytes);
}
static void set_space_status(void)
{
ULARGE_INTEGER ulFreeBytesToCaller, ulTotalBytes, ulFreeBytes;
- TCHAR fmt[64], b1[64], b2[64], buffer[BUFFER_LEN];
+ WCHAR fmt[64], b1[64], b2[64], buffer[BUFFER_LEN];
- if (GetDiskFreeSpaceEx(NULL, &ulFreeBytesToCaller, &ulTotalBytes, &ulFreeBytes)) {
+ 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);
+ lstrcpyW(buffer, sQMarks);
- SendMessage(Globals.hstatusbar, SB_SETTEXT, 0, (LPARAM)buffer);
+ 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 void create_tree_window(HWND parent, Pane* pane, UINT id, UINT id_header, LPCWSTR pattern, int filter_flags)
{
- static const TCHAR sListBox[] = {'L','i','s','t','B','o','x','\0'};
+ 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);
+ SetWindowLongPtrW(pane->hwnd, GWLP_USERDATA, (LPARAM)pane);
+ g_orgTreeWndProc = (WNDPROC)SetWindowLongPtrW(pane->hwnd, GWLP_WNDPROC, (LPARAM)TreeWndProc);
- SendMessage(pane->hwnd, WM_SETFONT, (WPARAM)Globals.hfont, FALSE);
+ SendMessageW(pane->hwnd, WM_SETFONT, (WPARAM)Globals.hfont, FALSE);
/* insert entries into listbox */
if (entry)
}
-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;
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;
}
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);*/
+ DrawTextExW(dis->hDC, (LPWSTR)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));
+ 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])
}
-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;
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);
+ DrawTextW(dis->hDC, str, -1, &rt, DT_SINGLELINE|DT_NOPREFIX|flags);
}
-static void output_tabbed_text(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCTSTR str)
+static void output_tabbed_text(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCWSTR str)
{
int x = dis->rcItem.left;
RECT rt;
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);*/
+ DrawTextExW(dis->hDC, (LPWSTR)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));
+ DrawTextW(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)
+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;
*d++ = *s++;
/* insert number separator characters */
- pos = lstrlen(s) % 3;
+ pos = lstrlenW(s) % 3;
while(*s)
if (pos--)
pos = 3;
}
- DrawText(dis->hDC, b, d-b, &rt, DT_RIGHT|DT_SINGLELINE|DT_NOPREFIX|DT_END_ELLIPSIS);
+ DrawTextW(dis->hDC, b, d-b, &rt, DT_RIGHT|DT_SINGLELINE|DT_NOPREFIX|DT_END_ELLIPSIS);
}
-static BOOL is_exe_file(LPCTSTR ext)
+static BOOL is_exe_file(LPCWSTR ext)
{
- static const TCHAR executable_extensions[][4] = {
+ static const WCHAR executable_extensions[][4] = {
{'C','O','M','\0'},
{'E','X','E','\0'},
{'B','A','T','\0'},
{'\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)
+static enum FILE_TYPE get_file_type(LPCWSTR filename)
{
- LPCTSTR ext = _tcsrchr(filename, '.');
+ LPCWSTR ext = strrchrW(filename, '.');
if (!ext)
ext = sEmpty;
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;
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;
}
if (!(attrs&FILE_ATTRIBUTE_DIRECTORY))
#endif
{
- ULONGLONG size;
-
- size = ((ULONGLONG)entry->data.nFileSizeHigh << 32) | entry->data.nFileSizeLow;
-
- _stprintf(buffer, sLongNumFmt, size);
+ format_longlong( buffer, ((ULONGLONG)entry->data.nFileSizeHigh << 32) | entry->data.nFileSizeLow );
if (calcWidthCol == -1)
output_number(pane, dis, col, buffer);
#ifndef _NO_EXTENSIONS
if (entry->bhfi_valid) {
- ULONGLONG index = ((ULONGLONG)entry->bhfi.nFileIndexHigh << 32) | entry->bhfi.nFileIndexLow;
-
if (visible_cols & COL_INDEX) {
- _stprintf(buffer, sLongHexFmt, index);
+ static const WCHAR fmtlow[] = {'%','X',0};
+ static const WCHAR fmthigh[] = {'%','X','%','0','8','X',0};
+
+ if (entry->bhfi.nFileIndexHigh)
+ wsprintfW(buffer, fmthigh,
+ entry->bhfi.nFileIndexHigh, entry->bhfi.nFileIndexLow );
+ else
+ wsprintfW(buffer, fmtlow, entry->bhfi.nFileIndexLow );
if (calcWidthCol == -1)
output_text(pane, dis, col, buffer, DT_RIGHT);
}
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);
/* 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';
/*TODO
if (flags.security) {
- static const TCHAR sSecTabs[] = {
+ static const WCHAR sSecTabs[] = {
' ','\t',' ','\t',' ','\t',' ',
' ','\t',' ',
' ','\t',' ','\t',' ','\t',' ',
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';
static void set_header(Pane* pane)
{
- HD_ITEM item;
+ HDITEMW item;
int scroll_pos = GetScrollPos(pane->hwnd, SB_HORZ);
int i=0, x=0;
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);
}
}
}
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;
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);
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;}
}
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);
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;
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;
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);
static void set_curdir(ChildWnd* child, Entry* entry, int idx, HWND hwnd)
{
- TCHAR path[MAX_PATH];
+ WCHAR path[MAX_PATH];
if (!entry)
return;
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;
scan_entry(child, &child->root.entry, 0, child->hwnd);
#ifdef _SHELL_FOLDERS
+
if (child->root.entry.etype == ET_SHELL)
- entry = read_tree(&child->root, NULL, get_path_pidl(path,child->hwnd), drv, child->sortOrder, child->hwnd);
+ {
+ LPITEMIDLIST local_pidl = get_path_pidl(path,child->hwnd);
+ if (local_pidl)
+ entry = read_tree(&child->root, NULL, local_pidl , drv, child->sortOrder, child->hwnd);
+ else
+ entry = NULL;
+ }
else
#endif
entry = read_tree(&child->root, path, NULL, drv, child->sortOrder, child->hwnd);
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);
}
{
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;
+ PWSTR p;
- GetLogicalDriveStrings(BUFFER_LEN, Globals.drives);
+ 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,
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, IDS_SHELL);
- b1[lstrlen(b1)+1] = '\0';
- SendMessage(Globals.hdrivebar, TB_ADDSTRING, 0, (LPARAM)b1);
+ load_string(b1, sizeof(b1)/sizeof(b1[0]), IDS_SHELL);
+ 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;
for(p=Globals.drives; *p; ) {
#ifdef _NO_EXTENSIONS
/* insert drive letter */
- TCHAR b[3] = {tolower(*p)};
- SendMessage(Globals.hdrivebar, TB_ADDSTRING, 0, (LPARAM)b);
+ WCHAR b[3] = {tolower(*p)};
+ SendMessageW(Globals.hdrivebar, TB_ADDSTRINGW, 0, (LPARAM)b);
#endif
- switch(GetDriveType(p)) {
+ switch(GetDriveTypeW(p)) {
case DRIVE_REMOVABLE: drivebarBtn.iBitmap = 1; break;
case DRIVE_CDROM: drivebarBtn.iBitmap = 3; break;
case DRIVE_REMOTE: drivebarBtn.iBitmap = 4; break;
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++;
/* update window layout */
GetClientRect(Globals.hMainWnd, &rect);
- SendMessage(Globals.hMainWnd, WM_SIZE, 0, MAKELONG(rect.right, rect.bottom));
+ SendMessageW(Globals.hMainWnd, WM_SIZE, 0, MAKELONG(rect.right, rect.bottom));
}
-static BOOL launch_file(HWND hwnd, LPCTSTR cmd, UINT nCmdShow)
+static BOOL launch_file(HWND hwnd, LPCWSTR cmd, UINT nCmdShow)
{
- HINSTANCE hinst = ShellExecute(hwnd, NULL/*operation*/, cmd, NULL/*parameters*/, NULL/*dir*/, nCmdShow);
+ HINSTANCE hinst = ShellExecuteW(hwnd, NULL/*operation*/, cmd, NULL/*parameters*/, NULL/*dir*/, nCmdShow);
if (PtrToUlong(hinst) <= 32) {
display_error(hwnd, GetLastError());
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;
+ SHELLEXECUTEINFOW shexinfo;
- shexinfo.cbSize = sizeof(SHELLEXECUTEINFO);
+ shexinfo.cbSize = sizeof(SHELLEXECUTEINFOW);
shexinfo.fMask = SEE_MASK_IDLIST;
shexinfo.hwnd = hwnd;
shexinfo.lpVerb = NULL;
shexinfo.nShow = nCmdShow;
shexinfo.lpIDList = get_to_absolute_pidl(entry, hwnd);
- if (!ShellExecuteEx(&shexinfo)) {
+ if (!ShellExecuteExW(&shexinfo)) {
display_error(hwnd, GetLastError());
ret = FALSE;
}
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);
}
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);
}
}
}
-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)
+static BOOL prompt_target(Pane* pane, LPWSTR source, LPWSTR target)
{
- TCHAR path[MAX_PATH];
+ 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);
/* 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'};
+ WCHAR fname[_MAX_FNAME], ext[_MAX_EXT];
+ static const WCHAR sAppend[] = {'%','s','/','%','s','%','s','\0'};
- _tsplitpath(source, NULL, NULL, fname, ext);
+ _wsplitpath(source, NULL, NULL, fname, ext);
- wsprintf(target, sAppend, path, fname, ext);
+ wsprintfW(target, sAppend, path, fname, ext);
}
return TRUE;
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) {
case WM_NCDESTROY:
free_child_window(child);
- SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
+ SetWindowLongPtrW(hwnd, GWLP_USERDATA, 0);
break;
case WM_PAINT: {
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;
}
}
resize_tree(child, rt.right, rt.bottom);
last_split = -1;
ReleaseCapture();
- SetCursor(LoadCursor(0, IDC_ARROW));
+ SetCursor(LoadCursorW(0, (LPCWSTR)IDC_ARROW));
}
break;
#ifndef _NO_EXTENSIONS
case WM_GETMINMAXINFO:
- DefMDIChildProc(hwnd, nmsg, wparam, lparam);
+ DefMDIChildProcW(hwnd, nmsg, wparam, lparam);
{LPMINMAXINFO lpmmi = (LPMINMAXINFO)lparam;
#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;
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};
+ SHFILEOPSTRUCTW shfo = {hwnd, FO_MOVE, source, target};
- source[lstrlen(source)+1] = '\0';
- target[lstrlen(target)+1] = '\0';
+ source[lstrlenW(source)+1] = '\0';
+ target[lstrlenW(target)+1] = '\0';
- if (!SHFileOperation(&shfo))
+ 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};
+ SHFILEOPSTRUCTW shfo = {hwnd, FO_COPY, source, target};
- source[lstrlen(source)+1] = '\0';
- target[lstrlen(target)+1] = '\0';
+ source[lstrlenW(source)+1] = '\0';
+ target[lstrlenW(target)+1] = '\0';
- if (!SHFileOperation(&shfo))
+ 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';
+ path[lstrlenW(path)+1] = '\0';
- if (!SHFileOperation(&shfo))
+ if (!SHFileOperationW(&shfo))
refresh_child(child);
break;}
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);
}
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);
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);
/* fall through */
default: def:
- return DefMDIChildProc(hwnd, nmsg, wparam, lparam);
+ return DefMDIChildProcW(hwnd, nmsg, wparam, lparam);
}
return 0;
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) {
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;
}
}
- 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'};
+ static const WCHAR sFont[] = {'M','i','c','r','o','s','o','f','t',' ','S','a','n','s',' ','S','e','r','i','f','\0'};
- WNDCLASSEX wcFrame;
- WNDCLASS wcChild;
+ WNDCLASSEXW wcFrame;
+ WNDCLASSW wcChild;
ATOM hChildClass;
int col;
/* 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);
+ wcFrame.hIconSm = LoadImageW(hinstance, MAKEINTRESOURCEW(IDI_WINEFILE), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED);
- Globals.hframeClass = RegisterClassEx(&wcFrame);
+ Globals.hframeClass = RegisterClassExW(&wcFrame);
/* register tree windows class */
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);
+ hChildClass = RegisterClassW(&wcChild);
- Globals.haccel = LoadAccelerators(hinstance, MAKEINTRESOURCE(IDA_WINEFILE));
+ Globals.haccel = LoadAcceleratorsW(hinstance, MAKEINTRESOURCEW(IDA_WINEFILE));
- Globals.hfont = CreateFont(-MulDiv(8,GetDeviceCaps(hdc,LOGPIXELSY),72), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, sFont);
+ 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);
CoInitialize(NULL);
CoGetMalloc(MEMCTX_TASK, &Globals.iMalloc);
SHGetDesktopFolder(&Globals.iDesktop);
- Globals.cfStrFName = RegisterClipboardFormat(CFSTR_FILENAME);
+ Globals.cfStrFName = RegisterClipboardFormatW(CFSTR_FILENAMEW);
#endif
/* load column strings */
col = 1;
- load_string(g_pos_names[col++], IDS_COL_NAME);
- load_string(g_pos_names[col++], IDS_COL_SIZE);
- load_string(g_pos_names[col++], IDS_COL_CDATE);
+ load_string(g_pos_names[col++], sizeof(g_pos_names[col])/sizeof(g_pos_names[col][0]), IDS_COL_NAME);
+ load_string(g_pos_names[col++], sizeof(g_pos_names[col])/sizeof(g_pos_names[col][0]), IDS_COL_SIZE);
+ load_string(g_pos_names[col++], sizeof(g_pos_names[col])/sizeof(g_pos_names[col][0]), IDS_COL_CDATE);
#ifndef _NO_EXTENSIONS
- load_string(g_pos_names[col++], IDS_COL_ADATE);
- load_string(g_pos_names[col++], IDS_COL_MDATE);
- load_string(g_pos_names[col++], IDS_COL_IDX);
- load_string(g_pos_names[col++], IDS_COL_LINKS);
+ load_string(g_pos_names[col++], sizeof(g_pos_names[col])/sizeof(g_pos_names[col][0]), IDS_COL_ADATE);
+ load_string(g_pos_names[col++], sizeof(g_pos_names[col])/sizeof(g_pos_names[col][0]), IDS_COL_MDATE);
+ load_string(g_pos_names[col++], sizeof(g_pos_names[col])/sizeof(g_pos_names[col][0]), IDS_COL_IDX);
+ load_string(g_pos_names[col++], sizeof(g_pos_names[col])/sizeof(g_pos_names[col][0]), IDS_COL_LINKS);
#endif
- load_string(g_pos_names[col++], IDS_COL_ATTR);
+ load_string(g_pos_names[col++], sizeof(g_pos_names[col])/sizeof(g_pos_names[col][0]), IDS_COL_ATTR);
#ifndef _NO_EXTENSIONS
- load_string(g_pos_names[col++], IDS_COL_SEC);
+ load_string(g_pos_names[col++], sizeof(g_pos_names[col])/sizeof(g_pos_names[col][0]), IDS_COL_SEC);
#endif
}
-static void show_frame(HWND hwndParent, int cmdshow, LPCTSTR path)
+static BOOL show_frame(HWND hwndParent, int cmdshow, LPCWSTR path)
{
- static const TCHAR sMDICLIENT[] = {'M','D','I','C','L','I','E','N','T','\0'};
+ static const WCHAR sMDICLIENT[] = {'M','D','I','C','L','I','E','N','T','\0'};
- TCHAR buffer[MAX_PATH], b1[BUFFER_LEN];
+ WCHAR buffer[MAX_PATH], b1[BUFFER_LEN];
ChildWnd* child;
HMENU hMenuFrame, hMenuWindow;
windowOptions opts;
CLIENTCREATESTRUCT ccs;
if (Globals.hMainWnd)
- return;
+ 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;
/* 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);
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;
}
child->pos.rcNormalPosition.right = 320;
child->pos.rcNormalPosition.bottom = 280;
- if (!create_child_window(child))
+ if (!create_child_window(child)) {
HeapFree(GetProcessHeap(), 0, child);
+ return FALSE;
+ }
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;
UpdateWindow(Globals.hMainWnd);
- if (path && path[0])
+ 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;
}
}
}
}
+ return TRUE;
}
static void ExitInstance(void)
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;
}
}
/* 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);
#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);
- show_frame(0, cmdshow, path);
+ if( !show_frame(0, cmdshow, path) )
+ {
+ ExitInstance();
+ 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();
}
-#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)
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;
}