/* Copyright (c) Oracle Corporation 1996.  All Rights Reserved */
/*****************************************************************************
  NAME
    ocx60.ins - V3 installation script for Oracle OCX Pack 6.0

  DESCRIPTION
    This script installs Oracle OCX Pack 6.0.

  MODIFIED   MM/DD/YY   Reason
   pgupta    12/12/97   Created.
*****************************************************************************/
{
    if (doit)
    {
        /*****************************
        Set the VRF-INS script ratchet
        ******************************/
        ins_ratchet = "6.0.0.0.0";

        execute("%installer_home%%dir_separator%%operating_system%.ins");

        permit_retry_operations  = TRUE;
        permit_ignore_operations = TRUE;
        permit_process_operations= TRUE;

        win32_register_OCSM_product();
        /******************
        Install the product
        *******************/
        ui_product(instantiate(display_product_label));

        ui_action(instantiate(install_files));
        copy(deinst);
        copy(ocx);
        copy(dll);
        copy(lic);
        copy(hlp);
        /******************/

        /*********************************
        Register and Reference the product
        **********************************/
        ui_product(instantiate(display_product_label));
        ui_action( instantiate(install_register) );

        register(current_product);
        reference(current_product);
        /*********************************/

        remove(delold);                                                    /* remove any outdated files if install was successful */

        permit_retry_operations = FALSE;

        /*******************
        Install dependencies
        ********************/
        ui_product(instantiate(display_product_label));
        while(not(empty(install_dependency_list)))
        {
            current_dependency = first(install_dependency_list);
            install_dependency_list = rest(install_dependency_list);

            install(current_dependency);
        }
        /*******************/
        /****************************
         Registering map file groups
        *****************************/
         win32_register_OCSM_group(deinst,'MINMODE);
         win32_register_OCSM_group(ocx,'MEDMODE);
         win32_register_OCSM_group(dll,'MEDMODE);
         win32_register_OCSM_group(lic,'MAXMODE);
         win32_register_OCSM_group(hlp,'MAXMODE);

        /*********************
        Reference dependencies
        **********************/
        ui_product(instantiate(display_product_label));
        ui_action(instantiate(reference_dependencies));

        while(not(empty(dependency_list)))
        {
            current_dependency = first(dependency_list);
            dependency_list = rest(dependency_list);

            {reference(current_dependency, current_product);}
            ['UNREGISTERED_PRODUCT: continue();]
        }
        /*********************/

        win32_set_value("HKEY_LOCAL_MACHINE","SOFTWARE\MICROSOFT\WINDOWS\HELP","mmbx.hlp",DOC60_NLS);
        win32_register_key("HKEY_LOCAL_MACHINE","SOFTWARE\MICROSOFT\WINDOWS\HELP","mmbx",'REPLICATE);

        win32_set_value("HKEY_LOCAL_MACHINE","SOFTWARE\MICROSOFT\WINDOWS\HELP","mmdx.hlp",DOC60_NLS);
        win32_register_key("HKEY_LOCAL_MACHINE","SOFTWARE\MICROSOFT\WINDOWS\HELP","mmdx",'REPLICATE);

        win32_set_value("HKEY_LOCAL_MACHINE","SOFTWARE\MICROSOFT\WINDOWS\HELP","mmix.hlp",DOC60_NLS);
        win32_register_key("HKEY_LOCAL_MACHINE","SOFTWARE\MICROSOFT\WINDOWS\HELP","mmix",'REPLICATE);

        win32_set_value("HKEY_LOCAL_MACHINE","SOFTWARE\MICROSOFT\WINDOWS\HELP","mmsx.hlp",DOC60_NLS);
        win32_register_key("HKEY_LOCAL_MACHINE","SOFTWARE\MICROSOFT\WINDOWS\HELP","mmsx",'REPLICATE);

        win32_set_value("HKEY_LOCAL_MACHINE","SOFTWARE\MICROSOFT\WINDOWS\HELP","mmtx.hlp",DOC60_NLS);
        win32_register_key("HKEY_LOCAL_MACHINE","SOFTWARE\MICROSOFT\WINDOWS\HELP","mmtx",'REPLICATE);

        win32_set_value("HKEY_LOCAL_MACHINE","SOFTWARE\MICROSOFT\WINDOWS\HELP","mmvx.hlp",DOC60_NLS);
        win32_register_key("HKEY_LOCAL_MACHINE","SOFTWARE\MICROSOFT\WINDOWS\HELP","mmvx",'REPLICATE);
        /*******************
        Register the MM OCXs
        ********************/
        mm_ocx_files_list = files("%oracle_home%\bin\mm*.ocx");

        sort(mm_ocx_files_list);

        while(not(empty(mm_ocx_files_list)))
        {
            current_mm_ocx_file = first(mm_ocx_files_list);
            mm_ocx_files_list = rest(mm_ocx_files_list);

            {win32_asynchronous_spawn("%ORACLE_HOME%%dir_separator%BIN%dir_separator%REGSVR32.EXE /s %current_mm_ocx_file%");}
            ['NO_RESPONSE, 'INVALID_FILE_NAME, 'FILE_NOT_FOUND, 'MEMORY_ERROR: continue();]
        }
        /*******************/
    }
    [
        'UNREGISTERED_PRODUCT: continue();
        'CANCEL: signal('FAILURE, instantiate(halt_installation));
    ]
}
