Hi everybody,
I want to get the ICON shown in the Explorer for the files.
I tried with this code:
lea rdi,[rsi].PROCESSENTRY32.szExeFile ;; rsi is a pointer to PROCESSENTRY32 struct
invoke SHGetFileInfo,rdi,NULL,addr sh,sizeof SHFILEINFO,SHGFI_SYSICONINDEX or SHGFI_SMALLICON
@IF <<cmp rax,0>>,EQUAL?
invoke MessageBox,NULL,NULL,NULL,MB_OK
@ENDIF
sh is a variable SHFILEINFO type
The SHFILEINFO struct that I have is the follows:
SHFILEINFOA STRUCT
hIcon QWORD ?
iIcon DWORD ?
dwAttributes DWORD ?
szDisplayName BYTE MAX_PATH DUP(?)
szTypeName BYTE 80 dup(?)
SHFILEINFOA ENDS
The API SHGetFileInfo allways returns NULL I don't know what is wrong in my code. Maybe the structure is not right?
GUAN
Hello,
seems that the structure has a bad size,and the function use it.
Bad size ? return zero
the best source for header files is here
http://www.masm32.com/board/index.php?topic=8542.msg62123#msg62123
Quote
SHFILEINFOA STRUCT
hIcon DWORD ? ; out: icon
iIcon DWORD ? ; out: icon index
dwAttributes DWORD ? ; out: SFGAO_ flags
szDisplayName BYTE MAX_PATH dup (?) ; out: display name (or path)
szTypeName BYTE 80 dup (?) ; out: type name
SHFILEINFOA ENDS
Quote
typedef struct _SHFILEINFOA
{
HICON hIcon; // out: icon
int iIcon; // out: icon index
DWORD dwAttributes; // out: SFGAO_ flags
CHAR szDisplayName[MAX_PATH]; // out: display name (or path)
CHAR szTypeName[80]; // out: type name
} SHFILEINFOA;
Hi,
>Bad size ? return zero
Yes I know that, but the problem is that I'm working on 64 bits platform.
The translations in masm of some varaibles like HANDLE, HICON, ... are in QWORD, so the Structure
SHFILEINFOA STRUCT
hIcon DWORD ? ; out: icon
iIcon DWORD ? ; out: icon index
dwAttributes DWORD ? ; out: SFGAO_ flags
szDisplayName BYTE MAX_PATH dup (?) ; out: display name (or path)
szTypeName BYTE 80 dup (?) ; out: type name
SHFILEINFOA ENDS
It 's incorrect in my case, this is the structe for 32 bits
Do you have the right structure for 64 bits?
GUAN
The sdk has two set of library 32 and x64 but not two set of headers.
There is a difference on a few variables with W64 and WIN64 but that all.
Be sure to use the good library.