Re: Advice wanted!

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

What "ID" could I use?

How about the serial number of the first local hard drive (C:)?

What you'll have to figure out is what to do when their drive "crashes" and they "can't recover anything."

I don't know from where the following originates, but it's Windows-only. This is also probably old and duplicates something in the standard library.

--include dll.e 
--include machine.e 
--include get.e 
 
constant 
   kernel32 = open_dll( "kernel32.dll" ), 
   xGetVolumeInfo = define_c_func( kernel32, "GetVolumeInformationA", 
		   {C_POINTER, C_POINTER, C_UINT, C_POINTER, C_POINTER, 
		    C_POINTER, C_POINTER, C_UINT }, C_INT) 
 
global function getVolSerial( object root_dir ) 
-- Input: A string that contains the root directory of the volume to be described. 
--        A trailing backslash is required. For example, you would specify 
--        \\MyServer\MyShare as "\\\\MyServer\\MyShare\\", or the C drive as "C:\\". 
-- Output: Volume Serial Number 
 
   atom rootPathName, volSerNum 
   sequence ret_val 
 
	if atom(root_dir) then 
		root_dir = root_dir & ":\\" 
	end if 
	 
   rootPathName    = allocate_string( root_dir ) 
   volSerNum       = allocate( 4 ) 
 
   if not c_func( xGetVolumeInfo, { rootPathName, NULL, NULL, volSerNum, 
				   NULL, NULL, NULL, NULL } ) then 
      --puts( 1, "\n**xGetVolumeInfo failed in function getVolSerial**\n" ) 
      --puts(1, root_dir) 
   end if 
 
   ret_val = { peek4u( volSerNum ) } 
   free( rootPathName ) 
   free( volSerNum ) 
   return ret_val 
end function 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu