| [460] | 1 | 5/9/2003
 | 
|---|
 | 2 | ========
 | 
|---|
 | 3 | 
 | 
|---|
 | 4 |                            IMPORTANT NOTE
 | 
|---|
 | 5 |         TO ALL SITES UTILIZING DELPHI CPRS GUI SOURCE CODE:
 | 
|---|
 | 6 | 
 | 
|---|
 | 7 | A problem was found in Delphis ComServ.pas file which causes problems 
 | 
|---|
 | 8 | with COM object registration during installation of an application 
 | 
|---|
 | 9 | utilizing such objects.  This file explains the problem and the fix 
 | 
|---|
 | 10 | for it.  
 | 
|---|
 | 11 | 
 | 
|---|
 | 12 | EACH SITE MUST IMPLEMENT THIS FIX MANUALLY in order to compile CPRS.  
 | 
|---|
 | 13 | 
 | 
|---|
 | 14 | You must have the Delphi Source code to implement this fix; it is 
 | 
|---|
 | 15 | available only with Delphi Prossional or Delphi Enterprise (unknown: 
 | 
|---|
 | 16 | Delphi Developer version?).  The assumption is that anyone involved 
 | 
|---|
 | 17 | with local modifications will have a properly-licensed version.  
 | 
|---|
 | 18 | 
 | 
|---|
 | 19 | After making the fix, DO NOT distribute the modified source code - anywhere.  
 | 
|---|
 | 20 | 
 | 
|---|
 | 21 | Explanation:
 | 
|---|
 | 22 | 
 | 
|---|
 | 23 | If you try to register Com objects as a Restricted User (not a Power User 
 | 
|---|
 | 24 | or Administrator) on Win2000 or XP, ComServ.pas will always throw an unhandled 
 | 
|---|
 | 25 | error during program initialization because you don't have write permissions 
 | 
|---|
 | 26 | to the registry.
 | 
|---|
 | 27 | 
 | 
|---|
 | 28 | The TComServer.Initialize code attempts to "squelch the exception unless 
 | 
|---|
 | 29 | we were explicitly told to register."  But, it only traps the Ole 
 | 
|---|
 | 30 | Registration Error and not the Ole Sys Error that was raised in 
 | 
|---|
 | 31 | RegisterTypeLibrary from the OleCheck call.
 | 
|---|
 | 32 | 
 | 
|---|
 | 33 | Two added lines were placed in the following code in the 
 | 
|---|
 | 34 | TComServer.Initialize procedure of the ComServ.pas unit as a 
 | 
|---|
 | 35 | workaround:
 | 
|---|
 | 36 | 
 | 
|---|
 | 37 | procedure TComServer.Initialize;
 | 
|---|
 | 38 | begin
 | 
|---|
 | 39 |   try
 | 
|---|
 | 40 |     UpdateRegistry(FStartMode <> smUnregServer);
 | 
|---|
 | 41 |   except
 | 
|---|
 | 42 |     on E: EOleRegistrationError do
 | 
|---|
 | 43 |       // User may not have write access to the registry.
 | 
|---|
 | 44 |       // Squelch the exception unless we were explicitly told to register.
 | 
|---|
 | 45 |       if FStartMode = smRegServer then raise;
 | 
|---|
 | 46 |     on E: EOleSysError do
 | 
|---|
 | 47 |       if FStartMode = smRegServer then raise;
 | 
|---|
 | 48 |   end;
 | 
|---|
 | 49 |   if FStartMode in [smRegServer, smUnregServer] then Halt;
 | 
|---|
 | 50 |   ComClassManager.ForEachFactory(Self, FactoryRegisterClassObject);
 | 
|---|
 | 51 | end;
 | 
|---|
 | 52 | 
 | 
|---|
 | 53 | To utilize this fix, copy the unit ComServ.pas into the CPRS-Chart 
 | 
|---|
 | 54 | directory, rename it to uComServ.pas and then make the change above to 
 | 
|---|
 | 55 | the TComServer.Initialize procedure of the new uComserv.pas file.  
 | 
|---|
 | 56 | Then add uComServ.pas to the project.  Finally, change the "Uses" clause 
 | 
|---|
 | 57 | of everything that used to use "ComServ" to "uComServ" instead -- currently, 
 | 
|---|
 | 58 | this consists of the files uAccessibleListBox.pas, uAccessibleStringGrid.pas, 
 | 
|---|
 | 59 | uAccessibleTreeNode.pas, and uAccessibleTreeView.pas.
 | 
|---|
 | 60 | 
 | 
|---|
 | 61 | NOTE that a ComServ.pas file IS NOT included in this zip distribution.  
 | 
|---|
 | 62 | You must create this file yourself (by copying and modifying) and place 
 | 
|---|
 | 63 | it in the CPRS-Chart directory.  The four units listed above already 
 | 
|---|
 | 64 | have uComServ in their Uses clauses (in place of the ComServ unit 
 | 
|---|
 | 65 | formerly listed).
 | 
|---|
 | 66 | 
 | 
|---|
 | 67 | This fix allows COM objects included with CPRS GUI to be registered on 
 | 
|---|
 | 68 | an installation machine.  (Note that machines where disabled users 
 | 
|---|
 | 69 | will utilize applications accessing those COM objects need to have a 
 | 
|---|
 | 70 | Power User or Adminstrator user run the application one time (unless 
 | 
|---|
 | 71 | the disabled user is already a Power User or Adminstrator user) before 
 | 
|---|
 | 72 | ongoing usage.  
 | 
|---|