* created a Makefile for compiling as standalone project using MinGW

* eliminated all warnings displayed when using -Wall
* activated option for compiling as UNICODE version

svn path=/trunk/; revision=6166
This commit is contained in:
Martin Fuchs
2003-09-27 17:21:03 +00:00
parent 8638791220
commit 367a45d72a
18 changed files with 223 additions and 156 deletions
@@ -0,0 +1,75 @@
#
# ReactOS explorer
#
# Makefile.MinGW
#
CC = gcc
CXX = g++
LINK = g++
CFLAGS = -DWIN32 -D_ROS_ -D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0501 -fexceptions -Wall
CXXFLAGS= $(CFLAGS)
RCFLAGS = -DWIN32 -D_ROS_
LFLAGS = -Wl,--subsystem,windows
ifdef DEBUG
CFLAGS += -D_DEBUG -g
RCFLAGS += -D_DEBUG
LFLAGS += -g
else
CFLAGS += -DNDEBUG -Os
RCFLAGS += -DNDEBUG
LFLAGS += -s
endif
ifdef UNICODE
CFLAGS += -DUNICODE
# LFLAGS+= -Wl,--entry,_wWinMain@16
endif
EXEC_SUFFIX = .exe
RES_SUFFIX = .coff
VPATH = shell utility taskbar desktop
PROGRAM = explorer
TARGET = $(PROGRAM)$(EXEC_SUFFIX)
OBJECTS = \
startup.o \
shellclasses.o \
utility.o \
window.o \
dragdropimpl.o \
explorer.o \
entries.o \
winfs.o \
unixfs.o \
shellfs.o \
mainframe.o \
filechild.o \
pane.o \
shellbrowser.o \
desktop.o \
desktopbar.o \
taskbar.o \
startmenu.o \
traynotify.o \
quicklaunch.o
LIBS = gdi32 comctl32 ole32 uuid
all: $(TARGET)
$(TARGET): $(OBJECTS) $(PROGRAM)$(RES_SUFFIX)
$(LINK) $(LFLAGS) -o $@ $^ $(addprefix -l,$(LIBS))
explorer$(RES_SUFFIX): $(PROGRAM)_intres.rc
windres $(RCFLAGS) -o $@ $^
clean:
rm -f $(TARGET) *.o *$(RES_SUFFIX)
@@ -35,3 +35,6 @@
10.09.2003 m. fuchs compatibility changes for correct desktop windows size on Windows NT
19.09.2003 m. fuchs compatibility changes for correct start menu subentries on Windows 9x
27.09.2003 m. fuchs moved start menu entries for control panel, etc. into new settings submenu
created a Makefile for compiling as standalone project using MinGW
eliminated all warnings displayed when using -Wall
activated option for compiling as UNICODE version
@@ -153,6 +153,24 @@ int explorer_main(HINSTANCE hInstance, HWND hwndDesktop, int cmdshow)
}
// MinGW does not provide a Unicode startup routine, so we have to implement an own.
#if defined(__MINGW32__) && defined(UNICODE)
#define _tWinMain wWinMain
int WINAPI wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int);
int main(int argc, char* argv[])
{
STARTUPINFO startupinfo;
GetStartupInfo(&startupinfo);
return wWinMain(GetModuleHandle(NULL), 0, GetCommandLine(), startupinfo.wShowWindow);
}
#endif // __MINGW && UNICODE
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nShowCmd)
{
// create desktop window and task bar only, if there is no other shell and we are
@@ -7,9 +7,8 @@
//
// Generated from the TEXTINCLUDE 2 resource.
//
#ifndef _ROS_
#include "afxres.h"
#endif
#include <windows.h>
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@@ -50,8 +49,8 @@ BEGIN
END
POPUP "&Ajutor"
BEGIN
MENUITEM "&Despre Explorer...", ID_ABOUT
MENUITEM "Explorer &FAQ...", ID_EXPLORER_FAQ
MENUITEM "&Despre Explorer...", ID_ABOUT
END
END
@@ -109,8 +108,8 @@ BEGIN
IDS_DRIVES "Discuri"
IDS_SEARCH_COMPUTER "Search Computer..."
IDS_SETTINGS_MENU "Settings Menu"
IDS_PRINTERS "Printers"
IDS_CONTROL_PANEL "Control Panel"
IDS_PRINTERS "Printers"
END
#endif // Romanian resources
@@ -311,9 +310,8 @@ END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#ifndef _ROS_\r\n"
"#include ""afxres.h""\r\n"
"#endif\0"
"#include <windows.h>\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
@@ -370,8 +368,8 @@ BEGIN
IDS_DRIVES "Verzeichnisse"
IDS_SEARCH_COMPUTER "Suche Computer..."
IDS_SETTINGS_MENU "Einstellungen-Menu"
IDS_PRINTERS "Drucker"
IDS_CONTROL_PANEL "Systemsteuerung"
IDS_PRINTERS "Drucker"
END
#endif // German (Germany) resources
@@ -415,8 +413,8 @@ BEGIN
END
POPUP "&Help"
BEGIN
MENUITEM "&About Explorer...", ID_ABOUT
MENUITEM "Explorer &FAQ...", ID_EXPLORER_FAQ
MENUITEM "&About Explorer...", ID_ABOUT
END
END
@@ -583,8 +581,8 @@ BEGIN
IDS_DRIVES "Drives"
IDS_SEARCH_COMPUTER "Search Computer..."
IDS_SETTINGS_MENU "Settings Menu"
IDS_PRINTERS "Printers"
IDS_CONTROL_PANEL "Control Panel"
IDS_PRINTERS "Printers"
END
#endif // English (U.S.) resources
@@ -41,7 +41,7 @@ CFG=make_explorer - Win32 Debug
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Cmd_Line "msdevfilt -gcc make"
# PROP Cmd_Line "msdevfilt -gcc -pipe "perl d:\tools\gSTLFilt.pl" make -f Makefile.MinGW UNICODE=1"
# PROP Rebuild_Opt "clean all"
# PROP Target_File "explorer.exe"
# PROP Bsc_Name ""
@@ -62,7 +62,7 @@ CFG=make_explorer - Win32 Debug
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Cmd_Line "msdevfilt -gcc -pipe "perl d:\tools\gSTLFilt.pl" make DEBUG=1"
# PROP Cmd_Line "msdevfilt -gcc -pipe "perl d:\tools\gSTLFilt.pl" make -f Makefile.MinGW UNICODE=1 DEBUG=1"
# PROP Rebuild_Opt "clean all"
# PROP Target_File "explorer.exe"
# PROP Bsc_Name ""
@@ -89,5 +89,9 @@ SOURCE=..\..\..\ChangeLog
SOURCE=.\makefile
# End Source File
# Begin Source File
SOURCE=.\Makefile.MinGW
# End Source File
# End Target
# End Project
+3 -4
View File
@@ -12,17 +12,16 @@ TARGET_APPTYPE = windows
TARGET_NAME = explorer
TARGET_CFLAGS = -fexceptions -Os -DNDEBUG -DWIN32 -D_ROS_ -W -D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0501
TARGET_CFLAGS = -fexceptions -Os -DNDEBUG -DWIN32 -D_ROS_ -Wall -D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0501
TARGET_CPPFLAGS = -fexceptions -Os -DNDEBUG -DWIN32 -D_ROS_ -W -D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0501
TARGET_CPPFLAGS = -fexceptions -Os -DNDEBUG -DWIN32 -D_ROS_ -Wall -D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0501
TARGET_RCFLAGS = -DNDEBUG -DWIN32 -D_ROS_
ifdef UNICODE
TARGET_CFLAGS += -DUNICODE
TARGET_CPPFLAGS += -DUNICODE
TARGET_RCFLAGS += -DUNICODE
MK_DEFENTRY = _wWinMain@16
# MK_DEFENTRY = _wWinMain@16
endif
VPATH += shell
@@ -48,8 +48,8 @@ Entry::Entry(ENTRY_TYPE etype)
}
Entry::Entry(Entry* parent)
: _etype(parent->_etype),
_up(parent)
: _up(parent),
_etype(parent->_etype)
{
_next = NULL;
_down = NULL;
@@ -113,8 +113,8 @@ Pane::Pane(HWND hparent, int id, int id_header, Entry* root, bool treePane, int
LBS_DISABLENOSCROLL|LBS_NOINTEGRALHEIGHT|LBS_OWNERDRAWFIXED|LBS_NOTIFY,
0, 0, 0, 0, hparent, (HMENU)id, g_Globals._hInstance, 0)),
_root(root),
_treePane(treePane),
_visible_cols(visible_cols)
_visible_cols(visible_cols),
_treePane(treePane)
{
// insert entries into listbox
Entry* entry = _root;
+3 -2
View File
@@ -71,13 +71,14 @@ struct Pane : public SubclassedWindow
WindowHandle _hwndHeader;
bool _treePane;
int _visible_cols;
Entry* _root;
Entry* _cur;
COLORREF _clrCompressed;
int _visible_cols;
bool _treePane;
void init();
void set_header();
bool create_header(HWND parent, int id);
@@ -119,7 +119,7 @@ void ShellEntry::get_path(PTSTR path) const
{
path[0] = TEXT('\0');
HRESULT hr = path_from_pidl(get_parent_folder(), &*_pidl, path, MAX_PATH);
/*HRESULT hr = */path_from_pidl(get_parent_folder(), &*_pidl, path, MAX_PATH);
}
@@ -243,7 +243,7 @@ void ShellDirectory::read_directory()
HRESULT hr = _folder->GetAttributesOf(1, (LPCITEMIDLIST*)&pidls[n], &attribs);
if (SUCCEEDED(hr)) {
if (attribs != ~SFGAO_FILESYSTEM)
if (attribs != (SFGAOF)~SFGAO_FILESYSTEM)
bhfi_valid = fill_w32fdata_shell(pidls[n], attribs, &w32fd, &bhfi);
else
attribs = 0;
+82 -118
View File
@@ -53,43 +53,7 @@
#include <stdio.h>
#include <windows.h>
#define MAX_LINE_LENGTH (2*MAX_PATH+2)
static BOOL GetLine( HANDLE hFile, char *buf, size_t buflen )
{
size_t i=0;
buf[0]='\0';
do
{
DWORD read;
if( !ReadFile( hFile, buf, 1, &read, NULL ) || read!=1 )
{
return FALSE;
}
} while( isspace( *buf ) );
while( buf[i]!='\n' && i<=buflen &&
ReadFile( hFile, buf+i+1, 1, NULL, NULL ) )
{
++i;
}
if( buf[i]!='\n' )
{
return FALSE;
}
if( i>0 && buf[i-1]=='\r' )
--i;
buf[i]='\0';
return TRUE;
}
#include <ctype.h>
/* Performs the rename operations dictated in %SystemRoot%\Wininit.ini.
* Returns FALSE if there was an error, or otherwise if all is ok.
@@ -116,27 +80,27 @@ static BOOL pendingRename()
printf("Entered\n");
if( (res=RegOpenKeyExW( HKEY_LOCAL_MACHINE, SessionW, 0, KEY_ALL_ACCESS, &hSession ))
!=ERROR_SUCCESS )
if ((res=RegOpenKeyExW(HKEY_LOCAL_MACHINE, SessionW, 0, KEY_ALL_ACCESS, &hSession))
!=ERROR_SUCCESS)
{
if( res==ERROR_FILE_NOT_FOUND )
if (res==ERROR_FILE_NOT_FOUND)
{
printf("The key was not found - skipping\n");
res=TRUE;
}
else
{
printf("Couldn't open key, error %ld\n", res );
printf("Couldn't open key, error %ld\n", res);
res=FALSE;
}
goto end;
}
res=RegQueryValueExW( hSession, ValueName, NULL, NULL /* The value type does not really interest us, as it is not
res=RegQueryValueExW(hSession, ValueName, NULL, NULL /* The value type does not really interest us, as it is not
truely a REG_MULTI_SZ anyways */,
NULL, &dataLength );
if( res==ERROR_FILE_NOT_FOUND )
NULL, &dataLength);
if (res==ERROR_FILE_NOT_FOUND)
{
/* No value - nothing to do. Great! */
printf("Value not present - nothing to rename\n");
@@ -144,23 +108,23 @@ static BOOL pendingRename()
goto end;
}
if( res!=ERROR_SUCCESS )
if (res!=ERROR_SUCCESS)
{
printf("Couldn't query value's length (%ld)\n", res );
printf("Couldn't query value's length (%ld)\n", res);
res=FALSE;
goto end;
}
buffer=malloc( dataLength );
if( buffer==NULL )
buffer=malloc(dataLength);
if (buffer==NULL)
{
printf("Couldn't allocate %lu bytes for the value\n", dataLength );
printf("Couldn't allocate %lu bytes for the value\n", dataLength);
res=FALSE;
goto end;
}
res=RegQueryValueExW( hSession, ValueName, NULL, NULL, (LPBYTE)buffer, &dataLength );
if( res!=ERROR_SUCCESS )
res=RegQueryValueExW(hSession, ValueName, NULL, NULL, (LPBYTE)buffer, &dataLength);
if (res!=ERROR_SUCCESS)
{
printf("Couldn't query value after successfully querying before (%lu),\n"
"please report to [email protected]\n", res);
@@ -171,17 +135,17 @@ static BOOL pendingRename()
/* Make sure that the data is long enough and ends with two NULLs. This
* simplifies the code later on.
*/
if( dataLength<2*sizeof(buffer[0]) ||
if (dataLength<2*sizeof(buffer[0]) ||
buffer[dataLength/sizeof(buffer[0])-1]!='\0' ||
buffer[dataLength/sizeof(buffer[0])-2]!='\0' )
buffer[dataLength/sizeof(buffer[0])-2]!='\0')
{
printf("Improper value format - doesn't end with NULL\n");
res=FALSE;
goto end;
}
for( src=buffer; (src-buffer)*sizeof(src[0])<dataLength && *src!='\0';
src=dst+lstrlenW(dst)+1 )
for(src=buffer; (src-buffer)*sizeof(src[0])<dataLength && *src!='\0';
src=dst+lstrlenW(dst)+1)
{
DWORD dwFlags=0;
@@ -190,29 +154,29 @@ static BOOL pendingRename()
dst=src+lstrlenW(src)+1;
/* We need to skip the \??\ header */
if( src[0]=='\\' && src[1]=='?' && src[2]=='?' && src[3]=='\\' )
if (src[0]=='\\' && src[1]=='?' && src[2]=='?' && src[3]=='\\')
src+=4;
if( dst[0]=='!' )
if (dst[0]=='!')
{
dwFlags|=MOVEFILE_REPLACE_EXISTING;
dst++;
}
if( dst[0]=='\\' && dst[1]=='?' && dst[2]=='?' && dst[3]=='\\' )
if (dst[0]=='\\' && dst[1]=='?' && dst[2]=='?' && dst[3]=='\\')
dst+=4;
if( *dst!='\0' )
if (*dst!='\0')
{
/* Rename the file */
MoveFileExW( src, dst, dwFlags );
MoveFileExW(src, dst, dwFlags);
} else
{
/* Delete the file or directory */
res = GetFileAttributesW ( src );
if ( res != (DWORD)-1 )
res = GetFileAttributesW (src);
if (res != (DWORD)-1)
{
if( (res&FILE_ATTRIBUTE_DIRECTORY)==0 )
if ((res&FILE_ATTRIBUTE_DIRECTORY)==0)
{
/* It's a file */
DeleteFileW(src);
@@ -223,24 +187,24 @@ static BOOL pendingRename()
}
} else
{
printf("couldn't get file attributes (%ld)\n", GetLastError() );
printf("couldn't get file attributes (%ld)\n", GetLastError());
}
}
}
if((res=RegDeleteValueW(hSession, ValueName))!=ERROR_SUCCESS )
if ((res=RegDeleteValueW(hSession, ValueName))!=ERROR_SUCCESS)
{
printf("Error deleting the value (%lu)\n", GetLastError() );
printf("Error deleting the value (%lu)\n", GetLastError());
res=FALSE;
} else
res=TRUE;
end:
if( buffer!=NULL )
if (buffer!=NULL)
free(buffer);
if( hSession!=NULL )
RegCloseKey( hSession );
if (hSession!=NULL)
RegCloseKey(hSession);
return res;
}
@@ -278,30 +242,30 @@ static int runCmd(LPWSTR cmdline, LPCWSTR dir, BOOL wait, BOOL minimized)
memset(&si, 0, sizeof(si));
si.cb=sizeof(si);
if( minimized )
if (minimized)
{
si.dwFlags=STARTF_USESHOWWINDOW;
si.wShowWindow=SW_MINIMIZE;
}
memset(&info, 0, sizeof(info));
if( !CreateProcessW(NULL, cmdline, NULL, NULL, FALSE, 0, NULL, dir, &si, &info) )
if (!CreateProcessW(NULL, cmdline, NULL, NULL, FALSE, 0, NULL, dir, &si, &info))
{
printf("Failed to run command (%ld)\n", GetLastError() );
printf("Failed to run command (%ld)\n", GetLastError());
return INVALID_RUNCMD_RETURN;
}
printf("Successfully ran command\n"); //%s - Created process handle %p\n",
//wine_dbgstr_w(cmdline), info.hProcess );
//wine_dbgstr_w(cmdline), info.hProcess);
if(wait)
if (wait)
{ /* wait for the process to exit */
WaitForSingleObject(info.hProcess, INFINITE);
GetExitCodeProcess(info.hProcess, &exit_code);
}
CloseHandle( info.hProcess );
CloseHandle(info.hProcess);
return exit_code;
}
@@ -315,8 +279,8 @@ static int runCmd(LPWSTR cmdline, LPCWSTR dir, BOOL wait, BOOL minimized)
* bSynchronous tells whether we should wait for the prog to complete before
* going on to the next prog.
*/
static BOOL ProcessRunKeys( HKEY hkRoot, LPCWSTR szKeyName, BOOL bDelete,
BOOL bSynchronous )
static BOOL ProcessRunKeys(HKEY hkRoot, LPCWSTR szKeyName, BOOL bDelete,
BOOL bSynchronous)
{
static const WCHAR WINKEY_NAME[]={'S','o','f','t','w','a','r','e','\\',
'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
@@ -332,7 +296,7 @@ static BOOL ProcessRunKeys( HKEY hkRoot, LPCWSTR szKeyName, BOOL bDelete,
else
wprintf(L"processing %s entries under HKCU\n", szKeyName);
if( (res=RegOpenKeyExW( hkRoot, WINKEY_NAME, 0, KEY_READ, &hkWin ))!=ERROR_SUCCESS )
if ((res=RegOpenKeyExW(hkRoot, WINKEY_NAME, 0, KEY_READ, &hkWin))!=ERROR_SUCCESS)
{
printf("RegOpenKey failed on Software\\Microsoft\\Windows\\CurrentVersion (%ld)\n",
res);
@@ -340,10 +304,10 @@ static BOOL ProcessRunKeys( HKEY hkRoot, LPCWSTR szKeyName, BOOL bDelete,
goto end;
}
if( (res=RegOpenKeyExW( hkWin, szKeyName, 0, bDelete?KEY_ALL_ACCESS:KEY_READ, &hkRun ))!=
if ((res=RegOpenKeyExW(hkWin, szKeyName, 0, bDelete?KEY_ALL_ACCESS:KEY_READ, &hkRun))!=
ERROR_SUCCESS)
{
if( res==ERROR_FILE_NOT_FOUND )
if (res==ERROR_FILE_NOT_FOUND)
{
printf("Key doesn't exist - nothing to be done\n");
@@ -355,15 +319,15 @@ static BOOL ProcessRunKeys( HKEY hkRoot, LPCWSTR szKeyName, BOOL bDelete,
goto end;
}
if( (res=RegQueryInfoKeyW( hkRun, NULL, NULL, NULL, NULL, NULL, NULL, &i, &nMaxValue,
&nMaxCmdLine, NULL, NULL ))!=ERROR_SUCCESS )
if ((res=RegQueryInfoKeyW(hkRun, NULL, NULL, NULL, NULL, NULL, NULL, &i, &nMaxValue,
&nMaxCmdLine, NULL, NULL))!=ERROR_SUCCESS)
{
printf("Couldn't query key info (%ld)\n", res );
printf("Couldn't query key info (%ld)\n", res);
goto end;
}
if( i==0 )
if (i==0)
{
printf("No commands to execute.\n");
@@ -371,7 +335,7 @@ static BOOL ProcessRunKeys( HKEY hkRoot, LPCWSTR szKeyName, BOOL bDelete,
goto end;
}
if( (szCmdLine=malloc(nMaxCmdLine))==NULL )
if ((szCmdLine=malloc(nMaxCmdLine))==NULL)
{
printf("Couldn't allocate memory for the commands to be executed\n");
@@ -379,7 +343,7 @@ static BOOL ProcessRunKeys( HKEY hkRoot, LPCWSTR szKeyName, BOOL bDelete,
goto end;
}
if( (szValue=malloc((++nMaxValue)*sizeof(*szValue)))==NULL )
if ((szValue=malloc((++nMaxValue)*sizeof(*szValue)))==NULL)
{
printf("Couldn't allocate memory for the value names\n");
@@ -387,36 +351,36 @@ static BOOL ProcessRunKeys( HKEY hkRoot, LPCWSTR szKeyName, BOOL bDelete,
goto end;
}
while( i>0 )
while(i>0)
{
DWORD nValLength=nMaxValue, nDataLength=nMaxCmdLine;
DWORD type;
--i;
if( (res=RegEnumValueW( hkRun, i, szValue, &nValLength, 0, &type,
(LPBYTE)szCmdLine, &nDataLength ))!=ERROR_SUCCESS )
if ((res=RegEnumValueW(hkRun, i, szValue, &nValLength, 0, &type,
(LPBYTE)szCmdLine, &nDataLength))!=ERROR_SUCCESS)
{
printf("Couldn't read in value %ld - %ld\n", i, res );
printf("Couldn't read in value %ld - %ld\n", i, res);
continue;
}
if( bDelete && (res=RegDeleteValueW( hkRun, szValue ))!=ERROR_SUCCESS )
if (bDelete && (res=RegDeleteValueW(hkRun, szValue))!=ERROR_SUCCESS)
{
printf("Couldn't delete value - %ld, %ld. Running command anyways.\n", i, res );
printf("Couldn't delete value - %ld, %ld. Running command anyways.\n", i, res);
}
if( type!=REG_SZ )
if (type!=REG_SZ)
{
printf("Incorrect type of value #%ld (%ld)\n", i, type );
printf("Incorrect type of value #%ld (%ld)\n", i, type);
continue;
}
if( (res=runCmd(szCmdLine, NULL, bSynchronous, FALSE ))==INVALID_RUNCMD_RETURN )
if ((res=runCmd(szCmdLine, NULL, bSynchronous, FALSE))==INVALID_RUNCMD_RETURN)
{
printf("Error running cmd #%ld (%ld)\n", i, GetLastError() );
printf("Error running cmd #%ld (%ld)\n", i, GetLastError());
}
printf("Done processing cmd #%ld\n", i);
@@ -425,10 +389,10 @@ static BOOL ProcessRunKeys( HKEY hkRoot, LPCWSTR szKeyName, BOOL bDelete,
res=ERROR_SUCCESS;
end:
if( hkRun!=NULL )
RegCloseKey( hkRun );
if( hkWin!=NULL )
RegCloseKey( hkWin );
if (hkRun!=NULL)
RegCloseKey(hkRun);
if (hkWin!=NULL)
RegCloseKey(hkWin);
printf("done\n");
@@ -448,40 +412,40 @@ static const struct op_mask SESSION_START={FALSE, FALSE, TRUE, TRUE, TRUE, TRUE}
SETUP={FALSE, FALSE, FALSE, TRUE, TRUE, TRUE};
#define DEFAULT SESSION_START
int startup( int argc, char *argv[] )
int startup(int argc, char *argv[])
{
struct op_mask ops; /* Which of the ops do we want to perform? */
/* First, set the current directory to SystemRoot */
TCHAR gen_path[MAX_PATH];
DWORD res;
res=GetWindowsDirectory( gen_path, sizeof(gen_path) );
res = GetWindowsDirectory(gen_path, sizeof(gen_path));
if( res==0 )
if (res==0)
{
printf("Couldn't get the windows directory - error %ld\n",
GetLastError() );
printf("Couldn't get the windows directory - error %ld\n",
GetLastError());
return 100;
return 100;
}
if( res>=sizeof(gen_path) )
if (res>=sizeof(gen_path))
{
printf("Windows path too long (%ld)\n", res );
printf("Windows path too long (%ld)\n", res);
return 100;
return 100;
}
if( !SetCurrentDirectory( gen_path ) )
if (!SetCurrentDirectory(gen_path))
{
printf("Cannot set the dir to %s (%ld)\n", gen_path, GetLastError() );
wprintf(L"Cannot set the dir to %s (%ld)\n", gen_path, GetLastError());
return 100;
}
if( argc>1 )
if (argc>1)
{
switch( argv[1][0] )
switch(argv[1][0])
{
case 'r': /* Restart */
ops=SETUP;
@@ -501,15 +465,15 @@ int startup( int argc, char *argv[] )
res=(ops.ntonly || !ops.preboot || wininit()) &&
(ops.w9xonly || !ops.preboot || pendingRename()) &&
(ops.ntonly || !ops.prelogin ||
ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICESONCE], TRUE, FALSE )) &&
ProcessRunKeys(HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICESONCE], TRUE, FALSE)) &&
(ops.ntonly || !ops.prelogin || !ops.startup ||
ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICES], FALSE, FALSE )) &&
ProcessRunKeys(HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICES], FALSE, FALSE)) &&
(!ops.postlogin ||
ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNONCE], TRUE, TRUE )) &&
ProcessRunKeys(HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNONCE], TRUE, TRUE)) &&
(!ops.postlogin || !ops.startup ||
ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUN], FALSE, FALSE )) &&
ProcessRunKeys(HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUN], FALSE, FALSE)) &&
(!ops.postlogin || !ops.startup ||
ProcessRunKeys( HKEY_CURRENT_USER, runkeys_names[RUNKEY_RUN], FALSE, FALSE ));
ProcessRunKeys(HKEY_CURRENT_USER, runkeys_names[RUNKEY_RUN], FALSE, FALSE));
printf("Operation done\n");
@@ -61,7 +61,7 @@ typedef list<StartMenuDirectory> StartMenuShellDirs;
struct StartMenuEntry
{
StartMenuEntry() : _entry(NULL), _hIcon(0) {}
StartMenuEntry() : _hIcon(0), _entry(NULL) {}
String _title;
HICON _hIcon;
@@ -150,7 +150,7 @@ protected:
ShellEntryMap _entries;
StartMenuShellDirs _dirs;
UINT _submenu_id;
int _submenu_id;
WindowHandle _submenu;
int _border_left; // left border in pixels
@@ -165,7 +165,7 @@ int TaskBar::Notify(int id, NMHDR* pnmh)
if (idx>=0 &&
SendMessage(_htoolbar, TB_GETBUTTONINFO, idx, (LPARAM)&btninfo)!=-1 &&
(it=_map.find_id(btninfo.idCommand))!=_map.end()) {
TaskBarEntry& entry = it->second;
//TaskBarEntry& entry = it->second;
ActivateApp(it, false);
ShowAppSystemMenu(it);
@@ -267,7 +267,7 @@ NotifyIconSet::iterator NotifyArea::IconHitTest(const POINT& pos)
int x = 2;
for(; it!=_sorted_icons.end(); ++it) {
NotifyInfo& entry = const_cast<NotifyInfo&>(*it); // Why does GCC 3.3 need this additional const_cast ?!
//NotifyInfo& entry = const_cast<NotifyInfo&>(*it); // Why does GCC 3.3 need this additional const_cast ?!
if (pos.x>=x && pos.x<x+16)
break;
@@ -18,9 +18,9 @@
// IDataObjectImpl Class
//////////////////////////////////////////////////////////////////////
IDataObjectImpl::IDataObjectImpl(IDropSourceImpl* pDropSource):
m_cRefCount(0),
m_pDropSource(pDropSource)
IDataObjectImpl::IDataObjectImpl(IDropSourceImpl* pDropSource)
: m_pDropSource(pDropSource),
m_cRefCount(0)
{
}
@@ -415,10 +415,12 @@ STDMETHODIMP EnumFormatEtcImpl::Clone(IEnumFORMATETC** ppCloneEnumFormatEtc)
//////////////////////////////////////////////////////////////////////
// IDropTargetImpl Class
//////////////////////////////////////////////////////////////////////
IDropTargetImpl::IDropTargetImpl(HWND hTargetWnd):
m_hTargetWnd(hTargetWnd),
m_cRefCount(0), m_bAllowDrop(false),
m_pDropTargetHelper(NULL), m_pSupportedFrmt(NULL)
IDropTargetImpl::IDropTargetImpl(HWND hTargetWnd)
: m_cRefCount(0),
m_bAllowDrop(false),
m_pDropTargetHelper(NULL),
m_pSupportedFrmt(NULL),
m_hTargetWnd(hTargetWnd)
{
assert(m_hTargetWnd != NULL);
@@ -32,6 +32,7 @@ class EnumFormatEtcImpl : public IEnumFORMATETC
public:
EnumFormatEtcImpl(const FormatArray& ArrFE);
EnumFormatEtcImpl(const StorageArray& ArrFE);
virtual ~EnumFormatEtcImpl() {}
//IUnknown members
STDMETHOD(QueryInterface)(REFIID, void**);
@@ -80,7 +81,7 @@ class IDataObjectImpl : public IDataObject//,public IAsyncOperation
public:
IDataObjectImpl(IDropSourceImpl* pDropSource);
~IDataObjectImpl();
virtual ~IDataObjectImpl();
void CopyMedium(STGMEDIUM* pMedDest, STGMEDIUM* pMedSrc, FORMATETC* pFmtSrc);
@@ -32,7 +32,9 @@
#include "shellclasses.h"
#ifdef _MS_VER
#pragma comment(lib, "shell32") // link to shell32.dll
#endif
// helper functions for string copying
@@ -72,7 +72,7 @@ struct COMException
LPTSTR pBuf;
if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
0, _hr, MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT), (LPSTR)&pBuf, 0, NULL)) {
0, _hr, MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT), (LPTSTR)&pBuf, 0, NULL)) {
_msg = pBuf;
LocalFree(pBuf);
} else {