i wrote this in TASM and it did exactly what i wanted. however in MASM it isnt working. invoke CreateFile,ADDR inipath,GENERIC_READ + GENERIC_WRITE,FILE_SHARE_READ + FILE_SHARE_WRITE,0,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,0 it is returning INVALID_HANDLE_VALUE it should create the file if it is not there and open it if it is. however regardless of whether it is there or not it is not returning a handle. i have tried replacing the "+"'s with "OR"'s (thx comrade) but it still isnt working. grrr. any help appreciated. skud.
Posted on 2001-04-29 12:02:00 by skud
.....hummmmm.......if you retrieved inifile, and it's in a buffer, try leaving off the ADDR. I found that when you use something in .DATA, you should use ADDR; and when you use something in .DATA?, you should not. ;) This worked for me:


.....hope that helps.......
Posted on 2001-04-29 13:05:00 by *unknown*
I think you have to use CREATE_ALWAYS something like that. anyway this works with masm, I use it to open a new if the file does not exist otherwise it opens an existing file. invoke CreateFile,addr INIPath,\ GENERIC_WRITE , FILE_SHARE_WRITE ,\ NULL,OPEN_ALWAYS, FILE_ATTRIBUTE_ARCHIVE, NULL
Posted on 2001-04-29 13:05:00 by Zcoder
ok thanks. but its still failing :( whats that about not using .data? im not using it anyway, but i just wondered. all i want to do is create the file and obtain its handle if it doesnt exist; and if it does then get its handle. thats it. i have done it before in TASM but using that code in the MASM way doesnt seem to work. this is the TASM code: push 0 push FILE_ATTRIBUTE_NORMAL push OPEN_ALWAYS push 0 push FILE_SHARE_READ + FILE_SHARE_WRITE push GENERIC_READ + GENERIC_WRITE push offset inipath call CreateFileA why the hell does this work but not the MASM version??? invoke CreateFile, ADDR inipath, GENERIC_READ + GENERIC_WRITE, FILE_SHARE_READ + FILE_SHARE_WRITE, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0 more help please ... skud. This message was edited by skud, on 4/30/2001 2:59:46 AM
Posted on 2001-04-29 16:46:00 by skud
Hmmmm.. try using NULL instead of "0".. That's the only diffrence between my own code I'm looking at right now and yours =) You could try GENERIC_READ & GENERIC_WRITE instead of GENERIC_READ + GENERIC_WRITE too. Can't remember if that's valid tho.. it's 2 am and I've just got home from a party =)) //Phrekie
Posted on 2001-04-30 19:55:00 by Phrekie
i have solved this problem there is nothing wrong with the code there; however the path was incorrect (inipath). o well. thanks anyway. skud.
Posted on 2001-05-01 11:36:00 by skud