flat assembler
Message board for the users of flat assembler.
Index
> Windows > FASM array overwriting itself |
Author |
|
revolution 09 Apr 2014, 23:40
Unconstrained file lengths are probably overwriting your name buffers into the next string.
Ideally you would have a separate memory allocation for each filename based upon the filename's length. Basically, you can't just assume all filenames are less than X characters long. In Windows, UNC paths can be as much as 32768 characters. And in UNICODE mode each character is 2 bytes, giving 65536 bytes per filename. Also, limiting your selection to four files in the source is probably going to hurt you at some point in the future. Instead consider allocating the string pointer buffer dynamically based upon the actual number of files in the list. |
|||
09 Apr 2014, 23:40 |
|
AsmGuru62 10 Apr 2014, 00:22
Also, no need to move the strings into array at run-time.
You can do it like that: Code: array dd str0,str1,str2,str3 However, you do need a dynamic memory allocation here to provide a list of strings, where the count of strings is not known beforehand. |
|||
10 Apr 2014, 00:22 |
|
patchariadog 10 Apr 2014, 01:01
I am sorry but I am kind of new at assembly, so how do I fix the Unconstrained file lengths. I will fix the 4 files because it is for a file shredding program so yeah their will be a lot more then 4, but how do I get them not to overwrite themselves?
thanks |
|||
10 Apr 2014, 01:01 |
|
revolution 10 Apr 2014, 01:18
patchariadog wrote: ... how do I fix the Unconstrained file lengths ... |
|||
10 Apr 2014, 01:18 |
|
patchariadog 10 Apr 2014, 01:23
okay I get it now. thank you revolution and AsmGuru62 for your help.
|
|||
10 Apr 2014, 01:23 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.