WINE build compatibility

svn path=/trunk/; revision=5931
This commit is contained in:
Martin Fuchs 2003-08-30 11:30:18 +00:00
parent 2566f13f3e
commit b69868a964
12 changed files with 86 additions and 48 deletions

View file

@ -38,6 +38,8 @@
#include "explorer_intres.h" #include "explorer_intres.h"
#include <locale.h>
ExplorerGlobals g_Globals; ExplorerGlobals g_Globals;

View file

@ -8,8 +8,10 @@
// Generated from the TEXTINCLUDE 2 resource. // Generated from the TEXTINCLUDE 2 resource.
// //
#ifndef _ROS_ #ifndef _ROS_
#ifndef __WINE__
#include "afxres.h" #include "afxres.h"
#endif #endif
#endif
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS #undef APSTUDIO_READONLY_SYMBOLS
@ -140,9 +142,8 @@ IDB_LOGOV BITMAP DISCARDABLE "res/logov.bmp"
IDA_EXPLORER ACCELERATORS DISCARDABLE IDA_EXPLORER ACCELERATORS DISCARDABLE
BEGIN BEGIN
"X", ID_FILE_EXIT, VIRTKEY, ALT, NOINVERT 0x58, ID_FILE_EXIT, VIRTKEY, ALT, NOINVERT
"S", ID_VIEW_FULLSCREEN, VIRTKEY, SHIFT, CONTROL, 0x53, ID_VIEW_FULLSCREEN, VIRTKEY, SHIFT, CONTROL, NOINVERT
NOINVERT
END END
#endif // Neutral resources #endif // Neutral resources

View file

@ -89,15 +89,15 @@ FileChildWindow::FileChildWindow(HWND hwnd, const FileChildWndInfo& info)
#ifdef __linux__ #ifdef __linux__
if (info._etype == ET_UNIX) if (info._etype == ET_UNIX)
{ {
_root.drive_type = GetDriveType(path); _root._drive_type = GetDriveType(info._path);
_tsplitpath(info._path, drv, NULL, NULL, NULL); _tsplitpath(info._path, drv, NULL, NULL, NULL);
lstrcat(drv, TEXT("/")); lstrcat(drv, TEXT("/"));
lstrcpy(_root.volname, TEXT("root fs")); lstrcpy(_root._volname, TEXT("root fs"));
_root.fs_flags = 0; _root._fs_flags = 0;
lstrcpy(_root.fs, TEXT("unixfs")); lstrcpy(_root._fs, TEXT("unixfs"));
lstrcpy(_root.path, TEXT("/")); lstrcpy(_root._path, TEXT("/"));
_root._entry = new UnixDirectory(_root._path, info._path); _root._entry = new UnixDirectory(_root._path);
entry = _root._entry->read_tree(info._path, SORT_NAME/*_sortOrder*/); entry = _root._entry->read_tree(info._path, SORT_NAME/*_sortOrder*/);
} }
else else

View file

@ -33,6 +33,8 @@
#include "../explorer_intres.h" #include "../explorer_intres.h"
//#include <tchar.h> // for _splitpath()
MainFrame::MainFrame(HWND hwnd) MainFrame::MainFrame(HWND hwnd)
: super(hwnd) : super(hwnd)

View file

@ -37,11 +37,10 @@
// for UnixDirectory::read_directory() // for UnixDirectory::read_directory()
#include <dirent.h> #include <dirent.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h>
#include <time.h> #include <time.h>
void UnixDirectory::read_directory(LPCTSTR path) void UnixDirectory::read_directory()
{ {
Entry* first_entry = NULL; Entry* first_entry = NULL;
Entry* last = NULL; Entry* last = NULL;
@ -49,6 +48,7 @@ void UnixDirectory::read_directory(LPCTSTR path)
int level = _level + 1; int level = _level + 1;
LPCTSTR path = (LPCTSTR)_path;
DIR* pdir = opendir(path); DIR* pdir = opendir(path);
if (pdir) { if (pdir) {
@ -63,7 +63,9 @@ void UnixDirectory::read_directory(LPCTSTR path)
*p++ = '/'; *p++ = '/';
while((ent=readdir(pdir))) { while((ent=readdir(pdir))) {
if (w32fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) int statres = stat(buffer, &st);
if (!statres && S_ISDIR(st.st_mode))
entry = new UnixDirectory(this, buffer); entry = new UnixDirectory(this, buffer);
else else
entry = new UnixEntry(this); entry = new UnixEntry(this);
@ -72,46 +74,46 @@ void UnixDirectory::read_directory(LPCTSTR path)
first_entry = entry; first_entry = entry;
if (last) if (last)
last->next = entry; last->_next = entry;
lstrcpy(entry->data.cFileName, ent->d_name); lstrcpy(entry->_data.cFileName, ent->d_name);
entry->data.dwFileAttributes = ent->d_name[0]=='.'? FILE_ATTRIBUTE_HIDDEN: 0; entry->_data.dwFileAttributes = ent->d_name[0]=='.'? FILE_ATTRIBUTE_HIDDEN: 0;
strcpy(p, ent->d_name); strcpy(p, ent->d_name);
if (!stat(buffer, &st)) { if (!statres) {
if (S_ISDIR(st.st_mode)) if (S_ISDIR(st.st_mode))
entry->data.dwFileAttributes |= FILE_ATTRIBUTE_DIRECTORY; entry->_data.dwFileAttributes |= FILE_ATTRIBUTE_DIRECTORY;
entry->data.nFileSizeLow = st.st_size & 0xFFFFFFFF; entry->_data.nFileSizeLow = st.st_size & 0xFFFFFFFF;
entry->data.nFileSizeHigh = st.st_size >> 32; entry->_data.nFileSizeHigh = st.st_size >> 32;
memset(&entry->data.ftCreationTime, 0, sizeof(FILETIME)); memset(&entry->_data.ftCreationTime, 0, sizeof(FILETIME));
time_to_filetime(&st.st_atime, &entry->data.ftLastAccessTime); time_to_filetime(&st.st_atime, &entry->_data.ftLastAccessTime);
time_to_filetime(&st.st_mtime, &entry->data.ftLastWriteTime); time_to_filetime(&st.st_mtime, &entry->_data.ftLastWriteTime);
entry->bhfi.nFileIndexLow = ent->d_ino; entry->_bhfi.nFileIndexLow = ent->d_ino;
entry->bhfi.nFileIndexHigh = 0; entry->_bhfi.nFileIndexHigh = 0;
entry->bhfi.nNumberOfLinks = st.st_nlink; entry->_bhfi.nNumberOfLinks = st.st_nlink;
entry->bhfi_valid = TRUE; entry->_bhfi_valid = TRUE;
} else { } else {
entry->data.nFileSizeLow = 0; entry->_data.nFileSizeLow = 0;
entry->data.nFileSizeHigh = 0; entry->_data.nFileSizeHigh = 0;
entry->bhfi_valid = FALSE; entry->_bhfi_valid = FALSE;
} }
entry->down = NULL; entry->_down = NULL;
entry->up = dir; entry->_up = this;
entry->expanded = FALSE; entry->_expanded = FALSE;
entry->scanned = FALSE; entry->_scanned = FALSE;
entry->level = level; entry->_level = level;
last = entry; last = entry;
} }
last->next = NULL; last->_next = NULL;
closedir(pdir); closedir(pdir);
} }
@ -142,9 +144,9 @@ Entry* UnixDirectory::find_entry(const void* p)
{ {
LPCTSTR name = (LPCTSTR)p; LPCTSTR name = (LPCTSTR)p;
for(Entry*entry=_down; entry; entry=entry->next) { for(Entry*entry=_down; entry; entry=entry->_next) {
LPCTSTR p = name; LPCTSTR p = name;
LPCTSTR q = entry->data.cFileName; LPCTSTR q = entry->_data.cFileName;
do { do {
if (!*p || *p==TEXT('/')) if (!*p || *p==TEXT('/'))
@ -162,7 +164,7 @@ void UnixEntry::get_path(PTSTR path) const
int level = 0; int level = 0;
int len = 0; int len = 0;
for(Entry* entry=this; entry; level++) { for(const Entry* entry=this; entry; level++) {
LPCTSTR name = entry->_data.cFileName; LPCTSTR name = entry->_data.cFileName;
int l = 0; int l = 0;

View file

@ -47,7 +47,7 @@ struct UnixDirectory : public UnixEntry, public Directory
} }
UnixDirectory(UnixDirectory* parent, LPCTSTR path) UnixDirectory(UnixDirectory* parent, LPCTSTR path)
: UnixEntry(parent), : UnixEntry(parent)
{ {
_path = _tcsdup(path); _path = _tcsdup(path);
} }

View file

@ -798,7 +798,7 @@ void StartMenuRoot::ShowRestartDialog(HWND hwndOwner, UINT flags)
RESTARTWINDOWSDLG RestartDlg = (RESTARTWINDOWSDLG)GetProcAddress(hShell32, (LPCSTR)59); RESTARTWINDOWSDLG RestartDlg = (RESTARTWINDOWSDLG)GetProcAddress(hShell32, (LPCSTR)59);
if (RestartDlg) if (RestartDlg)
RestartDlg(hwndOwner, L"You selected <Log Off>.\n\n", flags); //TODO: ANSI string conversion if needed RestartDlg(hwndOwner, (LPWSTR)L"You selected <Log Off>.\n\n", flags); //TODO: ANSI string conversion if needed
} }
void StartMenuRoot::ShowSearchDialog() void StartMenuRoot::ShowSearchDialog()

View file

@ -325,7 +325,7 @@ EnumFormatEtcImpl::EnumFormatEtcImpl(const StorageArray& ArrFE)
m_pFmtEtc.push_back(*it->_format); m_pFmtEtc.push_back(*it->_format);
} }
STDMETHODIMP EnumFormatEtcImpl::QueryInterface(REFIID refiid, void FAR* FAR* ppv) STDMETHODIMP EnumFormatEtcImpl::QueryInterface(REFIID refiid, void** ppv)
{ {
*ppv = NULL; *ppv = NULL;
if (IID_IUnknown==refiid || IID_IEnumFORMATETC==refiid) if (IID_IUnknown==refiid || IID_IEnumFORMATETC==refiid)
@ -356,7 +356,7 @@ STDMETHODIMP_(ULONG) EnumFormatEtcImpl::Release(void)
return nTemp; return nTemp;
} }
STDMETHODIMP EnumFormatEtcImpl::Next( ULONG celt,LPFORMATETC lpFormatEtc, ULONG FAR *pceltFetched) STDMETHODIMP EnumFormatEtcImpl::Next( ULONG celt,LPFORMATETC lpFormatEtc, ULONG* pceltFetched)
{ {
if (pceltFetched != NULL) if (pceltFetched != NULL)
*pceltFetched=0; *pceltFetched=0;
@ -395,7 +395,7 @@ STDMETHODIMP EnumFormatEtcImpl::Reset(void)
return S_OK; return S_OK;
} }
STDMETHODIMP EnumFormatEtcImpl::Clone(IEnumFORMATETC FAR * FAR*ppCloneEnumFormatEtc) STDMETHODIMP EnumFormatEtcImpl::Clone(IEnumFORMATETC** ppCloneEnumFormatEtc)
{ {
if (ppCloneEnumFormatEtc == NULL) if (ppCloneEnumFormatEtc == NULL)
return E_POINTER; return E_POINTER;

View file

@ -34,15 +34,15 @@ class EnumFormatEtcImpl : public IEnumFORMATETC
EnumFormatEtcImpl(const StorageArray& ArrFE); EnumFormatEtcImpl(const StorageArray& ArrFE);
//IUnknown members //IUnknown members
STDMETHOD(QueryInterface)(REFIID, void FAR* FAR*); STDMETHOD(QueryInterface)(REFIID, void**);
STDMETHOD_(ULONG, AddRef)(void); STDMETHOD_(ULONG, AddRef)(void);
STDMETHOD_(ULONG, Release)(void); STDMETHOD_(ULONG, Release)(void);
//IEnumFORMATETC members //IEnumFORMATETC members
STDMETHOD(Next)(ULONG, LPFORMATETC, ULONG FAR *); STDMETHOD(Next)(ULONG, LPFORMATETC, ULONG*);
STDMETHOD(Skip)(ULONG); STDMETHOD(Skip)(ULONG);
STDMETHOD(Reset)(void); STDMETHOD(Reset)(void);
STDMETHOD(Clone)(IEnumFORMATETC FAR * FAR*); STDMETHOD(Clone)(IEnumFORMATETC**);
}; };
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////

View file

@ -742,7 +742,7 @@ struct SpecialFolderPath : public ShellPath
{ {
SpecialFolderPath(int folder, HWND hwnd) SpecialFolderPath(int folder, HWND hwnd)
{ {
HRESULT hr = SHGetSpecialFolderLocation(hwnd, folder, &_p); /*HRESULT hr = */SHGetSpecialFolderLocation(hwnd, folder, &_p);
} }
}; };

View file

@ -42,25 +42,40 @@
#include <malloc.h> // for alloca() #include <malloc.h> // for alloca()
#include <assert.h> #include <assert.h>
#include <stdlib.h> // for _MAX_DIR, ...
#include <stdio.h> // for sprintf()
#include <time.h> #include <time.h>
#ifndef _MAX_PATH
#define _MAX_DRIVE 3
#define _MAX_FNAME 256
#define _MAX_DIR _MAX_FNAME
#define _MAX_EXT _MAX_FNAME
#define _MAX_PATH 260
#endif
#ifndef BTNS_BUTTON #ifndef BTNS_BUTTON
#define BTNS_BUTTON TBSTYLE_BUTTON //missing in old mingw headers #define BTNS_BUTTON TBSTYLE_BUTTON //missing in old mingw headers
#define BTNS_SEP TBSTYLE_SEP #define BTNS_SEP TBSTYLE_SEP
#define BTNS_NOPREFIX TBSTYLE_NOPREFIX #define BTNS_NOPREFIX TBSTYLE_NOPREFIX
#endif #endif
#ifndef TB_HITTEST //missing in mingw headers #ifndef TB_HITTEST //missing in mingw headers
#define TB_HITTEST (WM_USER+69) #define TB_HITTEST (WM_USER+69)
#endif #endif
#ifndef TB_GETBUTTONINFO //missing in mingw headers #ifndef TB_GETBUTTONINFO //missing in mingw headers
#define TB_GETBUTTONINFO (WM_USER+65) #define TB_GETBUTTONINFO (WM_USER+65)
#endif #endif
#ifndef __WINE__
#ifndef SFGAO_HIDDEN //SFGAO_GHOSTED wrong defined, SFGAO_HIDDEN missing in mingw headers #ifndef SFGAO_HIDDEN //SFGAO_GHOSTED wrong defined, SFGAO_HIDDEN missing in mingw headers
#define SFGAO_HIDDEN 0x00080000L #define SFGAO_HIDDEN 0x00080000L
#undef SFGAO_GHOSTED #undef SFGAO_GHOSTED
#define SFGAO_GHOSTED 0x00008000L #define SFGAO_GHOSTED 0x00008000L
#endif #endif
#endif
@ -438,6 +453,22 @@ extern "C" {
#endif #endif
#ifdef __WINE__
#ifdef UNICODE
extern void _wsplitpath(const WCHAR* path, WCHAR* drv, WCHAR* dir, WCHAR* name, WCHAR* ext);
#else
extern void _splitpath(const CHAR* path, CHAR* drv, CHAR* dir, CHAR* name, CHAR* ext);
#endif
#endif
#ifndef FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
#define FILE_ATTRIBUTE_ENCRYPTED 0x00000040
#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
#endif
#define SetDlgCtrlID(hwnd, id) SetWindowLong(hwnd, GWL_ID, id) #define SetDlgCtrlID(hwnd, id) SetWindowLong(hwnd, GWL_ID, id)
#define SetWindowStyle(hwnd, val) (DWORD)SetWindowLong(hwnd, GWL_STYLE, val) #define SetWindowStyle(hwnd, val) (DWORD)SetWindowLong(hwnd, GWL_STYLE, val)
#define SetWindowExStyle(h, val) (DWORD)SetWindowLong(hwnd, GWL_EXSTYLE, val) #define SetWindowExStyle(h, val) (DWORD)SetWindowLong(hwnd, GWL_EXSTYLE, val)

View file

@ -473,7 +473,7 @@ struct ToolTip : public WindowHandle
void add(HWND hparent, HWND htool, LPCTSTR txt=LPSTR_TEXTCALLBACK) void add(HWND hparent, HWND htool, LPCTSTR txt=LPSTR_TEXTCALLBACK)
{ {
TOOLINFO ti = { TOOLINFO ti = {
sizeof(TOOLINFO), TTF_SUBCLASS|TTF_IDISHWND/*|TTF_TRANSPARENT*/, hparent, (UINT)htool, 0, 0, 0, 0, 0, 0, 0 sizeof(TOOLINFO), TTF_SUBCLASS|TTF_IDISHWND/*|TTF_TRANSPARENT*/, hparent, (UINT)htool, {0,0,0,0}, 0, 0, 0
}; };
ti.lpszText = (LPTSTR) txt; ti.lpszText = (LPTSTR) txt;