Hi,
In one of the posting and downloading the source, and readingit, I found that it has most of its procedures declared with TV_FOLDERS at the end of the procedure declaration, e.g. in this manner:
ShowFolders PROC USES EBX EDI ESI,__lpTvFolders:Ptr TV_FOLDERS
I believe USES implied registers used by the procedure and declaration of lpTvFolders as a pointer. What does TV_FOLDERS do? I have not come across such advance programming and tend to use just simple declaration. Questions:
1. When/why do you use "USES" and advantage of using this?
2. Does TV_FOLDERS make this procedure ("ShowFolders") a type?
Appreciate some "teaching". Thanks...newAsm
Just guessing, but it looks like a boolean operator. I would appreciate you posting the procedure so I can see how it is used in context. It would eliminate a lot of guesswork. If it is a log procedure, please attach it.
The uses statement is a very useful thing for protecting registers used in a procedure. Some are not a problem, others should be preserved. The uses statement eliminates the need for push-pops.
Paul
Quote from: newAsm on June 03, 2008, 01:16:07 PM
1. When/why do you use "USES" and advantage of using this?
2. Does TV_FOLDERS make this procedure ("ShowFolders") a type?
aSample struct
first_info DD ?
second_info DD ?
aSample ENDS
paSample typedef ptr aSample
MyFunction PROTO :paSample
MyFunction proc uses ebx ecx pointer_on_struct_aSample:paSample
; ...
mov ebx, NULL; ....
inc ecx
;...
Ret
MyFunction ENDP
hi,
i use "uses" whenever I'm tired to push and pop the register used in my function. (means each times for me)
and i use each time i may do it pxxx typedef ptr xxx
i order to have a clear interpretation of my structure in a debugger.
regards
I am"The Author" of this code. Here are some explanaitions :
USES pushes registers onto the stack generally for preserving EBX EDI and ESI.
,__lpTvFolders:Ptr TV_FOLDERS
means that the "__lpTvFolders" is a pointer to a structure type TV_FOLDERS.
I could use a typedef but sometime I found problems, now I prefer to use the "Ptr" operator.
For parameters, the names are preseeding by two underscores.
Locals variables have one underscore and globals variables have no underscore.
This code is the same as the followiing C code :
void ShowFolders(LPTV_FOLDERS __lpTvFolders)
The function adds an item into a treeview and needs a structure identifying the child to add.
Bye
I found the source code and join it. It is extracted from my image viewer named I-View.
[attachment deleted by admin]
Grincheux,
I have been gone a long time and I completely forgot about I-View. I do remember that it was very useful to me. Do you still have a link to a download somewhere.
Thank you very much, in advance,
Paul
Here is a quick example that shows what USES does, with the source code for each procedure followed by a disassembly of the generated code:
test1 proc arg:DWORD
mov eax, arg
ret
test1 endp
00401000 55 push ebp
00401001 8BEC mov ebp,esp
00401003 8B4508 mov eax,[ebp+8]
00401006 C9 leave
00401007 C20400 ret 4
test2 proc uses ebx edi esi arg:DWORD
mov eax, arg
ret
test2 endp
0040100A 55 push ebp
0040100B 8BEC mov ebp,esp
0040100D 53 push ebx
0040100E 57 push edi
0040100F 56 push esi
00401010 8B4508 mov eax,[ebp+8]
00401013 5E pop esi
00401014 5F pop edi
00401015 5B pop ebx
00401016 C9 leave
00401017 C20400 ret 4
I-View can be downloaded (sources only) at : http://www.idcat39.com/download/Src/IVSrc.exe
You will need to download the GFL SDK available at http://pagesperso-orange.fr/pierre.g/xnview/endownloadgfl.html
I am very pleased that some one use it !
I have made a post coming from the next I-View version about resizing images like Photoshop, give me your advice.
Thanks
Thanks everyone for your feedback,
I remembered I downloaded the file from a posting made by Grincheux. I am trying to learn how to do networking using the file manager because I am thinking of doing a Linux version of rsync. I am looking through the sources and trying to make tail of how you (advance programmers do it). Thanks for some of the comment.
Just for the sake of the TV_FOLDERS, does this mean that the procedure is pointing to a routine/structure etc. I have yet seen the whole source so I am trying to make tail of it.
Thanks everyone for your feedback. I wrote something -password waller manaer and if interested I will sent the source. Ready for alpha release. Thanks everyone...newAsm
[attachment deleted by admin]
Hi Grincheux,
Thanks for the explanation as I was trying through the Masm32 help etc and assembler doc, -too much to read. The explanation saves me a lot of time. Same to the rest. Much appreciated.
Pls comment about the application if useful. I have too many passwords that I needed to categorize them. I am considering adding simple XOR encryption. Anyone knows of any encryption example in ASSEMBLY,with simple explanation.
Thanks again...newAsm
I would certainly be interested in looking at your Password Manager. I am always looking for examples that can be added to GeneSys and credits are ALWAYS given.
Some time ago, I posted my Encrypt program, it uses xor encryption along with pattern overlay encryption and a combination of the two. Though these are simplistic methods, they are very hard to decode because the methods change on the fly. There WERE scoffers, but no one here EVER broke my encryption. Technically, it could be classified as a 2048 Bit Key File Encryptor with a twist.
The sources are freely available. The original code was obfuscated but I removed it. I can help you make it suit your needs.
Paul
[attachment deleted by admin]
Hi everyone,
The previous application path was fixed to my system. Pls change to this one as it uses GetCurrentDirectory to determine its directory.
Regards..newAsm
[attachment deleted by admin]