Sign in to follow this  
Followers 0
jennico

how to find out the highest icon number in a recource

14 posts in this topic

#1 ·  Posted (edited)

when i search icons, let's say in shell32.dll the autoit way (negative and positive ordinals), how can i retrieve where to stop the search (what is the highest iconnumber ? despite of all gaps i want to keep on searching to the really last one.

i searched the forum examples, but no script seems to find the really last one.

anyone knows ?

thx j.

Edited by jennico

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

from here:

using System.Runtime.InteropServices;

Get Icon Count From ExtractIconEx WinAPI

This code snippet demonstrates how to get the total number of Icons in a DLL file.

public extern static int ExtractIconEx(string libName, int iconIndex, IntPtr[] largeIcon, IntPtr[] smallIcon, int nIcons);

int icons = ExtractIconEx("shell32.dll", 0, null, null, 0);

MessageBox.Show(icons.ToString());

now translate it... Edited by jennico

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Share this post


Link to post
Share on other sites

from here:

now translate it...

Would you like to super size that order?

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

....

#Include <WinAPI.au3>
MsgBox(0,"",_WinAPI_ExtractIconEx("shell32.dll",-1,0,0,0))

.....

just loudly thinking, the order was for myself.

keep calm, smoke_n ....

Edited by jennico

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Not that hard.

$file = @SystemDir & "\shell32.dll"
$ret = DllCall ("shell32.dll", "int", "ExtractIconEx", "str", $file, "int", -1, "hwnd", "", "hwnd", "", "uint", "")
MsgBox (0, "", $ret[0])

Cheers,

Brett

EDIT: I see it is in WinAPI.au3.... :)

Edited by BrettF

Share this post


Link to post
Share on other sites

one question is left: i hope this equals the number autoit gets out of the dll by pulling pos and neg ordinals. i will have to count them, no ?

j.


Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

one question is left: i hope this equals the number autoit gets out of the dll by pulling pos and neg ordinals. i will have to count them, no ?

j.

i am afraid, no !!!

as i suspected, the number is different

e.g. for "zipfldr.dll", ExtractIconEx says 7 icons, but i can extract at least 25:

ordinal 0

ordinal -1

ordinal -2

ordinal -3

ordinal -4

ordinal -5

ordinal -6

ordinal -7

ordinal 101

ordinal 123

ordinal 170

ordinal 10202

ordinal 10203

ordinal 32513

ordinal 32515

ordinal 65637

ordinal 65659

ordinal 65706

ordinal 75738

ordinal 75739

ordinal 98049

ordinal 98051

ordinal 131173

ordinal 131175

ordinal 131242

... (seems endless)

what now ? that's too bad

maybe the number excludes repetitions ?

Edited by jennico

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

i found another example:

the file "shdocvw.dll" : ExtractIconEx says it contain 35 icons. but in reality there are only 23 different icons.

$file = @SystemDir & "\shdocvw.dll"
$ret = DllCall ("shell32.dll", "int", "ExtractIconEx", "str", $file, "int", -1, "hwnd", "", "hwnd", "", "uint", "")
MsgBox (0, "", $ret[0])

that's what i suspected: this is not a good way to get the icon count. but is there another one ?

any idea ?

j.

Edited by jennico

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

There are 34 icons plus 1 empty icon in this file, but some icons are included multiple times in there.

//Edit: Strange. if you use The ordinal icon value, the first icon is shown mutliple times. If you open the file with reshacker, there are many empty icon groups, not multiple entries for the first icon.

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

Missing icons are manually deleted from RT_GROUP_ICON resources. What's left is only the mention of them.

Great findings!

I will update my reshacker wannabe (viewer currently) to meet this.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

that's not all.

ExtractIconEx is supposed to return the icon count without duplicates (there are many many more if you count duplicates.

"shdocvw.dll" is said to have 35 icons. there are only 23:

"NAME", not ordinal number

0

1 does not exist (it is not empty !)

2

3

4 does not exist (it is not empty !)

5

6-9 do not exist (not empty !)

10

11

12

13

14-15 do not exist (not empty !)

16

17 does not exist (it is not empty !)

18

19

20

21

22

23

24

25

26

27

28 => is identical to 10 !

29

30

31

32-34 are empty !

so, missing RT_GROUP_ICON groups is not the reason.

"shdocvw.dll" is not an exception. mmsys.cpl and netshell.dll, shell32.dll, newdev.dll..., they all have "false" entries.

i am just trying to get an understanding of resources, but it seems complicated.

j.

Edited by jennico

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Share this post


Link to post
Share on other sites

i will have to test if ExtractIconEx at least returns the max limit for searching (you can sort the empty/missing out with PixelChecksum (i do not see a better method)), but i fear there could be more icons beyond this limit.

j.


Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Share this post


Link to post
Share on other sites

that's not all.

ExtractIconEx is supposed to return the icon count without duplicates (there are many many more if you count duplicates.

"shdocvw.dll" is said to have 35 icons. there are only 23:

"NAME", not ordinal number

0

1 does not exist (it is not empty !)

2

3

4 does not exist (it is not empty !)

5

6-9 do not exist (not empty !)

10

11

12

13

14-15 do not exist (not empty !)

16

17 does not exist (it is not empty !)

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32-34 are empty !

so, missing RT_GROUP_ICON groups is not the reason.

"shdocvw.dll" is not an exception. mmsys.cpl and netshell.dll, shell32.dll, newdev.dll..., they all have "false" entries.

i am just trying to get an understanding of resources, but it seems complicated.

j.

They are not missing, they are missing!

Entry is there but points to nothing. RT_GROUP_ICON does not contain actuall icon data (that is stored in RT_ICON to which RT_GROUP_ICON points).

Authors (modifiers) of that dlls decided to preserve that RT_GROUP_ICON entries probably not to lose the count when using ordinals to extract icons for backward compatibility. And apparently in that cases, first icon (0) will be extracted instead of that one (that does not exists any more).


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

hmm..hmm.. i will have to go deeper into this forest.

j.


Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0