[ANN] Win32 API wrappers - General API 1.0.7 patch1 beta

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

[ANN] Win32 API wrappers - General API 1.0.7 patch1 beta

Daniel Quintela
Hi everybody:

A patch for current release of General Win32 API wrappers is ready to download from:
       http://luaforge.net/frs/?group_id=96

Notes:
* Bug fixed.
* Built with Lua 5.1.2 binaries.

Changes:
2007-04-15: Bug reported by Corey Tripp fixed.
            Bug fix:
                - Wrong parameter index in CreateMutex.


Best regards,
Daniel







Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Win32 API wrappers - General API 1.0.7 patch1 beta

Asko Kauppi

CreateMutex in Lua... **creeps** :P

While I feel some of OS API's are very nice to have, how far have you gone? I'm facing the same in deciding, which parts of Cocoa Foundation API's (OS X) to port. Decided to leave some parts strictly out, as unnecessary in a Lua world.

-asko


Daniel Quintela kirjoitti 15.4.2007 kello 18:12:

Hi everybody:

A patch for current release of General Win32 API wrappers is ready to download from:
       http://luaforge.net/frs/?group_id=96

Notes:
* Bug fixed.
* Built with Lua 5.1.2 binaries.

Changes:
2007-04-15: Bug reported by Corey Tripp fixed.
            Bug fix:
                - Wrong parameter index in CreateMutex.


Best regards,
Daniel








Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Win32 API wrappers - General API 1.0.7 patch1 beta

Peter Odding
Asko Kauppi wrote:

CreateMutex in Lua... **creeps** :P

While I feel some of OS API's are very nice to have, how far have you gone? I'm facing the same in deciding, which parts of Cocoa Foundation API's (OS X) to port. Decided to leave some parts strictly out, as unnecessary in a Lua world.

-asko

I've never used the Win32 API wrapper(s) so can't comment on those.

Speaking from my experience in binding APR, I've found that most of these `API primitives' are better wrapped in a higher level interface (am I stating the obvious?). This has the added advantage that the API you provide to Lua becomes less dependent on the API your binding. Of course in the case of Win32 it seems less relevant to defend yourself against API changes (because of Win32's extensive backcompat).

On the flip side, when you expose all the primitives, a higher level API can be written in Lua.

 - Peter Odding

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Win32 API wrappers - General API 1.0.7 patch1 beta

Daniel Quintela
Peter Odding escribió:

On the flip side, when you expose all the primitives, a higher level API can be written in Lua.

 - Peter Odding

I agree.

Regards,
DQ



Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Win32 API wrappers - General API 1.0.7 patch1 beta

Diego Nehab-3
On the flip side, when you expose all the primitives, a higher level API can be written in Lua.

 - Peter Odding

I agree.

I third that.

[]s,
Diego.

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Win32 API wrappers - General API 1.0.7 patch1 beta

Diego Nehab-3
In reply to this post by Daniel Quintela
Hi,

On the flip side, when you expose all the primitives, a higher level API can be written in Lua.

 - Peter Odding

I agree.

Damn it, I sent the message before writing the rest. As I said, I agree too.

The only problem is that, according to Lua's philosophy, it
should not be possible to crash an application from Lua. Exposing the bare Win32 API might not be compatible with
this philosophy.

Regards,
Diego.

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Win32 API wrappers - General API 1.0.7 patch1 beta

Peter Odding
Diego Nehab wrote:
Hi,

On the flip side, when you expose all the primitives, a higher level API can be written in Lua.

 - Peter Odding

I agree.

Damn it, I sent the message before writing the rest. As I said, I agree too.

The only problem is that, according to Lua's philosophy, it
should not be possible to crash an application from Lua. Exposing the bare Win32 API might not be compatible with
this philosophy.

Regards,
Diego.


I couldn't agree more, and go to quite a bit of trouble to avoid my own binary modules from crashing on invalid input.

Continuing on high- vs. low-level API advantages: when a module writer decides to expose the primitives I think he/she essentially gives over control to users of the module, and will have to accept the consequences (if you don't validate all input your module can crash and take the Lua interpreter with it).

Last note, if any of you are running Windows, try lua.exe -e "os.date'%e'". Does that crash? Because it does for me, on all >= XP SP2 installations I've tried. This means it's already possible to crash `plain' Lua on Windows, at least the os library, given an invalid (according to Microsoft's CRT) format string. Of course no-one could expect the Lua authors to implement (localized) date formatting independent of the CRT, but this goes to show that input validation is important.

 - Peter Odding

PS. Please don't take the lua.exe -e "os.date'%e'" comment as FUD against Lua!

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Win32 API wrappers - General API 1.0.7 patch1 beta

Diego Nehab-3
Hi,

PS. Please don't take the lua.exe -e "os.date'%e'" comment
as FUD against Lua!

Did anybody else know about this? I didn't. I am not sure
how to fix this, but I think Roberto will not be happy. :)

[]s,
Diego.

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Win32 API wrappers - General API 1.0.7 patch1 beta

Roger Ivie
In reply to this post by Peter Odding
On Sun, 15 Apr 2007, Peter Odding wrote:
Last note, if any of you are running Windows, try lua.exe -e "os.date'%e'". Does that crash? Because it does for me, on all >= XP SP2 installations I've tried.

Doesn't for me, using Lua 5.1 compiled with OpenWatcom.
--
roger ivie
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Win32 API wrappers - General API 1.0.7 patch1 beta

Peter Odding
In reply to this post by Diego Nehab-3
Diego Nehab wrote:
Did anybody else know about this? I didn't. I am not sure
how to fix this, but I think Roberto will not be happy. :)

Did you reproduce the crash? Because as explained below this might just be me screwing up...

I posted about this before[1] on the list. One person replied he couldn't reproduce the crash[2], another suggested I could try updating my compiler and Windows XP CRT[3], which didn't help. I suggested updating the manual to mention a minimal subset of supported conversion specifications supported by os.date (strftime), but I don't think anyone picked that up.

Roger Ivie wrote:
Doesn't for me, using Lua 5.1 compiled with OpenWatcom.

Thanks for the heads up. I decided to investigate further and think I've found the problem. Presumably caused by myself... The LuaBinaries 5.1.2 build I just tried[4] doesn't crash while my own build does. The only difference I've found is that the LuaBinaries build links to MSVCRT.DLL while my own build doesn't (just NTDLL.DLL and KERNEL32.DLL). I think my build might be linking to a stub strftime in another DLL than MSVCRT.DLL, which crashes, unlike `the official' strftime that everyone else in the MS/Windows world seems to be using... You may now commence throwing stones :(. Sorry about the potential FUD, definitely not intended!

 - Peter Odding

[1] http://lua-users.org/lists/lua-l/2007-03/msg00301.html
[2] http://lua-users.org/lists/lua-l/2007-03/msg00304.html
[3] http://lua-users.org/lists/lua-l/2007-03/msg00329.html
[4] http://luaforge.net/frs/download.php/2218/lua5_1_2_Win32_bin.zip

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Win32 API wrappers - General API 1.0.7 patch1 beta

Diego Nehab-3
Hi,

You may now commence throwing stones :(. Sorry about the potential FUD, definitely not intended!

The stones would come if you had posted on Slashdot that Lua
is a security liability because of a bug that you invented.
Posting something like this to the list is perfectly fine.

[]s,
Diego.

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Win32 API wrappers - General API 1.0.7 patch1 beta

Stefan Sandberg
In reply to this post by Roger Ivie
Roger Ivie wrote:
On Sun, 15 Apr 2007, Peter Odding wrote:
Last note, if any of you are running Windows, try lua.exe -e "os.date'%e'". Does that crash? Because it does for me, on all >= XP SP2 installations I've tried.

Doesn't for me, using Lua 5.1 compiled with OpenWatcom.
Crashes on Vista too..

Reply | Threaded
Open this post in threaded view
|

Re[2]: [ANN] Win32 API wrappers - General API 1.0.7 patch1 beta

Theodor-Iulian Ciobanu-2
Hello Stefan,

Monday, April 16, 2007, 1:02:44 PM, you wrote:

SS> Roger Ivie wrote:
>> On Sun, 15 Apr 2007, Peter Odding wrote:
>>> Last note, if any of you are running Windows, try lua.exe -e 
>>> "os.date'%e'". Does that crash? Because it does for me, on all >= XP 
>>> SP2 installations I've tried.

>> Doesn't for me, using Lua 5.1 compiled with OpenWatcom. 
SS> Crashes on Vista too..

As the manual says, os.date() is a wrap for strftime() and msvcrt doesn't implement "%e". So if you used Microsoft Visual Studio to compile Lua, you get the crash. (As MSDN states, it's not C99 standard compliant)

-- 
Theodor-Iulian Ciobanu
Virus Researcher

e-mail: [hidden email]

-----------------------------------------
Secure your every bit
-----------------------------------------


Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Win32 API wrappers - General API 1.0.7 patch1 beta

Philippe Lhoste
In reply to this post by Peter Odding
Peter Odding wrote:
Last note, if any of you are running Windows, try lua.exe -e "os.date'%e'". Does that crash? Because it does for me, on all >= XP SP2 installations I've tried. This means it's already possible to crash

Using LuaBinaries:

E:\Dev
> lua50.exe -e "print(os.date'%e')"
lua50.exe: <command line>:1: `date' format too long
stack traceback:
        [C]: in function `date'
        <command line>:1: in main chunk
        [C]: ?

E:\Dev
> lua51.exe -e "print(os.date'%e')"
lua51.exe: (command line):1: 'date' format too long
stack traceback:
        [C]: in function 'date'
        (command line):1: in main chunk
        [C]: ?

E:\Dev
> lua51.exe -e "print(os.date'%c')"
04/16/07 12:55:13

E:\Dev
> lua51.exe -e "print(os.date'%x')"
04/16/07

Might have been fixed?

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --


Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Win32 API wrappers - General API 1.0.7 patch1 beta

Luiz Henrique de Figueiredo
> E:\Dev
>  > lua51.exe -e "print(os.date'%e')"
> lua51.exe: (command line):1: 'date' format too long

Lua 5.1.2 no longer emits this error message:
	http://www.lua.org/bugs.html#5.1.1-4

When reporting problems, please always use -v in command lines.
--lhf