News:

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

Searching file on HardDrive

Started by Farabi, November 07, 2010, 09:41:56 AM

Previous topic - Next topic

clive

Quote from: donkey
Not sure why you are worried about MAX_PATH, there is never a need to push a file name onto the stack or anything that large.

Indeed, I've done it before in a single buffer, and just pass down the pointer to the leaf within the path (ie the end). The path gets built and torn back down as the recursion descends, and comes back. No need to copy or stack the path, or compute the string length.
It could be a random act of randomness. Those happen a lot as well.

ToutEnMasm

Quote
Not sure why you are worried about MAX_PATH, there is never a need to push a file name onto the stack or anything that large.
there is further soluces to pass arguments to FindFirstFile ,adress ,value ..
adress is my prefered but passed them by values is not wrong
So This give a unit more speaking about the problem,that all.

theunknownguy

Quote from: ToutEnMasm on November 08, 2010, 02:31:35 PM
To fix idea:
a windows prog,compiled wit ml 10 begin with a 3000h size of stack = 49 * MAX_PATH
You can verify this with the attached file


Looks like brainless method... (No offence) Dont really expect somebody doing a recursion by copying the new string file into a different stack pointer?...

Good method is using stack but later adjusting the pointer to the begin of the older string on the next recursion procedure. In that way dont need to worry about nothing.

ToutEnMasm


The recurse procedure can be use for further things,it's for that i have speak about the stack.

Here is a sample of mine who use a very few memory stack and can be insert easily in another prog who have perhaps big need in stack.

theunknownguy

Quote from: ToutEnMasm on November 08, 2010, 08:52:04 PM

The recurse procedure can be use for further things,it's for that i have speak about the stack.

Here is a sample of mine who use a very few memory stack and can be insert easily in another prog who have perhaps big need in stack.

I never found myself on the situation of using stack for even more than 32 bytes (8 arguments of DWORD size). I think its a universal programming method to avoid using stack for larger memory operations, for that you can use the heap or allocate virtual memory, while saving the pointers on the stack and retrieve them (mostly of what is intended for).

Still you can change SizeOfStackCommit under the PE format and use stack for odd ideas...

Cant find a recursive example when you need to use stack for such large operations, only in the very strange case you wanted to save each file name path without override the last pointer of the buffer holder and push on the recursive proc the older string path that would give you:

1000h (SizeOfStackCommit) / 4 = 400h size for saving pointers. Though that idea is crazy, you can do everything about recursive by override the old pointer. (and never worry about stack (in size matter) )

PS: I think the word "recursive" gives the whole description. Something recursive NEEDS to have the same a recursive algorithm inside if not, its not recursive...