what am i doing wrong that the cd rom wont open

.data
cdopen db "set CDAudio door open",0
cdclose db "set CDAudio door closed",0


.code
start:

invoke MessageBox,0,addr cdopen,addr cdopen,0
invoke mciSendString,ADDR cdopen,NULL,0,0
invoke Sleep, 5000
invoke MessageBox,0,addr cdclose,addr cdclose,0
invoke mciSendString,ADDR cdclose,NULL,0,0
ret
end start
:stupid:
Posted on 2002-09-14 04:25:31 by illwill
I think you have to open a channel first (to the cddrive).

http://fasm.metro-nt.pl/beer.zip

Note: FAsm dereferences labels. So you'll have to tweak to compile with MASM
Posted on 2002-09-14 05:43:42 by eet_1024
Try "set cd door open wait" and "set cd door closed wait".
Posted on 2002-09-14 05:46:54 by bazik
one of my first progs in ASM (translated from C++), but it works:



.586
.model flat, stdcall ;muss sein...
option casemap :none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\masm32.inc
include \masm32\include\advapi32.inc
include \masm32\include\winmm.inc
includelib \masm32\lib\advapi32.lib
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\winmm.lib

.data
OpenIt db "Set CDAudio Door Open",0
CloseIt db "Set CDAudio Door Closed",0

aboutTitle db "CD-Rom open/close about ...by CDW",0
aboutText db "Open/Close CDRom Drive",13, "Autor: CDW",13
db "Cult of the Dead Window(s)",13,"Germany/Neuss",13
db "cdw_@freenet.de",13,"www.cdw.de.vu",13
db "Language: Assembler (MASM32)",13,13,"Parameters:",13
db "cdrom.exe <arg>",13,"o open CDROM door",13,"c close CDROM door",13
db "a about <cdrom.exe>",13,13,"Sample:",13,"cdrom.exe o",13
db "will open your drive",13,13,"On my HP are some other programs and ",13,"tutorals (in German)!",0

clArguments db ?
MakeIt dd ?

.code

call MainAPIproc
Exitprog:
push 0
call ExitProcess

start:

MainAPIproc proc


;+++GetArguments
push offset clArguments
push 1
call GetCL ;ask for args
jmp IstArgumentO


;+++end GetArguments

;+++arguments stuff
IstArgumentO:
cmp [clArguments],6fh ; o for Open
jne IstArgumentC
mov MakeIt,offset OpenIt ;addr of OpenIt-String

jmp SendString

IstArgumentC: ; if argument = c(lose)
cmp [clArguments],63h
jne IstArgumentA ;if not, jmp to next
mov MakeIt, offset CloseIt; Adresse von CloseIt-String rein
jmp SendString

IstArgumentA: ;if argument = a(bove)
cmp [clArguments],00h
je About
cmp [clArguments],61h
jne Exitprog ; wenn nix zutrifft, ende
jmp About
About:
push MB_OK or MB_ICONQUESTION
push offset aboutTitle
push offset aboutText
push NULL
call MessageBoxA
jmp Exitprog


;+++ ende der Reaktion auf Argumente

;++++SendString
SendString:

push NULL
push NULL
push NULL
push MakeIt
call mciSendString

jmp Exitprog




ret
MainAPIproc endp



END start



this code was tested on my machine (win2k) and on win95/98/ME




I tested your code (with my inc/libs) and it works...



.586
.model flat, stdcall ;
option casemap :none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\masm32.inc
include \masm32\include\advapi32.inc
include \masm32\include\winmm.inc
includelib \masm32\lib\advapi32.lib
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\winmm.lib


.data
cdopen db "set CDAudio door open",0
cdclose db "set CDAudio door closed",0


.code
start:

invoke MessageBox,0,addr cdopen,addr cdopen,0
invoke mciSendString,ADDR cdopen,NULL,0,0
invoke Sleep, 5000
invoke MessageBox,0,addr cdclose,addr cdclose,0
invoke mciSendString,ADDR cdclose,NULL,0,0
ret
end start

Posted on 2002-09-14 10:43:41 by CDW
Sometime the problem is not software but hardware. For example when your cd-rom is connected like slave drive to the same IDE cable where is your hard disk then your source code doesnt work. You can add another IDE cable and make your cd-rom to be second master and then all be OK. I test it and I am very amazed from it.
Posted on 2002-09-23 17:23:34 by martidim
Connecting a {DVD, CD}-{BURNER, ROM} on the same cable as a harddisk is a BadThing(tm) because it slows down the HD.
Posted on 2002-09-23 17:29:51 by bazik
yea i guess that was the problem i was running into testing on other machines they had 2 cdroms etc . ijust dont have a cdrom on my laptop to test no my own so i had to rely on others i sent it to telling me it didnt work , so i just thought it was something in my code :alright:
Posted on 2002-09-24 18:31:37 by illwill