[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lua-l
Subject:    Fwd: HELP
From:       "JM Venet Magic.fr" <jmvenet () magic ! fr>
Date:       2017-03-01 22:15:10
Message-ID: 14a47935-72a5-cd22-1352-1f160becf9b2 () magic ! fr
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hello,

Yesterday,  I sent this message to have a little help of lua friends ..

------------------------

Hello,

I need to retrieve HDD's infos in lua, and store them in variables.
Does someone has an idea, especially the physical serial number, not the
one after formatting ?
Thanks,
JM Venet

-------------------
today, after hard searching on the net, I found this : For windows, the 
disk informations are retrieveable via the library kernell32.dll with 
the function GetVolumeInformation this function sends these datas 
(contained in a data structure:

  _In_opt_  LPCTSTR lpRootPathName,
   _Out_opt_ LPTSTR  lpVolumeNameBuffer,
   _In_      DWORD   nVolumeNameSize,
   _Out_opt_ LPDWORD lpVolumeSerialNumber,
   _Out_opt_ LPDWORD lpMaximumComponentLength,
   _Out_opt_ LPDWORD lpFileSystemFlags,
   _Out_opt_ LPTSTR  lpFileSystemNameBuffer,
   _In_      DWORD   nFileSystemNameSize

I coded with Wscite this :

local path = 'C:\\Windows\\System32\\kernell32.dll'

local func = package.loadlib(path, 'GetVolumeInformation')

a = {}
a[1] = func.lpRootPathName
a[2] = func.lpVolumeNameBuffer
a[3] = func.nVolumeNameSize
a[4] = func.lpVolumeSerialNumber
a[5] = func.lpMaximumComponentLength
a[6] = func.lpFileSystemFlags
a[7] = func.lpFileSystemNameBuffer
a[8] = func.nFileSystemNameSize

after process by F5, I received the following messages

>lua -e "io.stdout:setvbuf 'no'" "test.lua"
lua: test.lua:6: attempt to index local 'func' (a nil value)
stack traceback:
	test.lua:6: in main chunk
	[C]: ?
>Exit code: 1

If I put the lines from the statement a = {}, to the end in comments the 
messages are : (func is nil)
lua -e "io.stdout:setvbuf 'no'" "test.lua"
>Exit code: 0

is there someone who can give me a little help to retrieve the datas 
contained in the stucture returned by the function GetVolumeInformation 
thanks for help JM Venet


[Attachment #5 (text/html)]

<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hello,</p>
    <p>Yesterday,  I sent this message to have a little help of lua
      friends ..<br>
    </p>
    <div class="moz-forward-container">------------------------<br>
      <pre>Hello,

I need to retrieve HDD's infos in lua, and store them in variables.
Does someone has an idea, especially the physical serial number, not the 
one after formatting ?
Thanks,
JM Venet

-------------------
<font color="#3333ff">today, after hard searching on the net, I found this :

For windows, the disk informations are retrieveable via the library kernell32.dll
with the function GetVolumeInformation

this function sends these datas (contained in a data structure:</font>

 _In_opt_  LPCTSTR lpRootPathName,
  _Out_opt_ LPTSTR  lpVolumeNameBuffer,
  _In_      DWORD   nVolumeNameSize,
  _Out_opt_ LPDWORD lpVolumeSerialNumber,
  _Out_opt_ LPDWORD lpMaximumComponentLength,
  _Out_opt_ LPDWORD lpFileSystemFlags,
  _Out_opt_ LPTSTR  lpFileSystemNameBuffer,
  _In_      DWORD   nFileSystemNameSize

<font color="#3333ff">I coded with Wscite this :</font>

local path = 'C:\\Windows\\System32\\kernell32.dll'

local func = package.loadlib(path, 'GetVolumeInformation')

a = {}
a[1] = func.lpRootPathName
a[2] = func.lpVolumeNameBuffer
a[3] = func.nVolumeNameSize
a[4] = func.lpVolumeSerialNumber
a[5] = func.lpMaximumComponentLength
a[6] = func.lpFileSystemFlags
a[7] = func.lpFileSystemNameBuffer
a[8] = func.nFileSystemNameSize

<font color="#3333ff">after process by F5,
I received the following messages</font>

&gt;lua -e "io.stdout:setvbuf 'no'" "test.lua" 
lua: test.lua:6: attempt to index local 'func' (a nil value)
stack traceback:
	test.lua:6: in main chunk
	[C]: ?
&gt;Exit code: 1

<font color="#3333ff">If I put the lines from the statement a = {}, to the end in comments
the messages are : (func is nil)
</font>
lua -e "io.stdout:setvbuf 'no'" "test.lua" 
&gt;Exit code: 0

<font color="#3333ff">is there someone who can give me a little help to retrieve the datas contained
in the stucture returned by the function GetVolumeInformation

thanks for help

JM Venet
</font></pre>
    </div>
  </body>
</html>

["jmvenet.vcf" (text/x-vcard)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic