Jump to content
ricktendo

[Tutorial] Exotic INF ProfileItems/Shortcuts

Recommended Posts

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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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

I face the same situation as you. keycodes.exe is not much use when using combined keystroke. I relied on "200 = Ctrl + and 400 = Alt +" reference only.

Found a more reliable alternative solution. Query the shortcut's properties using Shortcut v1.11 (console tool, shortcut.exe)

It returns a dec value. Then use windows calculator to convert dec to hex

For Ctrl + Alt +A, dec value return is 1601 which then converted to 641 in hex. tada :)

@echo off
Shortcut /F:"%ALLUSERSPROFILE%\Start Menu\Programs\Accessories\System Tools\Disk Defragmenter.lnk" /A:Q
pause

Share this post


Link to post
Share on other sites

@Geej

The Shortcut tool you found seems to be a wonderful way to confirm the keycode! ie when you have created the link along with the desired Hotkey, then the Shortcut Tool can then be used to verify what the keycode is that equates to that Hotkey. I guess we just have to rely on remembering the "200 = Ctrl + and 400 = Alt +" trick for the actual creating of the Hotkey keycode in the first place. Thank you for pursuing this so diligently.

Cheer and Regards

Share this post


Link to post
Share on other sites
Guest

I need corrected of this command to use in inf file,i want unload with this command

or something like this,before delete file in uninstall section

CMD /Q /S CD /D %16422%\Utility\T-Clock2010\Win32\clock.exe /exit

Share this post


Link to post
Share on other sites

You could use UnregisterDLLs to call it or RunPreSetupCommands, either way this is how that would go (might only work with advpack.dll,LaunchINFSection)

[UnregDLLsection]
16422,Utility\T-Clock2010\Win32,clock.exe,,,"/exit"
; Or
[RunPreSetupSection]
"""%16422%\Utility\T-Clock2010\Win32\clock.exe"" /exit"

Share this post


Link to post
Share on other sites
Guest

You could use UnregisterDLLs to call it or RunPreSetupCommands, either way this is how that would go (might only work with advpack.dll,LaunchINFSection)

[UnregDLLsection]
16422,Utility\T-Clock2010\Win32,clock.exe,,,"/exit"
; Or
[RunPreSetupSection]
"""%16422%\Utility\T-Clock2010\Win32\clock.exe"" /exit"

Hi

i used below command to delete folders in uninstal section but in uninstalling show cmd window

how can hide this window?

RunPostSetupCommands = dirappdel

[dirappdel]

CMD /Q /C DEL /f /s /q """%16410%\SumatraPDF"""

CMD /Q /C RMDIR /s /q """%16410%\SumatraPDF"""

Share this post


Link to post
Share on other sites

What are you using to call it?

If you are using RunPre/PostSetupCommands add a :1 to the end of the name of the section you want to hide (dont add it to the actual section just the [uninstall] one, same as you do for tskill/taskkill)

RunPreSetupCommands=Close.Sidebar:1

[Close.Sidebar]
TSKILL sidebar

But I would better recommend this for deleting folders

[Del.Gadgets.Settings]
RUNDLL32 advpack.dll,DelNodeRunDLL32 %16422%\%GADS%,8
RUNDLL32 advpack.dll,DelNodeRunDLL32 %16422%\%SHGADS%,8
RUNDLL32 advpack.dll,DelNodeRunDLL32 %16422%\%VISXORG%,1
RUNDLL32 advpack.dll,DelNodeRunDLL32 %16412%\%WINSIDE%,8
RUNDLL32 advpack.dll,DelNodeRunDLL32 %16412%\%WINLIVE%,8

These are the numbers you can use

Delete Folder
1 // delete the directory only if it's empty
2 // don't delete any sub-dirs; delete only the files
4 // don't delete the dir itself
8 // delete UNC [network] paths

Share this post


Link to post
Share on other sites
Guest

your tips very good now it hide cmd window

i using it to sure it actually delete folder and file,sometimes it dont delete with DelDirs

even if i define folder.

but also even when use TSKILL to kill exe process if on the same directory one txt file opened

directory dont deleted.how can delete this folder?

it can be do like below,add it uninstall section so on the next log off directory deleted,but i want delete

it without log off

AddReg = Sum000.addreg

[sum000.addreg]

HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\softs","Delete3",0,"cmd /c RD /S /Q ""%userprofile%\Application Data\SumatraPDF"""

Edited by mona

Share this post


Link to post
Share on other sites
Guest

i know this with your tips but not possible do delete without RunOnceEx?

actually i use this for folder have dll shell extensions for delete folder on the next logoff

Edited by mona

Share this post


Link to post
Share on other sites
Guest

Now all we need to know is how to set Run: Normal Window/Minimized/Maximized and well have EVERYTHING!!! covered

hi rick

check below link

this for URL File Format to set window state,but seems dont work in inf file,or maybe somthing like this


Show Command =7
(Nothing) Normal
7 Minimized
3 Maximized

http://www.cyanwerks.com/file-format-url.html

Share this post


Link to post
Share on other sites

Nice find and you are right it does not work, it only works with inside .url files wich are nothing really but .ini files with a .url extension (I use updateinis to create my bitlocker2go url, it does appear to work this way)

[defaultinstall]
UpdateInis=BitLocker2Go.ReadMe.AddUrl

[BitLocker2Go.ReadMe.AddUrl]
%01%\readme.url,InternetShortcut,,URL=http://go.microsoft.com/fwlink/?LinkId=129765
%01%\readme.url,InternetShortcut,,ShowCommand=7

Share this post


Link to post
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...