Hi Pekr and all,

I had a look into the Win api reference and in this case you have to treat
the buffer like Gabrielle suggested. GetVolumeInformation call requires
buffers with enough preallocated size as the disk name and filesystem name
can vary. I don't think this could be done other way(but I'm not any expert
though ;-)).
One thing I'd suggest to Patrick is to not load the system library with
absolute path to achieve compatibility between different Win versions.

regards,

Cyphre


----- Original Message -----
From: "Petr Krenzelok" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, December 13, 2004 2:18 PM
Subject: [REBOL] Re: Calling Windows API


>
> Patrick Philipot wrote:
>
> >Hello Rebol-List,
> >
> >I've got a problem when calling windows API.
> >
> >Here is an example :
> >
> >; GetVolumeInformationA is returning the disk system (FAT32 or NTFS)
> >; in a buffer (FileSystemNameBuffer)that I have declared
> >; FileSystemNameBuffer: "YYYYYYYYYYYYYYYYYYY"
> >
> >kernel32.dll: load/library %/C/WINDOWS/system32/kernel32.dll
> >GetVolumeInfo: make routine! [
> >        disk [string!]
> >        lpVolumeNameBuffer [string!]
> >        size [integer!]
> >        lpVolumeSerialNumber [integer!]
> >        lpMaximumComponentLength [integer!]
> >        lpFileSystemFlags [integer!]
> >        lpFileSystemNameBuffer [string!]
> >        size2 [integer!]
> >        return: [integer!]
> >] kernel32.dll "GetVolumeInformationA"
> >VolumeNameBuffer: "XXXXXXXXXXXXXXXXXXXX"
> >FileSystemNameBuffer: "YYYYYYYYYYYYYYYYYYY"
> >GetVolumeInfo "C:\" VolumeNameBuffer 20 0 0 0 FileSystemNameBuffer 20
> >?? FileSystemNameBuffer
> >
> >The problem is that I don't get a clean buffer but
> >
> >
> >
> >>>?? FileSystemNameBuffer
> >>>
> >>>
> >FileSystemNameBuffer: "[EMAIL PROTECTED]"
> >== "[EMAIL PROTECTED]"
> >
> >
> It should be easy to copy/part find string "^@" or something like that,
> but, arent  those additional parameters just pointers? Try change their
> typ, e.g. to [char*] and see what gets into buffers, maybe rebol will do
> it for you. I would also try to stop preallocating those buffers with
> content. What about make string! 100 or something like that? Dunno,
> let's hope some more experienced rebollers step-in here and give you the
> right answers ...
>
> cheers,
> -pekr-
>
> >What do I have to do to get only "FAT32" ?
> >
> >
> >
>
>
>
> --
> To unsubscribe from the list, just send an email to rebol-request
> at rebol.com with unsubscribe as the subject.
>

-- 
To unsubscribe from the list, just send an email to rebol-request
at rebol.com with unsubscribe as the subject.

Reply via email to