Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 07-16-2012, 01:15 PM
CAnder1 CAnder1 is offline
Junior Member
 
Join Date: Sep 2011
Posts: 9
Default Unable to register Automation server in Windows 7

Hi,

I have a simple automation server written in delphi 7 that works fine under previous versions of Windows, but fails on Windows 7.

When the application is run in the IDE, an OLE error code of -2147319780 is returned. A Google search informs me this is an access denied code.

I have run Process Monitor which confirmed ACCESS DENIED for the RegCreateKey operation.

I then checked permissions in RegEdit. There is only one user on the machine, however both users and administrators are listed in Regedit permissions with the same user name. Giving Users the same full control as Administrators for HKEY_CLASSES_ROOT, then running the application again, allows the registration process to progress further; now the type library GUID is listed under HKCR\typelib, but the process still fails when it tries to add keys in HKCR\Wow6432Node\Interface. I've checked permissions for this, and they are full control for both users and administrators, so I am now officially stuck.

The other entries in permissions is SYSTEM, which has full control, and CREATOR OWNER which is listed as special and applies to sub keys only.

I would be very grateful to anyone who can shed light on how to resolve this problem.

Please accept my thanks in advance,

CAnder1
Reply With Quote
  #2  
Old 07-17-2012, 11:24 AM
CAnder1 CAnder1 is offline
Junior Member
 
Join Date: Sep 2011
Posts: 9
Default

Hi,

The issue isn't with Automation; it is to do with key creation, and since this is a registry problem, it should not appear in this forum.
Using the following code confirmed that attempts to create a key to HKEY_CLASSES_ROOT\Wow6432Node are denied (at least on my machine):

procedure TForm1.Button1Click(Sender: TObject);
var
Reg: TRegistry;
begin
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_CLASSES_ROOT;
if Reg.OpenKey('\Wow6432Node', False) then
begin
Memo1.Lines.Add('interface key opened');
if Reg.CreateKey('Test Sub Key') then memo1.Lines.Add('key added');
Reg.CloseKey;
end;
finally
Reg.Free;
end;
end;

Running this with Process Monitor running confirms the same problem as when attempting to register the automation object.

In spite of this, a key can be manually added using RegEdit.

If anyone has encountered this problem before, I would be grateful to hear from them.

Regards,

CAnder1
Reply With Quote
  #3  
Old 07-17-2012, 01:16 PM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 6,707
Default

You don't need that Wow6432Node
This is automatically added when you use a 32bit app on a 64bit OS

HKCR\Wow6432Node\Interface should be readed as HKCR\Interface
Reply With Quote
  #4  
Old 07-17-2012, 01:18 PM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 6,707
Default

So I have no x64 to try at the moment, but it should be something like:
Code:
procedure TForm1.Button1Click(Sender: TObject);
var
  Reg: TRegistry;
begin
  Reg := TRegistry.Create;
  try
    Reg.RootKey := HKEY_CLASSES_ROOT;
    if Reg.OpenKey('\', False) then
    begin
      Memo1.Lines.Add('interface key opened');
      if Reg.CreateKey('Test Sub Key') then memo1.Lines.Add('key added');
      Reg.CloseKey;
    end;
  finally
    Reg.Free;
  end;
end;
Although I have my doubts on the OpenKey on no folder, but as mentioned, cannot test at the moment
Reply With Quote
  #5  
Old 07-17-2012, 09:42 PM
CAnder1 CAnder1 is offline
Junior Member
 
Join Date: Sep 2011
Posts: 9
Default

Hi Norrit,

Thanks for the replies.

I have tried both OpenKey with '\' and '\Interface' and both are Denied Access.

I think, based on some furious Googling, that the issue is trying to register an out of process 32 bit server on a 64 bit machine.

I have found several references to using utilities in the Windows\SysWOW64 folder to allow 32 bit servers to be registered on 64 bit machines (such as RegSvr32), but these are expecting either DLL or OCX (which are in process?), and complain when I try to use them to register the 32 bit server.

As yet I haven't been able to find any resources on registering .exe type 32 bit servers on 64 bit machines, apart from an article on how to force an application to start as 32 bit:

CorFlags /32BIT+ application.exe

but haven't tried this; had issues downloading SDK.


Regards,

CAnder1
Reply With Quote
  #6  
Old 07-28-2012, 07:30 AM
CAnder1 CAnder1 is offline
Junior Member
 
Join Date: Sep 2011
Posts: 9
Default

Hi,

The problem turned out to be the Windows 7 User Access Control (UAC) under User Accounts in the Control Panel.

Setting the slider control to Never Notify, then rebooting the machine, allowed the Automation server to register without any problems.

It doesn't explain how I'm able to load other servers such as Office without having to alter this setting, however it's good enough for me.

Thanks again to Norrit for your input.

Regards,


CAnder1
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 01:53 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.