lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, May 20, 2010 at 1:34 PM, Gilles Ganault <gilles.ganault@free.fr> wrote:
> Hello
>
> In order to know specifically what files/directories I need to run the
> Xavante launcher wsapi.exe, I tried using the SysInternals Process
> Monitor utility to watch what this program does when I run "wsapi
> -p9999".
>
> I'm surprised by two things:
>
> 1. Process Monitor shows no access to the Registry, although the
> environment variables only include the following Lua-related entries:
>
> LUA_DEV=C:\Program Files\Lua\5.1
> LUA_PATH=;;C:\Program Files\Lua\5.1\lua\?.luac
> Path=[...]C:\Program Files\Lua\5.1;C:\Program Files\Lua\5.1\clibs
> PATHEXT=[...];.wlua;.lexe
>
> Does wsapi and its dependencies really only use the LUA_DEV variable
> to locate what it needs?

Not even the environment variables are needed. wsapi.exe reads a
wsapi.lua file in the same folder it is, if it exists. This file can
set the package.path and package.cpath variables to values that let
require find all the libraries that will be loaded.

wsapi.exe will happily run without the wsapi.lua file if there is a
"lua" directory in the same path as itself with all the pure Lua
modules it depends on, and a "clibs" directory in the same path as
itself with all the C modules it depends on.

If you want to package everything up as a no-fuss .zip file I
*strongly* suggest you study Lua's package loading mechanism, and its
peculiarities in Windows, including the parts of the Lua source code
responsible for that. Otherwise all of this will look like magic, I
think.

> 2. Using the following filter...
>
> "Process Name contains wsapi"
> "Command line contains wsapi"
> "Path contains C:\Program Files\Lua\5.1\rocks\wsapi\1.3.4-1\samples"
>
> ... Process Monitor shows that wsapi seems to try creating files,
> which are not found, but wsapi still manages to run succesfully and
> wait for queries:
>
> ==========
> CreateFile
> C:\Program Files\Lua\5.1\rocks\wsapi\1.3.4-1\samples\lfs.lua
> NAME NOT FOUND

...

>
> C:\Program Files\Lua\5.1\rocks\wsapi\1.3.4-1\samples\socket\core.lua
> PATH NOT FOUND
> ==========
>
> So using the above, I still have no idea what files/directories I need
> to extract from the LuaForWindows/Rocks thingie to run Xavante.

require tries to load .lua files first before trying the dlls. Why
this shows up as failed CreateFile calls
I have no idea, probably a glitch in your process monitor.

> Does someone know of a good Windows application that can completely
> monitor what a program does?

No generic Windows process monitor will tell you the Lua dependencies
of wsapi.exe, only the Windows DLLs it depends on. But you can try
changing wsapi.lua to hook require so it reports this to you:

-----
local old_require = require
function require(module, ...)
  print(module)
  return old_require(module, ...)
end
-----

This will tell you all the modules wsapi.exe requires. Some of them
will be .lua files, some of them will be .dlls, but all of them will
be under the lua and clibs directories of your Lua for Windows
install.

> Thank you.
>
>

--
Fabio Mascarenhas