flat assembler
Message board for the users of flat assembler.

Index > Windows > SHBrowseForFolder usage

Author
Thread Post new topic Reply to topic
zhak



Joined: 12 Apr 2005
Posts: 501
Location: Belarus
zhak 29 Apr 2005, 22:07
When I define global BROWSEINFO structure everything is ok, but when i try to use a local one:
Code:
proc DlgNewProjectProc, hDlg, uMsg, wParam, lParam
.bi BROWSEINFO
.buf rb 512

    enter
    ...
    


SHBrowseForFolder crushes. Why?
I set all the values for the struct just before the API call:
Code:
    lea ebx, [.bi]
    mov eax, [hDlg]
    mov [ebx+BROWSEINFO.hwndOwner], eax
    mov [ebx+BROWSEINFO.pidlRoot], 0
    lea edi, [.buf]
    mov [ebx+BROWSEINFO.pszDisplayName], edi
    mov [ebx+BROWSEINFO.lpszTitle], 0
    mov [ebx+BROWSEINFO.ulFlags], 0
    mov [ebx+BROWSEINFO.lpfn], 0
    mov [ebx+BROWSEINFO.lParam], 0
    mov [ebx+BROWSEINFO.iImage], 0
    push ebx
    call [SHBrowseForFolder]
    


Another question is how to free an item id list after everything is processed?
Post 29 Apr 2005, 22:07
View user's profile Send private message Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1614
Location: Ukraine
shoorick 30 Apr 2005, 00:38
maybe this will help


Description:
Download
Filename: browseff.zip
Filesize: 3.36 KB
Downloaded: 283 Time(s)


_________________
UNICODE forever!
Post 30 Apr 2005, 00:38
View user's profile Send private message Visit poster's website Reply with quote
coconut



Joined: 02 Apr 2004
Posts: 326
Location: US
coconut 30 Apr 2005, 00:45
preserving registers properly?
Post 30 Apr 2005, 00:45
View user's profile Send private message Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1614
Location: Ukraine
shoorick 30 Apr 2005, 02:36
this even better:
Code:
    invoke CoInitialize,0
    invoke SHBrowseForFolder,ebx
    test eax,eax
    jz @F
    push eax
    invoke SHGetPathFromIDList,eax,edi
    invoke CoTaskMemFree
    invoke SetDlgItemText,[hDlg],E_UPPER,edi
@@:     
    
Post 30 Apr 2005, 02:36
View user's profile Send private message Visit poster's website Reply with quote
zhak



Joined: 12 Apr 2005
Posts: 501
Location: Belarus
zhak 30 Apr 2005, 09:52
Thanks a lot, shoorick
It was crushing because of INT3, but I cannot understand why, because this interrupt was set in the other message handling routine (EN_UPDATE). And SHBrowseForFolder is called from BN_CLICKED section. Hmm... Maybe it is Olly's bug? SoftICE don't recognize this error. I'll test the circumstances better to find out what is wrong...
Post 30 Apr 2005, 09:52
View user's profile Send private message Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1614
Location: Ukraine
shoorick 30 Apr 2005, 12:54
you should use int3 instead of int 3 to debug your code...
i use this simple macro:

Code:
macro deb 
{       push eax 
        invoke IsDebuggerPresent 
        test eax,eax 
        pop eax 
        jz .nodeb 
        int3 
.nodeb: 
} 
    
Post 30 Apr 2005, 12:54
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.