backing out for now
This commit is contained in:
Родитель
0b734f456e
Коммит
975002d55e
|
@ -35,7 +35,6 @@
|
|||
#include "nsSpecialSystemDirectory.h"
|
||||
#include "nsDirectoryService.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
|
||||
static nsresult
|
||||
GetPersistentStringFromSpec(nsIFile* inSpec, char **string)
|
||||
|
@ -63,20 +62,31 @@ GetPersistentStringFromSpec(nsIFile* inSpec, char **string)
|
|||
#include <sys/stat.h>
|
||||
#include <windows.h>
|
||||
|
||||
PRInt32 ReplaceWindowsSystemFile(nsIFile* currentSpec, nsIFile* finalSpec)
|
||||
PRInt32 ReplaceExistingWindowsFile(nsIFile* currentSpec, nsIFile* finalSpec)
|
||||
{
|
||||
// this routine is now for DOS-based windows only. WinNT should
|
||||
// be taken care of by the XP code
|
||||
//
|
||||
// NOTE for WINNT:
|
||||
//
|
||||
// the MOVEFILE_DELAY_UNTIL_REBOOT option doesn't work on
|
||||
// NT 3.51 SP4 or on NT 4.0 until SP2. On the broken versions
|
||||
// of NT 4.0 Microsoft warns using it can lead to an irreparably
|
||||
// corrupt windows' registry "after an unknown number of calls".
|
||||
// Time to reinstall windows when that happens.
|
||||
//
|
||||
// I don't want to risk it, I also don't want two separate code
|
||||
// paths to test, so we do it the lame way on all NT systems
|
||||
// until such time as there are few enough old revs around to
|
||||
// make it worth switching back to MoveFileEx().
|
||||
|
||||
PRInt32 err = -1;
|
||||
|
||||
// Get OS version info
|
||||
/* Get OS version info */
|
||||
DWORD dwVersion = GetVersion();
|
||||
|
||||
char *final;
|
||||
char *current;
|
||||
/* Get build numbers for Windows NT or Win32s */
|
||||
|
||||
finalSpec->GetPath(&final);
|
||||
currentSpec->GetPath(¤t);
|
||||
|
||||
// Get build numbers for Windows NT or Win32s
|
||||
if (dwVersion > 0x80000000)
|
||||
{
|
||||
// Windows 95 or Win16
|
||||
|
@ -87,39 +97,42 @@ PRInt32 ReplaceWindowsSystemFile(nsIFile* currentSpec, nsIFile* finalSpec)
|
|||
int strlen;
|
||||
char Src[_MAX_PATH]; // 8.3 name
|
||||
char Dest[_MAX_PATH]; // 8.3 name
|
||||
|
||||
|
||||
char* final;
|
||||
char* current;
|
||||
|
||||
finalSpec->GetPath(&final);
|
||||
currentSpec->GetPath(¤t);
|
||||
|
||||
strlen = GetShortPathName( (LPCTSTR)current, (LPTSTR)Src, (DWORD)sizeof(Src) );
|
||||
if ( strlen > 0 )
|
||||
{
|
||||
free(current);
|
||||
current = strdup(Src);
|
||||
current = strdup(Src);
|
||||
}
|
||||
|
||||
strlen = GetShortPathName( (LPCTSTR)final, (LPTSTR)Dest, (DWORD)sizeof(Dest) );
|
||||
strlen = GetShortPathName( (LPCTSTR) final, (LPTSTR) Dest, (DWORD) sizeof(Dest));
|
||||
if ( strlen > 0 )
|
||||
{
|
||||
free(final);
|
||||
final = strdup(Dest);
|
||||
final = strdup(Dest);
|
||||
}
|
||||
|
||||
// NOTE: use OEM filenames! Even though it looks like a Windows
|
||||
// .INI file, WININIT.INI is processed under DOS
|
||||
/* NOTE: use OEM filenames! Even though it looks like a Windows
|
||||
* .INI file, WININIT.INI is processed under DOS
|
||||
*/
|
||||
|
||||
AnsiToOem( final, final );
|
||||
AnsiToOem( current, current );
|
||||
|
||||
if ( WritePrivateProfileString( "Rename", final, current, "WININIT.INI" ) )
|
||||
err = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Windows NT
|
||||
if ( MoveFileEx(final, current, MOVEFILE_DELAY_UNTIL_REBOOT) )
|
||||
err = 0;
|
||||
}
|
||||
|
||||
free(final);
|
||||
free(current);
|
||||
free(final);
|
||||
free(current);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
|
@ -335,7 +348,7 @@ PRInt32 ReplaceFileNow(nsIFile* replacementFile, nsIFile* doomedFile )
|
|||
|
||||
|
||||
|
||||
PRInt32 ReplaceFileNowOrSchedule(nsIFile* replacementFile, nsIFile* doomedFile, PRInt32 aMode )
|
||||
PRInt32 ReplaceFileNowOrSchedule(nsIFile* replacementFile, nsIFile* doomedFile )
|
||||
{
|
||||
PRInt32 result = ReplaceFileNow( replacementFile, doomedFile );
|
||||
|
||||
|
@ -343,9 +356,8 @@ PRInt32 ReplaceFileNowOrSchedule(nsIFile* replacementFile, nsIFile* doomedFile,
|
|||
{
|
||||
// if we couldn't replace the file schedule it for later
|
||||
#ifdef _WINDOWS
|
||||
if ( (aMode & WIN_SYSTEM_FILE) &&
|
||||
(ReplaceWindowsSystemFile(replacementFile, doomedFile) == 0) )
|
||||
return nsInstall::REBOOT_NEEDED;
|
||||
if ( ReplaceExistingWindowsFile(replacementFile, doomedFile) == 0 )
|
||||
return nsInstall::REBOOT_NEEDED;
|
||||
#endif
|
||||
|
||||
RKEY listkey;
|
||||
|
@ -438,7 +450,7 @@ void DeleteScheduledFiles( HREG reg )
|
|||
REGENUM state = 0;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// perform scheduled file deletions
|
||||
/* perform scheduled file deletions */
|
||||
if (REGERR_OK == NR_RegGetKey(reg,ROOTKEY_PRIVATE,REG_DELETE_LIST_KEY,&key))
|
||||
{
|
||||
// the delete key exists, so we loop through its children
|
||||
|
@ -478,7 +490,7 @@ void DeleteScheduledFiles( HREG reg )
|
|||
}
|
||||
}
|
||||
|
||||
// delete list node if empty
|
||||
/* delete list node if empty */
|
||||
state = 0;
|
||||
err = NR_RegEnumEntries(reg, key, &state, namebuf, sizeof(namebuf), 0);
|
||||
if ( err == REGERR_NOMORE )
|
||||
|
@ -495,7 +507,7 @@ void ReplaceScheduledFiles( HREG reg )
|
|||
{
|
||||
RKEY key;
|
||||
|
||||
// replace files if any listed
|
||||
/* replace files if any listed */
|
||||
if (REGERR_OK == NR_RegGetKey(reg,ROOTKEY_PRIVATE,REG_REPLACE_LIST_KEY,&key))
|
||||
{
|
||||
char keyname[MAXREGNAMELEN];
|
||||
|
@ -545,7 +557,7 @@ void ReplaceScheduledFiles( HREG reg )
|
|||
}
|
||||
|
||||
|
||||
// delete list node if empty
|
||||
/* delete list node if empty */
|
||||
state = 0;
|
||||
if (REGERR_NOMORE == NR_RegEnumSubkeys( reg, key, &state, keyname,
|
||||
sizeof(keyname), REGENUM_CHILDREN ))
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
PR_BEGIN_EXTERN_C
|
||||
|
||||
PRInt32 DeleteFileNowOrSchedule(nsIFile* filename);
|
||||
PRInt32 ReplaceFileNowOrSchedule(nsIFile* tmpfile, nsIFile* target, PRInt32 aMode);
|
||||
PRInt32 ReplaceFileNowOrSchedule(nsIFile* tmpfile, nsIFile* target );
|
||||
PRInt32 ScheduleFileForDeletion(nsIFile* filename);
|
||||
char* GetRegFilePath();
|
||||
|
||||
|
|
|
@ -120,11 +120,6 @@ class nsInstallInfo
|
|||
#define FILESEP '/'
|
||||
#endif
|
||||
|
||||
// not using 0x1 in this bitfield because it causes problems with legacy code
|
||||
#define DO_NOT_UNINSTALL 0x2
|
||||
#define WIN_SHARED_FILE 0x4
|
||||
#define WIN_SYSTEM_FILE 0x8
|
||||
|
||||
class nsInstall
|
||||
{
|
||||
friend class nsWinReg;
|
||||
|
@ -190,7 +185,10 @@ class nsInstall
|
|||
GESTALT_INVALID_ARGUMENT = -5551,
|
||||
|
||||
SUCCESS = 0,
|
||||
REBOOT_NEEDED = 999
|
||||
REBOOT_NEEDED = 999,
|
||||
|
||||
DO_NOT_UNINSTALL = 2,
|
||||
WIN_SHARED_FILE = 4
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -324,7 +324,7 @@ char* nsInstallFile::toString()
|
|||
|
||||
if (mReplaceFile)
|
||||
{
|
||||
if(mMode & WIN_SHARED_FILE)
|
||||
if(mMode & nsInstall::WIN_SHARED_FILE)
|
||||
{
|
||||
rsrcVal = mInstall->GetResourcedString(NS_LITERAL_STRING("ReplaceSharedFile"));
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ char* nsInstallFile::toString()
|
|||
}
|
||||
else
|
||||
{
|
||||
if(mMode & WIN_SHARED_FILE)
|
||||
if(mMode & nsInstall::WIN_SHARED_FILE)
|
||||
{
|
||||
rsrcVal = mInstall->GetResourcedString(NS_LITERAL_STRING("InstallSharedFile"));
|
||||
}
|
||||
|
@ -350,7 +350,7 @@ char* nsInstallFile::toString()
|
|||
char* interimCStr = nsnull;
|
||||
nsString interimStr;
|
||||
|
||||
if(mMode & DO_NOT_UNINSTALL)
|
||||
if(mMode & nsInstall::DO_NOT_UNINSTALL)
|
||||
interimStr.Assign(NS_LITERAL_STRING("(*dnu*) "));
|
||||
|
||||
interimStr.AppendWithConversion(rsrcVal);
|
||||
|
@ -391,10 +391,10 @@ PRInt32 nsInstallFile::CompleteFileMove()
|
|||
}
|
||||
else
|
||||
{
|
||||
result = ReplaceFileNowOrSchedule(mExtractedFile, mFinalFile, mMode );
|
||||
result = ReplaceFileNowOrSchedule(mExtractedFile, mFinalFile );
|
||||
}
|
||||
|
||||
if(mMode & WIN_SHARED_FILE)
|
||||
if(mMode & nsInstall::WIN_SHARED_FILE)
|
||||
{
|
||||
nsXPIDLCString path;
|
||||
mFinalFile->GetPath(getter_Copies(path));
|
||||
|
|
|
@ -1784,9 +1784,8 @@ static JSConstDoubleSpec install_constants[] =
|
|||
{ nsInstall::REBOOT_NEEDED, "REBOOT_NEEDED" },
|
||||
|
||||
// these are bitwise values supported by addFile
|
||||
{ DO_NOT_UNINSTALL, "DO_NOT_UNINSTALL" },
|
||||
{ WIN_SHARED_FILE, "WIN_SHARED_FILE" },
|
||||
{ WIN_SYSTEM_FILE, "WIN_SYSTEM_FILE" },
|
||||
{ nsInstall::DO_NOT_UNINSTALL, "DO_NOT_UNINSTALL" },
|
||||
{ nsInstall::WIN_SHARED_FILE, "WIN_SHARED_FILE" },
|
||||
|
||||
{ CHROME_SKIN, "SKIN" },
|
||||
{ CHROME_LOCALE, "LOCALE" },
|
||||
|
|
Загрузка…
Ссылка в новой задаче