Jump to content

[Tutorial] Exotic INF ProfileItems/Shortcuts


ricktendo

Recommended Posts

Everybody knows how to use ProfileItems to add/del shortcuts for your programs. And everybody knows the basic flags (so I will skip this part)

0x00000001 Create menu item in Current User flag

0x00000002 Delete menu item flag

0x00000004 Create Start menu group under All Users\Start\Programs

0x00000005 Create Start menu group under Current User\Start\Programs

0x00000006 Delete Start menu group under All Users\Start\Programs

0x00000007 Delete Start menu group under Current User\Start\Programs

Here is some exotic stuff you NEED and do NOT NEED to know about ProfileItems, including some new tips on how to add special types of shortcuts that do NOT go in the standard places like the All Programs group in your Start Menu.

QuickLaunch Shortcut Example

ProfileItems = Sidebar.QuickLaunch.AddShortcut

[Sidebar.QuickLaunch.AddShortcut]
Name = %SIDEBAR%,8,26
CmdLine = 16422,%SIDEBAR%,sidebar.exe
SubDir = %QUICK%
WorkingDir = 16422,%SIDEBAR%
InfoTip = "@%%ProgramFiles%%\%SIDEBAR%\sidebar.exe,-1012"
DisplayResource = "%%ProgramFiles%%\%SIDEBAR%\sidebar.exe",1000

[Strings]
SIDEBAR = "Windows Sidebar"
QUICK = "Microsoft\Internet Explorer\Quick Launch"

SendTo Shortcut Example

This is a double wammy, in addition of showing you how to add a shortcut to SendTo folder it shows how its possible to use ProfileItmes to make shortcuts to CMD and other files that were not possible before.

ProfileItems = Reg2Inf.SendTo.AddShortcut

[Reg2Inf.SendTo.AddShortcut]
Name = Reg2Inf,8,9
CmdLine = 11,,Reg2InfHandler.cmd
WorkingDir = 11
IconPath = 11,,shell32.dll
IconIndex = 71;<- Include this for DLL/EXE files with multipple icons

The secret of making links to files that cant normally be done using ProfileItems is IconPath and IconIndex, I point the CMD shortcut to the shell32.dll icon for CMD files but you can use any custom path to any icon. I prefer to point n7Epilson's Reg2Inf shortcut to regedit.exe like so

IconPath = 10,,regedit.exe;<-You dont need a IconIndex for this, IconPath uses the first executable/library icon by default.

How to add custom bookmark links for IE

You can also Delete Bookmarks... More info bellow

ProfileItems = RyanVM.AddBookmark

[RyanVM.AddBookmark]
Name = RyanVM's MSFN Files Page,8,6
URL = "http://www.ryanvm.net/msfn/"
IconPath = 16422,%IE%,IEXPLORE.EXE
IconIndex = 1

[Strings]
IE = "Internet Explorer"

Desktop & Folder Shortcut Example

Another double wammy, the following shows how to create a link to a Folder (%WinDir% or WINDOWS) in addition to creating it in %AllUsersProfile%\Desktop

ProfileItems = Desktop.WinDir.AddShortcut

[Desktop.WinDir.AddShortcut]
Name = WINDOWS,8,25
CmdLine = 10,,;<- Will NOT work without subdir commas
WorkingDir = 0;<- Very Important you use Zero
IconPath = 11,,shell32.dll
IconIndex = 3;<- Folder icon number in shell32.dll

Here are some of the special flags (more to come) you can use for all sorts of cool things (I have more flags but I wont post them because they lead to the Fonts and other useless directories)

Not all of them work during Windows Setup

0x00000008,2 = %UserProfile%\Start Menu\Programs

0x00000008,5 = %UserProfile%\My Documents

0x00000008,6 = %UserProfile%\Favorites <- Perfect for adding custom IE Bookmarks

0x00000008,7 = %UserProfile%\Start Menu\Programs\Startup

0x00000008,8 = %UserProfile%\Recent

0x00000008,9 = %UserProfile%\SendTo

0x00000008,11 = %UserProfile%\Start Menu

0x00000008,13 = %UserProfile%\My Documents\My Music

0x00000008,14 = %UserProfile%\My Documents\My Videos

0x00000008,16 = %UserProfile%\Desktop

0x00000008,19 = %UserProfile%\NetHood

0x00000008,20 = %WinDir%\Fonts

0x00000008,21 = %UserProfile%\Templates

0x00000008,22 = %AllUserProfile%\Start Menu

0x00000008,23 = %AllUserProfile%\Start Menu\Programs

0x00000008,24 = %AllUserProfile%\Start Menu\Programs\Startup

0x00000008,25 = %AllUserProfile%\Desktop

0x00000008,26 = %UserProfile%\Application Data <- Perfect for QuickLauch

0x00000008,27 = %UserProfile%\PrintHood

0x00000008,28 = %UserProfile%\Local Settings\Application Data

0x00000008,31 = %AllUsersProfile%\Favorites <- More IE Bookmarks

0x00000008,32 = %UserProfile%\Local Settings\Temporary Internet Files

0x00000008,33 = %UserProfile%\Local Settings\Cookies

0x00000008,34 = %UserProfile%\Local Settings\History

0x00000008,35 = %AllUsersProfile%\Application Data

0x00000008,36 = %WinDir%

0x00000008,37 = %WinDir%\system32

0x00000008,38 = %ProgramFiles%

0x00000008,39 = %UserProfile%\My Documents\My Pictures

0x00000008,40 = %UserProfile%

0x00000008,41 = %WinDir%\system32

0x00000008,43 = %CommonProgramFiles%

0x00000008,45 = %AllUsersProfile%\Templates

0x00000008,46 = %AllUsersProfile%\Documents

0x00000008,47 = %AllUsersProfile%\Start Menu\Programs\Administrative Tools

0x00000008,48 = %UserProfile%\Start Menu\Programs\Administrative Tools

0x00000008,53 = %AllUsersProfile%\Documents\My Music

0x00000008,54 = %AllUsersProfile%\Documents\My Pictures

0x00000008,55 = %AllUsersProfile%\Documents\My Videos

0x00000008,56 = %ResourceDir%

0x00000008,57 = %ResourceDir%409

0x00000008,59 = %UserProfile%\Local Settings\Application Data\Microsoft\CD Burning

In order to DELETE any of the same links as above using ProfileItems in your INF Uninstall, use the 0x0000000A,XX flag followed by the special number. Use the same one you used to add the link in the first place (just edit "XX").

Example: The following deletes "Windows Update.LNK" from %AllUsersProfile%\Start Menu

ProfileItems = MU.DelShortcut

[MU.DelShortcut]
Name=Windows Update,0x0000000A,22

Link to comment
Share on other sites

  • 5 months later...
  • 2 weeks later...

great job.

But can I ask you a question for my nero addon shortcut?

The orginal Nero ControlCenter shortcut target line is

"C:\Program Files\Common Files\Nero\Nero Web\SetupX.exe" MODE="update"

and i want prepare it for my addon shortcut

This is my code in nero.inf for Nero ControlCenter shortcut

[Nero.Webcut]
Name =Nero ControlCenter
CmdLine =16427,"Nero\Nero Web",SetupX.exe MODE="update"
SubDir ="Nero\Setup"
WorkingDir=16422,"Nero\%PROG_NAME%"
IconPath =16427,"Nero\Nero Web",nps.dll
IconIndex =0
InfoTip ="Update The Legendary Burner!"

But when i install addon this shotcut target line is become to

"C:\Program Files\Common Files\Nero\Nero Web\SetupX.exe" MODE=update

so it doesn't work. How i add invert commas("") in shortcut target line?

Edited by Preputium64
Link to comment
Share on other sites

Responded to your PM also (its easy, you just quote the quotes :P)

[Nero.Webcut]
Name =Nero ControlCenter
CmdLine =16427,"Nero\Nero Web",SetupX.exe MODE="""update"""
SubDir ="Nero\Setup"
WorkingDir=16422,"Nero\Nero Web"
IconPath =16427,"Nero\Nero Web",nps.dll
;IconIndex =0 ;<-Don't need this, IconPath will automatically use the 1st icon by default
InfoTip ="Update The Legendary Burner!"

Link to comment
Share on other sites

  • 2 months later...

i`m having a problem in the cmd line the file name has a space in it

and i cant fix it

plz help.

Edited by Dark_Knight
Link to comment
Share on other sites

THIS IS MY INF

[Version]

Signature="$Windows NT$"

[Optional Components]

FOXIT

[DefaultInstall]

AddReg =FOXIT.AddReg

CopyFiles =FOXIT.FILES

ProfileItems=Desketop.AddShortcut,Foxit.AddShortcut,Uninstall.AddShortcut

[FOXIT]

OptionDesc ="Foxit Pdf Reader"

Tip ="Small PDF reader"

Modes =0,1,2,3

AddReg =FOXIT.AddReg

CopyFiles =FOXIT.FILES

rofileItems=Desketop.AddShortcut,Foxit.AddShortcut,Uninstall.AddShortcut

[DestinationDirs]

FOXIT.FILES=16422,%FX%

[sourceDisksNames.x86]

1="WinXp","Foxit.Cab",,I386

[sourceDisksFiles]

FoxitReader.exe=1

Readme.txt=1

Uninstall.exe=1

[FOXIT.FILES]

Foxit Reader.exe,FoxitReader.exe

Readme.txt

Uninstall.exe

[FOXIT.AddReg]

HKCU,"Software\%FX%\FrameWnd","WindowPos",0x0,"2,3,-1,-1,-1,-1,22,29,982,583"

HKCU,"Software\%FX%\MainFrame","AdvertiseIndex",0x0,"8"

HKLM,"SOFTWARE\%FX%","isplugin",0x0,"0"

HKLM,"SOFTWARE\%FX%","isreaderpro",0x0,"0"

HKLM,"SOFTWARE\%FX%","InstallPath",0x0,"%16422%\%FX%\"

HKLM,"SOFTWARE\%FX%","Version",0x0,"2.3.2008.2923"

HKLM,"SOFTWARE\%FX%","IsForAllUser",0x0,"1"

[Desketop.AddShortcut]

Name ="Foxit Reader",8,25

CmdLine =16422,%FX%,%SH%

WorkingDir=-1

[Foxit.AddShortcut]

Name ="Foxit Reader"

CmdLine =16422,%FX%,%SH%

SubDir =%FX%

WorkingDir=-1

[uninstall.AddShortcut]

Name =Uninstall

CmdLine =16422,%FX%,Uninstall.exe

SubDir =%FX%

WorkingDir=-1

[strings]

FX="Foxit Software\Foxit Reader"

SH="Foxit Reader.exe"

Link to comment
Share on other sites

Dude nice thinking :D

BTW I was going to do it but it was using a totally difrent way of adding shortcuts, I was just about to post it

thx i remembered the dos and that ~1 thing for tall folders and files

so i did the same and entered the dos and tried it and it worked

you should still post this new way i need to try it.

it might be better

and thx

Edited by Dark_Knight
Link to comment
Share on other sites

  • 2 months later...
  • 2 weeks later...

Hi Ricks !

I'd like to create the shortcut below to uninstall my app (KO Approach). Does it work ?

[uninstall.Startcut]

Name =Uninstall KO Approach,0x00000008,23

CmdLine ="rundll32.exe advpack.dll,LaunchINFSection %17%\Approach.inf,Uninstall.KOA <-- THIS COMMAND

SubDir =KO Approach

WorkingDir=16422,KO Approach

IconPath =11,,shell32.dll

IconIndex =110

Thanks.

Link to comment
Share on other sites

[Uninstall.Startcut]
Name =Uninstall KO Approach,0x00000008,23
CmdLine ="rundll32.exe advpack.dll,LaunchINFSection Approach.inf,Uninstall.KOA"
SubDir =KO Approach
IconPath =11,,shell32.dll
IconIndex =110

This should work fine for you like that.

[EDIT]

@ Kels

Failed. But lines below work fine :D :

[Uninstall.Startcut]
Name =Uninstall %KOSOFT%,0x00000008,23
CmdLine =11,,rundll32.exe,"advpack.dll,LaunchINFSection Approach.inf,Uninstall.KOA"
WorkingDir =11,,
SubDir =%KOSOFT%
IconPath =11,,shell32.dll
IconIndex =110

Tried & found work fine too

CmdLine =11,,rundll32.exe,"advpack.dll LaunchINFSection Approach.inf,Uninstall.KOA"

CmdLine =11,,rundll32.exe,advpack.dll "LaunchINFSection Approach.inf,Uninstall.KOA"

Thanx again for help.

Edited by Ken@fri
Link to comment
Share on other sites

  • 11 months later...

Hi everyone, I signed up to discuss an adventure I'm having with removing shortcuts created with ProfileItems.

First of all, ricktendo64 - thank you for sharing the info, it has been very useful.

Your example of deleting a shortcut is given here:

ProfileItems = MU.DelShortcut

[MU.DelShortcut]
Name=Windows Update,0x0000000A,22

Microsoft, on the other hand, advocates a different method. They say the flag to be used is 0x00000002 (FLG_PROFITEM_DELETE)

The problem is that I've tried them both, both work on XP, but none works on Vista or Seven.

Here is the relevant part of the INF that I expect to do the job:


[CreateStartMenuFolderEx]
Name = %AppLink%
SubDir = %App_StartMenuFolder%
CmdLine = -1, %App_ProgramFolder%, File.exe ;-1 means Absolute path
WorkingDir = -1, %App_ProgramFolder%

[DelStartMenuFolderEx]
Name = %AppLink%,0x00000002

I suspect it may have something to do with how I call the shortcut removal section. I do it this way:


[DefaultUninstall]
ProfileItems=DelStartMenuFolderEx

At this point I have several questions:

  1. How did you discover the 0x0000000A flag?
  2. What do you think goes wrong during the attempt to remove the shortcut?
  3. Am I invoking the ProfileItems delete procedure correctly?
  4. The Name keyword takes 2 arguments, while you give it a third one - "22", what is it?

I hope some light can be shed on this problem.

Link to comment
Share on other sites

well try

[DelStartMenuFolderEx]
Name = %AppLink%,0x00000002
SubDir = %App_StartMenuFolder%

if i wasn't mistaken

you think about it

i tell you delete a file

?? you need to know it's place

that why you will need the subdir

the other advantage in using the A

is 0x0000000A,22 << that the 22 says the file place

so if i wasn't mistaken you wouldn't need the subdir

test and tell

Link to comment
Share on other sites

0x00000008,22 = %AllUserProfile%\Start Menu

(just switch "8" to "A" and it deletes the shortcut)

Yes you can also try/use either 0x00000002 or 0x00000003 to delete the shortcut.

You have to also take in mind when you run your script...remember this shortcut does not actually get created until syssetup.inf is executed, which happens somewhere around or before t13

Test your shortcut removal code on right now on your actual pc, if it works fine but not during setup then you should look at when you are executing it during the install

@egorz if you know a way to use CMD.EXE or some other tool I could maybe try to launch it with .INF but no, dont know how to do that

Link to comment
Share on other sites

Thank you for the quick feedback. I've tried multiple approaches and the behaviour is the same - the shortcut is not removed.

Specifically, I tried the following:

  • with and without SubDir = %App_StartMenuFolder%
  • with "0x00000002", "0x00000003" and with "0x0000000A,22"

I am surprised that none of them work, because the documentation says they should, and your experience is also suggesting that deleting shortcuts this way must work.

remember this shortcut does not actually get created until syssetup.inf is executed, which happens somewhere around or before t13

I am thinking that in my case the problem is in the fact that the procedure is not invoked at the right time.

I also guessed it could have some thing to do with administrative privileges (or lack of them), but the results are the same even if I use "run as administrator".

What other ideas you think I could test?

Link to comment
Share on other sites

Thank you for the quick feedback. I've tried multiple approaches and the behaviour is the same - the shortcut is not removed.

Specifically, I tried the following:

  • with and without SubDir = %App_StartMenuFolder%
  • with "0x00000002", "0x00000003" and with "0x0000000A,22"

I am surprised that none of them work, because the documentation says they should, and your experience is also suggesting that deleting shortcuts this way must work.

I am thinking that in my case the problem is in the fact that the procedure is not invoked at the right time.

I also guessed it could have some thing to do with administrative privileges (or lack of them), but the results are the same even if I use "run as administrator".

What other ideas you think I could test?

try to change the 22

it's the file path

if %App_StartMenuFolder% mean

0x00000008,2 = %UserProfile%\Start Menu\Programs

then the command should be

0x0000000A,2

to delete

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...