Repository navigation
Expand file tree
/
Copy pathLightCore.Win.Shell.pas
More file actions
558 lines (453 loc) · 21.2 KB
/
Copy pathLightCore.Win.Shell.pas
File metadata and controls
558 lines (453 loc) · 21.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
UNIT LightCore.Win.Shell;
{$IFNDEF MSWINDOWS}
{$MESSAGE FATAL 'LightCore.Win.Shell is Windows-only. Its package LightCore.Win builds for Win32 and Win64 only.'}
{$ENDIF}
{=============================================================================================================
2026.09.30
www.GabrielMoraru.com
--------------------------------------------------------------------------------------------------------------
Shell utilities:
* Associate a program with a file type (for example when the user double click a jpg file, your program (image viewer) will start and show that image.
* Add commands to the context menu (right click menu).
* Create desktop shortcuts (when your app starts for the first time it can create a shortcut on the desktop so user can easily find it)
* Restore the 'Show Desktop' icon of the Quick Launch bar
* Register an uninstaller in Windows Programs and Features (Add/Remove Programs)
See also:
LightCore.Shell.pas - the taskbar, the program associated with a file type, the list of recent files of the taskbar button, IsApiFunctionAvailable
LightVcl.Common.Shell.pas - the file properties dialog, the Start menu, INF files, ExtractIconFromFile
Windows-only unit, package LightCore.Win. Every routine works through the Windows registry, the COM shell link object (IShellLink) or a Windows shell folder, and the association routines notify Windows Explorer through SHChangeNotify. None of these exists off Windows, so a build for Android, macOS or iOS stops at the top of this unit with a fatal compiler message.
=============================================================================================================}
INTERFACE
USES
Winapi.Windows, Winapi.ShlObj, Winapi.ActiveX,
System.Win.Registry, System.Win.ComObj, System.Classes, System.SysUtils;
{==================================================================================================
FILE ASSOCIATION
==================================================================================================}
function AssociateWith (CONST FileExtension, AsociationName: string; CONST ForAllUsers: Boolean= FALSE; {LogErrors: Boolean= FALSE; we always log} Notify: Boolean= TRUE): Boolean; { Associate a application with an extension. EXAMPLE: FileExtension:= '.txt' / AsociationName:= 'Metapad'. A registry failure goes into AppDataCore's log. Nothing appears on screen }
function AssociationReset (CONST FileExtension: string; CONST ForAllUsers: Boolean): Boolean;
procedure AssociateSelf_ShellMenu; { A registry failure goes into AppDataCore's log. Nothing appears on screen }
{--------------------------------------------------------------------------------------------------
CONTEXT MENU
-------------------------------------------------------------------------------------------------}
function AddContextMenu (CONST CommandName, Extensions: string): Boolean; overload;
procedure AddContextMenu (CONST GUID: TGUID; CONST ShellExtDll, FileExt, UtilityName: string); overload;
procedure RemoveContextMenu(CONST GUID: TGUID; CONST FileExt, UtilityName: string);
{--------------------------------------------------------------------------------------------------
DESKTOP: SHORTCUTS
--------------------------------------------------------------------------------------------------}
procedure CreateShortcut (CONST ShortCutName: string; OnDesktop: Boolean);
procedure CreateShortcutEx (CONST ShortCutName, ShortcutTo: string; OnDesktop: Boolean); { Full parameters }
procedure CreateShortcut_SendTo (CONST ShortcutName : string); { Add your application in the "Send To" menu and processing the file http://delphi.about.com/od/adptips2006/qt/app2sendtomenu.htm }
function DeleteDesktopShortcut (CONST ShortcutName: string): Boolean;
function DeleteStartMenuShortcut (CONST ShortcutName: string): Boolean;
function ExtractPathFromLnkFile (CONST LnkFile: WideString): string;
{--------------------------------------------------------------------------------------------------
DESKTOP: SCF
--------------------------------------------------------------------------------------------------}
function RestoreOriginalSCF_Association: Boolean; { Make 'Show Desktop' icon in Quick Launch to work again (to show desktop) }
function RemoveShowDesktopFile: Boolean;
procedure RestoreShowDesktopFile;
procedure AddUninstaller(CONST UninstallerExePath, ProductName: string); { Uninstaller= Full path to the EXE file that represents the uninstaller; ProductName= the uninstaller will be listed with this name. Keep it simple without special chars like '\'. Example: 'BioniX Wallpaper' }
IMPLEMENTATION
USES
LightCore.Win.IO, LightCore.IO, LightCore.TextFile, LightCore.AppData, LightCore.Win.Registry, LightCore;
{--------------------------------------------------------------------------------------------------
SHORTCUTS (LNK)
--------------------------------------------------------------------------------------------------}
{ Creates a Windows shortcut (.lnk) file.
ShortcutName: The name of the shortcut (without .lnk extension).
ShortcutTo: The target path that the shortcut will point to.
OnDesktop: TRUE places the shortcut on the Desktop, FALSE places it in the Start Menu.
Note: CoInitialize must be called before this function. Application.Initialize does this automatically. }
procedure CreateShortcutEx(CONST ShortcutName, ShortcutTo: string; OnDesktop: Boolean);
var
MyObject : IUnknown;
MySLink : IShellLink;
MyPFile : IPersistFile;
Directory : String;
WFileName : WideString;
begin
Assert(ShortcutName <> '', 'ShortcutName cannot be empty!');
Assert(ShortcutTo <> '', 'ShortcutTo cannot be empty!');
MyObject:= CreateComObject(CLSID_ShellLink);
MySLink := MyObject as IShellLink;
MyPFile := MyObject as IPersistFile;
MySLink.SetArguments(''); { Example argument: 'C:\AUTOEXEC.BAT' }
MySLink.SetPath(PChar(ShortcutTo));
MySLink.SetWorkingDirectory(PChar(AppDataCore.AppFolder)); { Using AppFolder avoids issues when running from read-only media }
if OnDesktop
then Directory:= GetDesktopFolder
else
begin
Directory:= GetStartMenuFolder;
CreateDir(Directory); {shortcut on start menu}
end;
{ CREATE FILE }
WFileName := Directory+ ShortCutName+ '.lnk'; {numele shortcut-ului}
MyPFile.Save(PWChar(WFileName), False);
end;
procedure CreateShortcut(CONST ShortCutName: string; OnDesktop: Boolean); { OnDesktop: 1=Desktop 0=StartMenu }
begin
CreateShortcutEx(ShortCutName, ParamStr(0), OnDesktop);
end;
{ Deletes a desktop shortcut. Provide only the name (without .lnk extension). }
function DeleteDesktopShortcut(CONST ShortcutName: string): Boolean;
begin
Assert(ShortcutName <> '', 'ShortcutName cannot be empty!');
Result:= DeleteFile(GetDesktopFolder+ ShortCutName+ '.lnk');
{TODO: send a refresh signal to the desktop otherwise the icon is still drawn there }
end;
{ Deletes a Start Menu shortcut. Provide only the name (without .lnk extension). }
function DeleteStartMenuShortcut(CONST ShortcutName: string): Boolean;
VAR
Directory: String;
MyReg: TRegIniFile;
begin
Assert(ShortcutName <> '', 'ShortcutName cannot be empty!');
MyReg:= TRegIniFile.Create('Software\MicroSoft\Windows\CurrentVersion\Explorer');
TRY
Directory:= MyReg.ReadString('Shell Folders', 'Start Menu', '');
Result:= DeleteFile(Directory + '\' + ShortCutName + '.lnk');
FINALLY
FreeAndNil(MyReg);
END;
end;
{--------------------------------------------------------------------------------------------------
Add your application in the "Send To" menu of a file and load that file.
Usage:
1. On the FirstRun, call CreateShortcutIn(CSIDL_SENDTO, App_Name2) to add self to the 'SendTo' menu
2. In TForm1.OnCreate do this: if ParamCount > 0 then MessageInfo(ParamStr(1))
From:
http://delphi.about.com/od/adptips2006/qt/app2sendtomenu.htm
--------------------------------------------------------------------------------------------------}
procedure CreateShortcut_SendTo(CONST ShortcutName: string);
CONST
SentToIDL= CSIDL_SENDTO;
VAR
IObject : IUnknown;
ISLink : IShellLink;
IPFile : IPersistFile;
PIDL : PItemIDList;
InFolder : array[0..MAX_PATH] of Char;
TargetName: String;
LinkName : WideString;
begin
Assert(ShortcutName <> '', 'ShortcutName cannot be empty!');
TargetName:= ParamStr(0);
IObject:= CreateComObject(CLSID_ShellLink);
ISLink := IObject as IShellLink;
IPFile := IObject as IPersistFile;
ISLink.SetPath(PChar(TargetName));
ISLink.SetWorkingDirectory(PChar(ExtractFilePath(TargetName)));
{ Get the location of the "special folder".
The returned PIDL is allocated by the shell and must be released with CoTaskMemFree, otherwise it leaks. }
OleCheck(SHGetSpecialFolderLocation(0, SentToIDL, PIDL));
TRY
if NOT SHGetPathFromIDList(PIDL, InFolder)
then raise Exception.Create('CreateShortcut_SendTo: Cannot resolve the SendTo folder path!');
FINALLY
CoTaskMemFree(PIDL);
END;
LinkName := Format('%s\%s.lnk',[InFolder, shortcutName]) ;
IPFile.Save(PWChar(LinkName), False) ;
end;
{ Extracts the target path from a Windows shortcut (.lnk) file.
Returns empty string if the file cannot be loaded or path cannot be extracted. }
function ExtractPathFromLnkFile(CONST LnkFile: WideString): String;
VAR
ShellLink: IShellLink;
FindData: TWin32FindData;
Path: array[0..MAX_PATH] of Char;
begin
Result:= '';
if LnkFile = '' then EXIT;
ShellLink:= CreateComObject(CLSID_ShellLink) as IShellLink;
if (ShellLink as IPersistFile).Load(PWideChar(LnkFile), STGM_READ) = 0
then
if ShellLink.GetPath(Path, MAX_PATH, FindData, SLGP_SHORTPATH) = 0
then Result:= Path;
end;
{-------------------------------------------------------------------------------------------------------------
ASSOCIATE APP WITH A FILE TYPE
ALSO SEE THIS:
ms-help://embarcadero.rs_xe7/codeexamples/JumpListTest_(Delphi).html
-------------------------------------------------------------------------------------------------------------}
{ Let Windows Explorer know we added our file type }
procedure AssociationChanged;
begin
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nil, nil);
end;
{ If Notify= true then notify Windows
Use dot in file extension. Ex: '.txt' }
function AssociateWith;
VAR
FName: string;
RootKey: HKEY;
CONST
Path= '\Software\Classes\';
begin
Result:= FALSE;
Assert(FileExtension.Length > 0, 'FileExtension is empty!');
Assert(FileExtension[1] = '.', 'FileExtension should start with dot!');
Assert(Pos('*', FileExtension) = 0, 'Invalid file extension in AssociateWith!');
{ Both roots are combined with Path='\Software\Classes\' below.
HKLM\Software\Classes = per-machine associations (visible in the HKCR merged view).
HKCU\Software\Classes = per-user associations.
Do NOT use HKEY_CLASSES_ROOT here: HKCR is itself the merged view of the two keys above, so HKCR + '\Software\Classes\.ext' would physically land in HKLM\Software\Classes\Software\Classes\.ext - a bogus nested path the shell never reads. }
if ForAllUsers { On Windows 7 and up, you need admin rights to register a file type for all the machine users }
then RootKey:= HKEY_LOCAL_MACHINE
else RootKey:= HKEY_CURRENT_USER;
FName:= System.Copy(FileExtension+ '_file', 2, MaxInt);
TRY
Result:=
RegWriteString(RootKey, Path+ FileExtension, '', FName, TRUE) AND
RegWriteString(RootKey, Path+ FName, '', AsociationName, TRUE) AND
RegWriteString(RootKey, Path+ FName+'\shell', '', 'open', TRUE) AND
RegWriteString(RootKey, Path+ FName+'\shell\open\command', '', ParamStr(0)+ ' "%L"', TRUE) AND { Using %L instead of %1 gives the long path format instead of 8.3/DOS format }
RegWriteString(RootKey, Path+ FName+'\DefaultIcon' , '', ParamStr(0)+ ',0', TRUE);
if NOT Result
AND (AppDataCore <> NIL)
then AppDataCore.LogWarn('AssociateWith: cannot associate application with '+ FileExtension);
EXCEPT
on E: ERegistryException DO
begin
if (AppDataCore <> NIL)
then AppDataCore.LogWarn('AssociateWith: cannot associate application with '+ FileExtension+ '. '+ E.Message);
end;
else RAISE;
END;
if Result AND Notify
then AssociationChanged;
end;
{ Note: use dot in the file extension: '.txt' }
function AssociationReset(CONST FileExtension: string; CONST ForAllUsers: Boolean): Boolean;
begin
Assert(FileExtension.Length > 0, 'FileExtension is empty!');
Assert(FileExtension[1] = '.', 'FileExtension should start with dot!');
if ForAllUsers
then Result:= RegDeleteKey(HKEY_CLASSES_ROOT, FileExtension)
else Result:= RegDeleteKey(HKEY_CURRENT_USER, '\Software\Classes\'+ FileExtension);
if Result
then AssociationChanged;
end;
{ Add current application in the 'Open with' section of the 'File Properties' popup menu that appears when we right click a file in Explorer }
procedure AssociateSelf_ShellMenu;
begin
TRY
VAR Reg:= TRegistry.Create;
TRY
Reg.RootKey:= HKEY_CLASSES_ROOT;
Reg.OpenKey('*\Shell\Open with '+AppDataCore.AppName +'\Command', TRUE);
Reg.WriteString('', Lowercase(ParamStr(0)) + ' %1');
Reg.CloseKey;
FINALLY
FreeAndNil(Reg);
end;
EXCEPT
on E: ERegistryException DO
begin
if (AppDataCore <> NIL)
then AppDataCore.LogError('AssociateSelf_ShellMenu: cannot associate application. '+ E.Message);
end;
else RAISE;
END;
end;
{ Add current application in the 'properties' menu of this filetype.
Example: AddContextMenu2('Open with '+ AppName, '.nfo') }
function AddContextMenu(CONST CommandName, Extensions: string): Boolean;
VAR
extns: TStringList;
Reg: TRegistry;
name: string;
command: string;
begin
Result:= FALSE;
Reg := TRegistry.Create;
extns := TStringList.Create;
TRY
Reg.RootKey := HKEY_CLASSES_ROOT;
extns.CommaText := Extensions;
command := '"' + ParamStr(0) + '" "%1"'; { Build the command string we want to store }
TRY
// Loop over extensions we can handle
for var Extension in extns do
// See if this extension is already known in HKCR
if Reg.OpenKeyReadOnly ('\' + Extension) then
begin
name := Reg.ReadString (''); // Get the name of this type
if name <> '' then
begin
// If not blank, open this type's shell key, but don't create it
if Reg.OpenKey ('\' + name + '\shell', False)
then Reg.Access := KEY_READ or KEY_WRITE; { Try to create a new key called command_name }
if Reg.OpenKey (CommandName, TRUE) then
begin
Reg.WriteString ('', '&' + CommandName); { The default value will be displayed in the context menu }
Reg.Access := KEY_READ or KEY_WRITE;
if Reg.OpenKey ('command', TRUE) then
begin
Reg.WriteString ('', command); { Write the command string as the default value }
Result:= TRUE;
end;
end;
end;
end;
EXCEPT
on E: ERegistryException DO Result:= FALSE;
else RAISE;
END;
FINALLY
FreeAndNil(extns);
FreeAndNil(Reg);
END;
end;
{--------------------------------------------------------------------------------------------------
SHELL EXTENSION
--------------------------------------------------------------------------------------------------}
{ Registers a shell extension DLL for the specified file type in the Windows context menu.
GUID: The COM class GUID for the shell extension.
ShellExtDll: Full path to the shell extension DLL.
FileExt: The file extension to associate with (e.g., '.txt') or '*' for all files.
UtilityName: Display name for the context menu handler. }
procedure AddContextMenu(CONST GUID: TGUID; CONST ShellExtDll, FileExt, UtilityName: string);
VAR
Key: string;
Rg: TRegistry;
BufGUID: array [0..255] of WideChar;
FileType: string;
begin
Rg:= TRegistry.Create;
TRY
Rg.RootKey:= HKEY_CLASSES_ROOT;
StringFromGUID2(GUID, BufGUID, SizeOf(BufGUID));
if NOT Rg.OpenKey(FileExt, False) then EXIT;
if FileExt <> '*' then
begin
FileType:= Rg.ReadString('');
Rg.CloseKey;
Rg.OpenKey(FileType, False);
end;
Key:= Format('shellex\ContextMenuHandlers\%s', [UtilityName]);
Rg.OpenKey(Key, TRUE);
Rg.WriteString('', BufGUID);
Rg.CloseKey;
Key:= Format('CLSID\%s', [BufGUID]);
Rg.OpenKey(Key, True);
Rg.WriteString('', UtilityName);
Rg.OpenKey('InprocServer32', True);
Rg.WriteString('', ShellExtDll);
Rg.WriteString('ThreadingModel', 'Apartment');
Rg.CloseKey;
FINALLY
FreeAndNil(Rg);
END;
end;
{ Remove shell extension from the context menu }
procedure RemoveContextMenu(CONST GUID: TGUID; CONST FileExt, UtilityName: string);
VAR
Key: string;
BufGUID: array [0..255] of WideChar;
FileType: string;
Reg: TRegistry;
begin
Reg:= TRegistry.Create(KEY_ALL_ACCESS);
TRY
Reg.RootKey:= HKEY_CLASSES_ROOT;
StringFromGUID2(GUID, BufGUID, SizeOf(BufGUID));
FileType:= FileExt;
if FileType <> '*' then
begin
if NOT Reg.OpenKey(FileExt, FALSE) then EXIT;
FileType:= Reg.ReadString('');
Reg.CloseKey;
end;
Key:= Format('%s\shellex\ContextMenuHandlers\%s', [FileType, UtilityName]);
Reg.DeleteKey(Key);
Key:= Format('CLSID\%s', [BufGUID]);
Reg.DeleteKey(Key);
FINALLY
FreeAndNil(Reg);
END;
end;
(*
procedure DoContextMenuVerb(AFolder: TShellFolder; Verb: PChar); { executes a command }
var
ICI: TCMInvokeCommandInfo;
CM: IContextMenu;
PIDL: PItemIDList;
begin
if AFolder = nil then Exit;
FillChar(ICI, SizeOf(ICI), #0);
with ICI do begin
cbSize := SizeOf(ICI);
fMask := CMIC_MASK_ASYNCOK;
hWND := 0;
lpVerb := Verb;
nShow := SW_SHOWNORMAL;
end; {with ICI..}
PIDL := AFolder.RelativeID;
AFolder.ParentShellFolder.GetUIObjectOf(0, 1, PIDL, IID_IContextMenu, nil, CM);
CM.InvokeCommand(ICI);
end; *)
{--------------------------------------------------------------------------------------------------
SCF 'SHOW DESKTOP' icon
--------------------------------------------------------------------------------------------------}
{ Restores the .scf file association to make 'Show Desktop' icon work in Quick Launch.
Registry path: HKEY_CLASSES_ROOT\.scf = "SHCmdFile" }
function RestoreOriginalSCF_Association: Boolean;
begin
Result:= RegWriteString(HKEY_CLASSES_ROOT, '.scf', '', 'SHCmdFile', TRUE);
if Result
then AssociationChanged;
end;
function RemoveShowDesktopFile: Boolean;
VAR ShowDesktopFilePath: string;
begin
{ GetSpecialFolder returns the path WITHOUT a trailing backslash (Trail is applied only when ForceFolder=TRUE) - without Trail the path would read '...\RoamingMicrosoft\...' }
ShowDesktopFilePath:=
Trail(GetSpecialFolder(CSIDL_APPDATA))
+'Microsoft\Internet Explorer\Quick Launch\Show Desktop.scf';
Result:= FALSE;
if FileExists(ShowDesktopFilePath)
then Result:= DeleteFile(ShowDesktopFilePath);
end;
procedure RestoreShowDesktopFile;
VAR
ShowDesktopFilePath: string;
CONST
ShowDesktopContent=
'[Shell]' + CRLFw+
'Command=2' + CRLFw+
'IconFile=explorer.exe,3'+ CRLFw+
'[Taskbar]' + CRLFw+
'Command=ToggleDesktop';
begin
{ Trail needed: GetSpecialFolder returns the path WITHOUT a trailing backslash }
ShowDesktopFilePath:= Trail(GetSpecialFolder(CSIDL_APPDATA))+'Microsoft\Internet Explorer\Quick Launch\Show Desktop.scf';
StringToFileA(ShowDesktopFilePath, ShowDesktopContent, woOverwrite);
end;
{ MINIMIZE ALL
Does not work:
1
procedure ShowDesktop(CONST YesNo : Boolean);
setwindowlong ptr(getwindow(self.Handle,GW_OWNER),GWL_STYLE,0);
setwindowlong ptr(getwindow(self.Handle,GW_OWNER),GWL_EXSTYLE,0);
2
procedure ShowDesktop(CONST YesNo : Boolean);
VAR h : THandle;
h := FindWindow('ProgMan', nil) ;
h := GetWindow(h, GW_CHILD) ;
ShowWindow(h, SW_SHOW);
ShowWindow(h, SW_HIDE); }
{ Registers an uninstaller in Windows Programs and Features (Add/Remove Programs).
UninstallerExePath: Full path to the uninstaller EXE file.
ProductName: Display name in the uninstall list. Avoid special chars like '\'. }
procedure AddUninstaller(CONST UninstallerExePath, ProductName: string);
begin
Assert(UninstallerExePath <> '', 'UninstallerExePath cannot be empty!');
Assert(ProductName <> '', 'ProductName cannot be empty!');
RegWriteString(HKEY_CURRENT_USER, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\'+ ProductName, 'DisplayName', ProductName);
RegWriteString(HKEY_CURRENT_USER, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\'+ ProductName, 'UninstallString', UninstallerExePath);
end;
end.