invoke GetPrivateProfileSectionNames,addr returnbuff,addr szbuff,addr aimini
dec szbuff
mov counter,0

invoke MessageBox,0,addr returnbuff,addr szbuff,MB_OK
mov eax,counter ;| move value of MyCounter to EAX
cmp eax,szbuff ;| compare eax(counter) to keysize
jge AllDone ;| jump to alldone if compared values are greater or equal
inc counter ;| increments '1' to the 'counter" buffer
jmp DoLoop ;| jump back up to get next name

trying to make this loop until all the names pop in the message box one by one
its for a program that already uses ini files i know the registry is much better to use :grin:
Posted on 2002-04-21 00:48:14 by illwill

Here is a suggestion, load the complete INI file into memory then use a function in the MASM32 library called "WordCount" to count the number of "[" in the file. As long as no sections are comented out like,


it will be correct and much faster than the method you are testing.

Posted on 2002-04-21 07:09:48 by hutch--
Hutch: what if one of the values contains a bracket?

value="blah blah [brackets] blah"

You can probably count lines starting with [ though..

Posted on 2002-04-21 07:13:38 by Thomas
Just count the 0's in the buffer and substract one. Then you have the count of sections. Quote from MSDN:

Pointer to a buffer that receives the section names associated with the named file. The buffer is filled with one or more null-terminated strings; the last string is followed by a second null character.

If you can't get it work, I can post you the way, I use in one of my programms.
Posted on 2002-04-21 08:44:06 by bazik
well maybe just a sample of it i havnet had much with msdn tehyre considor ini files outdated and dont have much on them so if you could post and example to go by id appreciate
Posted on 2002-04-21 21:20:47 by illwill