Initial wineboot implementation; at this stage only wininit.ini
processing has been written.
diff --git a/configure b/configure
index 123131b..25c0bfd 100755
--- a/configure
+++ b/configure
@@ -15231,7 +15231,7 @@
MAKE_PROG_RULES=programs/Makeprog.rules
- ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/ctl3d/Makefile dlls/d3d8/Makefile dlls/d3dx8/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput8/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/icmp/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/mapi32/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msdmo/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvideo/Makefile dlls/msvideo/msrle32/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/psapi/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/Makefile dlls/snmpapi/Makefile dlls/sti/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/version/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/tests/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winenas/Makefile dlls/winmm/winejack/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefile documentation/Makefile include/Makefile library/Makefile miscemu/Makefile ole/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/notepad/Makefile programs/osversioncheck/Makefile programs/progman/Makefile programs/regapi/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/regtest/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/wmc/Makefile tools/wpp/Makefile tools/wrc/Makefile unicode/Makefile"
+ ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/ctl3d/Makefile dlls/d3d8/Makefile dlls/d3dx8/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput8/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/icmp/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/mapi32/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msdmo/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvideo/Makefile dlls/msvideo/msrle32/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/psapi/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/Makefile dlls/snmpapi/Makefile dlls/sti/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/version/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/tests/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winenas/Makefile dlls/winmm/winejack/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefile documentation/Makefile include/Makefile library/Makefile miscemu/Makefile ole/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/notepad/Makefile programs/osversioncheck/Makefile programs/progman/Makefile programs/regapi/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/regtest/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/wmc/Makefile tools/wpp/Makefile tools/wrc/Makefile unicode/Makefile"
cat >confcache <<\_ACEOF
@@ -15907,6 +15907,7 @@
"programs/uninstaller/Makefile" ) CONFIG_FILES="$CONFIG_FILES programs/uninstaller/Makefile" ;;
"programs/view/Makefile" ) CONFIG_FILES="$CONFIG_FILES programs/view/Makefile" ;;
"programs/wcmd/Makefile" ) CONFIG_FILES="$CONFIG_FILES programs/wcmd/Makefile" ;;
+ "programs/wineboot/Makefile" ) CONFIG_FILES="$CONFIG_FILES programs/wineboot/Makefile" ;;
"programs/wineconsole/Makefile" ) CONFIG_FILES="$CONFIG_FILES programs/wineconsole/Makefile" ;;
"programs/winedbg/Makefile" ) CONFIG_FILES="$CONFIG_FILES programs/winedbg/Makefile" ;;
"programs/winefile/Makefile" ) CONFIG_FILES="$CONFIG_FILES programs/winefile/Makefile" ;;
diff --git a/configure.ac b/configure.ac
index f6ce7ac..d35cdce 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1500,6 +1500,7 @@
programs/uninstaller/Makefile
programs/view/Makefile
programs/wcmd/Makefile
+programs/wineboot/Makefile
programs/wineconsole/Makefile
programs/winedbg/Makefile
programs/winefile/Makefile
diff --git a/programs/Makefile.in b/programs/Makefile.in
index 2c563ea..c3ccd3e 100644
--- a/programs/Makefile.in
+++ b/programs/Makefile.in
@@ -22,6 +22,7 @@
uninstaller \
view \
wcmd \
+ wineboot \
wineconsole \
winedbg \
winefile \
@@ -44,6 +45,7 @@
rundll32 \
uninstaller \
wcmd \
+ wineboot \
wineconsole \
winedbg \
winefile \
@@ -61,6 +63,7 @@
regsvr32 \
uninstaller \
wcmd \
+ wineboot \
wineconsole \
winedbg \
winefile \
diff --git a/programs/wineboot/.cvsignore b/programs/wineboot/.cvsignore
new file mode 100644
index 0000000..cbe7d33
--- /dev/null
+++ b/programs/wineboot/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+wineboot.exe.dbg.c
+wineboot.exe.spec.c
diff --git a/programs/wineboot/Makefile.in b/programs/wineboot/Makefile.in
new file mode 100644
index 0000000..8f1f2f7
--- /dev/null
+++ b/programs/wineboot/Makefile.in
@@ -0,0 +1,14 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../..
+SRCDIR = @srcdir@
+VPATH = @srcdir@
+MODULE = wineboot.exe
+APPMODE = cui
+IMPORTS = kernel32
+
+C_SRCS = \
+ wineboot.c
+
+@MAKE_PROG_RULES@
+
+### Dependencies:
diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c
new file mode 100644
index 0000000..2a1093e
--- /dev/null
+++ b/programs/wineboot/wineboot.c
@@ -0,0 +1,180 @@
+/*
+ * Copyright (C) 2002 Andreas Mohr
+ * Copyright (C) 2002 Shachar Shemesh
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <stdio.h>
+#include "winbase.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(wineboot);
+
+const char * const RENAME_FILE="wininit.ini";
+const char * const RENAME_FILE_SECTION="[rename]";
+#define MAX_LINE_LENGTH (2*MAX_PATH+2)
+
+static BOOL GetLine( HANDLE hFile, char *buf, size_t buflen )
+{
+ int 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;
+}
+
+/* Performs the rename operations dictated in %SystemRoot%\Wininit.ini.
+ * Returns FALSE if there was an error, or otherwise if all is ok.
+ */
+static BOOL wininit()
+{
+ char buffer[MAX_LINE_LENGTH];
+ char ini_path[MAX_PATH];
+ HANDLE hFile;
+ DWORD res;
+
+ res=GetWindowsDirectoryA( ini_path, sizeof(ini_path) );
+
+ if( res==0 )
+ {
+ WINE_ERR("Couldn't get the windows directory - error %ld\n",
+ GetLastError() );
+
+ return FALSE;
+ }
+
+ if( res>=sizeof(ini_path) )
+ {
+ WINE_ERR("Windows path too long (%ld)\n", res );
+
+ return FALSE;
+ }
+
+ sprintf( ini_path+res, "\\%s", RENAME_FILE );
+
+ hFile=CreateFileA(ini_path, GENERIC_READ,
+ FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
+ NULL );
+
+ if( hFile==INVALID_HANDLE_VALUE )
+ {
+ DWORD err=GetLastError();
+
+ if( err==ERROR_FILE_NOT_FOUND )
+ {
+ /* No file - nothing to do. Great! */
+ WINE_TRACE("Wininit.ini not present - no renaming to do\n");
+
+ return TRUE;
+ }
+
+ WINE_ERR("There was an error in reading wininit.ini file - %ld\n",
+ GetLastError() );
+
+ return FALSE;
+ }
+
+ printf("Wine is finalizing your software installation. This may take a few minutes,\n");
+ printf("though it never actually does.\n");
+
+ while( GetLine( hFile, buffer, sizeof(buffer) ) &&
+ lstrcmpiA(buffer,RENAME_FILE_SECTION)!=0 )
+ ; /* Read the lines until we match the rename section */
+
+ while( GetLine( hFile, buffer, sizeof(buffer) ) && buffer[0]!='[' )
+ {
+ /* First, make sure this is not a comment */
+ if( buffer[0]!=';' && buffer[0]!='\0' )
+ {
+ char * value;
+
+ value=strchr(buffer, '=');
+
+ if( value==NULL )
+ {
+ WINE_WARN("Line with no \"=\" in it in wininit.ini - %s\n",
+ buffer);
+ } else
+ {
+ /* split the line into key and value */
+ *(value++)='\0';
+
+ if( lstrcmpiA( "NUL", buffer )==0 )
+ {
+ WINE_TRACE("Deleting file \"%s\"\n", value );
+ /* A file to delete */
+ if( !DeleteFileA( value ) )
+ WINE_WARN("Error deleting file \"%s\"\n", value);
+ } else
+ {
+ WINE_TRACE("Renaming file \"%s\" to \"%s\"\n", value,
+ buffer );
+
+ if( !MoveFileExA(value, buffer, MOVEFILE_COPY_ALLOWED|
+ MOVEFILE_REPLACE_EXISTING) )
+ {
+ WINE_WARN("Error renaming \"%s\" to \"%s\"\n", value,
+ buffer );
+ }
+ }
+ }
+ }
+ }
+
+ CloseHandle( hFile );
+
+ if( !DeleteFileA( ini_path ) )
+ {
+ WINE_ERR("Couldn't erase %s, error %ld\n", ini_path, GetLastError() );
+
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+int main( int argc, char *argv[] )
+{
+ wininit();
+
+ return 0;
+}