Back to index

lightning-sunbird  0.9+nobinonly
Functions
xpi.h File Reference
#include <os2.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

APIRET InitializeXPIStub (void)
APIRET DeInitializeXPIStub (void)
APIRET SmartUpdateJars (PSZ szAppName, PSZ szAppPath, PSZ listArchive[])
void cbXPIStart (const char *, const char *UIName)
void cbXPIProgress (const char *msg, PRInt32 val, PRInt32 max)
void cbXPIFinal (const char *, PRInt32 finalStatus)
void InitProgressDlg (void)
void DeInitProgressDlg (void)
int GetTotalArchivesToInstall (PSZ listArchive[])
void ProcessWindowsMessages ()

Function Documentation

void cbXPIFinal ( const char *  ,
PRInt32  finalStatus 
)

Definition at line 416 of file xpi.c.

{
}
void cbXPIProgress ( const char *  msg,
PRInt32  val,
PRInt32  max 
)

Definition at line 384 of file xpi.c.

{
  char szFilename[MAX_BUF];
  char szStrProcessingFileBuf[MAX_BUF];
  char szStrCopyingFileBuf[MAX_BUF];

  if(sgProduct.mode != SILENT)
  {
    ParsePath((char *)msg, szFilename, sizeof(szFilename), FALSE, PP_FILENAME_ONLY);

    dlgInfo.nFileBars = 0;
    
    // XXXben this is a really nasty hack. We shouldn't be parsing the msg value
    // to find out what sort of progress notification this is. Really, the installer
    // listener system needs to be rearchitected to send out a message type (int) 
    // and a message value, and the listeners can synthesize a display message if
    // they want to. As it stands, the strings that are used here are NOT localizable
    // (hard coded over in mozilla/xpinstall/src), which blows dead goats through
    // straws. 
    if ((!strncmp(msg, "Installing: ", 12) ||
         !strncmp(msg, "Replacing: ", 11)) 
         && (max != 0 && val <= max)) {
      ++dwCurrentFile;

      UpdateArchiveInstallProgress((int)dwCurrentFile);
      UpdateGREInstallProgress((int)dwCurrentFile);
    }

    ProcessWindowsMessages();
  }
}
void cbXPIStart ( const char *  ,
const char *  UIName 
)

Definition at line 380 of file xpi.c.

{
}
APIRET DeInitializeXPIStub ( void  )

Definition at line 836 of file xpi.c.

{
  if(sgProduct.mode != SILENT)
  {
    SaveWindowPosition(dlgInfo.hWndDlg);
    DestroyWindow(dlgInfo.hWndDlg);
    UnregisterClass("GaugeFile", hInst);
    UnregisterClass("GaugeArchive", hInst);
  }
}
int GetTotalArchivesToInstall ( PSZ  listArchive[])

Definition at line 103 of file xpi.c.

{
  int i = 0;

  while(TRUE)
  {
    if(*listArchive[i] != '\0')
      ++i;
    else
      return(i);
  }
}
APIRET InitializeXPIStub ( void  )

Definition at line 76 of file xpi.c.

{
  char szBuf[MAX_BUF];
  char szXPIStubFile[MAX_BUF];
  char szEDosQueryProcAddr[MAX_BUF];
  APIRET rc;

  hXPIStubInst = NULL;

  if(!GetPrivateProfileString("Messages", "ERROR_DOSQUERYPROCADDR", "", szEDosQueryProcAddr, sizeof(szEDosQueryProcAddr), szFileIniInstall))
    return(1);

  /* change current directory to where xpistub.dll */
  /* change current directory to where xpistub.dll */
  strcpy(szBuf, siCFXpcomFile.szDestination);
  AppendBackSlash(szBuf, sizeof(szBuf));
  strcat(szBuf, "bin");
  chdir(szBuf);

  /* Set LIBPATHSTRICT */
  DosSetExtLIBPATH("T", LIBPATHSTRICT);

  /* Add it to LIBPATH */
  DosSetExtLIBPATH(szBuf, BEGIN_LIBPATH);

  /* build full path to xpistub.dll */
  strcpy(szXPIStubFile, szBuf);
  AppendBackSlash(szXPIStubFile, sizeof(szXPIStubFile));
  strcat(szXPIStubFile, "xpistub.dll");

  if(FileExists(szXPIStubFile) == FALSE)
    return(2);

  /* load xpistub.dll */
  if (DosLoadModule(NULL, 0, szXPIStubFile, &hXPIStubInst) != NO_ERROR)
  {
    sprintf(szBuf, szEDllLoad, szXPIStubFile);
    PrintError(szBuf, ERROR_CODE_SHOW);
    return(1);
  }
  if(DosQueryProcAddr(hXPIStubInst, 0, "_XPI_Init", &pfnXpiInit) != NO_ERROR)
  {
    sprintf(szBuf, szEDosQueryProcAddr, "_XPI_Init");
    PrintError(szBuf, ERROR_CODE_SHOW);
    return(1);
  }
  if(DosQueryProcAddr(hXPIStubInst, 0, "_XPI_Install", &pfnXpiInstall) != NO_ERROR)
  {
    sprintf(szBuf, szEDosQueryProcAddr, "_XPI_Install");
    PrintError(szBuf, ERROR_CODE_SHOW);
    return(1);
  }
  if(DosQueryProcAddr(hXPIStubInst, 0, "_XPI_Exit", &pfnXpiExit) != NO_ERROR)
  {
    sprintf(szBuf, szEDosQueryProcAddr, "_XPI_Exit");
    PrintError(szBuf, ERROR_CODE_SHOW);
    return(1);
  }

  return(0);
}

Definition at line 427 of file xpi.c.

{
  if(sgProduct.ulMode != SILENT)
  {
    dlgInfo.hWndDlg = WinLoadDlg(HWND_DESKTOP, hWndMain, ProgressDlgProc, hSetupRscInst, DLG_EXTRACTING, NULL);
    WinShowWindow(dlgInfo.hWndDlg, TRUE);
  }
}

Definition at line 2336 of file dialogs.c.

{
  MSG msg;

  while(PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
  {
    TranslateMessage(&msg);
    DispatchMessage(&msg);
  }
}
APIRET SmartUpdateJars ( PSZ  szAppName,
PSZ  szAppPath,
PSZ  listArchive[] 
)

Definition at line 116 of file xpi.c.

{
  int       i;
  int       iTotalArchives;
  char      szBuf[MAX_BUF];
  APIRET   hrResult;

  hXPIStubInst = NULL;

  if((hrResult = InitializeXPIStub()) == TEST_OK)
  {
    RemoveBackSlash(szAppPath);
    hrResult = pfnXpiInit(szAppPath, cbXPIProgress);
    if(hrResult != 0)
    {
      sprintf(szBuf, "XpiInit() failed: %d", hrResult);
      PrintError(szBuf, ERROR_CODE_HIDE, hrResult);
    }

    iTotalArchives = GetTotalArchivesToInstall(listArchive);
    for(i = 0; i < iTotalArchives; i++)
    {
      if(FileExists(listArchive[i]) == FALSE)
      {
        printf("File not found: %s\n", listArchive[i]);

        /* continue with next file */
        continue;
      }

      hrResult = pfnXpiInstall(listArchive[i], "", 0xFFFF);
      if((hrResult != TEST_OK) && (hrResult != 999))
      {
        sprintf(szBuf, "XpiInstall() failed: %d", hrResult);
        PrintError(szBuf, ERROR_CODE_HIDE, hrResult);

        /* break out of the for loop */
        break;
      }
      printf("\n");
    }

    pfnXpiExit();
  }
  else
  {
    sprintf(szBuf, "InitializeXPIStub() failed: %d", hrResult);
    PrintError(szBuf, ERROR_CODE_HIDE, hrResult);
  }

  DeInitializeXPIStub();
  return(hrResult);
}