1. Windows7 Euphoria3 opening files problem
- Posted by AndyDrummond Mar 16, 2011
- 2034 views
I have just transferred my work to a Windows 7 laptop, and am having a problem which maybe someone can answer.
I have a PIM (written in Euphoria3) which opens a few files on the root of drive C:. Well, it tries to, but it fails. The file handle is always returned as -1. The files are present, not RO, and all the permission boxes have been set for all types of user. In any case, they fail just opening to read. The program and the files are precisely the ones I have copied from WinXP and which have been working A-OK for literally years.
Is it possible that programs are no longer allowed to access files in the root of C: ? It seems possible, but that is a real so-and-so if true.
Also I am having trouble binding a program - I am getting a fail in seek in file.e - "file not open". Seems that a similar thing is happening.
This is getting to be a real problem. I am going off Win7 somewhat! Any of you worthy gentlemen have any relevant ideas?
Andy
2. Re: Windows7 Euphoria3 opening files problem
- Posted by alanjohnoxley Mar 16, 2011
- 2035 views
Hi, I have Eu all legit licenced versions since v1.4... Can you post a code snippet that fails, I will give it a go on Eu 3.1 and earlier for you
3. Re: Windows7 Euphoria3 opening files problem
- Posted by DerekParnell (admin) Mar 16, 2011
- 1978 views
Is it possible that programs are no longer allowed to access files in the root of C: ? It seems possible, but that is a real so-and-so if true.
I think that this is the case in Windows 7. Can't you move your files to a directory rather than use the root?
I have access to a Win7 machine so I'll do some testing too.
4. Re: Windows7 Euphoria3 opening files problem
- Posted by AndySerpa Mar 16, 2011
- 1943 views
I used Win 7 with Eu3.1 for about 8 months -- zero problems, didn't have any trouble binding, etc. I don't think I ever used Eu to access files in the root folder, but I used it to access files pretty much everywhere else, including network drives. Did you install v3.1 from scratch? Maybe there is actually some weird permissions set on your executables. Also I should point out that I was always logged in as the administrator.
5. Re: Windows7 Euphoria3 opening files problem
- Posted by AndyDrummond Mar 17, 2011
- 1916 views
Two things have materialized: one is that binding suddenly began to work. I copied bindw.bat into my working folder, edited it with actual parameters, and it crashed. Over and over. Then suddenly without apparent reason it worked. And so does binding within Judith's IDE. So I put that one on the back burner and pray it never re-emerges. The other is that I have moved my data files into \ProgramData\Euphoria and again it works. I still find that if I try and open a file in the root of C: it fails. Solidly. I don't know why, and I'd like to know. Euphoria was copied across from my XP machine in toto, maybe that is a problem. I had to put in the environment variables, of course, too.
If you want a code snippet, try this (after creating gash.txt in C:\ with notepad or similar):
fh = open("C:\\gash.txt", "r") trace(1)
I find fh always returns -1. If I can't access files in the root of C: then I won't put them there, and I expect someone will say that that is a good thing anyway; it isn't a good place to leave odd data files lying about. It is just that I can find them there easily.
Otherwise, yes, I find Euphoria 3 just works on Windows 7, no trouble. I haven't yet migrated to Eu 4 because Eu 3 does what I want, and I still await a version of IDE which really works fully in Eu 4; the last modified one did but not fully, and as a man working on other things and using Euphoria as simply a tool to do jobs I just don't have the time or skill to fool with it and try sorting it out. If I buy a car it must run A-OK "from the box"; when I shift to Eu4 and IDE then they must work like that. Long gone it seems are the days when Judith and I exchanged ideas on enhancements and bugs on IDE.
Many thanks for your ideas, though.
6. Re: Windows7 Euphoria3 opening files problem
- Posted by petelomax Mar 17, 2011
- 1913 views
I have moved my data files into \ProgramData\Euphoria
Ideally use %ALLUSERSPROFILE% if you need it to work on XP and Win7.
A quick google gave me lots of references to UAC preventing access to C: in windows 7.
Regards, Pete
7. Re: Windows7 Euphoria3 opening files problem
- Posted by AndyDrummond Mar 17, 2011
- 1848 views
I am struggling here, after all. I have tried Dell support and that is very hard work; Microshaft is also hard work. Maybe one of you experts can point me in the right direction.
I find I cannot write files in the root of C:. I can create them there, move them there, move them out - but edit & save? Nope. I created a folder called Root and moved my files there. Still can't save from Notepad. Moved them to Users\Andy and same result. I checked all the permissions and turned them all on. I am administrator so that should be OK - though Win7 keeps on telling me I can only do this or that if I am an administrator - doesn't it KNOW if I am or not? I seem to have no bothers except saving to files. Anything else is fine.
I looked at UAC but that only seems to dictate how long before the screen dims to ask permission for new installs. What I am getting is that in Notepad I click Save and it says "Do you want to replace this file?" to which I reply yes; then it just bongs and says "Access in Denied!".
I have created a folder in Users\Andy called Private, and I can edit & save files there. I have a batch file which runs an editor there, and that can edit & save files there. But if I put a shortcut to that batch file from Startup (so it runs when I start my day) then that canNOT save the file. Worse - it zaps the file contents. It is as if it is creating a new file OK, then getting inhibited from writing to it so it becomes null. What the !&*$@' is going on?
I am getting very frustrated with this; it must be something trivial but what? I have no ideas. Gentlemen - can you help? Please! I shouldn't ask Win7 problems here, so unless there is a simple answer don't worry; I will try and dig my way into either Dell or Microsoft. There could have been at least SOME documentation with a new PC, but nothing. Nada. Zilch.
Andy
8. Re: Windows7 Euphoria3 opening files problem
- Posted by mattlewis (admin) Mar 17, 2011
- 1843 views
I am struggling here, after all. I have tried Dell support and that is very hard work; Microshaft is also hard work. Maybe one of you experts can point me in the right direction.
After a little bit of searching, I think Pete might have been on to something with respect to UAC. If you have it on, then even if you are logged in as an admin, I think that you're not really running that way by default. Do you have UAC enabled?
I have no idea if you need to do something special to get the UAC prompts, or if it should simply happen when a program does something that requires it.
Matt
9. Re: Windows7 Euphoria3 opening files problem
- Posted by AndyDrummond Mar 17, 2011
- 1840 views
I put UAC down one level, with possibly a small change. What I have found is that when I save a file from Notepad, it says Access Denied, but if I save again, it saves. It looks like the first save copies the file to a backup, then the write truncates the file but can't write to it. The NEXT save finds a null file, so it can write to it. Now this is surmising, and it seems very odd, but I have found a similar case with our NAS when writing from a Mac. The Mac creates a unique filename, which is null, then (seems to write to it) but can't rename it to the proper name. The NAS - and the Mac, with OSX - is based around Unix, as it appears Win7 is. It is all very odd. I'm looking at Microsoft docs for progammer's guide to Win7 but that is largely irrelevant.
Bring back DOS - all is forgiven!
10. Re: Windows7 Euphoria3 opening files problem
- Posted by jaygade Mar 17, 2011
- 1869 views
No, Windows 7 is not, and has never been, based on Unix. It can trace part of its lineage back to Vax/VMS I hear.
Anyway, see this thread for some information. See especially the replies by Till and MPedersen.
I don't do a lot with Win7 myself but I DO have Win7 machines at home where I can try to help if necessary.
11. Re: Windows7 Euphoria3 opening files problem
- Posted by AndyDrummond Mar 17, 2011
- 1860 views
No, Windows 7 is not, and has never been, based on Unix. It can trace part of its lineage back to Vax/VMS I hear.
Anyway, see this thread for some information. See especially the replies by Till and MPedersen.
I don't do a lot with Win7 myself but I DO have Win7 machines at home where I can try to help if necessary.
Sorry, Jay, I only demonstrate my appaling ignorance.
I found that thread interesting though most of it seemed to be from other aggrieved users! I followed the rather vague instructions to give myself full access rights but I still found my program couldn't write the file. That was only a first and rather vestigial test. It certainly seemed that although I, as Andy, have adminstrator rights, that isn't the same as giving Andy, per se, those rights. But I feel in my water that I may be forced to rewrite all my code to access data in folders in my documents folder; that, at least, should give me full RWX rights.
So thank you. If anyone else has an idea, that's great, but I think I am being caught up by the "Let's protect Windows from the user" syndrome, which does have its merits. But it is my PC, my C: drive, and if I want to write files there I really think I should have the right. Rights? What are they?? Ah well, Bill Gates wins again.
12. Re: Windows7 Euphoria3 opening files problem
- Posted by jaygade Mar 17, 2011
- 1862 views
No, Windows 7 is not, and has never been, based on Unix. It can trace part of its lineage back to Vax/VMS I hear.
Anyway, see this thread for some information. See especially the replies by Till and MPedersen.
I don't do a lot with Win7 myself but I DO have Win7 machines at home where I can try to help if necessary.
Sorry, Jay, I only demonstrate my appaling ignorance.
I found that thread interesting though most of it seemed to be from other aggrieved users! I followed the rather vague instructions to give myself full access rights but I still found my program couldn't write the file. That was only a first and rather vestigial test. It certainly seemed that although I, as Andy, have adminstrator rights, that isn't the same as giving Andy, per se, those rights. But I feel in my water that I may be forced to rewrite all my code to access data in folders in my documents folder; that, at least, should give me full RWX rights.
Well, I did find some info in that thread and elsewhere.
So thank you. If anyone else has an idea, that's great, but I think I am being caught up by the "Let's protect Windows from the user" syndrome, which does have its merits. But it is my PC, my C: drive, and if I want to write files there I really think I should have the right. Rights? What are they?? Ah well, Bill Gates wins again.
Heh - I wouldn't blame it all on Bill Gates.
I see the logic behind the scheme - it is to protect users from harming their operating system files and to prevent malware from doing Bad Stuff(tm) to your computer. It's a tradeoff.
Otherwise, yeah. I agree with you - it's your computer and if you want to make a massive security hole in it then it is your choice. (Well, unless your computer is used as part of a botnet to DDOS someone, but still.)
I did some experiments with my Win7 computer but I wasn't completely successful. I was able to create files in the root, and delete them, but not modify them.
Probably because I tried to still maintain some kind of security and didn't check the "full control" box.
Now, there SHOULD be a Windows way for giving your program permission to write wherever - at least by asking for admin credentials - but I don't know that bit yet. I mean, when your program attempts to write "C:" it should pop up the UAC and ask for permission and then do it if you have the proper credentials.
I don't know how to do that, however.
If you still want to know how to open up your C: drive to full control by anybody then let me know. I'll post what I've learned. But I still think that it would be easier to change your program to write to an allowed folder.
13. Re: Windows7 Euphoria3 opening files problem
- Posted by AndyDrummond Mar 18, 2011
- 1817 views
Heh - I wouldn't blame it all on Bill Gates.
I see the logic behind the scheme - it is to protect users from harming their operating system files and to prevent malware from doing Bad Stuff(tm) to your computer. It's a tradeoff.
Otherwise, yeah. I agree with you - it's your computer and if you want to make a massive security hole in it then it is your choice. (Well, unless your computer is used as part of a botnet to DDOS someone, but still.)
I did some experiments with my Win7 computer but I wasn't completely successful. I was able to create files in the root, and delete them, but not modify them.
Probably because I tried to still maintain some kind of security and didn't check the "full control" box.
Now, there SHOULD be a Windows way for giving your program permission to write wherever - at least by asking for admin credentials - but I don't know that bit yet. I mean, when your program attempts to write "C:" it should pop up the UAC and ask for permission and then do it if you have the proper credentials.
I don't know how to do that, however.
If you still want to know how to open up your C: drive to full control by anybody then let me know. I'll post what I've learned. But I still think that it would be easier to change your program to write to an allowed folder.
Yes, if you have any more information I would love to know. Some programs seem to work fine, others fail. But it changes with time! I have Eu3 installed as normal, and today I began to work on my FolderCopy program which I use for backup to my server. Using IDE. I clicked to bind the program, and it ran fine, but the FolderCopy program failed. OK, that's what I was trying to find. I did some mods, and it seemed right, so I tried to bind again. This time the bind failed:
C:\Euphoria\include\file.e:37 in function seek() bad file number (-1) fn = -1It fails consistently - for now! Actually, it is binding within IDE which has failed to work; if I use bindw.bat itself it is OK. Another oddity. I don't mind tracking down problems, but if they won't stay fixed when they are fixed, I am just lost. And why has this formatting suddenly got fouled up? Windows7 isn't involved somewhere is it?
I'm sure some of you guys are running on Win7 quite happily - and I'd love to know how you achieved that. I can't even make code do the same thing on two consecutive minutes. "The advantage of digital systems over analog us that they are consistent" - oh yeah? Not since computers got involved!
I do a lot of work on PIC microcontrollers. All my project folders are off the root of C:. And there is no bother editing, compiling, working on PCB layouts, everything normal, in fact, in those folders. But when I create a folder C:\Root, I couldn't even get Notepad to save to a file there. I can create and delete files - but not modify them. Except all the work folders which seem quite unfazed by the shift to Win7.
We need to call an end to this thread - Euphoria isn't the right place to air my Win7 problems, though I greatly value the input of so many knowledgeable guys. But if you DO have any more suggestions, I will be very pleased indeed to entertain them. Please ignore my ramblings - I am just getting very frustrated. Maybe I should buy a book like "Windows7 for Dummies".
Andy
14. Re: Windows7 Euphoria3 opening files problem
- Posted by jaygade Mar 19, 2011
- 1767 views
Andy, are you running your program from the command line or from the GUI?
If you are running from the command line then first open a command prompt with elevated privileges. Two ways to do that:
- In the Start Menu, find All Programs -> Accessories -> Command Prompt. Right-click on it and choose "Run as Administrator". Then any programs you launch should be able to write files and folders to where Administrators can.
- In the Start Menu, in the Search Programs and Files box, type "Command Prompt". From your choices do as above, right click and choose "Run as Administrator".
Instead of right-clicking, you can also Ctrl-Shift-Left Click on the program to launch it as administrator. You can also just type "cmd" into the box and press "Ctrl-Shift-Enter".
And finally, you can change the Command Line Prompt shortcut to run as Administrator or create a copy of the Command Line Prompt and make IT run as administrator. (Right-Click -> Properties -> Advanced -> Run as Administrator)
If you are running the program from the Gui, then you will have to right-click and "Run as Administrator" on it. That should work if it is an actual executable (bound or translated). If it is a .exw or .ex file which is associated with the Euphoria interpreter, then I'm still not sure. I'll look into it some more.
Don't worry that this isn't a Windows 7 forum. You are asking help with Euphoria even if the root problem is Windows. That's okay, we're here to help.
So let me know if that helps and if not I'll look into it further until we figure it out.
15. Re: Windows7 Euphoria3 opening files problem
- Posted by ne1uno Mar 19, 2011
- 1781 views
Heh - I wouldn't blame it all on Bill Gates.
I see the logic behind the scheme - it is to protect users from harming their operating system files and to prevent malware from doing Bad Stuff(tm) to your computer. It's a tradeoff.
Yes, if you have any more information I would love to know. Some programs seem to work fine, others fail. But it changes with time!
[...]
I do a lot of work on PIC microcontrollers. All my project folders are off the root of C:. And there is no bother editing, compiling, working on PCB layouts, everything normal, in fact, in those folders. But when I create a folder C:\Root, I couldn't even get Notepad to save to a file there. I can create and delete files - but not modify them. Except all the work folders which seem quite unfazed by the shift to Win7.
are there too many files in the root dir?
We need to call an end to this thread - Euphoria isn't the right place to air my Win7 problems, though I greatly value the input of so many knowledgeable guys. But if you DO have any more suggestions, I will be very pleased indeed to entertain them.
you might try including a manifest file with either the translated program or bin/eu*.exe, in the same directory, prog.ext.manifest
do a search on your system for other manifest files, I notice some of them have permissions and security sections that may be help, although I have no specific information about how. for ex: a manifest may make the problem worse! if running in some automatically imposed compatibility mode the manifest may simply be ignored. that coupled with the intermittent nature of the problem is a powerful time sink.
you would think someone would have created a manifest editor by now, but I have not seen one mentioned anywhere.
16. Re: Windows7 Euphoria3 opening files problem
- Posted by AndyDrummond Mar 19, 2011
- 1775 views
Andy, are you running your program from the command line or from the GUI?
If you are running from the command line then first open a command prompt with elevated privileges. Two ways to do that:
- In the Start Menu, find All Programs -> Accessories -> Command Prompt. Right-click on it and choose "Run as Administrator". Then any programs you launch should be able to write files and folders to where Administrators can.
- In the Start Menu, in the Search Programs and Files box, type "Command Prompt". From your choices do as above, right click and choose "Run as Administrator".
Instead of right-clicking, you can also Ctrl-Shift-Left Click on the program to launch it as administrator. You can also just type "cmd" into the box and press "Ctrl-Shift-Enter".
I didn't know that!
And finally, you can change the Command Line Prompt shortcut to run as Administrator or create a copy of the Command Line Prompt and make IT run as administrator. (Right-Click -> Properties -> Advanced -> Run as Administrator)
If you are running the program from the Gui, then you will have to right-click and "Run as Administrator" on it. That should work if it is an actual executable (bound or translated). If it is a .exw or .ex file which is associated with the Euphoria interpreter, then I'm still not sure. I'll look into it some more.
Don't worry that this isn't a Windows 7 forum. You are asking help with Euphoria even if the root problem is Windows. That's okay, we're here to help.
So let me know if that helps and if not I'll look into it further until we figure it out.
These programs are all bound Euphoria GUI programs. Basically, I have filled my old laptop with XP and piles of rubbish, and now I have a new laptop. With Win7. I just copied across what I needed - my PIM, various database programs, etc etc. I was gutted when my PIM crashed with file handle -1 errors when accessing files. Then just writing files. Then I found even notepad was having trouble. The new laptop is nice and clean (just a week old now, a baby!) so there is no trouble with excess stuff. And I'm getting away from command-line driven stuff as I need other people to access my programs.
So - running a program as administrator might work; since I am administrator and have set up myself as administrator as well (the two things seemed different) I am hoping to edit all the programs to use data files in \Users\Andy\Private instead of the root. That ought to be OK, but changing all my programs will be a great nuisance. The question will be - how do I ensure the program always runs with administrator privileges? That might be the manifest file - I will have to see.
I have just ordered a book on Windows 7 which might help me to answer these questions. But the biggest question is probably this: if I, as user Andy, create a file anywhere - anywhere at all - I would expect, as user Andy, as owner, to have full rights to read, write, modify, execute (possibly), change attributes, etc. I would expect Windows OS files to be inaccessible, protected, etc. But my files? They're mine, darn it, mine!
Ne1uno (not your birth name, I suspect) suggests playing with the manifest files, and I actually have one I can look at, though it means not a lot just now. I think Derek gave an example to allow Eu GUI programs to run with some characteristic or other. If that can fix the problem, fine. But I'd rather have a machine which lets me use my own files!
Guys, I have to wait till Monday before I can look at this stuff much, but I do appreciate your help. I'm hoping some general good can come out of this as we poor Windows users slowly get shifted across to Windows 7 - it might save some other people pulling out their hair!
Till next week - au revoir, mes amis.
17. Re: Windows7 Euphoria3 opening files problem
- Posted by jaygade Mar 19, 2011
- 1730 views
Glad to help.
Just remember, on Windows 7 even if you are logged in as an Administrator, you are still usually running programs as a regular user if you have UAC on. So you still have to right-click the program and choose "run as administrator" or select that in the properties dialog, even Notepad, if you need to write to areas of the disk where normal users cannot write.
So - running a program as administrator might work; since I am administrator and have set up myself as administrator as well (the two things seemed different) I am hoping to edit all the programs to use data files in \Users\Andy\Private instead of the root. That ought to be OK, but changing all my programs will be a great nuisance. The question will be - how do I ensure the program always runs with administrator privileges? That might be the manifest file - I will have to see.
It's in the properties dialog for the executable file under either "advanced" button or "compatability" tab depending on the program. There's a checkbox that says "run as administrator" or something. I'll check.
But the biggest question is probably this: if I, as user Andy, create a file anywhere - anywhere at all - I would expect, as user Andy, as owner, to have full rights to read, write, modify, execute (possibly), change attributes, etc. I would expect Windows OS files to be inaccessible, protected, etc. But my files? They're mine, darn it, mine!
Well, yes and no. While I understand the reasons for it I don't completely understand the mechanism either. Maybe I should buy a Windows 7 book too! Even though I mostly use Linux, I have to be able to solve these kinds of issues when they crop up at work or at home on Windows too.
18. Re: Windows7 Euphoria3 opening files problem
- Posted by AndyDrummond Mar 20, 2011
- 1691 views
It's in the properties dialog for the executable file under either "advanced" button or "compatability" tab depending on the program. There's a checkbox that says "run as administrator" or something. I'll check.
Yesss! As you say, in "Advanced". I was looking in "Security". And if I set to run in XP_SP3 mode that should do it. I will test Monday.
Thanks!
19. Re: Windows7 Euphoria3 opening files problem
- Posted by AndyDrummond Mar 20, 2011
- 1700 views
Just like before: for a short-cut you select properties & advanced. For the program executable you select properties and compatibility. In both places you can set "run as administrator" which looks like it gets around the problems. I must do some tests and see about writing to the root etc. But so far you seem to have identified the fix. It may seem simple, it's usually the case that when you see how to do something, it immediately becomes obvious and simple to anybody. Until then - it's a mystery only open to the cognoscenti!
I didn't realise that when I run things, being administrator, the actually running is still under full restriction.
Hoepfully this thread will be of some value to other people who to transit to Windows 7. I hope this is an end to it - until something else wraps around our faces. One thing I have found is that accessing my server by FTP using wininet.dll works fine; I thought this was most likely to be a source of trouble. Ah well.
20. Re: Windows7 Euphoria3 opening files problem
- Posted by jaygade Mar 20, 2011
- 1674 views
I also added a Wiki page the other day on running under Windows 7. Feel free to add to it if you learn some things.
21. Re: Windows7 Euphoria3 opening files problem
- Posted by AndyDrummond Mar 21, 2011
- 1685 views
Thanks, Jay, but I'll let you update it if you feel that what I have said is of use to other people. All seems well here now, and there are fewer and fewer annoyances. I still get Win7 going through all this lark asking if I want to let this program or that change settings on this computer; but those GUI programs I have which I have set to run under administrator privileges seem to work fine.
So many many thanks for your help, everyone, and let's hope this has it all under control.