Header files for Java to C conversion. They are not part of the build system yet.

This commit is contained in:
raman%netscape.com 1998-08-17 00:44:45 +00:00
Родитель f10b268d52
Коммит c20de2fd12
17 изменённых файлов: 1889 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,104 @@
/* -*- Mode: C++; tab-width: 4; 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 nsFolderSpec_h__
#define nsFolderSpec_h__
#include "prtypes.h"
PR_BEGIN_EXTERN_C
struct nsFolderSpec {
public:
/* Public Methods */
/* Constructor
*/
nsFolderSpec(char* inFolderID , char* inVRPath, char* inPackageName);
~nsFolderSpec();
/*
* GetDirectoryPath
* returns full path to the directory in the standard URL form
*/
char* GetDirectoryPath(char* *errorMsg);
/**
* Returns full path to a file. Makes sure that the full path is bellow
* this directory (security measure
* @param relativePath relative path
* @return full path to a file
*/
char* MakeFullPath(char* relativePath, char* *errorMsg);
/**
* IsJavaCapable
* returns true if folder is on the Java classpath
*/
PRBool IsJavaCapable() { return NativeIsJavaDir(); }
char* toString();
private:
/* Private Fields */
char* urlPath; // Full path to the directory. Used to cache results from GetDirectoryPath
char* folderID; // Unique string specifying a folder
char* versionRegistryPath; // Version registry path of the package
char* userPackageName; // Name of the package presented to the user
/* Private Methods */
/* PickDefaultDirectory
* asks the user for the default directory for the package
* stores the choice
*/
char* PickDefaultDirectory(char* *errorMsg);
/* Private Native Methods */
/* NativeGetDirectoryPath
* gets a platform-specific directory path
* stores it in urlPath
*/
int NativeGetDirectoryPath();
/* GetNativePath
* returns a native equivalent of a XP directory path
*/
char* GetNativePath(char* Path);
/*
* NativePickDefaultDirectory
* Platform-specific implementation of GetDirectoryPath
*/
char* NativePickDefaultDirectory(char* *errorMsg);
PRBool NativeIsJavaDir();
};
PR_END_EXTERN_C
#endif /* nsFolderSpec_h__ */

Просмотреть файл

@ -0,0 +1,73 @@
/* -*- Mode: C++; tab-width: 4; 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 nsInstallDelete_h__
#define nsInstallDelete_h__
#include "prtypes.h"
#include "nsSoftwareUpdate.h"
PR_BEGIN_EXTERN_C
struct nsInstallDelete : public nsInstallObject {
public:
/* Public Fields */
PRInt32 FILE_DOES_NOT_EXIST; // File cannot be deleted as it does not exist.
PRInt32 FILE_READ_ONLY; // File cannot be deleted as it is read only.
PRInt32 FILE_IS_DIRECTORY; // File cannot be deleted as it is a directory.
PRInt32 deleteStatus;
/* Public Methods */
/* Constructor
* inFolder - a folder object representing the directory that contains the file
* inRelativeFileName - a relative path and file name
*/
nsInstallDelete(nsSoftwareUpdate* inSoftUpdate, nsFolderSpec* inFolder, char* inRelativeFileName, char* *errorMsg);
/* Constructor
* inRegistryName - name of the component in the registry
*/
nsInstallDelete(nsSoftwareUpdate* inSoftUpdate, char* inRegistryName, char* *errorMsg);
virtual ~nsInstallDelete();
char* Prepare();
char* Complete();
void Abort();
char* toString();
private:
/* Private Fields */
char* finalFile; // final file to be deleted
char* registryName; // final file to be deleted
/* Private Methods */
void processInstallDelete();
int NativeComplete();
int NativeCheckFileStatus();
};
PR_END_EXTERN_C
#endif /* nsInstallDelete_h__ */

Просмотреть файл

@ -0,0 +1,74 @@
/* -*- Mode: C++; tab-width: 4; 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 nsInstallExecute_h__
#define nsInstallExecute_h__
#include "prtypes.h"
#include "nsSoftwareUpdate.h"
PR_BEGIN_EXTERN_C
struct nsInstallExecute : public nsInstallObject {
public:
/* Public Fields */
/* Public Methods */
/* Constructor
* inJarLocation - location inside the JAR file
* inZigPtr - pointer to the ZIG *
*/
nsInstallExecute(nsSoftwareUpdate* inSoftUpdate, char* inJarLocation, char* *errorMsg, char* inArgs);
virtual ~nsInstallExecute();
/* Prepare
* Extracts file out of the JAR archive into the temp directory
*/
char* Prepare();
/* Complete
* Completes the install by executing the file
* Security hazard: make sure we request the right permissions
*/
char* Complete();
void Abort();
char* toString();
private:
/* Private Fields */
char* jarLocation; // Location in the JAR
char* tempFile; // temporary file location
char* args; // command line arguments
char* cmdline; // constructed command-line
/* Private Methods */
void NativeComplete();
void NativeAbort();
};
PR_END_EXTERN_C
#endif /* nsInstallExecute_h__ */

Просмотреть файл

@ -0,0 +1,107 @@
/* -*- Mode: C++; tab-width: 4; 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 nsInstallFile_h__
#define nsInstallFile_h__
#include "prtypes.h"
#include "nsSoftwareUpdate.h"
#include "nsVersionInfo.h"
#include "nsFolderSpec.h"
#include "nsString.h"
#include "nsVersionInfo.h"
#include "nsTarget.h"
PR_BEGIN_EXTERN_C
struct nsInstallFile : public nsInstallObject {
public:
/* Public Methods */
/* Constructor
inSoftUpdate - softUpdate object we belong to
inComponentName - full path of the registry component
inVInfo - full version info
inJarLocation - location inside the JAR file
inFinalFileSpec - final location on disk
*/
nsInstallFile(nsSoftwareUpdate* inSoftUpdate,
char* inVRName,
nsVersionInfo* inVInfo,
char* inJarLocation,
nsFolderSpec* folderSpec,
char* inPartialPath,
PRBool forceInstall,
char* *errorMsg);
virtual ~nsInstallFile();
/* Prepare
* Extracts file out of the JAR archive into the temp directory
*/
char* Prepare();
/* Complete
* Completes the install:
* - move the downloaded file to the final location
* - updates the registry
*/
char* Complete();
void Abort();
char* toString();
private:
/* Private Fields */
nsString* vrName; /* Name of the component */
nsVersionInfo* versionInfo; /* Version */
nsString* jarLocation; /* Location in the JAR */
nsString* tempFile; /* temporary file location */
nsString* finalFile; /* final file destination */
nsString* regPackageName; /* Name of the package we are installing */
nsString* userPackageName; /* User-readable package name */
nsTarget* target; /* security target */
PRBool force; /* whether install is forced */
PRBool bJavaDir; /* whether file is installed to a Java directory */
PRBool replace; /* whether file exists */
PRBool bChild; /* whether file is a child */
PRBool bUpgrade; /* whether file is an upgrade */
/* Private Field Accessors */
/* Private Methods */
/* Private Native Methods */
void NativeAbort();
int NativeComplete();
PRBool NativeDoesFileExist();
void AddToClasspath(nsString* file);
};
PR_END_EXTERN_C
#endif /* nsInstallFile_h__ */

Просмотреть файл

@ -0,0 +1,59 @@
/* -*- Mode: C++; tab-width: 4; 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 nsInstallObject_h__
#define nsInstallObject_h__
#include "prtypes.h"
#include "nsSoftwareUpdate.h"
PR_BEGIN_EXTERN_C
struct nsInstallObject {
public:
struct nsSoftwareUpdate* softUpdate;
/* Public Methods */
nsInstallObject(struct nsSoftwareUpdate* inSoftUpdate) {softUpdate = inSoftUpdate; }
/* Override with your set-up action */
virtual char* Prepare();
/* Override with your Completion action */
virtual char* Complete();
/* Override with an explanatory string for the progress dialog */
virtual char* toString();
/* Override with your clean-up function */
virtual void Abort();
private:
/* Private Field Accessors */
/* Private Methods */
};
PR_END_EXTERN_C
#endif /* nsInstallObject_h__ */

Просмотреть файл

@ -0,0 +1,93 @@
/* -*- Mode: C++; tab-width: 4; 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 nsInstallPath_h__
#define nsInstallPath_h__
#include "prtypes.h"
#include "nsSoftwareUpdate.h"
#include "nsVersionInfo.h"
#include "nsFolderSpec.h"
PR_BEGIN_EXTERN_C
struct nsInstallPath {
public:
/* Public Fields */
/* Public Methods */
/* Constructor
* inSoftUpdate - softUpdate object we belong to
* inVRName - full path of the registry component
* inVInfo - full version info
* inJarLocation - location inside the JAR file
* folderspec - FolderSpec of target file
* inPartialPath - target file on disk relative to folderspec
*/
nsInstallPatch(nsSoftwareUpdate* inSoftUpdate,
char* inVRName,
nsVersionInfo* inVInfo,
char* inJarLocation);
nsInstallPatch(nsSoftwareUpdate* inSoftUpdate,
char* inVRName,
nsVersionInfo* inVInfo,
char* inJarLocation,
nsFolderSpec* folderSpec,
char* inPartialPath);
~nsInstallPath();
void Prepare();
/* Complete
* Completes the install:
* - move the patched file to the final location
* - updates the registry
*/
void Complete();
void Abort();
char* toString();
private:
/* Private Fields */
char* vrName; // Registry name of the component
nsVersionInfo* versionInfo; // Version
char* jarLocation; // Location in the JAR
char* patchURL; // extracted location of diff (xpURL)
char* targetfile; // source and final file (native)
char* patchedfile; // temp name of patched file
/* Private Methods */
void checkPrivileges();
char* NativePatch( char* srcfile, char* diffURL );
PRInt32 NativeReplace( char* target, char* tmpfile );
void NativeDeleteFile( char* file );
};
PR_END_EXTERN_C
#endif /* nsInstallPath_h__ */

Просмотреть файл

@ -0,0 +1,39 @@
/* -*- Mode: C++; tab-width: 4; 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 nsSUError_h__
#define nsSUError_h__
#include "prtypes.h"
#include "nsString.h"
#include "nsSoftUpdateEnums.h"
PR_BEGIN_EXTERN_C
/* XXX: First cut at Error messages. The following could change. */
char * SU_GetErrorMsg1(int id, char* arg1);
char * SU_GetErrorMsg2(int id, nsString* arg1);
char * SU_GetErrorMsg3(char *str, int err);
char * SU_GetString(int id);
char * SU_GetString1(int id, char* arg1);
char * SU_GetString2(int id, nsString* arg1);
PR_END_EXTERN_C
#endif /* nsSUError_h__ */

Просмотреть файл

@ -0,0 +1,140 @@
/* -*- Mode: C++; tab-width: 4; 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 nsSoftUpdateEnums_h__
#define nsSoftUpdateEnums_h__
typedef enum nsSoftUpdateError {
nsSoftUpdateError_INVALID_PATH_ERR = -100,
nsSoftUpdateError_USER_CANCELLED_ERR = -101,
/* Errors -200 to -300 */
nsSoftUpdateError_BAD_PACKAGE_NAME = -200,
nsSoftUpdateError_UNEXPECTED_ERROR = -201,
nsSoftUpdateError_ACCESS_DENIED = -202,
nsSoftUpdateError_TOO_MANY_CERTIFICATES = -203, /* Installer file must have 1 certificate */
nsSoftUpdateError_NO_INSTALLER_CERTIFICATE = -204, /* Installer file must have a certificate */
nsSoftUpdateError_NO_CERTIFICATE = -205, /* Extracted file is not signed */
nsSoftUpdateError_NO_MATCHING_CERTIFICATE = -206, /* Extracted file does not match installer certificate */
nsSoftUpdateError_UNKNOWN_JAR_FILE = -207, /* JAR file has not been opened */
nsSoftUpdateError_INVALID_ARGUMENTS = -208, /* Bad arguments to a function */
nsSoftUpdateError_ILLEGAL_RELATIVE_PATH = -209, /* Illegal relative path */
nsSoftUpdateError_USER_CANCELLED = -210, /* User cancelled */
nsSoftUpdateError_INSTALL_NOT_STARTED = -211,
nsSoftUpdateError_SILENT_MODE_DENIED = -212,
nsSoftUpdateError_NO_SUCH_COMPONENT = -213, /* no such component in the registry. */
nsSoftUpdateError_FILE_DOES_NOT_EXIST = -214, /* File cannot be deleted as it does not exist */
nsSoftUpdateError_FILE_READ_ONLY = -215, /* File cannot be deleted as it is read only. */
nsSoftUpdateError_FILE_IS_DIRECTORY = -216, /* File cannot be deleted as it is a directory */
nsSoftUpdateError_APPLE_SINGLE_ERR = -218, /* error in AppleSingle unpacking */
nsSoftUpdateError_GESTALT_UNKNOWN_ERR = -5550,
nsSoftUpdateError_GESTALT_INVALID_ARGUMENT = -5551,
} nsSoftUpdateError;
#define nsSoftwareUpdate_SUCCESS 0
#define nsSoftwareUpdate_REBOOT_NEEDED 999
typedef enum nsInstallType {
nsInstallType_LIMITED_INSTALL= 0,
nsInstallType_FULL_INSTALL = 1,
nsInstallType_SILENT_INSTALL = 2
} nsInstallType;
typedef enum nsVersionEnum {
nsVersionEnum_MAJOR_DIFF = 4,
nsVersionEnum_MINOR_DIFF = 3,
nsVersionEnum_REL_DIFF = 2,
nsVersionEnum_BLD_DIFF = 1,
nsVersionEnum_EQUAL = 0
} nsVersionEnum;
typedef enum nsInstallDeleteEnum {
DELETE_FILE = 1,
DELETE_COMPONENT=2
} nsInstallDeleteEnum;
/**
* diff levels are borrowed from the VersionInfo class
*/
typedef enum nsTriggerDiffLevelEnum {
MAJOR_DIFF = 4,
MINOR_DIFF = 3,
REL_DIFF = 2,
BLD_DIFF = 1,
EQUAL = 0
} nsTriggerDiffLevelEnum;
typedef enum nsWinRegEnum {
/* not static because class is not public--users couldn't get to them */
HKEY_CLASSES_ROOT = 0x80000000,
HKEY_CURRENT_USER = 0x80000001,
HKEY_LOCAL_MACHINE = 0x80000002,
HKEY_USERS = 0x80000003,
CREATE = 1,
DELETE = 2,
DELETE_VAL = 3,
SET_VAL_STRING = 4,
SET_VAL = 5
} nsWinRegEnum;
typedef enum nsWinRegValueEnum {
REG_SZ = 1,
REG_EXPAND_SZ = 2,
REG_BINARY = 3,
REG_DWORD = 4,
REG_DWORD_LITTLE_ENDIAN = 4,
REG_DWORD_BIG_ENDIAN = 5,
REG_LINK = 6,
REG_MULTI_SZ = 7,
REG_RESOURCE_LIST = 8,
REG_FULL_RESOURCE_DESCRIPTOR = 9,
REG_RESOURCE_REQUIREMENTS_LIST = 10
} nsWinRegValueEnum;
typedef enum nsRegistryErrorsEnum {
REGERR_OK = 0,
REGERR_FAIL = 1,
REGERR_NOMORE = 2,
REGERR_NOFIND = 3,
REGERR_BADREAD = 4,
REGERR_BADLOCN = 5,
REGERR_PARAM = 6,
REGERR_BADMAGIC = 7,
REGERR_BADCHECK = 8,
REGERR_NOFILE = 9,
REGERR_MEMORY = 10,
REGERR_BUFTOOSMALL = 11,
REGERR_NAMETOOLONG = 12,
REGERR_REGVERSION = 13,
REGERR_DELETED = 14,
REGERR_BADTYPE = 15,
REGERR_NOPATH = 16,
REGERR_BADNAME = 17,
REGERR_READONLY = 18,
REGERR_BADUTF8 = 19,
REGERR_SECURITY = 99,
} nsRegistryErrorsEnum;
#endif /* nsSoftUpdateEnums_h__ */

Просмотреть файл

@ -0,0 +1,431 @@
/* -*- Mode: C++; tab-width: 4; 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 nsSoftwareUpdate_h__
#define nsSoftwareUpdate_h__
#include "prtypes.h"
#include "nsHashtable.h"
#include "nsVector.h"
#include "nsSoftUpdateEnums.h"
#include "nsFolderSpec.h"
#include "nsVersionInfo.h"
#include "nsInstallObject.h"
#include "nsPrincipal.h"
PR_BEGIN_EXTERN_C
#define IMPERSONATOR "Impersonator"
#define INSTALL_PRIV "SoftwareInstall"
#define SILENT_PRIV "SilentInstall"
#define FOLDER_FILE_URL "File URL"
struct nsProgressDetails;
struct nsSoftwareUpdate {
public:
/* Public Fields */
char* packageName; /* Name of the package we are installing */
char* userPackageName; /* User-readable package name */
nsVector* installedFiles; /* List of files/processes to be installed */
nsHashtable* patchList; /* files that have been patched (orig name is key) */
nsVersionInfo* versionInfo; /* Component version info */
/* Public Methods */
/**
* @param env JavaScript environment (this inside the installer). Contains installer directives
* @param inUserPackageName Name of tha package installed. This name is displayed to the user
*/
nsSoftwareUpdate(void* env, char* inUserPackageName);
virtual ~nsSoftwareUpdate();
nsPrincipal* GetPrincipal();
char* GetUserPackageName();
char* GetRegPackageName();
PRBool GetSilent();
/**
* @return a vector of InstallObjects
*/
nsVector* GetInstallQueue();
/**
* @return the most recent non-zero error code
* @see ResetError
*/
PRInt32 GetLastError();
/**
* resets remembered error code to zero
* @see GetLastError
*/
void ResetError();
/**
* @return the folder object suitable to be passed into AddSubcomponent
* @param folderID One of the predefined folder names
* @see AddSubcomponent
*/
nsFolderSpec* GetFolder(char* folderID, char* *errorMsg);
/**
* @return the full path to a component as it is known to the
* Version Registry
* @param component Version Registry component name
*/
nsFolderSpec* GetComponentFolder(char* component);
nsFolderSpec* GetComponentFolder(char* component, char* subdir, char* *errorMsg);
/**
* sets the default folder for the package
* @param folder a folder object obtained through GetFolder()
*/
void SetPackageFolder(nsFolderSpec* folder);
/**
* Returns a Windows Profile object if you're on windows,
* null if you're not or if there's a security error
*/
void* GetWinProfile(nsFolderSpec* folder, char* file, char* *errorMsg);
/**
* @return an object for manipulating the Windows Registry.
* Null if you're not on windows
*/
void* GetWinRegistry(char* *errorMsg);
/**
* extract the file out of the JAR directory and places it into temporary
* directory.
* two security checks:
* - the certificate of the extracted file must match the installer certificate
* - must have privileges to extract the jar file
* @param inJarLocation file name inside the JAR file
*/
char* ExtractJARFile(char* inJarLocation, char* finalFile, char* *errorMsg);
/**
* Call this to initialize the update
* Opens the jar file and gets the certificate of the installer
* Opens up the gui, and asks for proper security privileges
* @param vrPackageName Full qualified version registry name of the package
* (ex: "/Plugins/Adobe/Acrobat")
* null or empty package names are errors
* @param inVInfo version of the package installed.
* Can be null, in which case package is installed
* without a version. Having a null version, this package is
* automatically updated in the future (ie. no version check is performed).
* @param securityLevel ignored (was LIMITED_INSTALL or FULL_INSTALL)
*/
PRInt32 StartInstall(char* vrPackageName, nsVersionInfo* inVInfo, PRInt32 securityLevel, char* *errorMsg);
/**
* An new form that doesn't require the security level
*/
PRInt32 StartInstall(char* vrPackageName, nsVersionInfo* inVInfo, char* *errorMsg);
/**
* another StartInstall() simplification -- version as char*
*/
PRInt32 StartInstall(char* vrPackageName, char* inVer, char* *errorMsg);
/*
* UI feedback
*/
void UserCancelled();
void UserApproved();
/**
* Proper completion of the install
* Copies all the files to the right place
* returns 0 on success, <0 error code on failure
*/
PRInt32 FinalizeInstall(char* *errorMsg);
/**
* Aborts the install :), cleans up all the installed files
* XXX: This is a synchronized method. FIX it.
*/
void AbortInstall();
/**
* ScheduleForInstall
* call this to put an InstallObject on the install queue
* Do not call installedFiles.addElement directly, because this routine also handles
* progress messages
*/
char* ScheduleForInstall(nsInstallObject* ob);
/**
* Extract a file from JAR archive to the disk, and update the
* version registry. Actually, keep a record of elements to be installed. FinalizeInstall()
* does the real installation. Install elements are accepted if they meet one of the
* following criteria:
* 1) There is no entry for this subcomponnet in the registry
* 2) The subcomponent version info is newer than the one installed
* 3) The subcomponent version info is null
*
* @param name path of the package in the registry. Can be:
* absolute: "/Plugins/Adobe/Acrobat/Drawer.exe"
* relative: "Drawer.exe". Relative paths are relative to main package name
* null: if null jarLocation is assumed to be the relative path
* @param version version of the subcomponent. Can be null
* @param jarSource location of the file to be installed inside JAR
* @param folderSpec one of the predefined folder locations
* @see GetFolder
* @param relativePath where the file should be copied to on the local disk.
* Relative to folder
* if null, use the path to the JAR source.
* @param forceInstall if true, file is always replaced
*/
PRInt32 AddSubcomponent(char* name,
nsVersionInfo* version,
char* jarSource,
nsFolderSpec* folderSpec,
char* relativePath,
PRBool forceInstall,
char* *errorMsg);
/**
* executes the file
* @param jarSource name of the file to execute inside JAR archive
* @param args command-line argument string (Win/Unix only)
*/
PRInt32 Execute(char* jarSource, char* *errorMsg, char* args);
/**
* Mac-only, simulates Mac toolbox Gestalt function
* OSErr Gestalt(char* selector, long * response)
* @param selector 4-character string,
* @return 2 item array. 1st item corresponds to OSErr,
* 2nd item corresponds to response
*/
PRInt32 Gestalt(char* selectorStr, int* os_err, char* *errorMsg);
/**
* Patch
*
*/
PRInt32 Patch(char* regName, nsVersionInfo* version, char* patchname, char* *errorMsg);
PRInt32 Patch(char* regName, nsVersionInfo* version, char* patchname,
nsFolderSpec* folder, char* filename, char* *errorMsg);
/**
* This method deletes the specified file from the disk. It does not look
* for the file in the registry and is guaranteed to muddle any uninstall
* reference counting. Its main purpose is to delete files installed or
* created outside of SmartUpdate.
*/
PRInt32 DeleteFile(nsFolderSpec* folder, char* relativeFileName, char* *errorMsg);
/**
* This method finds named registry component and deletes both the file and the
* entry in the Client VR. registryName is the name of the component in the registry.
* Returns usual errors codes + code to indicate item doesn't exist in registry, registry
* item wasn't a file item, or the related file doesn't exist. If the file is in use we will
* store the name and to try to delete it on subsequent start-ups until we're successful.
*/
PRInt32 DeleteComponent(char* registryName, char* *errorMsg);
nsFolderSpec* GetFolder(char* targetFolder, char* subdirectory, char* *errorMsg);
nsFolderSpec* GetFolder(nsFolderSpec* folder, char* subdir, char* *errorMsg);
/**
* This method returns true if there is enough free diskspace, false if there isn't.
* The drive containg the folder is checked for # of free bytes.
*/
long DiskSpaceAvailable(nsFolderSpec* folder);
/**
* This method is used to install an entire subdirectory of the JAR.
* Any files so installed are individually entered into the registry so they
* can be uninstalled later. Like AddSubcomponent the directory is installed
* only if the version specified is greater than that already registered,
* or if the force parameter is true.The final version presented is the complete
* form, the others are for convenience and assume values for the missing
* arguments.
*/
PRInt32 AddDirectory(char* name,
nsVersionInfo* version,
char* jarSource,
nsFolderSpec* folderSpec,
char* subdir,
PRBool forceInstall);
/* Uninstall */
PRInt32 Uninstall(char* packageName);
/*******************************
*
* progress window
*
* functions for dealing with the progress window.
* normally I'd make this an object, but since we're implementing
* it with native routines and will soon be getting rid of Java
* altogether this makes more sense for now. Creating a new object
* would only lead to more JRI hell, especially on the Mac
*******************************/
void OpenProgressDialog();
void CloseProgressDialog();
void SetProgressDialogItem(char* message);
void SetProgressDialogRange(PRInt32 max);
void SetProgressDialogThermo(PRInt32 value);
private:
/* Private Fields */
nsFolderSpec* packageFolder; /* default folder for package */
nsProgressDetails* confdlg; /* Detail confirmation dialog */
PRInt32 userChoice; /* User feedback: -1 unknown, 0 is cancel, 1 is OK */
PRInt32 progwin; /* pointer to native progress window */
PRBool silent; /* Silent upgrade? */
PRBool force; /* Force install? */
PRInt32 lastError; /* the most recent non-zero error */
char* filesep; /* the platform-specific file separator */
char* installerJarName; /* Name of the installer file */
char* jarName; /* Name of the JAR file */
char* jarCharset; /* Charset for filenames in JAR */
void* zigPtr; /* Stores the pointer to ZIG * */
nsPrincipal* installPrincipal; /* principal with the signature from the JAR file */
/* Private Field Accessors */
/* Private Methods */
/*
* Reads in the installer certificate, and creates its principal
*/
char* InitializeInstallerCertificate();
/*
* checks if our principal has privileges for silent install
*/
PRBool CheckSilentPrivileges();
/* Request the security privileges, so that the security dialogs
* pop up
*/
void RequestSecurityPrivileges();
/**
* saves non-zero error codes so they can be seen by GetLastError()
*/
PRInt32 saveError(PRInt32 errcode);
/*
* CleanUp
* call it when done with the install
*
* XXX: This is a synchronized method. FIX it.
*/
void CleanUp();
/**
* GetQualifiedRegName
*
* This routine converts a package-relative component registry name
* into a full name that can be used in calls to the version registry.
*/
char* GetQualifiedRegName(char* name);
/* Private Native methods */
/* VerifyJSObject
* Make sure that JSObject is of type SoftUpdate.
* Since SoftUpdate JSObject can only be created by C code
* we cannot be spoofed
*/
void VerifyJSObject(void* jsObj);
/* Open/close the jar file
*/
char* OpenJARFile();
void CloseJARFile();
/* getCertificates
* native encapsulation that calls AppletClassLoader.getCertificates
* we cannot call this method from Java because it is private.
* The method cannot be made public because it is a security risk
*/
void* getCertificates(void* zigPtr, char* inJarLocation);
char* NativeExtractJARFile(char* inJarLocation, char* finalFile, char* *errorMsg);
PRInt32 NativeMakeDirectory(char* path);;
long NativeDiskSpaceAvailable(char* path);
char* NativeFileURLToNative(char* Dir, char* path);
char** ExtractDirEntries(char* Dir);
PRInt32 NativeOpenProgDlg(char* packageName);
void NativeCloseProgDlg(PRInt32 progptr);
void NativeSetProgDlgItem(PRInt32 progptr, char* message);
void NativeSetProgDlgRange(PRInt32 progptr, PRInt32 max);
void NativeSetProgDlgThermo(PRInt32 progptr, PRInt32 value);
PRBool UserWantsConfirm();
};
PR_END_EXTERN_C
#endif /* nsSoftwareUpdate_h__ */

Просмотреть файл

@ -0,0 +1,131 @@
/* -*- Mode: C++; tab-width: 4; 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 nsTrigger_h__
#define nsTrigger_h__
#include "prtypes.h"
#include "nsVersionInfo.h"
PR_BEGIN_EXTERN_C
struct nsTrigger {
public:
/* Public Fields */
/**
* DEFAULT_MODE has UI, triggers conditionally
* @see StartSoftwareUpdate flags argument
*
*/
static PRInt32 DEFAULT_MODE = 0;
/**
* FORCE_MODE will install the package regardless of what was installed previously
* @see StartSoftwareUpdate flags argument
*/
static PRInt32 FORCE_MODE = 1;
/**
* SILENT_MODE will not display the UI
*/
static PRInt32 SILENT_MODE = 2;
/* Public Methods */
/**
* @return true if SmartUpdate is enabled
*/
static PRBool UpdateEnabled();
/**
* @param componentName version registry name of the component
* @return version of the package. null if not installed, or SmartUpdate disabled
*/
static nsVersionInfo* GetVersionInfo( char* componentName );
/**
* Unconditionally starts the software update
* @param url URL of the JAR file
* @param flags SmartUpdate modifiers (SILENT_INSTALL, FORCE_INSTALL)
* @return false if SmartUpdate did not trigger
*/
static PRBool StartSoftwareUpdate( char* url, PRInt32 flags );
static PRBool StartSoftwareUpdate( char* url );
/**
* Conditionally starts the software update
* @param url URL of JAR file
* @param componentName name of component in the registry to compare
* the version against. This doesn't have to be the
* registry name of the installed package but could
* instead be a sub-component -- useful because if a
* file doesn't exist then it triggers automatically.
* @param diffLevel Specifies which component of the version must be
* different. If not supplied BLD_DIFF is assumed.
* If the diffLevel is positive the install is triggered
* if the specified version is NEWER (higher) than the
* registered version. If the diffLevel is negative then
* the install is triggered if the specified version is
* OLDER than the registered version. Obviously this
* will only have an effect if FORCE_MODE is also used.
* @param version The version that must be newer (can be a VersionInfo
* object or a char* version
* @param flags Same flags as StartSoftwareUpdate (force, silent)
*/
static PRBool
ConditionalSoftwareUpdate( char* url,
char* componentName,
PRInt32 diffLevel,
nsVersionInfo* version,
PRInt32 flags);
/**
* Validates existence and compares versions
*
* @param regName name of component in the registry to compare
* the version against. This doesn't have to be the
* registry name of an installed package but could
* instead be a sub-component. If the named item
* has a Path property the file must exist or a
* null version is used in the comparison.
* @param version The version to compare against
*/
static PRInt32 CompareVersion( char* regName, nsVersionInfo* version );
static PRInt32 CompareVersion( char* regName, char* version );
static PRInt32 CompareVersion( char* regName, PRInt32 maj, PRInt32 min, PRInt32 rel, PRInt32 bld );
private:
/* Private Fields */
/* Private Methods */
};
PR_END_EXTERN_C
#endif /* nsTrigger_h__ */

Просмотреть файл

@ -0,0 +1,70 @@
/* -*- Mode: C++; tab-width: 4; 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 nsVersionInfo_h__
#define nsVersionInfo_h__
#include "prtypes.h"
#include "nsSoftUpdateEnums.h"
#include "nsVersionInfo.h"
PR_BEGIN_EXTERN_C
struct nsVersionInfo {
public:
/* Public Methods */
nsVersionInfo(PRInt32 maj, PRInt32 min, PRInt32 rel, PRInt32 bld, PRInt32 checksum);
nsVersionInfo(char* version);
~nsVersionInfo();
/* Text representation of the version info */
char* toString();
/*
* compareTo() -- Compares version info.
* Returns -n, 0, n, where n = {1-4}
*/
nsVersionEnum compareTo(nsVersionInfo* vi);
nsVersionEnum compareTo(char* version);
nsVersionEnum compareTo(PRInt32 maj, PRInt32 min, PRInt32 rel, PRInt32 bld);
private:
/* Private Fields */
/* Equivalent to Version Registry structure fields */
PRInt32 major;
PRInt32 minor;
PRInt32 release;
PRInt32 build;
PRInt32 check;
/* Private Methods */
};
PR_END_EXTERN_C
#endif /* nsVersionInfo_h__ */

Просмотреть файл

@ -0,0 +1,189 @@
/* -*- Mode: C++; tab-width: 4; 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 nsVersionRegistry_h__
#define nsVersionRegistry_h__
#include "prtypes.h"
#include "nsVersionInfo.h"
PR_BEGIN_EXTERN_C
struct nsVersionRegistry {
public:
/* Public Fields */
/* Public Methods */
/**
* Return the physical disk path for the specified component.
* @param component Registry path of the item to look up in the Registry
* @return The disk path for the specified component; NULL indicates error
* @see VersionRegistry#checkComponent
*/
static char* componentPath( char* component );
/**
* Return the version information for the specified component.
* @param component Registry path of the item to look up in the Registry
* @return A VersionInfo object for the specified component; NULL indicates error
* @see VersionRegistry#checkComponent
*/
static nsVersionInfo* componentVersion( char* component );
static char* getDefaultDirectory( char* component );
static PRInt32 setDefaultDirectory( char* component, char* directory );
static PRInt32 installComponent( char* name, char* path, nsVersionInfo* version );
static PRInt32 installComponent( char* name, char* path, nsVersionInfo* version, PRInt32 refCount );
/**
* Delete component and all sub-components.
* @param component Registry path of the item to delete
* @return Error code
*/
static PRInt32 deleteComponent( char* component );
/**
* Check the status of a named components.
* @param component Registry path of the item to check
* @return Error code. REGERR_OK means the named component was found in
* the registry, the filepath referred to an existing file, and the
* checksum matched the physical file. Other error codes can be used to
* distinguish which of the above was not true.
*/
static PRInt32 validateComponent( char* component );
/**
* verify that the named component is in the registry (light-weight
* version of validateComponent since it does no disk access).
* @param component Registry path of the item to verify
* @return Error code. REGERR_OK means it is in the registry.
* REGERR_NOFIND will usually be the result otherwise.
*/
static PRInt32 inRegistry( char* component );
/**
* Closes the registry file.
* @return Error code
*/
static PRInt32 close();
/**
* Returns an enumeration of the Version Registry contents. Use the
* enumeration methods of the returned object to fetch individual
* elements sequentially.
*/
static void* elements();
/**
* Set the refcount of a named component.
* @param component Registry path of the item to check
* @param refcount value to be set
* @return Error code
*/
static PRInt32 setRefCount( char* component, PRInt32 refcount );
/**
* Return the refcount of a named component.
* @param component Registry path of the item to check
* @return the value of refCount
*/
static PRInt32 getRefCount( char* component );
/**
* Creates a node for the item in the Uninstall list.
* @param regPackageName Registry name of the package we are installing
* @return userPackagename User-readable package name
* @return Error code
*/
static PRInt32 uninstallCreate( char* regPackageName, char* userPackageName );
static PRInt32 uninstallCreateNode( char* regPackageName, char* userPackageName );
/**
* Adds the file as a property of the Shared Files node under the appropriate
* packageName node in the Uninstall list.
* @param regPackageName Registry name of the package installed
* @param vrName registry name of the shared file
* @return Error code
*/
static PRInt32 uninstallAddFile( char* regPackageName, char* vrName );
static PRInt32 uninstallAddFileToList( char* regPackageName, char* vrName );
/**
* Checks if the shared file exists in the uninstall list of the package
* @param regPackageName Registry name of the package installed
* @param vrName registry name of the shared file
* @return true or false
*/
static PRInt32 uninstallFileExists( char* regPackageName, char* vrName );
static PRInt32 uninstallFileExistsInList( char* regPackageName, char* vrName );
static char* getUninstallUserName( char* regPackageName );
private:
/* Private Fields */
/* Private Methods */
/**
* This class is simply static function wrappers; don't "new" one
*/
nsVersionRegistry();
/**
* Replaces all '/' with '_',in the given char*.If an '_' already exists in the
* given char*, it is escaped by adding another '_' to it.
* @param regPackageName Registry name of the package we are installing
* @return modified char*
*/
static char* convertPackageName( char* regPackageName );
};
/* XXX: We should see whether we need the following class or not.
* Because there is no Enumerator class in C++
*/
struct VerRegEnumerator {
public:
PRBool hasMoreElements();
void* nextElement();
private:
char* path;
PRInt32 state;
char* regNext();
};
PR_END_EXTERN_C
#endif /* nsVersionRegistry_h__ */

Просмотреть файл

@ -0,0 +1,88 @@
/* -*- Mode: C++; tab-width: 4; 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 nsWinProfile_h__
#define nsWinProfile_h__
#include "prtypes.h"
#include "nsSoftwareUpdate.h"
#include "nsFolderSpec.h"
#include "nsPrincipal.h"
#include "nsPrivilegeManager.h"
#include "nsTarget.h"
#include "nsUserTarget.h"
PR_BEGIN_EXTERN_C
struct nsWinProfile {
public:
/* Public Fields */
/* Public Methods */
nsWinProfile( nsSoftwareUpdate* suObj, nsFolderSpec* folder, char* file );
/**
* Schedules a write into a windows "ini" file. "Value" can be
* null to delete the value, but we don't support deleting an entire
* section via a null "key". The actual write takes place during
* SoftwareUpdate.FinalizeInstall();
*
* @return false for failure, true for success
*/
PRBool writeString( char* section, char* key, char* value );
/**
* Reads a value from a windows "ini" file. We don't support using
* a null "key" to return a list of keys--you have to know what you want
*
* @return String value from INI, "" if not found, null if error
*/
char* getString( char* section, char* key );
char* getFilename();
nsSoftwareUpdate* softUpdate();
int finalWriteString( char* section, char* key, char* value );
private:
/* Private Fields */
char* filename;
nsSoftwareUpdate* su;
nsPrincipal* principal;
nsPrivilegeManager* privMgr;
nsTarget* impersonation;
nsUserTarget* target;
/* Private Methods */
int nativeWriteString( char* section, char* key, char* value );
char* nativeGetString( char* section, char* key );
};
PR_END_EXTERN_C
#endif /* nsWinProfile_h__ */

Просмотреть файл

@ -0,0 +1,73 @@
/* -*- Mode: C++; tab-width: 4; 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 nsWinProfileItem_h__
#define nsWinProfileItem_h__
#include "prtypes.h"
#include "nsSoftwareUpdate.h"
#include "nsInstallObject.h"
#include "nsWinProfile.h"
PR_BEGIN_EXTERN_C
class nsWinProfileItem : public nsInstallObject {
public:
/* Public Fields */
/* Public Methods */
nsWinProfileItem(nsWinProfile* profileObj,
char* sectionName,
char* keyName,
char* val);
/**
* Completes the install:
* - writes the data into the .INI file
*/
char* Complete();
float GetInstallOrder();
char* toString();
// no need for special clean-up
void Abort();
// no need for set-up
char* Prepare();
private:
/* Private Fields */
nsWinProfile* profile; // initiating profile object
char* section; // Name of section
char* key; // Name of key
char* value; // data to write
/* Private Methods */
};
PR_END_EXTERN_C
#endif /* nsWinProfileItem_h__ */

Просмотреть файл

@ -0,0 +1,88 @@
/* -*- Mode: C++; tab-width: 4; 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 nsWinReg_h__
#define nsWinReg_h__
#include "prtypes.h"
#include "nsSoftwareUpdate.h"
#include "nsSoftUpdateEnums.h"
#include "nsWinRegValue.h"
#include "nsPrincipal.h"
#include "nsPrivilegeManager.h"
#include "nsTarget.h"
#include "nsUserTarget.h"
PR_BEGIN_EXTERN_C
struct nsWinReg {
public:
/* Public Fields */
/* Public Methods */
nsWinReg(nsSoftwareUpdate* suObj);
void setRootKey(PRInt32 key);
PRInt32 createKey(char* subkey, char* classname);
PRInt32 deleteKey(char* subkey);
PRInt32 deleteValue(char* subkey, char* valname);
PRInt32 setValueString(char* subkey, char* valname, char* value);
char* getValueString(char* subkey, char* valname);
PRInt32 setValue(char* subkey, char* valname, nsWinRegValue* value);
nsWinRegValue* getValue(char* subkey, char* valname);
nsSoftwareUpdate* softUpdate();
PRInt32 finalCreateKey(PRInt32 root, char* subkey, char* classname);
PRInt32 finalDeleteKey(PRInt32 root, char* subkey);
PRInt32 finalDeleteValue(PRInt32 root, char* subkey, char* valname);
PRInt32 finalSetValueString(PRInt32 root, char* subkey, char* valname, char* value);
PRInt32 finalSetValue(PRInt32 root, char* subkey, char* valname, nsWinRegValue* value);
private:
/* Private Fields */
PRInt32 rootkey;
nsPrincipal* principal;
nsPrivilegeManager* privMgr;
nsTarget* impersonation;
nsSoftwareUpdate* su;
nsUserTarget* target;
/* Private Methods */
PRInt32 nativeCreateKey(char* subkey, char* classname);
PRInt32 nativeDeleteKey(char* subkey);
PRInt32 nativeDeleteValue(char* subkey, char* valname);
PRInt32 nativeSetValueString(char* subkey, char* valname, char* value);
char* nativeGetValueString(char* subkey, char* valname);
PRInt32 nativeSetValue(char* subkey, char* valname, nsWinRegValue* value);
nsWinRegValue* nativeGetValue(char* subkey, char* valname);
};
PR_END_EXTERN_C
#endif /* nsWinReg_h__ */

Просмотреть файл

@ -0,0 +1,80 @@
/* -*- Mode: C++; tab-width: 4; 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 nsWinRegItem_h__
#define nsWinRegItem_h__
#include "prtypes.h"
#include "nsSoftwareUpdate.h"
#include "nsInstallObject.h"
#include "nsWinReg.h"
PR_BEGIN_EXTERN_C
class nsWinRegItem : public nsInstallObject {
public:
/* Public Fields */
/* Public Methods */
nsWinRegItem(nsWinReg* regObj,
PRInt32 root,
PRInt32 action,
char* sub,
char* valname,
void* val);
/**
* Completes the install:
* - writes the data into the .INI file
*/
virtual char* Complete();
float GetInstallOrder();
char* toString();
// no need for special clean-up
void Abort();
// no need for set-up
virtual char* Prepare();
private:
/* Private Fields */
nsWinReg* reg; // initiating WinReg object
PRInt32 rootkey;
PRInt32 command;
char* subkey; // Name of section
char* name; // Name of key
void* value; // data to write
/* Private Methods */
char* keystr(PRInt32 root, char* subkey, char* name);
};
PR_END_EXTERN_C
#endif /* nsWinRegItem_h__ */

Просмотреть файл

@ -0,0 +1,50 @@
/* -*- Mode: C++; tab-width: 4; 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 nsWinRegValue_h__
#define nsWinRegValue_h__
#include "prtypes.h"
PR_BEGIN_EXTERN_C
struct nsWinRegValue {
public:
/* Public Fields */
PRInt32 type;
void* data;
PRInt32 data_length;
/* Public Methods */
nsWinRegValue(PRInt32 datatype, void* regdata, PRInt32 len) {type = datatype; data = regdata; data_length = len;}
private:
/* Private Fields */
/* Private Methods */
};
PR_END_EXTERN_C
#endif /* nsWinRegValue_h__ */