Delphi: error EPrivilege when uninstalling package

formi
formi used Ask the Experts™
on
Hi
I am developing components with Delphi 10.3. Now I have the following problem: when I uninstall the package I get the error "Exception EPrivilege in modul rtl260.bpl at address …". I have to end the process and restart Delphi. After this the component is no longer installed, so I can rebuild and install it. Uninstalling again, same problem. Has anybody an idea how can I find the wrong code in the component?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Martyn SpencerSoftware Developer / Linux System Administrator / Managing Director

Commented:
How about creating the component in code, working with it then freeing it? You can then debug the code to see if you have an error. Also, if you have any custom design time editors do the same.
Sinisa VukSoftware architect
Top Expert 2012

Commented:
I assume you've got error somewhere in init part. Try to use it as Martyn suggest. This way you can use debugger to locate error.
Geert GOracle dba
Top Expert 2009

Commented:
did you install delphi in c:\program files ?
needs admin privs if so

reinstall delphi in another self created directory
like c:\delpi
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

Author

Commented:
yes, I run it as administrator.
Martyn SpencerSoftware Developer / Linux System Administrator / Managing Director

Commented:
The privileged instruction error is nothing to to with user rights and running as an administrator, it is more likely to be a privileged instruction that is being run due to data being run as if it were code, etc. So, try as I suggest and see where that takes you.

Reinstalling Delphi should be your last resort. It is likely to be something with the component itself.

Author

Commented:
@Martyn: I did it as you suggested and I found a problem with a tForm-component. I got an error "resource tMyForm not found" creating it dynamically with myForm := tMyForm.Create(self); When I make a new form (tForm) and change the type to tMyForm it works, but creating it dynamically it doesn't. How have I to create a new component tMyForm? Here how I did:
typ
  tMyForm = class(tForm)
    some methodes as create, destroy
  end;

RegisterNoIcon([TMyForm]);

Open in new window

What's wrong with that?
Geert GOracle dba
Top Expert 2009

Commented:
absolutely do not run delphi as administrator
if you have to run it like this, then reinstall it
every program created like this will need admin privs to run


you didn't provide enough code to see if anything is wrong
with that code, seems ok
Geert GOracle dba
Top Expert 2009

Commented:
why do you need RegisterNoIcon ?

that's for components and being able to use the object inspector on them

Author

Commented:
I want to make new forms choosing them in the object galerie (or is this the inspector in English versions??) . So I have found in internet to  call RegisterNoIcon for those forms. Adding new form here: 06-05-_2019_09-47-30.jpg

Author

Commented:
I made now a simple example. Compiled it in package1
unit myComponent;

interface

uses
    Forms, System.classes;

type
    tMyForm = class(tForm)

    end;

procedure Register;

implementation

procedure Register;
begin
  RegisterNoIcon([tMyForm]);
end;

end.

Open in new window

Then made a program:
var form1 : tMyForm;
begin
  form1 := tMyForm.Create(self); <--Error "ressource tMyForm not found"
end;

Open in new window

I think the reason is that it does not find a dfm file. But how to make it?

Author

Commented:
meanwhile I have found an article that one has to create such form with tMyForm.CreatNew(self). It does not need the dfm. Well, with this command I can really create and free each own component with no errors, so by problem is not solved. What I have seen: if I close Delphi and restart it and uninstall the package then the error does not occur. What I do:
close IDE
start IDE
uninstall package --> OK
install package
uninstall package --> ERROR

or
start IDE
making some stuff in some project
closing this project and open the package
uninstall package --> ERROR

I'm afraid that nobody can find the solution, may be an error of Delphi??
Martyn SpencerSoftware Developer / Linux System Administrator / Managing Director

Commented:
The message indicates that the the class TMyForm cannot be found in the executable. If there is indeed no DFM it's possible, I guess, that the lack of ability to stream the component causes the error. Are you saying that you are creating a form class component that does not have an associated DFM? If so, you may need to prevent the VCL code from attempting to stream the DFM.
Geert GOracle dba
Top Expert 2009

Commented:
huh ?
why not

create your form like want it, then in the designer : right click, add to  repository

google for:
dephi form add to repository

you can then inherit from those predefined forms

i tried it, very easy and it also copies/creates the  dfm
Geert GOracle dba
Top Expert 2009

Commented:
for components as form ... you need to create form wizards and install them in delphi
a form wizard is more advanced than the repository

you can let a form wizard interact with the user and create forms based on input
this would be your starting point:
http://docwiki.embarcadero.com/RADStudio/Rio/en/Creating_Form_and_Project_Wizards
Commented:
Nobody could give me the solution (the problem didn't disappear) but I can life with it: I have to restart the IDE before uninstalling and then Delphi doesn't crash. Thanks for your other hints, they where helpful for other purposes.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial