lua-users home
lua-l archive

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


Am 24.04.2010 12:00, schrieb Attila:
After your help, I was able to load it, and almost works perfectly. Currently I want to use GetVolumeInformationA, which prototype is the following: BOOL ::GetVolumeInformation(LPCWSTR lpRootPathName, LPWSTR lpVolumaNameBuffer, DWORD nVolumeNameSize, LPDWORD lpVolumeSerialNumber,LPDWORD lpMaximumComponentLength, LPDWORD lpFileSystemFlag, LPWSTR lpFileSystemNameBuffer,DWORD nFileSystemNameSize) LPDWORD is unsigned long* , so I should pass a referenced value to get the value, but I can't, because only ref char, ref int and ref double are available, but ref long isn't. What can I do to make this working? I Googled a lot, but there is only one working Windows example on the stackoverflow forum. Can somebody mention some places where I can find more?
Thanks: Attila
I would try the following.
Prototype the argument as "pointer"
    your_function:types{ret="int",abi="stdcall","pointer"}
allocate a buffer
    local one_long=alien.array('long',1)
pass the buffer as argument
    your_function(one_long.buffer)
get the result
    local result=one_long[1]

In your case for GetVolumeInformation you must declare one "pointer" and allocate one buffer for each LPDWORD argument.
Hope this helps
regards Jørgen