diff --git a/rosapps/applications/winfile/It.rc b/rosapps/applications/winfile/It.rc index bfbf6f12f57..f2012300057 100644 --- a/rosapps/applications/winfile/It.rc +++ b/rosapps/applications/winfile/It.rc @@ -164,7 +164,7 @@ FONT 8, "MS Shell Dlg" 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 @@ FONT 8, "MS Shell Dlg" 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." } diff --git a/rosapps/applications/winfile/splitpath.c b/rosapps/applications/winfile/splitpath.c index 42286eccac8..7425147ccbc 100644 --- a/rosapps/applications/winfile/splitpath.c +++ b/rosapps/applications/winfile/splitpath.c @@ -19,9 +19,6 @@ #include "winefile.h" -#ifdef __WINE__ -#ifdef UNICODE - void _wsplitpath(const WCHAR* path, WCHAR* drv, WCHAR* dir, WCHAR* name, WCHAR* ext) { const WCHAR* end; /* end of processed string */ @@ -75,81 +72,23 @@ void _wsplitpath(const WCHAR* path, WCHAR* drv, WCHAR* dir, WCHAR* name, WCHAR* } } -#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; slevel + 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 @@ static void read_directory_win(Entry* dir, LPCTSTR 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; @@ -402,7 +402,7 @@ static void read_directory_win(Entry* dir, LPCTSTR path) 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 @@ static void read_directory_win(Entry* dir, LPCTSTR path) 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) { @@ -427,7 +427,7 @@ static void read_directory_win(Entry* dir, LPCTSTR path) #endif last = entry; - } while(FindNextFile(hFind, &w32fd)); + } while(FindNextFileW(hFind, &w32fd)); if (last) last->next = NULL; @@ -440,13 +440,13 @@ static void read_directory_win(Entry* dir, LPCTSTR path) } -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* find_entry_win(Entry* dir, LPCTSTR name) } -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; @@ -527,7 +527,7 @@ static BOOL time_to_filetime(const time_t* t, FILETIME* ftime) 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 @@ static void read_directory_unix(Entry* dir, LPCTSTR path) 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 @@ static void read_directory_unix(Entry* dir, LPCTSTR path) 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 @@ static void read_directory_unix(Entry* dir, LPCTSTR path) 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 @@ static Entry* find_entry_unix(Entry* dir, LPCTSTR name) 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; @@ -678,69 +669,12 @@ static Entry* read_tree_unix(Root* root, LPCTSTR path, SORT_ORDER sortOrder, HWN #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; @@ -769,14 +703,14 @@ static void get_strretW(STRRET* str, const SHITEMID* shiid, LPWSTR buffer, int l } -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'; @@ -804,18 +738,12 @@ static HRESULT path_from_pidlW(IShellFolder* folder, LPITEMIDLIST pidl, LPWSTR b /* 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 @@ static LPITEMIDLIST get_to_absolute_pidl(Entry* entry, HWND hwnd) 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 LPITEMIDLIST get_to_absolute_pidl(Entry* entry, HWND hwnd) 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; @@ -866,7 +794,7 @@ static HICON extract_icon(IShellFolder* folder, LPCITEMIDLIST pidl) 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 @@ static Entry* read_tree_shell(Root* root, LPITEMIDLIST pidl, SORT_ORDER sortOrde 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 Entry* read_tree_shell(Root* root, LPITEMIDLIST pidl, SORT_ORDER sortOrde } -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 @@ static void fill_w32fdata_shell(IShellFolder* folder, LPCITEMIDLIST pidl, SFGAOF 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 @@ static void read_directory_shell(Entry* dir, HWND hwnd) 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 @@ enum TYPE_ORDER { }; /* 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 @@ static int TypeOrderFromDirname(LPCTSTR name) } /* 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 compareType(const WIN32_FIND_DATA* fd1, const WIN32_FIND_DATA* fd2) 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 @@ static int compareExt(const void* arg1, const void* arg2) 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 compareSize(const void* arg1, const void* arg2) 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 SortDirectory(Entry* dir, SORT_ORDER sortOrder) } -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) @@ -1323,7 +1251,7 @@ static void read_directory(Entry* dir, LPCTSTR path, SORT_ORDER sortOrder, HWND 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 @@ static void read_directory(Entry* dir, LPCTSTR path, SORT_ORDER sortOrder, HWND 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 void read_directory(Entry* dir, LPCTSTR path, SORT_ORDER sortOrder, HWND } -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) @@ -1381,27 +1309,27 @@ static Entry* read_tree(Root* root, LPCTSTR path, LPITEMIDLIST pidl, LPTSTR drv, #if !defined(_NO_EXTENSIONS) && defined(__WINE__) if (*path == '/') { - /* read unix file system tree */ - root->drive_type = GetDriveType(path); + /* read unix file system tree */ + root->drive_type = GetDriveTypeW(path); - lstrcat(drv, sSlash); + 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); + 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); } @@ -1418,12 +1346,12 @@ enum TYPE_FILTER { }; -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; @@ -1456,18 +1384,18 @@ static ChildWnd* alloc_child_window(LPCTSTR path, LPITEMIDLIST pidl, HWND hwnd) 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 @@ -1475,7 +1403,7 @@ static ChildWnd* alloc_child_window(LPCTSTR path, LPITEMIDLIST pidl, HWND hwnd) 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 @@ static void free_child_window(ChildWnd* child) /* 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 @@ static void get_path(Entry* dir, PTSTR path) 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 @@ static void get_path(Entry* dir, PTSTR path) 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 @@ static void get_path(Entry* dir, PTSTR path) 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 @@ static windowOptions load_registry_settings(void) 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 @@ static windowOptions load_registry_settings(void) 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 @@ static void save_registry_settings(void) WINDOWINFO wi; HKEY hKey; INT width, height; - LOGFONT logfont; + LOGFONTW logfont; wi.cbSize = sizeof( WINDOWINFO ); GetWindowInfo(Globals.hMainWnd, &wi); @@ -1646,9 +1574,9 @@ static void save_registry_settings(void) (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 @@ static void resize_frame_rect(HWND hwnd, PRECT prect) 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 @@ static void resize_frame_rect(HWND hwnd, PRECT prect) 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 @@ static LRESULT CALLBACK CBTProc(int code, WPARAM wparam, LPARAM lparam) 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 LRESULT CALLBACK CBTProc(int code, WPARAM wparam, LPARAM 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; @@ -1740,10 +1668,10 @@ static HWND create_child_window(ChildWnd* child) 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 @@ static HWND create_child_window(ChildWnd* child) 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; }; @@ -1779,7 +1707,7 @@ static INT_PTR CALLBACK ExecuteDialogDlgProc(HWND hwnd, UINT nmsg, WPARAM wparam 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 ExecuteDialogDlgProc(HWND hwnd, UINT nmsg, WPARAM wparam 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 @@ static INT_PTR CALLBACK DestinationDlgProc(HWND hwnd, UINT nmsg, WPARAM wparam, 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 @@ static INT_PTR CALLBACK DestinationDlgProc(HWND hwnd, UINT nmsg, WPARAM wparam, 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 @@ static INT_PTR CALLBACK DestinationDlgProc(HWND hwnd, UINT nmsg, WPARAM wparam, struct FilterDialog { - TCHAR pattern[MAX_PATH]; + WCHAR pattern[MAX_PATH]; int flags; }; @@ -1841,7 +1769,7 @@ static INT_PTR CALLBACK FilterDialogDlgProc(HWND hwnd, UINT nmsg, WPARAM wparam, 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 @@ static INT_PTR CALLBACK FilterDialogDlgProc(HWND hwnd, UINT nmsg, WPARAM wparam, 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 @@ static INT_PTR CALLBACK FilterDialogDlgProc(HWND hwnd, UINT nmsg, WPARAM wparam, struct PropertiesDialog { - TCHAR path[MAX_PATH]; + WCHAR path[MAX_PATH]; Entry entry; void* pVersionData; }; @@ -1906,32 +1834,32 @@ static LPCSTR InfoStrings[] = { 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]; @@ -1945,7 +1873,7 @@ static void CheckForFileInfo(struct PropertiesDialog* dlg, HWND hwnd, LPCTSTR st } /* 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 @@ static void CheckForFileInfo(struct PropertiesDialog* dlg, HWND hwnd, LPCTSTR st 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 @@ static INT_PTR CALLBACK PropertiesDialogDlgProc(HWND hwnd, UINT nmsg, WPARAM wpa 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; + 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); format_longlong( b1, ((ULONGLONG)pWFD->nFileSizeHigh << 32) | pWFD->nFileSizeLow ); - wsprintf(b2, sByteFmt, b1); - SetWindowText(GetDlgItem(hwnd, IDC_STATIC_PROP_SIZE), b2); + 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); @@ -2057,7 +1979,7 @@ static void show_properties_dlg(Entry* entry, HWND hwnd) 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 @@ static void toggle_child(HWND hwnd, UINT cmd, HWND hchild) 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); @@ -2202,17 +2124,17 @@ static BOOL activate_drive_window(LPCTSTR path) 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 BOOL activate_fs_window(LPCTSTR filesys) 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 @@ static LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM 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++) @@ -2276,28 +2198,28 @@ static LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM 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)) @@ -2309,19 +2231,19 @@ static LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM 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 @@ static LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM 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 @@ static LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM 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 @@ static LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM #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 @@ static LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM #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 @@ static LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM /*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 @@ static LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM STRING_SelectLanguageByNumber(wParam - PM_FIRST_LANGUAGE); else */if ((cmd=IDW_FIRST_CHILD+0x100) && (cmdSC_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 @@ -2480,14 +2396,14 @@ static LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM #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 @@ static void resize_tree(ChildWnd* child, int cx, int cy) 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); @@ -2548,15 +2464,15 @@ static void resize_tree(ChildWnd* child, int cx, int cy) 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 @@ static HWND create_header(HWND parent, Pane* pane, UINT id) 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 void draw_item(Pane* pane, LPDRAWITEMSTRUCT dis, Entry* entry, int calcWi 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 @@ static BOOL calc_widths(Pane* pane, BOOL anyway) hfontOld = SelectObject(hdc, Globals.hfont); for(cnt=0; cnthwnd, LB_GETITEMDATA, cnt, 0); + Entry* entry = (Entry*)SendMessageW(pane->hwnd, LB_GETITEMDATA, cnt, 0); DRAWITEMSTRUCT dis; @@ -2660,7 +2576,7 @@ static BOOL calc_widths(Pane* pane, BOOL anyway) 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 @@ static void calc_single_width(Pane* pane, int col) { 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 @@ static void calc_single_width(Pane* pane, int col) hfontOld = SelectObject(hdc, Globals.hfont); for(cnt=0; cnthwnd, LB_GETITEMDATA, cnt, 0); + Entry* entry = (Entry*)SendMessageW(pane->hwnd, LB_GETITEMDATA, cnt, 0); DRAWITEMSTRUCT dis; dis.CtlType = 0; @@ -2737,11 +2653,11 @@ static void calc_single_width(Pane* pane, int col) 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 == '*') { @@ -2768,14 +2684,14 @@ static BOOL pattern_match(LPCTSTR str, LPCTSTR 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); } @@ -2787,12 +2703,12 @@ enum FILE_TYPE { 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 @@ static int insert_entries(Pane* pane, Entry* dir, LPCTSTR pattern, int filter_fl 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 int insert_entries(Pane* pane, Entry* dir, LPCTSTR pattern, int filter_fl } -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 TCHAR sFmtB[] = {'%', 'u', 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; @@ -2886,36 +2802,36 @@ static void format_bytes(LPTSTR buffer, LONGLONG 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) @@ -2942,7 +2858,7 @@ static void InitChildWindow(ChildWnd* child) } -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 @@ static void format_date(const FILETIME* ft, TCHAR* buffer, int visible_cols) 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 @@ static void format_date(const FILETIME* ft, TCHAR* buffer, int visible_cols) 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]) @@ -3002,7 +2918,7 @@ static void calc_tabbed_width(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCTSTR } -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 @@ static void output_text(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCTSTR str, 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; @@ -3026,18 +2942,18 @@ static void output_tabbed_text(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCTST 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; @@ -3049,7 +2965,7 @@ static void output_number(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCTSTR str *d++ = *s++; /* insert number separator characters */ - pos = lstrlen(s) % 3; + pos = lstrlenW(s) % 3; while(*s) if (pos--) @@ -3059,13 +2975,13 @@ static void output_number(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCTSTR str 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'}, @@ -3078,33 +2994,33 @@ static BOOL is_exe_file(LPCTSTR ext) {'\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 = strrchrW(filename, '.'); + LPCWSTR ext = strrchrW(filename, '.'); if (!ext) ext = sEmpty; @@ -3119,7 +3035,7 @@ static enum FILE_TYPE get_file_type(LPCTSTR filename) 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 @@ static void draw_item(Pane* pane, LPDRAWITEMSTRUCT dis, Entry* entry, int calcWi 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 @@ static void draw_item(Pane* pane, LPDRAWITEMSTRUCT dis, Entry* entry, int calcWi #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 @@ static void draw_item(Pane* pane, LPDRAWITEMSTRUCT dis, Entry* entry, int calcWi } 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 @@ static void draw_item(Pane* pane, LPDRAWITEMSTRUCT dis, Entry* entry, int calcWi /* 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 @@ static void draw_item(Pane* pane, LPDRAWITEMSTRUCT dis, Entry* entry, int calcWi /*TODO if (flags.security) { - static const TCHAR sSecTabs[] = { + static const WCHAR sSecTabs[] = { ' ','\t',' ','\t',' ','\t',' ', ' ','\t',' ', ' ','\t',' ','\t',' ','\t',' ', @@ -3437,7 +3353,7 @@ static void draw_item(Pane* pane, LPDRAWITEMSTRUCT dis, Entry* entry, int calcWi 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 draw_splitbar(HWND hwnd, int x) 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 @@ static void set_header(Pane* pane) for(; x+pane->widths[i]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(; iwidths[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 void set_header(Pane* pane) 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 @@ static LRESULT pane_notify(Pane* pane, NMHDR* pnmh) 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 @@ static LRESULT pane_notify(Pane* pane, NMHDR* pnmh) 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 LRESULT pane_notify(Pane* pane, NMHDR* pnmh) 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 @@ static BOOL expand_entry(ChildWnd* child, Entry* dir) 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 BOOL expand_entry(ChildWnd* child, Entry* dir) 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 collapse_entry(Pane* pane, Entry* dir) 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 refresh_right_pane(ChildWnd* child) 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 @@ static void set_curdir(ChildWnd* child, Entry* entry, int idx, HWND hwnd) 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 @@ static void refresh_child(ChildWnd* child) 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 @@ static void create_drive_bar(void) { 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, @@ -3827,25 +3743,25 @@ static void create_drive_bar(void) 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 @@ static void create_drive_bar(void) 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; @@ -3864,7 +3780,7 @@ static void create_drive_bar(void) 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 @@ static void refresh_drives(void) /* 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()); @@ -3904,15 +3820,15 @@ static BOOL launch_file(HWND hwnd, LPCTSTR cmd, UINT nCmdShow) 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; @@ -3922,7 +3838,7 @@ static BOOL launch_entry(Entry* entry, HWND hwnd, UINT nCmdShow) 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 @@ static void activate_entry(ChildWnd* child, Pane* pane, HWND hwnd) 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 @@ static void activate_entry(ChildWnd* child, Pane* pane, HWND 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); } } @@ -4061,25 +3977,25 @@ static void update_view_menu(ChildWnd* child) } -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); @@ -4087,23 +4003,23 @@ static BOOL prompt_target(Pane* pane, LPTSTR source, LPTSTR target) /* 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; @@ -4202,7 +4118,7 @@ static HRESULT ShellFolderContextMenu(IShellFolder* shell_folder, HWND hwndParen 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 @@ static LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM 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 @@ static LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM ScreenToClient(hwnd, &pt); if (pt.x>=child->split_pos-SPLIT_WIDTH/2 && pt.xsplit_pos+SPLIT_WIDTH/2+1) { - SetCursor(LoadCursor(0, IDC_SIZEWE)); + SetCursor(LoadCursorW(0, (LPCWSTR)IDC_SIZEWE)); return TRUE; } } @@ -4310,7 +4226,7 @@ static LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM 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 @@ static LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM #ifndef _NO_EXTENSIONS case WM_GETMINMAXINFO: - DefMDIChildProc(hwnd, nmsg, wparam, lparam); + DefMDIChildProcW(hwnd, nmsg, wparam, lparam); {LPMINMAXINFO lpmmi = (LPMINMAXINFO)lparam; @@ -4362,7 +4278,7 @@ static LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, 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; @@ -4389,42 +4305,42 @@ static LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM 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;} @@ -4448,11 +4364,11 @@ static LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM 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 @@ static LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM 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 @@ static LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM 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 @@ static LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM /* 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 ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM 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 @@ static LRESULT CALLBACK TreeWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM 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 @@ static LRESULT CALLBACK TreeWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM } } - 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; @@ -4635,25 +4551,20 @@ static void InitInstance(HINSTANCE hinstance) /* 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 */ @@ -4664,17 +4575,17 @@ static void InitInstance(HINSTANCE hinstance) 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); @@ -4684,7 +4595,7 @@ static void InitInstance(HINSTANCE hinstance) 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 void InitInstance(HINSTANCE hinstance) } -static BOOL 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; @@ -4721,7 +4632,7 @@ static BOOL show_frame(HWND hwndParent, int cmdshow, LPCTSTR path) 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 @@ static BOOL show_frame(HWND hwndParent, int cmdshow, LPCTSTR path) /* 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 @@ static BOOL show_frame(HWND hwndParent, int cmdshow, LPCTSTR path) 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 @@ static BOOL show_frame(HWND hwndParent, int cmdshow, LPCTSTR path) 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 @@ static BOOL show_frame(HWND hwndParent, int cmdshow, LPCTSTR path) 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 int g_foundPrevInstance = 0; 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 @@ static BOOL CALLBACK EnumWndProc(HWND hwnd, LPARAM lparam) } /* 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 @@ static int find_window_class(LPCTSTR 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); if( !show_frame(0, cmdshow, path) ) @@ -4897,15 +4808,15 @@ static int winefile_main(HINSTANCE hinstance, int cmdshow, LPCTSTR path) 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 @@ static int winefile_main(HINSTANCE hinstance, int cmdshow, LPCTSTR path) } -#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 @@ int APIENTRY WinMain(HINSTANCE hinstance, HINSTANCE previnstance, LPSTR cmdline, 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; } diff --git a/rosapps/applications/winfile/winefile.h b/rosapps/applications/winfile/winefile.h index 7c1f66c6ca2..ab294c1cb5b 100644 --- a/rosapps/applications/winfile/winefile.h +++ b/rosapps/applications/winfile/winefile.h @@ -43,7 +43,7 @@ #include #include -#include /* for ShellExecute() */ +#include /* for ShellExecuteW() */ #include /* for SHFormatDrive() */ #ifndef _NO_EXTENSIONS @@ -128,11 +128,11 @@ typedef struct 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 @@ typedef struct 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 /* for _tsplitpath() */ - -#endif