Re: Disk Serial ID

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hi all,
Reading the forum often gives you great ideas. I tried the file supplied by
Brian and got the following error, any idea why. I saved the file a test.ex

C:\EUPHORIA\include\dll.e:27 in function open_dll()
open_dll() is not supported in Euphoria for DOS32
    file_name = {107'k',101'e',114'r',110'n',101'e',108'l',51'3',50'2',
46'.',100'd',108'l',108'l'}

.. called from C:\PROGRA~2\TEMP\TEST2.EX:7

Global & Local Variables

 C:\EUPHORIA\include\machine.e:
    check_calls = 1

 C:\EUPHORIA\include\get.e:
    input_file = <no value>
    input_string = <no value>
    string_next = <no value>
    ch = <no value>

Thanks
Tony
Come Visit Me At www.locksdownunder.com

----- Original Message -----
From: "Brian Broker" <bkb at cnw.com>
To: "EUforum" <EUforum at topica.com>
Sent: Thursday, March 22, 2001 9:33 AM
Subject: RE: Disk Serial ID


>
>
> CK Lester wrote:
> >
> > Thanks, Irv, but I forgot to specify that I need it for a Windows
> > program...
> >
>
> CK,
>
> This it something I posted to the old list.  It does not require
> Win32Lib.
>
> -- start tested program --
> 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)
>
> function getVolSerial( sequence 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
>
>    rootPathName    = allocate_string( root_dir )
>    volSerNum       = allocate( 4 )
>
>    if not c_func( xGetVolumeInfo, { rootPathName, NULL, NULL, volSerNum,
>                                    NULL, NULL, NULL, NULL } ) then
>       puts( 1, "xGetVolumeInfo failed in function getVolSerial" )
>    end if
>
>    ret_val = { peek4u( volSerNum ) }
>    free( rootPathName )
>    free( volSerNum )
>
>    return ret_val
>
> end function
>
> sn = sprintf( "%08x", getVolSerial( "C:\\" ) )
> printf( 1, "Volume Serial Number is %s-%s", {sn[1..4],sn[5..8]} )
> -- this can be verified by typing "vol" at the C: prompt
> if wait_key() then end if
>
> -- end tested program --
>
> -- Brian
>
>
>
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu