Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Calling Windows API

From: petr:krenzelok:trz:cz at: 13-Dec-2004 14:18

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: "FAT32^@YYYYYYYYYYYYY" >== "FAT32^@YYYYYYYYYYYYY" >
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-