home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / vile-src.zip / vile-8.1 / w32reg.c < prev    next >
C/C++ Source or Header  |  1998-09-03  |  19KB  |  620 lines

  1. /*
  2.  * w32ole.cpp:  Winvile OLE registration code (currently only used
  3.  *              for OLE automation).
  4.  *
  5.  * $Header: /usr/build/vile/vile/RCS/w32reg.c,v 1.3 1998/09/03 10:15:45 cmorgan Exp $
  6.  */
  7.  
  8. #include <windows.h>
  9. #include <objbase.h>
  10. #include <direct.h>
  11. #include <ctype.h>
  12.  
  13. #include <initguid.h>
  14. #include "w32reg.h"
  15.  
  16.  
  17. #include "estruct.h"
  18. #include "edef.h"
  19.  
  20.  
  21. static void make_editor_name(char *name),
  22.             make_editor_path(char *path),
  23.             registration_success(char *editor_name, char *which, char *path);
  24.  
  25. static int  report_last_error(void);
  26.  
  27. /* ---------------------------------------------------------------------- */
  28.  
  29. /*
  30.  * Description of ole automation registry info...borrowed heavily from
  31.  * MS SDK sample code.
  32.  *
  33.  * Register type info using the following 5 simple :-) steps....
  34.  *
  35.  * 1) Version independent registration. Points to Version <verstr>
  36.  
  37.  HKEY_CLASSES_ROOT\<vilename>.Application = <vilename> <verstr> Application
  38.  HKEY_CLASSES_ROOT\<vilename>.Application\CLSID = <GUID_clsid>
  39.  HKEY_CLASSES_ROOT\<vilename>.Application\CURVER =
  40.                                              <vilename>.Application.<verstr>
  41.  
  42.  * 2) Explicit version registration
  43.  
  44.  HKEY_CLASSES_ROOT\<vilename>.Application.<verstr> =
  45.                                               <vilename> <verstr> Application
  46.  HKEY_CLASSES_ROOT\<vilename>.Application.<verstr>\CLSID = <GUID_clsid>
  47.  HKEY_CLASSES_ROOT\CLSID\<GUID_clsid> = <vilename> <verstr> Application
  48.  HKEY_CLASSES_ROOT\CLSID\<GUID_clsid>\ProgID = <vilename>.Application.<verstr>
  49.  HKEY_CLASSES_ROOT\CLSID\<GUID_clsid>\VersionIndependentProgID =
  50.                                                        <vilename>.Application
  51.  HKEY_CLASSES_ROOT\CLSID\<GUID_clsid>\LocalServer32 = <path_to_vile> -Oa [opts]
  52.  HKEY_CLASSES_ROOT\CLSID\<GUID_clsid>\TypeLib = <GUID_libid>
  53.  HKEY_CLASSES_ROOT\CLSID\<GUID_clsid>\Programmable
  54.  
  55.  * 3) Type library registration information
  56.  
  57.  HKEY_CLASSES_ROOT\TypeLib\<GUID_libid>\<verstr> =
  58.                                                 <vilename> <verstr> Type Library
  59.  HKEY_CLASSES_ROOT\TypeLib\<GUID_libid>\<verstr>\HELPDIR = N/A (unsupported)
  60.  
  61.  * 4) English
  62.  
  63.  HKEY_CLASSES_ROOT\TypeLib\<GUID_libid>\<verstr>\9\win32 = <path_to_vile,
  64.                                   contains embedded English help strings>
  65.  
  66.  * 5) Interface registration. All interfaces that support vtable binding must
  67.  *    be registered.
  68.  
  69.  HKEY_CLASSES_ROOT\Interface\<GUID_iid> = IVileAuto
  70.  HKEY_CLASSES_ROOT\Interface\<GUID_iid>\TypeLib = <GUID_libid>
  71.  HKEY_CLASSES_ROOT\Interface\<GUID_iid>\ProxyStubClsid32 = <GUID_proxy>
  72.  
  73.  */
  74.  
  75.  
  76. /* Pound a bunch of keys into the registry. */
  77. int
  78. oleauto_register(OLEAUTO_OPTIONS *opts)
  79. {
  80.     HKEY  hk, hksub;
  81.     char  key[512], name[64], editor_path[NFILEN];
  82.     long  rc;
  83.     DWORD val_len;
  84.     BYTE  value[NFILEN * 2];
  85.  
  86.     make_editor_name(name);
  87.     make_editor_path(editor_path);
  88.  
  89.     /* -------------------------- Step 1 --------------------------- */
  90.  
  91.     sprintf(key, "%s.Application", name);
  92.     if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  93.                        key,
  94.                        0,
  95.                        NULL,
  96.                        0,
  97.                        KEY_ALL_ACCESS,
  98.                        NULL,
  99.                        &hk,
  100.                        NULL) != ERROR_SUCCESS)
  101.     {
  102.         return (report_last_error());
  103.     }
  104.     val_len = sprintf((char *) value, "%s %s Application", name, VTL_VERSTR);
  105.     if (RegSetValueEx(hk, NULL, 0, REG_SZ, value, val_len) != ERROR_SUCCESS)
  106.     {
  107.         RegCloseKey(hk);
  108.         return (report_last_error());
  109.     }
  110.     strcat(key, "\\CLSID");
  111.     if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  112.                        key,
  113.                        0,
  114.                        NULL,
  115.                        0,
  116.                        KEY_ALL_ACCESS,
  117.                        NULL,
  118.                        &hksub,
  119.                        NULL) != ERROR_SUCCESS)
  120.     {
  121.         RegCloseKey(hk);
  122.         return (report_last_error());
  123.     }
  124.     rc = RegSetValueEx(hksub,
  125.                        NULL,
  126.                        0,
  127.                        REG_SZ,
  128.                        (BYTE *) CLSID_VILEAUTO_KEY,
  129.                        sizeof(CLSID_VILEAUTO_KEY) - 1);
  130.     RegCloseKey(hksub);
  131.     if (rc != ERROR_SUCCESS)
  132.     {
  133.         RegCloseKey(hk);
  134.         return (report_last_error());
  135.     }
  136.     sprintf(key, "%s.Application\\CURVER", name);
  137.     if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  138.                        key,
  139.                        0,
  140.                        NULL,
  141.                        0,
  142.                        KEY_ALL_ACCESS,
  143.                        NULL,
  144.                        &hksub,
  145.                        NULL) != ERROR_SUCCESS)
  146.     {
  147.         RegCloseKey(hk);
  148.         return (report_last_error());
  149.     }
  150.     val_len = sprintf((char *) value, "%s.Application.%s", name, VTL_VERSTR);
  151.     rc = RegSetValueEx(hksub, NULL, 0, REG_SZ, value, val_len);
  152.     RegCloseKey(hksub);
  153.     RegCloseKey(hk);
  154.     if (rc != ERROR_SUCCESS)
  155.         return (report_last_error());
  156.  
  157.     /* -------------------------- Step 2 --------------------------- */
  158.  
  159.     sprintf(key, "%s.Application.%s", name, VTL_VERSTR);
  160.     val_len = sprintf((char *) value, "%s %s Application", name, VTL_VERSTR);
  161.     if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  162.                        key,
  163.                        0,
  164.                        NULL,
  165.                        0,
  166.                        KEY_ALL_ACCESS,
  167.                        NULL,
  168.                        &hk,
  169.                        NULL) != ERROR_SUCCESS)
  170.     {
  171.         return (report_last_error());
  172.     }
  173.     if (RegSetValueEx(hk, NULL, 0, REG_SZ, value, val_len) != ERROR_SUCCESS)
  174.     {
  175.         RegCloseKey(hk);
  176.         return (report_last_error());
  177.     }
  178.     strcat(key, "\\CLSID");
  179.     if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  180.                        key,
  181.                        0,
  182.                        NULL,
  183.                        0,
  184.                        KEY_ALL_ACCESS,
  185.                        NULL,
  186.                        &hksub,
  187.                        NULL) != ERROR_SUCCESS)
  188.     {
  189.         RegCloseKey(hk);
  190.         return (report_last_error());
  191.     }
  192.     rc = RegSetValueEx(hksub,
  193.                        NULL,
  194.                        0,
  195.                        REG_SZ,
  196.                        (BYTE *) CLSID_VILEAUTO_KEY,
  197.                        sizeof(CLSID_VILEAUTO_KEY) - 1);
  198.     RegCloseKey(hksub);
  199.     RegCloseKey(hk);
  200.     if (rc != ERROR_SUCCESS)
  201.         return (report_last_error());
  202.     sprintf(key, "CLSID\\%s", CLSID_VILEAUTO_KEY);
  203.     val_len = sprintf((char *) value, "%s %s Application", name, VTL_VERSTR);
  204.     if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  205.                        key,
  206.                        0,
  207.                        NULL,
  208.                        0,
  209.                        KEY_ALL_ACCESS,
  210.                        NULL,
  211.                        &hk,
  212.                        NULL) != ERROR_SUCCESS)
  213.     {
  214.         return (report_last_error());
  215.     }
  216.     if (RegSetValueEx(hk, NULL, 0, REG_SZ, value, val_len) != ERROR_SUCCESS)
  217.     {
  218.         RegCloseKey(hk);
  219.         return (report_last_error());
  220.     }
  221.     strcat(key, "\\ProgID");
  222.     val_len = sprintf((char *) value, "%s.Application.%s", name, VTL_VERSTR);
  223.     if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  224.                        key,
  225.                        0,
  226.                        NULL,
  227.                        0,
  228.                        KEY_ALL_ACCESS,
  229.                        NULL,
  230.                        &hksub,
  231.                        NULL) != ERROR_SUCCESS)
  232.     {
  233.         RegCloseKey(hk);
  234.         return (report_last_error());
  235.     }
  236.     rc = RegSetValueEx(hksub, NULL, 0, REG_SZ, value, val_len);
  237.     RegCloseKey(hksub);
  238.     if (rc != ERROR_SUCCESS)
  239.     {
  240.         RegCloseKey(hk);
  241.         return (report_last_error());
  242.     }
  243.     sprintf(key, "CLSID\\%s\\VersionIndependentProgID", CLSID_VILEAUTO_KEY);
  244.     val_len = sprintf((char *) value, "%s.Application", name);
  245.     if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  246.                        key,
  247.                        0,
  248.                        NULL,
  249.                        0,
  250.                        KEY_ALL_ACCESS,
  251.                        NULL,
  252.                        &hksub,
  253.                        NULL) != ERROR_SUCCESS)
  254.     {
  255.         RegCloseKey(hk);
  256.         return (report_last_error());
  257.     }
  258.     rc = RegSetValueEx(hksub, NULL, 0, REG_SZ, value, val_len);
  259.     RegCloseKey(hksub);
  260.     if (rc != ERROR_SUCCESS)
  261.     {
  262.         RegCloseKey(hk);
  263.         return (report_last_error());
  264.     }
  265.     sprintf(key, "CLSID\\%s\\LocalServer32", CLSID_VILEAUTO_KEY);
  266.     sprintf((char *) value, "%s -Oa", editor_path);
  267.     if (opts->invisible)
  268.         strcat((char *) value, " -invisible");
  269.     if (opts->multiple)
  270.         strcat((char *) value, " -multiple");
  271.     val_len = strlen((char *) value);
  272.     if (opts->rows)
  273.     {
  274.         val_len += sprintf(((char *) value) + val_len,
  275.                            " -geometry %ux%u",
  276.                            opts->cols,
  277.                            opts->rows);
  278.     }
  279.     if (opts->fontstr)
  280.     {
  281.         val_len += sprintf(((char *) value) + val_len,
  282.                            " -fn '%s'",
  283.                            opts->fontstr);
  284.     }
  285.     if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  286.                        key,
  287.                        0,
  288.                        NULL,
  289.                        0,
  290.                        KEY_ALL_ACCESS,
  291.                        NULL,
  292.                        &hksub,
  293.                        NULL) != ERROR_SUCCESS)
  294.     {
  295.         RegCloseKey(hk);
  296.         return (report_last_error());
  297.     }
  298.     rc = RegSetValueEx(hksub, NULL, 0, REG_SZ, value, val_len);
  299.     RegCloseKey(hksub);
  300.     if (rc != ERROR_SUCCESS)
  301.     {
  302.         RegCloseKey(hk);
  303.         return (report_last_error());
  304.     }
  305.     sprintf(key, "CLSID\\%s\\TypeLib", CLSID_VILEAUTO_KEY);
  306.     if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  307.                        key,
  308.                        0,
  309.                        NULL,
  310.                        0,
  311.                        KEY_ALL_ACCESS,
  312.                        NULL,
  313.                        &hksub,
  314.                        NULL) != ERROR_SUCCESS)
  315.     {
  316.         RegCloseKey(hk);
  317.         return (report_last_error());
  318.     }
  319.     rc = RegSetValueEx(hksub,
  320.                        NULL,
  321.                        0,
  322.                        REG_SZ,
  323.                        (BYTE *) LIBID_VILEAUTO_KEY,
  324.                        sizeof(LIBID_VILEAUTO_KEY) - 1);
  325.     RegCloseKey(hksub);
  326.     if (rc != ERROR_SUCCESS)
  327.     {
  328.         RegCloseKey(hk);
  329.         return (report_last_error());
  330.     }
  331.     sprintf(key, "CLSID\\%s\\Programmable", CLSID_VILEAUTO_KEY);
  332.     if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  333.                        key,
  334.                        0,
  335.                        NULL,
  336.                        0,
  337.                        KEY_ALL_ACCESS,
  338.                        NULL,
  339.                        &hksub,
  340.                        NULL) != ERROR_SUCCESS)
  341.     {
  342.         RegCloseKey(hk);
  343.         return (report_last_error());
  344.     }
  345.     RegCloseKey(hksub);
  346.     RegCloseKey(hk);
  347.  
  348.     /* -------------------------- Step 3 --------------------------- */
  349.  
  350.     sprintf(key, "TypeLib\\%s\\%s", LIBID_VILEAUTO_KEY, VTL_VERSTR);
  351.     val_len = sprintf((char *) value, "%s %s Type Library", name, VTL_VERSTR);
  352.     if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  353.                        key,
  354.                        0,
  355.                        NULL,
  356.                        0,
  357.                        KEY_ALL_ACCESS,
  358.                        NULL,
  359.                        &hk,
  360.                        NULL) != ERROR_SUCCESS)
  361.     {
  362.         return (report_last_error());
  363.     }
  364.     if (RegSetValueEx(hk,
  365.                       NULL,
  366.                       0,
  367.                       REG_SZ,
  368.                       value,
  369.                       val_len) != ERROR_SUCCESS)
  370.     {
  371.         RegCloseKey(hk);
  372.         return (report_last_error());
  373.     }
  374.  
  375.     /* -------------------------- Step 4 --------------------------- */
  376.  
  377.     strcat(key, "\\9\\win32");
  378.     val_len = strlen(strcpy((char *) value, editor_path));
  379.     if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  380.                        key,
  381.                        0,
  382.                        NULL,
  383.                        0,
  384.                        KEY_ALL_ACCESS,
  385.                        NULL,
  386.                        &hksub,
  387.                        NULL) != ERROR_SUCCESS)
  388.     {
  389.         RegCloseKey(hk);
  390.         return (report_last_error());
  391.     }
  392.     rc = RegSetValueEx(hksub, NULL, 0, REG_SZ, value, val_len);
  393.     RegCloseKey(hksub);
  394.     RegCloseKey(hk);
  395.     if (rc != ERROR_SUCCESS)
  396.         return (report_last_error());
  397.  
  398.     /* -------------------------- Step 5 --------------------------- */
  399.  
  400.     sprintf(key, "Interface\\%s", IID_IVILEAUTO_KEY);
  401.     if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  402.                        key,
  403.                        0,
  404.                        NULL,
  405.                        0,
  406.                        KEY_ALL_ACCESS,
  407.                        NULL,
  408.                        &hk,
  409.                        NULL) != ERROR_SUCCESS)
  410.     {
  411.         return (report_last_error());
  412.     }
  413.     if (RegSetValueEx(hk,
  414.                       NULL,
  415.                       0,
  416.                       REG_SZ,
  417.                       "IVileAuto",
  418.                       sizeof("IVileAuto") - 1) != ERROR_SUCCESS)
  419.     {
  420.         RegCloseKey(hk);
  421.         return (report_last_error());
  422.     }
  423.     strcat(key, "\\TypeLib");
  424.     if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  425.                        key,
  426.                        0,
  427.                        NULL,
  428.                        0,
  429.                        KEY_ALL_ACCESS,
  430.                        NULL,
  431.                        &hksub,
  432.                        NULL) != ERROR_SUCCESS)
  433.     {
  434.         RegCloseKey(hk);
  435.         return (report_last_error());
  436.     }
  437.     rc = RegSetValueEx(hksub,
  438.                        NULL,
  439.                        0,
  440.                        REG_SZ,
  441.                        (BYTE *) LIBID_VILEAUTO_KEY,
  442.                        sizeof(LIBID_VILEAUTO_KEY) - 1);
  443.     RegCloseKey(hksub);
  444.     if (rc != ERROR_SUCCESS)
  445.     {
  446.         RegCloseKey(hk);
  447.         return (report_last_error());
  448.     }
  449.     sprintf(key, "Interface\\%s\\ProxyStubClsid32", IID_IVILEAUTO_KEY);
  450.     if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  451.                        key,
  452.                        0,
  453.                        NULL,
  454.                        0,
  455.                        KEY_ALL_ACCESS,
  456.                        NULL,
  457.                        &hksub,
  458.                        NULL) != ERROR_SUCCESS)
  459.     {
  460.         RegCloseKey(hk);
  461.         return (report_last_error());
  462.     }
  463.     rc = RegSetValueEx(hksub,
  464.                        NULL,
  465.                        0,
  466.                        REG_SZ,
  467.                        (BYTE *) CLSID_PROXY_STUB,
  468.                        sizeof(CLSID_PROXY_STUB) - 1);
  469.     RegCloseKey(hksub);
  470.     RegCloseKey(hk);
  471.     if (rc != ERROR_SUCCESS)
  472.         return (report_last_error());
  473.  
  474.     /* ------  Get to here, then all is well.  Report status. ------ */
  475.  
  476.     registration_success(name, "registered", editor_path);
  477.     return (0);
  478. }
  479.  
  480.  
  481.  
  482. /*
  483.  * Undo oleauto_register().  Absence of any of the keys/values is not an
  484.  * error.  This routine can't fail (no news is good news).
  485.  */
  486. int
  487. oleauto_unregister(void)
  488. {
  489.     char keytop[512], keysub[512], name[64];
  490.  
  491.     make_editor_name(name);
  492.  
  493.     /*
  494.      * To be compatible with both WinNT and Win95, must delete subkeys
  495.      * before deleting top-level key.
  496.      */
  497.  
  498.     /* -------------------------- Step 1 --------------------------- */
  499.  
  500.     sprintf(keytop, "%s.Application", name);
  501.     sprintf(keysub, "%s\\CLSID", keytop);
  502.     RegDeleteKey(HKEY_CLASSES_ROOT, keysub);
  503.     sprintf(keysub, "%s\\CURVER", keytop);
  504.     RegDeleteKey(HKEY_CLASSES_ROOT, keysub);
  505.     RegDeleteKey(HKEY_CLASSES_ROOT, keytop);
  506.  
  507.     /* -------------------------- Step 2 --------------------------- */
  508.  
  509.     sprintf(keytop, "%s.Application.%s", name, VTL_VERSTR);
  510.     sprintf(keysub, "%s\\CLSID", keytop);
  511.     RegDeleteKey(HKEY_CLASSES_ROOT, keysub);
  512.     RegDeleteKey(HKEY_CLASSES_ROOT, keytop);
  513.     sprintf(keytop, "CLSID\\%s", CLSID_VILEAUTO_KEY);
  514.     sprintf(keysub, "%s\\ProgID", keytop);
  515.     RegDeleteKey(HKEY_CLASSES_ROOT, keysub);
  516.     sprintf(keysub, "%s\\VersionIndependentProgID", keytop);
  517.     RegDeleteKey(HKEY_CLASSES_ROOT, keysub);
  518.     sprintf(keysub, "%s\\LocalServer32", keytop);
  519.     RegDeleteKey(HKEY_CLASSES_ROOT, keysub);
  520.     sprintf(keysub, "%s\\TypeLib", keytop);
  521.     RegDeleteKey(HKEY_CLASSES_ROOT, keysub);
  522.     sprintf(keysub, "%s\\Programmable", keytop);
  523.     RegDeleteKey(HKEY_CLASSES_ROOT, keysub);
  524.     RegDeleteKey(HKEY_CLASSES_ROOT, keytop);
  525.  
  526.     /* ----------------------- Step 3 & 4 -------------------------- */
  527.  
  528.     sprintf(keytop, "TypeLib\\%s\\%s", LIBID_VILEAUTO_KEY, VTL_VERSTR);
  529.     sprintf(keysub, "%s\\9\\win32", keytop);
  530.     RegDeleteKey(HKEY_CLASSES_ROOT, keysub);
  531.     sprintf(keysub, "%s\\9", keytop);
  532.     RegDeleteKey(HKEY_CLASSES_ROOT, keysub);
  533.     RegDeleteKey(HKEY_CLASSES_ROOT, keytop);
  534.     sprintf(keytop, "TypeLib\\%s", LIBID_VILEAUTO_KEY);
  535.     RegDeleteKey(HKEY_CLASSES_ROOT, keytop);
  536.  
  537.     /* -------------------------- Step 5 --------------------------- */
  538.  
  539.     sprintf(keytop, "Interface\\%s", IID_IVILEAUTO_KEY);
  540.     sprintf(keysub, "%s\\TypeLib", keytop);
  541.     RegDeleteKey(HKEY_CLASSES_ROOT, keysub);
  542.     sprintf(keysub, "%s\\ProxyStubClsid32", keytop);
  543.     RegDeleteKey(HKEY_CLASSES_ROOT, keysub);
  544.     RegDeleteKey(HKEY_CLASSES_ROOT, keytop);
  545.  
  546.     registration_success(name, "unregistered", NULL);
  547.     return (0);
  548. }
  549.  
  550.  
  551.  
  552. static void
  553. make_editor_name(char *name /* must be long enough to hold result */)
  554. {
  555.     strcpy(name, prognam);
  556.     *name = toupper(*name);
  557. }
  558.  
  559.  
  560.  
  561. static void
  562. make_editor_path(char *path /* must be at least NFILEN chars long */)
  563. {
  564.     char temp[NFILEN], name[128], *s;
  565.  
  566.     /*
  567.      * Can't use "exec_pathname" in this routine because that global var
  568.      * is always initialized to "." on a win32 host (bummer).
  569.      */
  570.     sprintf(name, "%s.exe", prognam);
  571.     if ((s = flook(name, FL_PATH|FL_EXECABLE)) != 0)
  572.         strcpy(path, sl_to_bsl(s));
  573.     else
  574.     {
  575.         /* lookup failed, assume cwd. */
  576.  
  577.         if (_getcwd(temp, sizeof(temp)) == NULL)
  578.         {
  579.             /* getcwd failed, user must live with '.' . */
  580.  
  581.             temp[0] = '.';
  582.             temp[1] = '\0';
  583.         }
  584.         sprintf(path, "%s\\%s", sl_to_bsl(temp), name);
  585.     }
  586. }
  587.  
  588.  
  589.  
  590. static int
  591. report_last_error(void)
  592. {
  593.     disp_win32_error(W32_SYS_ERROR, NULL);
  594.     return (1);  /* This becomes the exit status returned to shell. */
  595. }
  596.  
  597.  
  598.  
  599. static void
  600. registration_success(char *editor_name, char *which, char *path)
  601. {
  602.     char status[256];
  603.     int  len;
  604.  
  605.     len = sprintf(status,
  606.                   "%s OLE Automation successfully %s.",
  607.                   editor_name,
  608.                   which);
  609.     if (path)
  610.     {
  611.         /* Registered -- warn user about registering temp copy of editor. */
  612.  
  613.         sprintf(status + len, "\r\rNote:  registered path is %s .\r\r"
  614.         "If this path is temporary or otherwise undesirable, install the "
  615.         "editor in its proper destination directory and re-register.",
  616.                 path);
  617.     }
  618.     MessageBox(NULL, status, editor_name, MB_ICONINFORMATION|MB_OK);
  619. }
  620.