First Checked In.

This commit is contained in:
dougt%netscape.com 1999-05-07 21:35:49 +00:00
parent ecf5b1c49b
commit 4bfb7582c3
11 changed files with 1931 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,18 @@
{C29DB6A1-D195-11d2-BCF1-00805F0E1353}
{C29DB6A2-D195-11d2-BCF1-00805F0E1353}
{C29DB6A3-D195-11d2-BCF1-00805F0E1353}
{C29DB6A4-D195-11d2-BCF1-00805F0E1353}
{C29DB6A5-D195-11d2-BCF1-00805F0E1353}
{C29DB6A6-D195-11d2-BCF1-00805F0E1353}
{C29DB6A7-D195-11d2-BCF1-00805F0E1353}
{C29DB6A8-D195-11d2-BCF1-00805F0E1353}
{C29DB6A9-D195-11d2-BCF1-00805F0E1353}

View File

@ -0,0 +1,71 @@
interface Prefm
{
/* IID: { 0xc29db6a1, 0xd195, 0x11d2, \
{0xbc, 0xf1, 0x00, 0x80, 0x5f, 0x0e, 0x13, 0x53}}
/* error codes */
const int PMERR_NO_4X_ON_SYSTEM = -200;
const int PMERR_GESTALT_UNKNOWN_ERR = -5550;
const int PMERR_GESTALT_INVALID_ARGUMENT = -5551;
const int PM_SUCCESS = 0;
/* message IDs*/
const int PM_ALEADY_UPDATED = 0;
/* 4.x and 5.x file names */
const char* PM_USER_PREFS_FILE_4 = "prefs.js";
const char* PM_USER_PREFS_FILE_5 = "prefs5.js";
const char* PM_COMMUNICATOR_PREFS_FILE_4 = "netscape.cfg";
const char* PM_COMMUNICATOR_PREFS_FILE_5 = "netscape5.cfg";
const char* PM_REGFILE_4 = "nsreg.dat";
const char* PM_REGFILE_5 = "nsreg5.dat";
readonly attribute wstring com4xPath;
readonly attribute wstring com5xPath;
readonly attribute wstring userProfilePath;
readonly attribute wstring systemPath;
void Prefm();
long SetPrefFilePaths(in wstring systemType,
in wstring com5xPath,
in wstring userProfilePath);
};

View File

@ -0,0 +1,58 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..
DEFINES=-D_IMPL_NS_DOM
EXPORTS= nsIPrefMigration.h \
nsPrefMigrationIIDs.h \
nsPrefMigration.h
MODULE=prefm
include <$(DEPTH)\config\rules.mak>

View File

@ -0,0 +1,118 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsIPrefMigration_h__
#define nsIPrefMigration_h__
#include "nsPrefMigrationIIDs.h"
#include "nsISupports.h"
#include "nsIFactory.h"
class nsIPrefMigration : public nsISupports
{
public:
static const nsIID& IID() { static nsIID iid = NS_IPrefMigration_IID; return iid; }
//NS_IMETHOD Startup() = 0;
//NS_IMETHOD Shutdown()= 0;
NS_IMETHOD ProcessPrefs(char*, char*)=0;
};
class nsPrefMigrationFactory : public nsIFactory
{
public:
nsPrefMigrationFactory();
~nsPrefMigrationFactory();
NS_DECL_ISUPPORTS
NS_IMETHOD CreateInstance(nsISupports *aOuter,
REFNSIID aIID,
void **aResult);
NS_IMETHOD LockFactory(PRBool aLock);
};
#endif // nsISoftwareUpdate_h__

View File

@ -0,0 +1,68 @@
#ifndef nsPrefMigration_h___
#define nsPrefMigration_h___
#include "nsPrefMigrationIIDs.h"
#include "nsIPrefMigration.h"
#include "nscore.h"
#include "nsIFactory.h"
#include "nsISupports.h"
class nsPrefMigration: public nsIPrefMigration
{
public:
static const nsIID& IID() { static nsIID iid = NS_PrefMigration_CID; return iid; }
nsPrefMigration();
~nsPrefMigration();
NS_DECL_ISUPPORTS
NS_IMETHOD Startup();
NS_IMETHOD Shutdown();
NS_IMETHOD ProcessPrefs(char* , char* );
private:
nsresult CreateNewUser5Tree(char*, char *);
nsresult Copy4xFiles(char*, char*);
nsresult CheckForSpace(char*, PRUint32);
};
#endif

View File

@ -0,0 +1,23 @@
#ifndef nsPrefMigrationIIDs_h___
#define nsPrefMigrationIIDs_h___
#define NS_IPrefMigration_IID { 0xc29db6a1, 0xd195, 0x11d2, 0xbc, 0xf1, 0x00, 0x80, 0x5f, 0x0e, 0x13, 0x53}
#define NS_PrefMigration_CID { 0xc29db6a2, 0xd195, 0x11d2, 0xbc, 0xf1, 0x00, 0x80, 0x5f, 0x0e, 0x13, 0x53}
#define NS_PrefMigrationFactory_CID { 0xc29db6a3, 0xd195, 0x11d2, 0xbc, 0xf1, 0x00, 0x80, 0x5f, 0x0e, 0x13, 0x53}
#define NS_IPrefMigrationFactory_IID { 0xc29db6a4, 0xd195, 0x11d2, 0xbc, 0xf1, 0x00, 0x80, 0x5f, 0x0e, 0x13, 0x53}
#endif /* nsPrefMigrationIIDs_h___ */

View File

@ -0,0 +1,148 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..
IGNORE_MANIFEST=1
MODULE=nsprefm
DLL=.\$(OBJDIR)\$(MODULE).dll
DEFINES=-D_IMPL_NS_DOM
# -DXP_MAC
LCFLAGS = \
$(LCFLAGS) \
$(DEFINES) \
$(NULL)
LINCS= \
-I..\base \
-I$(XPDIST)\public\prefm \
-I$(XPDIST)\public\js \
-I$(XPDIST)\public\netlib \
-I$(XPDIST)\public\network \
-I$(XPDIST)\public\dom \
-I$(XPDIST)\public\xpcom \
-I$(XPDIST)\public\util \
-I$(XPDIST)\public\nspr2 \
-I$(XPDIST)\public\pref \
-I$(XPDIST)\public\raptor \
-I$(XPDIST)\public\libreg \
$(NULL)
LLIBS = \
$(DIST)\lib\libreg32.lib \
$(DIST)\lib\xpcom32.lib \
$(DIST)\lib\raptorbase.lib \
$(DIST)\lib\plc3.lib \
$(DIST)\lib\xppref32.lib \
$(LIBNSPR) \
$(NULL)
OBJS = \
.\$(OBJDIR)\nsprefmigration.obj \
.\$(OBJDIR)\nsprefmigrationfactory.obj \
$(NULL)
include <$(DEPTH)\config\rules.mak>
install:: $(DLL)
$(MAKE_INSTALL) .\$(OBJDIR)\$(MODULE).dll $(DIST)\bin
$(MAKE_INSTALL) .\$(OBJDIR)\$(MODULE).lib $(DIST)\lib
clobber::
rm -f $(DIST)\lib\$(MODULE).lib
rm -f $(DIST)\bin\$(MODULE).dll

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,96 @@
#ifndef nsPrefMigration_h___
#define nsPrefMigration_h___
#include "nsPrefMigrationIIDs.h"
#include "nsIPrefMigration.h"
#include "nscore.h"
#include "nsIFactory.h"
#include "nsISupports.h"
class nsPrefMigration: public nsIPrefMigration
{
public:
static const nsIID& IID() { static nsIID iid = NS_PrefMigration_CID; return iid; }
nsPrefMigration();
~nsPrefMigration();
NS_DECL_ISUPPORTS
//NS_IMETHOD Startup();
//NS_IMETHOD Shutdown();
NS_IMETHOD ProcessPrefs(char* , char* );
private:
nsresult CreateNewUser5Tree(char* oldProfilePath,
char* newProfilePath);
nsresult GetDirFromPref(char* newProfilePath,
char* pref,
char* newPath,
char* oldPath);
nsresult Read4xFiles(char* ProfilePath,
char* fileArray[],
PRUint32* sizeTotal);
nsresult CheckForSpace(char* newProfilePath,
PRFloat64 requiredSpace);
nsresult DoTheCopy(char* oldPath,
char* newPath,
char* fileArray[]);
};
#endif

View File

@ -0,0 +1,276 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#include "pratom.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "VerReg.h"
#include "nsCOMPtr.h"
//#include "net.h"
#include "nsPrefMigration.h"
/*-------------------------------------------------------------------------*/
/* Pref Migration Factory routines */
/*-------------------------------------------------------------------------*/
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); /* Need to remove these defines from this */
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID); /* file they should be global to the */
/* prefmigration source files. */
static PRInt32 gPrefMigrationInstanceCnt = 0;
static PRInt32 gPrefMigrationLock = 0;
nsPrefMigrationFactory::nsPrefMigrationFactory(void)
{
mRefCnt=0;
PR_AtomicIncrement(&gPrefMigrationInstanceCnt);
}
nsPrefMigrationFactory::~nsPrefMigrationFactory(void)
{
PR_AtomicDecrement(&gPrefMigrationInstanceCnt);
}
NS_IMETHODIMP
nsPrefMigrationFactory::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (aInstancePtr == NULL)
{
return NS_ERROR_NULL_POINTER;
}
// Always NULL result, in case of failure
*aInstancePtr = NULL;
if ( aIID.Equals(kISupportsIID) )
{
*aInstancePtr = (void*) this;
}
else if ( aIID.Equals(kIFactoryIID) )
{
*aInstancePtr = (void*) this;
}
if (aInstancePtr == NULL)
{
return NS_ERROR_NO_INTERFACE;
}
AddRef();
return NS_OK;
}
NS_IMETHODIMP
nsPrefMigrationFactory::AddRef(void)
{
return ++mRefCnt;
}
NS_IMETHODIMP
nsPrefMigrationFactory::Release(void)
{
if (--mRefCnt ==0)
{
delete this;
return 0; // Don't access mRefCnt after deleting!
}
return mRefCnt;
}
/*------------------------------------------------------------------------*/
/* The PrefMigration CreateInstance Method
/*------------------------------------------------------------------------*/
NS_IMETHODIMP
nsPrefMigrationFactory::CreateInstance(nsISupports *aOuter,
REFNSIID aIID,
void **aResult)
{
if (aResult == NULL)
{
return NS_ERROR_NULL_POINTER;
}
*aResult = NULL;
nsPrefMigration *pPrefMigration = new nsPrefMigration();
if (pPrefMigration == NULL)
return NS_ERROR_OUT_OF_MEMORY;
nsresult result = pPrefMigration->QueryInterface(aIID, aResult);
if (result != NS_OK)
delete pPrefMigration;
return result;
}
NS_IMETHODIMP
nsPrefMigrationFactory::LockFactory(PRBool aLock)
{
if (aLock)
PR_AtomicIncrement(&gPrefMigrationLock);
else
PR_AtomicDecrement(&gPrefMigrationLock);
return NS_OK;
}