News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Shell32 ordinals 660 and 71

Started by Jimg, July 28, 2005, 06:07:18 PM

Previous topic - Next topic

Jimg

What is the meaning of the value that needs to be pushed when calling ordinal 660 of shell32.dll?  (Which is initialize system image list.)  I have some sample code that pushes a one before the call, I would just like to know what it means.

Also, is this function really necessary if I want to call ordinal 71, get the system image lists?  It seems to work without the 660 on XP SP2, perhaps this is only needed on older versions of NT?

And also, is there some cleaner way to accomplish this rather than using shell32 ordinals?  Alternately, Is there an include file somewhere with all the requirements of using these undocumented shell32 calls?

PBrennick

Jimq,
I do not use ordinals, I think it is a Goasm feature?  Anyway, as a result I have no idea what a system image list is so how can I help?  Can you give more information or maybe a sample of the output?

Paul
The GeneSys Project is available from:
The Repository or My crappy website

Jimg

Ok, thanks Paul, I thought this was common stuff and only I didn't know the answers :P

The long story:

I'm writing a program that helps the user position desktop icons, and saves their positions so that if something screws them up, they can restore the settings from a file.  Actually, this was the first assembly language program for windows that I tried to write.  I did it with a listbox because listviews were just too confusing at the time. Like all my programs, I never got around to finishing it, just made it functional for my purposes.  Now I am in the process of converting the listbox to a listview.  With a listview, I can display the icon associated with each decktop item.  To get the icons, I need to get the system image list that is applied to the desktop items.  Windows 95/98 is no problem, but NT is kind of messy in this area.  The following code snippets get the information into my listview-

Note***  Much of this is modified Donkey code (Thanks Edgar!)---  any error are my fault, not Donkey's---

The Setup:

.data?
    OSinfo OSVERSIONINFO <>
hShell32 dd ?
hSysImlSmall dd ?
hSysImlLarge dd ?
.code
    invoke GetModuleHandle,soff("Shell32.DLL") ; for image stuff
    mov hShell32,eax
    mov OSinfo.dwOSVersionInfoSize,sizeof OSinfo
    inv GetVersionEx,addr OSinfo ; test for NT vs. 95/98
    .if OSinfo.dwPlatformId >= 2
        mov NT,1    ; it's NT
invoke GetProcAddress,hShell32,660 ; initialize system image list
.if eax!=0
    push dword ptr 1
call eax
.endif
    .endif

invoke GetProcAddress,hShell32,71 ; get the image lists

.if eax==0
mov eax, soff("Unable to get ImageLists")
    jmp ErrorExit
.endif
push offset hSysImlSmall
push offset hSysImlLarge
call eax

    GetMyHandle lv,hLv ; get the handle to our listview
invoke SendMessage,hLv,LVM_SETIMAGELIST,LVSIL_SMALL,hSysImlSmall
invoke SendMessage,hLv,LVM_SETIMAGELIST,LVSIL_NORMAL,hSysImlLarge



Now we can set the listview mask to allow an icon-

   mov lvi.imask, LVIF_TEXT + LVIF_PARAM + LVIF_IMAGE ; set up to save data in listview

And we can use
       inv SHGetFileInfo,addr IDL,0,addr sfi,SIZEOF SHFILEINFO,SHGFI_SYSICONINDEX+SHGFI_TYPENAME+SHGFI_PIDL+SHGFI_ICON
   mov edx,sfi.iIcon

to get the icons index.  Then we do

   mov lvi.iImage,edx
   inv SendMessage, hLv, LVM_INSERTITEM, 0, addr lvi

and the icon shows up in the listview.

My questions is, what is the 660 function in shell32.dll and how do I know to push a one before calling it.  I really hate to use code without understanding it.  Is there a better way to get to these shell32 functions?








comrade

can u show us that code u found that calls 660?

Vortex

Quote from: PBrennick on July 28, 2005, 09:44:08 PM
Jimq,
I do not use ordinals, I think it is a Goasm feature?

Hi Paul,

Yes, GoAsm has the capacity to call functions with ordinal numbers.

Infro_X


LOCAL pSHFILEINFO:SHFILEINFO

;if you want small icons, then use SHGFI_SMALLICON flag as well.

invoke SHGetFileInfo,"C:\any.txt",FILE_ATTRIBUTE_NORMAL,addr pSHFILEINFO,sizeof SHFILEINFO,SHGFI_USEFILEATTRIBUTES Or SHGFI_SYSICONINDEX
push eax

;if you want small icons, then use SHGFI_SMALLICON flag as well.

invoke SHGetFileInfo, "C:\any.txt", FILE_ATTRIBUTE_NORMAL,addr pSHFILEINFO,sizeof SHFILEINFO, SHGFI_SYSICONINDEX

push [pSHFILEINFO.Icon]
pop [listIndex]
pop [SystemImageListHandle]


Check the following site if I made any errors in translation.
http://www.vbaccelerator.com/home/VB/Code/Controls/ImageList/System_Image_List/article.asp

PBrennick

Jimq,
SHChangeNotify, Default List View Message Processing, ImageList_Add and DeleteObject are just a few of the topics I found that may have revelance to maintaining image lists.  Default List View Message Processing is particularly good.

Erol (Vortex),
Thanks, I thought I had that correct but was unsure.  I am just starting to explore GOASM and thought I recalled Donkey talking about ordinals at some point in the past.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

Jimg

Thank you all for your replies.

Comrade-   Here's the link to Donkey's site for this file - http://donkey.visualassembler.com/files/LVDesktop9xNT.zip

Infro_X -   If I understood the information in this link http://www.catch22.net/tuts/sysimg.asp, The SHGFI_SYSICONINDEX only get the index for one particular icon and not the whole system image list.  At the microsoft site they say the return for the remaining items in the list are undefined and cannot be relied upon.  I suppose I could call this for each individual and save both the pointers to the list and the index but I haven't tried this, and it seems rather more complicated then just getting the real pointer to the system list.

Paul-  I guess I am under the mistaken impression that this was something other people do that I had just not learned yet.  I expected that these shell32 functions would be useful enough that there would be an include file or something to make them more accessible.

PBrennick

Jimq,
I am a vacuum for knowledge, always have been.  As a consequence of this, I would be very interested to see if you are able to solve this problem.  Also, if you develop an include file, which I hope you do, be sure to send it to Hutch.  Finally, we are all here to help so if you continually post code along with your progress we can always help you.

Paul
The GeneSys Project is available from:
The Repository or My crappy website