Re: Starting project EuphoriaVista Interpreter

new topic     » goto parent     » topic index » view thread      » older message » newer message
jcmarsh1 said...

Euphoria on Vista

  • Today, I am starting a project aimed at producing a stable and safe version of the Interpreter targeting the MS Windows Vista platform. I will be calling it tentatively "EuphoriaVista". This comes after the Euphoria Interpreter v3.1.1 for Windows, which seems to be targeting WinXP, crashed my system twice. I am not a full-time programmer, so I would be interested in whatever community support I could get with it.

I think it says much for Vista that 3.1.1 could BSOD the entire system. ;) Sorry, I couldn't resist.

Both 3.1.1 and 4.0 are currently trying to target the entire range of Windows systems from 98 to Vista, as well as OS X, Linux, and FreeBSD.

jcmarsh1 said...
  1. One of the problems is that GUI Windows (API calls from the Interpreter) wont work with DEP on. DEP protects Vista from malicious code and leaving it off leaves my system vulnerable to attack and file system corruption from other programs, as well as the ones I'm debugging. File system corruption could lead to "Genuine Windows" Anti-Piracy Limited Access Auto-Protect Mode (which happened to me once). In that mode, an annoying dialog pops up and you are limited to Internet access only, while you try to verify that your Windows copy is genuine. Once it's verified as genuine, you get your computer back.
  1. Vista and later systems use a method for protecting memory so that traditional Euphoria machine code embedded in source files does not work. [It has to be called from the program's own memory, I think, or it has to be hard-coded in the executable or in a project *.dll that the Interpreter can link to.]

Shawn Pringle has written DEP support, and is in the process of integrating it to the current 4.0 branch. The next alpha release will fully support DEP. This includes support for calling embedded machine code (although the libraries themselves might need slight modification, e.g. changing allocate() to allocate_executable() or similar).

jcmarsh1 said...
  1. The next problem is that Microsoft is dropping support for older code and older APIs in favor of newer and "safer" APIs and system library functions (such as UNICODE instead of "ascii", TCHAR instead of CHAR for character data, StringCchPrintf instead of "sprintf" to avoid buffer overflow the length and the character count is passed, etc.)
  2. Since Windows 2000 (perhaps since NT), Windows is a UNICODE system internally. Any "ascii" strings passed to API functions using "functionA" format have to be converted to a UNICODE string before they are processed. This is provided for back-wards compatibility, however, all new programs targeting NT systems should be built using the "functionW" version of the API function passing a full UNICODE UTF-16 "like" string to the function. [The exact UNICODE encoding is based on the OS version, but they are all based on a 16-bit WCHAR]
  • Euphoria v3.1.1 still uses the "functionA" version of the Windows API. Many older libraries use outdated machine code that wont work on Vista.

I see exactly three places in the source code where the functionA form is directly called (and two of those are in pathopen.e where we have to choose between A and W). The current console code in be_w.c using WriteConsoleOutput() uses the ascii format as well.

All of this looks trivial to change (and could be #ifdef'd and uname()'d to maintain backwards compatibility with 98).

True unicode support for Euphoria is a long term goal that'll probably come in 4.1 or 4.2

jcmarsh1 said...
  1. Most new programs targeting the MS Vista and later are meant to be written in "dot net" (.NET) a compiled executable format with a program compress inside it similar to Euphoria's *.il method. [Sun's Java uses a similar technique to produce Java class files.]
  2. Microsoft provides a free [for a home user at least, I don't know about commercial, someone would have to help me understand the legal jargon] programming tool "Microsoft Visual C++ 2008 Express Edition" (and other Express editions in VB, C#, Web) that compiles for the Vista platform [I think all Vista versions and supported processors, there are many output formats it supports] and can produce "dot net" (.NET) executables. (http://www.microsoft.com/Express/)

What's the benefit of switching from the current il to producing .NET output?

jcmarsh1 said...
  1. It may be easier to map the "dot net" (.NET) framework to the Interpreter its self. Each call to a "dot net" (.NET) function that the Interpreter uses could be in a C style switch statement.

This is going to be unpopular due to the speed hit we'll take. (This will be as slow as, or even slower than, using INT_CODES.)

jcmarsh1 said...
  1. 64-bit Operating Systems. A newer data type "long long" or "__int64" is used extensively, and the standard method for calling functions is different, but uniform across all function calls.

I can only speak for Linux here (where adding this kind of support is very easy).

jcmarsh1 said...
  1. Different privilege levels, and security descriptors that a programmer now has to account for.

The interpreter itself should work at the lowest possible privilege level, and the coder is responsible for calling the right APIs to perform elevation and such (possibly using a vista32lib.ew to do so). This is the way it should be.

jcmarsh1 said...
  • EuphoriaVista will only use "safe" functions as specified by Microsoft and use recommended Windows API functions for the target Windows version whenever possible.
  • The goal is to write source code in Euphoria, and have it run on Vista in a safe and predictable manner.

That should already be the case for the 4.0 alpha. If it isn't then we have a bug that needs to be fixed.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu