RRUZ/delphi-dev-shell-tools

Windows 8.1 cannot install

Closed this issue · 13 comments

What steps will reproduce the problem?

1. Windows 8.1 pro

2. Delphi 7, 2007, 2010, xe3

3. When insallation comes to the part where it should register dll file, 
regsvr32 just goes waiting into background and nothing happens more. Same way 
when i try to register dll with regsvr32 manually, it just goes into bg and 
idles.

any solution to this ?

Original issue reported on code.google.com by bo...@globalnet.ba on 13 Feb 2014 at 10:45

[deleted comment]
[deleted comment]
[deleted comment]
debugged, found problem, patched...

it was not releated to operating system, but to GetAssocAppByExt API. When 
registration is invoked by regsvr32 along the way it checks how txt files are 
handled... this was the problem.

explanation:
when calling 
 GetAssocAppByExt('foo.txt', ExeNameTxt, FriendlyAppNameTxt);
and from there calls AssocQueryString.

as i have ultraedit and other hex/txt editors installed it returns location of 
OpenWith.exe. This is the problem which may cause "hang" when 
installing/deinstalling while registering/unregistering dll file.

Original comment by bo...@globalnet.ba on 15 Feb 2014 at 4:24

Can you please attach the patch was you made?.

Original comment by Rodrigo.Ruz.V@gmail.com on 16 Feb 2014 at 2:28

i will certenly, currently is an ugly patch give me a day or two to make it
nice as i was exploring what is wrong with the code and made many changes.
when done ill submit to you via mail, ok ?

Original comment by bo...@globalnet.ba on 16 Feb 2014 at 5:34

Can You give me a copy too? Please.

Best regards.

Original comment by fredinho...@gmail.com on 3 Jun 2014 at 4:18

Can You give me a copy too? Please.

Thanks.

Original comment by futures...@gmail.com on 12 Jun 2014 at 6:57

here is quick fix, update function in uMisc.pas:

procedure  GetAssocAppByExt(const FileName:string; var ExeName, FriendlyAppName 
: string);
var
 pszOut: array [0..1024] of Char;
 pcchOut: DWord;
begin
  ExeName:='';
  FriendlyAppName:='';
  pcchOut := Sizeof(pszOut);
  ZeroMemory(@pszOut, SizeOf(pszOut));

  if FileName='foo.txt' then begin
    ExeName:='C:\Windows\System32\Notepad.exe';
    FriendlyAppName:='Notepad';
  end else begin

  OleCheck( AssocQueryString(ASSOCF_NOTRUNCATE, ASSOCSTR(ASSOCSTR_EXECUTABLE), LPCWSTR(ExtractFileExt(FileName)), 'open', pszOut, @pcchOut));
  if pcchOut>0 then
   SetString(ExeName, PChar(@pszOut[0]), pcchOut-1);

  pcchOut := Sizeof(pszOut);
  ZeroMemory(@pszOut, SizeOf(pszOut));

  OleCheck( AssocQueryString(ASSOCF_NOTRUNCATE, ASSOCSTR(ASSOCSTR_FRIENDLYAPPNAME), LPCWSTR(ExtractFileExt(FileName)), 'open', pszOut, @pcchOut));
  if pcchOut>0 then
  SetString(FriendlyAppName, PChar(@pszOut[0]), pcchOut-1);
  end;
end;

Original comment by bo...@globalnet.ba on 3 Jul 2014 at 4:12

This code will cause which not third-party editors will be detected by the 
shell extension. Also I have several text editors installed on my system and 
the extension works fine. 

Original comment by Rodrigo.Ruz.V@gmail.com on 3 Jul 2014 at 9:40

it works fine on your system, and did you even count how many people asked for 
this ? you better make a patch then that will work instead of keeping this as 
half-working extension.

Original comment by bo...@globalnet.ba on 3 Jul 2014 at 9:43

Can you run this code in your machine and tell me which is the output? 

{$APPTYPE CONSOLE}

uses
  ShellAPI,
  ComObj,
  Windows,
  ShLwApi,
  SysUtils;

procedure GetAssocAppByExt(const FileName:string; var ExeName, FriendlyAppName 
: string);
var
 pszOut: array [0..1024] of Char;
 pcchOut: DWord;
begin
  ExeName:='';
  FriendlyAppName:='';
  pcchOut := Sizeof(pszOut);
  ZeroMemory(@pszOut, SizeOf(pszOut));

  OleCheck( AssocQueryString(ASSOCF_NOTRUNCATE, ASSOCSTR(ASSOCSTR_EXECUTABLE), LPCWSTR(ExtractFileExt(FileName)), 'open', pszOut, @pcchOut));
  if pcchOut>0 then
   SetString(ExeName, PChar(@pszOut[0]), pcchOut-1);

  pcchOut := Sizeof(pszOut);
  ZeroMemory(@pszOut, SizeOf(pszOut));

  OleCheck( AssocQueryString(ASSOCF_NOTRUNCATE, ASSOCSTR(ASSOCSTR_FRIENDLYAPPNAME), LPCWSTR(ExtractFileExt(FileName)), 'open', pszOut, @pcchOut));
  if pcchOut>0 then
   SetString(FriendlyAppName, PChar(@pszOut[0]), pcchOut-1);
end;

var ExeName, FriendlyAppName : string;
begin
  try
    GetAssocAppByExt('foo.txt', ExeName, FriendlyAppName);
    Writeln(ExeName);
    Writeln(FriendlyAppName);
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
  Readln;
end.

Original comment by Rodrigo.Ruz.V@gmail.com on 3 Jul 2014 at 10:01

The output is the following:
===========================
C:\Windows\system32\NOTEPAD.exe
Notepad
===========================
How does it solve the problem 
with regsvr32 which fails to 
(un)register your dll?
It doesn't work for me on Win8.1 & Win7,
albeit previous versions worked fine...

Original comment by Dmitry.L...@gmail.com on 18 Jul 2014 at 1:17