Jump to content

[Tutorial] Exotic INF ProfileItems/Shortcuts


ricktendo

Recommended Posts

Here is the body of the INF file, I included the section with the strings, so you can see where everything is taken from.


[Version]
Signature = $Windows NT$

[DefaultInstall]
;UpdateInis=CreateStartMenuFolder
AddReg = RegAddUninst
ProfileItems = AddTest, AddTestEx

[DefaultUnInstall]
ProfileItems=AddTest.DelShortcut

[AddTest.DelShortcut]
Name =ACME distorterA,0x0000000A, 2
;Also tried with Name =%Soft_Name%,0x0000000A, 2
;SubDir =Sub Directory


[RegAddUninst]
HKLM,%SMWCV%\Uninstall\%Soft_Name%,DisplayName,,"ACME"
HKLM,%SMWCV%\Uninstall\%Soft_Name%,UninstallString,,"RunDll32 advpack.dll,LaunchINFSection d:\test\installer\installer.inf, DefaultUninstall"


;16422 = program files
[AddTest]
Name = ACME distorterA
SubDir = %Provider%
Infotip = "This is a tooltip weeha!"
CmdLine = -1, %App_ProgramFolder%, Acmedist.exe
WorkingDir = -1, %App_ProgramFolder%



[AddTestEx]
Name = %Soft_Name%
SubDir = %Provider%
Infotip = "This is a tooltip weeha!QQQQQQ"
CmdLine = -1, %App_ProgramFolder%, Acmedist.exe
WorkingDir = -1, %App_ProgramFolder%


[Strings]
SMWCV="Software\Microsoft\Windows\CurrentVersion"
Provider="ACME"
Soft_Name="ACME distorter 5.0"
AppLink="ACME distorter 5.0"
App_Name="ACME distorter 5.0"
App_StartMenuFolder="ACME\Distorter 5.0"
App_ProgramFolder="ACME\Distorter 5.0"
ShortCutFileName="ACME\Distorter 5.0.lnk"
PathAndFileName="ACMEdist.exe"
Arguments= ""

I tried using "0x0000000A,2", as suggested by DaRk MaDnEsS, but the result is the same - the shortcut continues to stay in the Start menu.

Edited by Cum zicea poetul
Link to comment
Share on other sites

Here is the body of the INF file, I included the section with the strings, so you can see where everything is taken from.


[Version]
Signature = $Windows NT$

[DefaultInstall]
;UpdateInis=CreateStartMenuFolder
AddReg = RegAddUninst
ProfileItems = AddTest, AddTestEx

[DefaultUnInstall]
ProfileItems=AddTest.DelShortcut

[AddTest.DelShortcut]
Name =ACME distorterA,0x0000000A, 2
;Also tried with Name =%Soft_Name%,0x0000000A, 2
;SubDir =Sub Directory


[RegAddUninst]
HKLM,%SMWCV%\Uninstall\%Soft_Name%,DisplayName,,"ACME"
HKLM,%SMWCV%\Uninstall\%Soft_Name%,UninstallString,,"RunDll32 advpack.dll,LaunchINFSection d:\test\installer\installer.inf, DefaultUninstall"


;16422 = program files
[AddTest]
Name = ACME distorterA
SubDir = %Provider%
Infotip = "This is a tooltip weeha!"
CmdLine = -1, %App_ProgramFolder%, Acmedist.exe
WorkingDir = -1, %App_ProgramFolder%



[AddTestEx]
Name = %Soft_Name%
SubDir = %Provider%
Infotip = "This is a tooltip weeha!QQQQQQ"
CmdLine = -1, %App_ProgramFolder%, Acmedist.exe
WorkingDir = -1, %App_ProgramFolder%


[Strings]
SMWCV="Software\Microsoft\Windows\CurrentVersion"
Provider="ACME"
Soft_Name="ACME distorter 5.0"
AppLink="ACME distorter 5.0"
App_Name="ACME distorter 5.0"
App_StartMenuFolder="ACME\Distorter 5.0"
App_ProgramFolder="ACME\Distorter 5.0"
ShortCutFileName="ACME\Distorter 5.0.lnk"
PathAndFileName="ACMEdist.exe"
Arguments= ""

I tried using "0x0000000A,2", as suggested by DaRk MaDnEsS, but the result is the same - the shortcut continues to stay in the Start menu.

well what i think it should work

[AddTest.DelShortcut]
Name =%Soft_Name%,0x0000000A, 2
SubDir = %Provider%

and the shortcut should be

[AddTestEx]
Name = %Soft_Name%,0x00000008,2
SubDir = %Provider%
Infotip = "This is a tooltip weeha!QQQQQQ"
CmdLine = -1, %App_ProgramFolder%, Acmedist.exe
WorkingDir = -1, %App_ProgramFolder%

test and tell me

Edit:

i think since it installs to all users

you might need to use 0x0000000A, 23

with the old inf ( i'm not sure tho i just got this in my head)

Edited by DaRk MaDnEsS
Link to comment
Share on other sites

[Adds]
Name=%Soft_Name%,0x00000008,2
SubDir=%Provider%
Infotip="This is a tooltip weeha!QQQQQQ"
CmdLine=-1,%App_ProgramFolder%,Acmedist.exe
WorkingDir=-1,%App_ProgramFolder%

[Deletes]
Name=%Soft_Name%,0x0000000A,2
SubDir=%Provider%

BTW you dont need to use any exotic inf profileitem flags for this shortcut, you can use 0x00000001 then 0x00000002 or 0x00000003 to delete it (OH an it does not install to all users its going into current user)

[Adds]
Name=%Soft_Name%,0x00000001
SubDir=%Provider%
Infotip="This is a tooltip weeha!QQQQQQ"
CmdLine=-1,%App_ProgramFolder%,Acmedist.exe
WorkingDir=-1,%App_ProgramFolder%

[Deletes1]
Name=%Soft_Name%,0x00000002
SubDir=%Provider%

[Deletes2]
Name=%Soft_Name%,0x00000003
SubDir=%Provider%

Link to comment
Share on other sites

How to use the flag "CE_COPYFLG_NO_DATE_DIALOG 0x20000000" which does not copy a file if the target file is newer.

in the copy section

lets say that you are copying DM.exe

DM.exe,,0x20000000

should do the trick

Link to comment
Share on other sites

ok thank you but I FGCBA reports errors by as follows :s

sorry my bad

i miss writien it

DM.exe,,,0x20000000

it should be 3 ,,, not only 2

If FGCBA Reports any error

try to test it and see

Link to comment
Share on other sites

my program .exe is an Installshield installer that creates files in "%ProgramFiles%\InstallShield Installation Information\(8F5A0981-5CDC-41D0-BCA2-AD3B777FC358)\" so I love creating knowledge in INF installer?

you mean you want to make an inf that installs fies to there

or .. ?

cause i don't understand

Link to comment
Share on other sites

yes I want to make a INF that installs the application (.exe) installshield...

you understand French?

otherwise I ask you in French by private message because my English is very bad ..

sorry i have been busy the couple of days

sorry i don't understand French well

but ok can you tell me the name of the application so i can see what is the problem exactly

Link to comment
Share on other sites

  • 7 months later...

Does inf shortcut allows shortcut syntax to launch application in Min,Max,Normal mode?

If can, how to do it?

I too am looking for how but have never found it...I wanted this when I made my Windows Search addon, because the startup shortcut was set to minimized or something

If you find out how please report back

Link to comment
Share on other sites

  • 3 weeks later...

I too am looking for how but have never found it...I wanted this when I made my Windows Search addon, because the startup shortcut was set to minimized or something

If you find out how please report back

I thought about this and think that Profileitems does not have the command to set it.

So I thought using vbscript could do the job and after experimenting with it, it could do it only during T13.

I hereby enclosed an sysoc.inf addon that run vbscript to create shortcut at begining of T13. (It runs silently)

The vbscript creates 2 shortcut in Max mode. 1) Windows Movie Maker and 2) Program Files folder shortcut on desktop

Geej_T13_VBSshortcut_addon.cab

Size: 3.47 Kb (3,554 bytes)

MD5: 04E6C90BCF9C1008969DC0E2AE813F3C

CreateShortcuts.pdf for future reference

CreateShortcuts.zip

Size: 38.93 Kb (39,864 bytes)

MD5: 8C15321A2309F687A5EF9A3D7CFAF645

Below screenshot is a test shown that at T13, actual vbs execution path is root drive. Also not all windows shortcut are ready. Only Windows Movie Maker etc.

IE and WMP are not created by setup at T13. I have disabled the prompt message in the addon.

vbst13.th.png

inf code that self-delete after vbs execution.

[Version]
Signature=$Windows NT$

[DefaultInstall]
RegisterDLLs=Start.Register

[Start.Register]
11,,rundll32.exe,,,"advpack.dll,LaunchINFSection %1%\vbs1test.inf,Install"

[Install]
RunPreSetupCommands=Create.EmptyDirectorys
CopyFiles=vbs1.Copy
AddReg =AddRegSection
RunPostSetupCommands =Del.i386

[Create.EmptyDirectorys]
CMD /Q/C MD """%1%\i386""" & COPY /D/Y """%1%\*.cab""" """%1%\i386"""

[vbs1.Copy]
CreateShortcuts.vbs

[Install.Delvbs]
DelFiles=vbs1.Copy,PNF.copy
Updateinis=Sysoc.Edit
SmartReboot=N ; Suppress reboot prompt at T13
Cleanup=1

[PNF.copy]
vbs1test.PNF,,,1 ; this file can only be deleted after reboot (when setup completes and boots to user desktop)

[Sysoc.Edit]
%17%\sysoc.inf,Components,vbs1test=*

[Del.i386]
RUNDLL32 advpack.dll,DelNodeRunDLL32 %1%\i386,8

[Optional Components]
vbs1test

[vbs1test]
OptionDesc =vbs1test
Tip =%Tip0%
Modes =0,1,2,3
CopyFiles =vbs1.Copy
AddReg =AddRegSection

[SourceDisksNames.x86]
1="Vbs shortcut Files","vbsShcut.cab",,"i386"

[DestinationDirs]
vbs1.Copy=10 ; copy .vbs files to C:\windows
PNF.copy=17

[SourceDisksFiles]
CreateShortcuts.vbs=1

[AddRegSection]
HKLM,"%VBSSC%","300",0x0,"%10%\CreateShortcuts.vbs"
HKLM,"%VBSSC%","301",0x0,"rundll32.exe advpack.dll,LaunchINFSection vbs1test.inf,Install.Delvbs"

[Strings]
Tip0 = "Test vbScript via ROE at T13"
VBSSC="SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\VBSshortcut"

vbs code is a bit long, so won't want to post the code here. See the addon for the actual detail. I hope it will be useful with this method.

Link to comment
Share on other sites

  • 2 months later...

Does inf shortcut allows shortcut syntax to launch application in Min,Max,Normal mode?

If can, how to do it?

Has anyone found a way yet?

Anyways, thank you Geej for the VBScript and if you or anyone is interested I implemented into a batchfile

that will search for your ShortCuts and output it to .vbs using your script as a template.

This should eliminate (atleast for me) the use of alot of .inf and batchfiles.

THX

Link to comment
Share on other sites

  • 9 months later...

In profileitems, there is Hotkey=hotkey-value (ref)

What is the exact syntax to set this value? (say I want it Ctrl+Alt+U)

Where can I download "Windows SDK documentation" as mention in the above ref link?

Anyone here knows?

Link to comment
Share on other sites

In profileitems, there is Hotkey=hotkey-value (ref)

What is the exact syntax to set this value? (say I want it Ctrl+Alt+U)

Where can I download "Windows SDK documentation" as mention in the above ref link?

Anyone here knows?

I think you can get this if you go to the properties of a LNK file and enter the keyboard shortcuts...then using the same values in the INF profileitem

BTW I think the way you have it written (Ctrl+Alt+U) will work give it a try

Link to comment
Share on other sites

I think you can get this if you go to the properties of a LNK file and enter the keyboard shortcuts...then using the same values in the INF profileitem

BTW I think the way you have it written (Ctrl+Alt+U) will work give it a try

Have tried before I ask here. Not working. Actually I asked because I encountered this challenge while making Pretty Run addon, which has "Ctrl + Alt + S" set as hotkey.

Neverthless, I made some progress but still has no total solution to it.

Hotkey syntax is hex-base keyboard code. (which I am unable to find any proper keyboard code thur googling)

Here is a sample inf test if Pretty Run is installed.

[Version]
Signature=$Windows NT$

[DefaultInstall]
ProfileItems=Start.Shortcut1

[Start.Shortcut1]
Name =%ShortcutN1%
SubDir =%ProfileSubdir%
CmdLine =16422,Pretty Run,PrettyRun.exe
WorkingDir=16422,Pretty Run
;HotKey ="Ctrl + Alt + S" ;Desired hotkey
HotKey =0x200 ; Ctrl +
;HotKey =0x14 ; got it as Caplock
;HotKey =0x400 ; Alt +

[Strings]
ShortcutN1=PrettyRun
ProfileSubdir=Pretty Run

As you can see, hotkey is partially set only. Need to know how to do it exactly... If someone can throw some more light here, that will be great.

Edited by Geej
Link to comment
Share on other sites

The problem is the ALT key. CTL + S is an easily defined value. When you add the ALT key it ends up being quite different. It's like trying to find the value sent by CTL + ALT + Del. All references I found described writing a program to send the code. Sorry I couldn't be of much help.

Cheers and Regards

Link to comment
Share on other sites

CREDIT - I referred to the following:

http://www.jimprice.com/jim-asc.shtml

Charts are copied from there.


My ASCII Chart (Hex)

0 1 2 3 4 5 6 7 8 9 A B C D E F
0 NUL SOH STX ETX EOT ENQ ACK BEL BS HT LF VT FF CR SO SI
1 DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US
2 SP ! " # $ % & ' ( ) * + , - . /
3 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
4 @ A B C D E F G H I J K L M N O
5 P Q R S T U V W X Y Z [ \ ] ^ _
6 ` a b c d e f g h i j k l m n o
7 p q r s t u v w x y z { | } ~ DEL

Another version of the table that includes Decimal, Hex, Octal, and HTML values can be found here - http://www.asciitable.com/index/asciifull.gif

From my own experimentations, I've found that CTL effects the key codes in a "linear" manner. From the table above, the codes, in Hex, for A, B, C, D are 0x41, 0x42, 0x43, 0x44. CTL+A, CTL+B, CTL+C, CTL+D yielded 0x01, 0x02, 0x03, 0x04. My simple test program yielded the same results for CTL+a, CTL+b, CTL+c, CTL+d as CTL+A, CTL+B, CTL+C, CTL+D.

A table showing how ALT effects the value transmitted is this one:


IBM PC Keyboard Scan Codes


For many of the special key combinations such as ALT-A, F1, PgUp, and so forth,
the IBM PC uses a special two-character escape sequence. Depending on the programming
language being used and the level at which the keyboard is being accessed, the escape
character is either ESC (27, 0x1B), or NUL (0). Here are some common sequences:

Char. Decimal Pair Hex Pair Char. Decimal Pair Hex Pair
ALT-A (00,30) (0x00,0x1e) ALT-B (00,48) (0x00,0x30)
ALT-C (00,46) (0x00,0x2e) ALT-D (00,32) (0x00,0x20)
ALT-E (00,18) (0x00,0x12) ALT-F (00,33) (0x00,0x21)
ALT-G (00,34) (0x00,0x22) ALT-H (00,35) (0x00,0x23)
ALT-I (00,23) (0x00,0x17) ALT-J (00,36) (0x00,0x24)
ALT-K (00,37) (0x00,0x25) ALT-L (00,38) (0x00,0x26)
ALT-M (00,50) (0x00,0x32) ALT-N (00,49) (0x00,0x31)
ALT-O (00,24) (0x00,0x18) ALT-P (00,25) (0x00,0x19)
ALT-Q (00,16) (0x00,0x10) ALT-R (00,19) (0x00,0x13)
ALT-S (00,31) (0x00,0x1a) ALT-T (00,20) (0x00,0x14)
ALT-U (00,22) (0x00,0x16) ALT-V (00,47) (0x00,0x2f)
ALT-W (00,17) (0x00,0x11) ALT-X (00,45) (0x00,0x2d)
ALT-Y (00,21) (0x00,0x15) ALT-Z (00,44) (0x00,0x2c)
PgUp (00,73) (0x00,0x49) PgDn (00,81) (0x00,0x51)
Home (00,71) (0x00,0x47) End (00,79) (0x00,0x4f)
UpArrw (00,72) (0x00,0x48) DnArrw (00,80) (0x00,0x50)
LftArrw (00,75) (0x00,0x4b) RtArrw (00,77) (0x00,0x4d)
F1 (00,59) (0x00,0x3b) F2 (00,60) (0x00,0x3c)
F3 (00,61) (0x00,0x3d) F4 (00,62) (0x00,0x3e)
F5 (00,63) (0x00,0x3f) F6 (00,64) (0x00,0x40)
F7 (00,65) (0x00,0x41) F8 (00,66) (0x00,0x42)
F9 (00,67) (0x00,0x43) F10 (00,68) (0x00,0x44)
F11 (00,133) (0x00,0x85) F12 (00,134) (0x00,0x86)
ALT-F1 (00,104) (0x00,0x68) ALT-F2 (00,105) (0x00,0x69)
ALT-F3 (00,106) (0x00,0x6a) ALT-F4 (00,107) (0x00,0x6b)
ALT-F5 (00,108) (0x00,0x6c) ALT-F6 (00,109) (0x00,0x6d)
ALT-F7 (00,110) (0x00,0x6e) ALT-F8 (00,111) (0x00,0x6f)
ALT-F9 (00,112) (0x00,0x70) ALT-F10 (00,113) (0x00,0x71)
ALT-F11 (00,139) (0x00,0x8b) ALT-F12 (00,140) (0x00,0x8c)

Hint - If you look at how the keys are laid out on the keyboard, you'll probably see the pattern.

My VERY simple test program could not display these paired codes so I could not verify them, but I have no reason to doubt them. But as a result, I could also not display the paired codes created by CTL+ALT+A, etc. I assume it will also be a paired code, but I have not found a reference to describe what is actually produced. I've found AutoIT scripts that emulate these key presses, but those references also do not describe what the actual key codes are. Sorry I couldn't be of more help.

Cheers and Regards

Link to comment
Share on other sites

Just to share a few things. I got it set sucessfully as

HotKey    =0x653 ;  hex 200 + 400 + 53 

where 200 is Ctrl +

400 is Alt +

53 is S

Thanks to ricktendo64, OnePiece & bphlpt for some thought & info on this.

I google around and found this vb forum post (small software) where you press a key and it returns dec & hex code.

Might be useful somehow without going to MSDN for the keycodes.

http://www.vbforums.com/showthread.php?t=499084

Download 1st post attachment, extract and find in bin folder, keycodes.exe (found it can run standalone)

So while fiddling with combination of hex codes, found Shift + (which might be useful)

has 0x115 or 0x107 (yes both codes set the same hotkey)

Since 200 = Ctrl + and 400 = Alt + , it might means some other values might also be valid for Ctrl + and Alt + respectively.

Just need to know which value. (I was googling when I stumbled 200 & 400 value and I didn't take note of the url. But it was from a vb forum thread where some codes are posted for Ctrl + and shift +. Unfortunately, the thread did not indicate how it derived these values as discussion was something else)

With this info, bphlpt, setting Ctrl + Alt + A hotkey is much easier now.

Just add these hex code: 200 + 400 + 41

You don't have to install Pretty Run to test. I made another simple inf for anyone who wish to test. I use "Disk Defragmenter.lnk" that is found in Accessories\systen Tools on XP so that you can see the effect.

(View the .lnk properties before applying this inf test)

[Version]
Signature=$Windows NT$

[DefaultInstall]
ProfileItems=Start.Shortcut1

[Start.Shortcut1]
Name =%ShortcutN1%,0x8,23
SubDir =%ProfileSubdir%
CmdLine =11,,dfrg.msc
WorkingDir=11
;HotKey ="Ctrl + Alt + A" ;Desired hotkey
HotKey =0x641 ; hex 200 + 400 + 41
; where A=0x41
Infotip =Defragments your volumes so that your computer runs faster and more efficiently.

[Strings]
ShortcutN1=Disk Defragmenter
ProfileSubdir=Accessories\System Tools

Now, just press Ctrl + Alt + A and wait for Disk Defragmenter to launch.

Now we have some real solution to this thing but do not know if it is consistent globally or just limited to English US 101 keyboard . Same thing to consider when running on laptop or non-english keyboard such as Japanese / French etc. What if it is english keyboard but not 101 type? I really don't know.

Perhaps "Windows SDK documentation" might throw the rest of the light over this issue, but then it is yet another mystery to find out. (lol)

Cheers

Link to comment
Share on other sites

Great work Geej! I guess your finding the post telling you that "200 = Ctrl + and 400 = Alt +" was key. I tried verifying the keycodes by using keycodes.exe which you referenced and was unable to do it.

I'm on Win7 x32 using a Logitech keyboard. When running the keycodes.exe, I found that it displays the keycode information of the LAST key-up that occurs. I was unable to get it to display multi-key info, ie if I have CTL+Alt+A pressed, when I release them it only displays the info of whichever of those single keys is the LAST one to lift, even if only by a few microseconds. So keycodes.exe is unable to confirm those values of "200 = Ctrl + and 400 = Alt +". For the keys by themselves, keycodes.exe shows Ctrl=11(Hex) and Alt=12(Hex). So were you able to use keycodes.exe for anything useful for this particular problem, of did you only rely on the "200 = Ctrl + and 400 = Alt +" reference?

Cheers and Regards

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...