ok.. so i used createfile and "\\.\VWIN32" to open the memory, saved the handle, and opened an actual file with createfile for write access. then what i did was make a file copying loop, but it's not working because i guess readfile and writefile calls don't work on the handle for the memory.. anyway, here's the code:

.repeat
invoke ReadFile,hMem,addr dBuff,sizeof dBuff,addr dBytesRead,NULL
invoke WriteFile,hImage,addr dBuff,dBytesRead,addr dBytesWrite,NULL
push dTotal
pop eax
add eax,dBytesRead
.until eax == dDrvSize

what it should do, or what i want it to do anyway, is read the data stored in the handle for the memory, and write it back to the file, but it doesn't work! any suggestions would be great. oh, and if you were wondering, here's the line used to create the handle to the memory..


invoke CreateFile,addr sMem,GENERIC_READ+GENERIC_WRITE,FILE_SHARE_READ+FILE_SHARE_WRITE,NULL,OPEN_EXISTING,NULL,NULL

sMem db "\\.\VWIN32",0

i know the memory contains the data i want in the file, i just can't seem to make the transfer.. thanks in advance
Posted on 2002-02-13 17:09:38 by mc`
If the program is crashing it may be because dTotal is not beeing updated in the loop.
Posted on 2002-02-13 17:24:52 by NoException
the error seems to be in the ReadFile line, it returns an error about an invalid handle. i don't get it, everything else says it's valid, why won't readfile work??
Posted on 2002-02-13 17:38:12 by mc`
What do you mean by data stored in a memory handle?
The parameters where you've written hMem and hImage must be file handles.
Posted on 2002-02-13 20:59:07 by tank
perhaps i didn't make myself clear. i called createfile with the file name being "\\.\VWIN32" which returns a handle to a "file" created in memory as i understand. it should act as a file does in every way, just not actually be a file. the problem i'm having is that it isn't actually working.. i can read from and write to the "file" but i can't seem to copy the data from it to a real file. i dunno.. i guess if no one can answer after this i'll just attach the entire source, see if someone can figure out where i went wrong..
Posted on 2002-02-13 23:32:00 by mc`
CreateFile is used to open anything that looks like a file or device, but it doesn't require them to implement ReadFile and WriteFile. I/O could be done entirely with DeviceIoControl.

A quick glance at MSDN indicates that VWIN32 is a driver for low level DOS-like disk access in Win9x, and not a driver for a "RAM file". It seems everything is done with DeviceIoControl.
Posted on 2002-02-14 12:06:50 by tank
i see.. so after having used it and read the data from the floppy disk (that's the purpose of it), how could i write this back out to a file?
Posted on 2002-02-14 17:33:17 by mc`
the problem i'm having is that it isn't actually working.. i can read from and write to the "file" but i can't seem to copy the data from it to a real file

Hmmm, after reading this, it appears that your problem is with the destination (real) file, not the source (virtual) file. If you can read data from the virtual file, then your problem has to be with trying to write the data to the actual filesystem, and you appear to be worrying about the wrong part of the code. Maybe you should post the code section and let everyone take a look at it.
Posted on 2002-02-14 21:55:17 by sluggy
well, i'm lazy, so here's the full source to the program thus far. it needs a lot of clean up, i know, i'm gonna do some restructuring and move stuff into procs later, right now i just want it to work. the code in question resides in the 9x section, with all the DeviceIoControl calls and whatnot.. not entirely sure what's going on there, so any help is appreciated, thanks in advance.
oh, any other tips on the code would be nice too, just general optimizations and whatnot :P
Posted on 2002-02-15 18:12:23 by mc`