this pretty cute programm cause a crash of its self:
.data
checkdrives DWORD 0
formattext DB "%s %d", 0
formatbuffer DB 150 DUP(0)
formattemp DB 150 DUP(0)


.code
start:
;INVOKE GetLogicalDrives
;MOV checkdrives, EAX

INVOKE wsprintf, ADDR formatbuffer, ADDR formattext, checkdrives
INVOKE MessageBox, NULL, formatbuffer, checkdrives, NULL
INVOKE ExitProcess, NULL
END start


By the way, have I use GetLogicalDrives right ?
Posted on 2003-04-17 07:26:31 by Forginforcer
wsprintf crashes because it expected 4 parameter and you only passed 3 parameters. PS: No you got it wrong


DWORD GetLogicalDrives(VOID)


Parameters

This function has no parameters.

Return Values

If the function succeeds, the return value is a bitmask representing the currently available disk drives. Bit position 0 (the least-significant bit) is drive A, bit position 1 is drive B, bit position 2 is drive C, and so on.
If the function fails, the return value is zero.
Posted on 2003-04-17 07:33:08 by roticv
Year, I understoot, but I wanted to choose these cute BITs.

P.S. Even now its crashs at wsprintf
Posted on 2003-04-17 07:40:09 by Forginforcer
reread my previous post... the format string is "%s %d", thus it is expected that you pass 4 parameters and not 3.
Posted on 2003-04-17 08:09:19 by roticv
I'm sorry to be a ultra-twit !
Thats just my way of life:
> sittting in front of my 2 computers.
> organsiate girls who go under the table
> hear musik all the time, even at night. I have about 50 fafourite songs. thats one of them : http://bbs-fachdemontage.de/BISON/ForThoseWhoDied.mp3
Its not illegal, its a free mp3.
>And to do programming. Imaginee some commands, an wonder why it doesnt work, although I was hard to invent.

Please accept me.

Thanks a lot !:stupid:
Posted on 2003-04-17 08:14:46 by Forginforcer
Two computers,girls,music... You are a very lucky man,Forginforcer:alright: :)
Posted on 2003-04-17 08:27:10 by Vortex
Auspiciousness, I have solved my prob.
P.S.
THX, but I cant find the right girl, because the righ girls !
I want to get a very nice girl, who is very affectionate, faithfull and intelligent (that you will never find).
Have you heard the cool musik ?
I sometimes dream that I can sing so.
Even when I have medievil songs, where a very cool gilr sing I dream that I have the same voice. :cool: :confused:
Posted on 2003-04-17 08:36:57 by Forginforcer
Forginforcer,

If the question is "who is right person?"... The person who understands you and who
shares your feelings and ideas.

I am afraid,the moderators are coming here. :) So,better to conclude here this touchy subject. :)

Good luck mon ami:alright:

Vortex
Posted on 2003-04-17 08:44:56 by Vortex
Okay, as conclusion:
Newbies, dont be so silly to make the mistake I made.
Here is the right code:
__________________
.data
checkdrives DWORD "5", 0
formattext DB "%s %dM Bytes", 0
formatbuffer DB 150 DUP(0)
formattemp DB 150 DUP(0)

.code
INVOKE wsprintf, ADDR formatbuffer, ADDR formattext, ADDR checkdrives, ADDR checkdrives
INVOKE MessageBox, NULL, ADDR formatbuffer, ADDR formatbuffer, NULL
?????????????????????????

P.S. You mean the moderators don like girls ? :confused: :grin: :grin: :grin:
Posted on 2003-04-17 08:52:19 by Forginforcer
Yes,that's the correct code.

P.S. : If we continue to talk about that subject,the moderators will move
this thread to the "Heap" section. :) We don't want this to happen. :)

Vortex
Posted on 2003-04-17 08:57:22 by Vortex
First of all, you should get rid of those girls, they're obviously ruining your concentration. How do you expect to learn to program with all these distractions? You can send them over to me. :grin:

Third of all, the code you have doesn't do anything useful, does it? :P
Posted on 2003-04-18 07:16:47 by Sephiroth3
@Sephiroth3 coool :grin: :cool:

I wanted to list al my logical drives, but I'm not able to. :confused:
Posted on 2003-04-18 08:52:44 by Forginforcer
Okay. This is how you do it:



.bss
drives db 79 dup(?)
.code
start:
call GetLogicalDrives
mov edi,ADDR drives
mov ecx,0x203a41
the_loop:
shr eax,1
jae no_drive
mov dword ptr [edi],ecx
add edi,3
no_drive:
inc ecx
cmp cl,0x5b
jb the_loop
dec edi
stosb
invoke MessageBoxA,ADDR drives,ADDR blah,MB_OK
ret
blah db "The drives",0
end start


I'm not familiar with MASM, but I think that's how it would be written.
Posted on 2003-04-18 11:55:49 by Sephiroth3
Hey Thanks !

I just have a visitor at my - my friend Valle, I will try your solution later !

Thanks !

Deep regard FF
Posted on 2003-04-18 12:01:02 by Forginforcer