These files were on the branch but never made it to the tip.
This commit is contained in:
dougt%netscape.com 1999-05-07 00:47:09 +00:00
Родитель daa9065307
Коммит 66aa98a5d5
7 изменённых файлов: 2593 добавлений и 0 удалений

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,233 @@
/* -*- 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 "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,
* released March 31, 1998.
*
* 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.
*
* Contributors:
* Douglas Turner <dougt@netscape.com>
*/
#ifndef SU_PAS_H
#define SU_PAS_H
#include <Errors.h>
#include <Types.h>
#include <Files.h>
#include <Script.h>
#include <Resources.h>
typedef struct PASHeader /* header portion of Patchable AppleSingle */
{
UInt32 magicNum; /* internal file type tag = 0x00244200*/
UInt32 versionNum; /* format version: 1 = 0x00010000 */
UInt8 filler[16]; /* filler */
UInt16 numEntries; /* number of entries which follow */
} PASHeader ;
typedef struct PASEntry /* one Patchable AppleSingle entry descriptor */
{
UInt32 entryID; /* entry type: see list, 0 invalid */
UInt32 entryOffset; /* offset, in bytes, from beginning */
/* of file to this entry's data */
UInt32 entryLength; /* length of data in octets */
} PASEntry;
typedef struct PASMiscInfo
{
short fileHasResFork;
short fileResAttrs;
OSType fileType;
OSType fileCreator;
UInt32 fileFlags;
} PASMiscInfo;
typedef struct PASResFork
{
short NumberOfTypes;
} PASResFork;
typedef struct PASResource
{
short attr;
short attrID;
OSType attrType;
Str255 attrName;
unsigned long length;
} PASResource;
#if PRAGMA_ALIGN_SUPPORTED
#pragma options align=reset
#endif
#define kCreator 'MOSS'
#define kType 'PASf'
#define PAS_BUFFER_SIZE (1024*512)
#define PAS_MAGIC_NUM (0x00244200)
#define PAS_VERSION (0x00010000)
enum
{
ePas_Data = 1,
ePas_Misc,
ePas_Resource
};
#ifdef __cplusplus
extern "C" {
#endif
/* Prototypes */
OSErr PAS_EncodeFile(FSSpec *inSpec, FSSpec *outSpec);
OSErr PAS_DecodeFile(FSSpec *inSpec, FSSpec *outSpec);
#ifdef __cplusplus
}
#endif
#endif /* SU_PAS_H */

135
xpinstall/src/gdiff.h Normal file
Просмотреть файл

@ -0,0 +1,135 @@
/* -*- 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.
*/
/*--------------------------------------------------------------
* GDIFF.H
*
* Constants used in processing the GDIFF format
*--------------------------------------------------------------*/
#include "prio.h"
#include "nsFileSpec.h"
#define GDIFF_MAGIC "\xD1\xFF\xD1\xFF"
#define GDIFF_MAGIC_LEN 4
#define GDIFF_VER 5
#define GDIFF_EOF "\0"
#define GDIFF_VER_POS 4
#define GDIFF_CS_POS 5
#define GDIFF_CSLEN_POS 6
#define GDIFF_HEADERSIZE 7
#define GDIFF_APPDATALEN 4
#define GDIFF_CS_NONE 0
#define GDIFF_CS_MD5 1
#define GDIFF_CS_SHA 2
#define GDIFF_CS_CRC32 32
#define CRC32_LEN 4
/*--------------------------------------
* GDIFF opcodes
*------------------------------------*/
#define ENDDIFF 0
#define ADD8MAX 246
#define ADD16 247
#define ADD32 248
#define COPY16BYTE 249
#define COPY16SHORT 250
#define COPY16LONG 251
#define COPY32BYTE 252
#define COPY32SHORT 253
#define COPY32LONG 254
#define COPY64 255
/* instruction sizes */
#define ADD16SIZE 2
#define ADD32SIZE 4
#define COPY16BYTESIZE 3
#define COPY16SHORTSIZE 4
#define COPY16LONGSIZE 6
#define COPY32BYTESIZE 5
#define COPY32SHORTSIZE 6
#define COPY32LONGSIZE 8
#define COPY64SIZE 12
/*--------------------------------------
* error codes
*------------------------------------*/
#define GDIFF_OK 0
#define GDIFF_ERR_UNKNOWN -1
#define GDIFF_ERR_ARGS -2
#define GDIFF_ERR_ACCESS -3
#define GDIFF_ERR_MEM -4
#define GDIFF_ERR_HEADER -5
#define GDIFF_ERR_BADDIFF -6
#define GDIFF_ERR_OPCODE -7
#define GDIFF_ERR_OLDFILE -8
#define GDIFF_ERR_CHKSUMTYPE -9
#define GDIFF_ERR_CHECKSUM -10
#define GDIFF_ERR_CHECKSUM_TARGET -11
#define GDIFF_ERR_CHECKSUM_RESULT -12
/*--------------------------------------
* types
*------------------------------------*/
#ifndef AIX
#ifdef OSF1
#include <sys/types.h>
#else
typedef unsigned char uchar;
#endif
#endif
typedef struct _diffdata {
PRFileDesc* fSrc;
PRFileDesc* fOut;
PRFileDesc* fDiff;
uint8 checksumType;
uint8 checksumLength;
uchar* oldChecksum;
uchar* newChecksum;
PRBool bMacAppleSingle;
PRBool bWin32BoundImage;
uchar* databuf;
uint32 bufsize;
} DIFFDATA;
typedef DIFFDATA* pDIFFDATA;
/*--------------------------------------
* miscellaneous
*------------------------------------*/
#define APPFLAG_W32BOUND "autoinstall:Win32PE"
#define APPFLAG_APPLESINGLE "autoinstall:AppleSingle"
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif

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

@ -0,0 +1,67 @@
/* -*- 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 "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,
* released March 31, 1998.
*
* 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.
*
* Contributors:
* Daniel Veditz <dveditz@netscape.com>
* Douglas Turner <dougt@netscape.com>
*/
#include "nsInstallResources.h"
char* nsInstallResources::GetInstallFileString(void)
{
return "Installing: %s";
}
char* nsInstallResources::GetReplaceFileString(void)
{
return "Replacing %s";
}
char* nsInstallResources::GetDeleteFileString(void)
{
return "Deleting file: %s";
}
char* nsInstallResources::GetDeleteComponentString(void)
{
return "Deleting component: %s";
}
char* nsInstallResources::GetExecuteString(void)
{
return "Executing: %s";
}
char* nsInstallResources::GetExecuteWithArgsString(void)
{
return "Executing: %s with argument: %s";
}
char* nsInstallResources::GetPatchFileString(void)
{
return "Patching: %s";
}
char* nsInstallResources::GetUninstallString(void)
{
return "Uninstalling: %s";
}

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

@ -0,0 +1,45 @@
/* -*- 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 "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,
* released March 31, 1998.
*
* 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.
*
* Contributors:
* Daniel Veditz <dveditz@netscape.com>
* Douglas Turner <dougt@netscape.com>
*/
#ifndef __NS_INSTALLRESOURCES_H__
#define __NS_INSTALLRESOURCES_H__
class nsInstallResources
{
public:
static char* GetInstallFileString(void);
static char* GetReplaceFileString(void);
static char* GetDeleteFileString(void);
static char* GetDeleteComponentString(void);
static char* GetExecuteString(void);
static char* GetExecuteWithArgsString(void);
static char* GetPatchFileString(void);
static char* GetUninstallString(void);
};
#endif

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

@ -0,0 +1,196 @@
/* -*- 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 "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,
* released March 31, 1998.
*
* 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.
*
* Contributors:
* Daniel Veditz <dveditz@netscape.com>
* Douglas Turner <dougt@netscape.com>
*/
#include "nsInstall.h"
#include "nsInstallUninstall.h"
#include "nsInstallResources.h"
#include "VerReg.h"
#include "prmem.h"
#include "nsFileSpec.h"
#include "ScheduledTasks.h"
extern "C" NS_EXPORT PRInt32 SU_Uninstall(char *regPackageName);
REGERR su_UninstallProcessItem(char *component_path);
nsInstallUninstall::nsInstallUninstall( nsInstall* inInstall,
const nsString& regName,
PRInt32 *error)
: nsInstallObject(inInstall)
{
if (regName == "null")
{
*error = nsInstall::INVALID_ARGUMENTS;
return;
}
mRegName.SetString(regName);
char* userName = (char*)PR_Malloc(MAXREGPATHLEN);
PRInt32 err = VR_GetUninstallUserName( (char*) (const char*) nsAutoCString(regName),
userName,
MAXREGPATHLEN );
mUIName.SetString(userName);
if (err != REGERR_OK)
{
*error = nsInstall::NO_SUCH_COMPONENT;
}
PR_FREEIF(userName);
}
nsInstallUninstall::~nsInstallUninstall()
{
}
PRInt32 nsInstallUninstall::Prepare()
{
// no set-up necessary
return nsInstall::SUCCESS;
}
PRInt32 nsInstallUninstall::Complete()
{
PRInt32 err = nsInstall::SUCCESS;
if (mInstall == NULL)
return nsInstall::INVALID_ARGUMENTS;
err = SU_Uninstall( (char*)(const char*) nsAutoCString(mRegName) );
return err;
}
void nsInstallUninstall::Abort()
{
}
char* nsInstallUninstall::toString()
{
char* buffer = new char[1024];
char* temp = mUIName.ToNewCString();
sprintf( buffer, nsInstallResources::GetUninstallString(), temp);
delete [] temp;
return buffer;
}
PRBool
nsInstallUninstall::CanUninstall()
{
return PR_FALSE;
}
PRBool
nsInstallUninstall::RegisterPackageNode()
{
return PR_FALSE;
}
extern "C" NS_EXPORT PRInt32 SU_Uninstall(char *regPackageName)
{
REGERR status = REGERR_FAIL;
char pathbuf[MAXREGPATHLEN+1] = {0};
char sharedfilebuf[MAXREGPATHLEN+1] = {0};
REGENUM state = 0;
int32 length;
int32 err;
if (regPackageName == NULL)
return REGERR_PARAM;
if (pathbuf == NULL)
return REGERR_PARAM;
/* Get next path from Registry */
status = VR_Enum( regPackageName, &state, pathbuf, MAXREGPATHLEN );
/* if we got a good path */
while (status == REGERR_OK)
{
char component_path[2*MAXREGPATHLEN+1] = {0};
strcat(component_path, regPackageName);
length = strlen(regPackageName);
if (component_path[length - 1] != '/')
strcat(component_path, "/");
strcat(component_path, pathbuf);
err = su_UninstallProcessItem(component_path);
status = VR_Enum( regPackageName, &state, pathbuf, MAXREGPATHLEN );
}
err = VR_Remove(regPackageName);
// there is a problem here. It looks like if the file is refcounted, we still blow away the reg key
// FIX!
state = 0;
status = VR_UninstallEnumSharedFiles( regPackageName, &state, sharedfilebuf, MAXREGPATHLEN );
while (status == REGERR_OK)
{
err = su_UninstallProcessItem(sharedfilebuf);
err = VR_UninstallDeleteFileFromList(regPackageName, sharedfilebuf);
status = VR_UninstallEnumSharedFiles( regPackageName, &state, sharedfilebuf, MAXREGPATHLEN );
}
err = VR_UninstallDeleteSharedFilesKey(regPackageName);
err = VR_UninstallDestroy(regPackageName);
return err;
}
REGERR su_UninstallProcessItem(char *component_path)
{
int refcount;
int err;
char filepath[MAXREGPATHLEN];
err = VR_GetPath(component_path, sizeof(filepath), filepath);
if ( err == REGERR_OK )
{
err = VR_GetRefCount(component_path, &refcount);
if ( err == REGERR_OK )
{
--refcount;
if (refcount > 0)
err = VR_SetRefCount(component_path, refcount);
else
{
err = VR_Remove(component_path);
DeleteFileLater(nsFileSpec(filepath));
}
}
else
{
/* delete node and file */
err = VR_Remove(component_path);
DeleteFileLater(nsFileSpec(filepath));
}
}
return err;
}

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

@ -0,0 +1,63 @@
/* -*- 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 "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,
* released March 31, 1998.
*
* 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.
*
* Contributors:
* Daniel Veditz <dveditz@netscape.com>
* Douglas Turner <dougt@netscape.com>
*/
#ifndef nsInstallUninstall_h__
#define nsInstallUninstall_h__
#include "prtypes.h"
#include "nsString.h"
#include "nsInstallObject.h"
#include "nsInstall.h"
class nsInstallUninstall : public nsInstallObject
{
public:
nsInstallUninstall( nsInstall* inInstall,
const nsString& regName,
PRInt32 *error);
virtual ~nsInstallUninstall();
PRInt32 Prepare();
PRInt32 Complete();
void Abort();
char* toString();
PRBool CanUninstall();
PRBool RegisterPackageNode();
private:
nsString mRegName; // Registry name of package
nsString mUIName; // User name of package
};
#endif /* nsInstallUninstall_h__ */