This is great to know Gregg and works well. I wouldn't have figured this out. They should probably update the library doc on how to handle this type.
Paul Tretter ----- Original Message ----- From: "Gregg Irwin" <[EMAIL PROTECTED]> To: "Paul Tretter" <[EMAIL PROTECTED]> Sent: Thursday, September 18, 2003 11:48 PM Subject: [REBOL] Re: sizeof(structure) > > Hi Paul, > > PT> Yeah I actually tried that thinking the same but had no luck with it. I get > PT> a return value of 0 which denotes failure of the GetVersionEx function. > > The fixed char array will give you grief, if you haven't already dealt > with them in structs. Here's a very quick hack for you, with credit to > Pekr and Cyphre for the nifty trick of generating elements dynamically > to emulate char arrays in structs. > > -- Gregg > > make-elements: func [name count type /local result][ > if not word? type [type: type?/word type] > result: copy "^/" > repeat i count [ > append result join name [i " [" type "]" newline] > ] > to block! result > ] > > kernel.dll: load/library %kernel32.dll > > OSVERSIONINFOEXA: make struct! OSVERSIONINFOEXA-def: compose/deep [ > dwOSVersionInfoSize [integer!] ; DWORD > dwMajorVersion [integer!] ; DWORD > dwMinorVersion [integer!] ; DWORD > dwBuildNumber [integer!] ; DWORD > dwPlatformId [integer!] ; DWORD > (make-elements 'szCSDVersion 128 #"@") ; TCHAR > ] none > OSVERSIONINFOEXA/dwOSVersionInfoSize: length? third OSVERSIONINFOEXA > > GetVersionEx: make routine! compose/deep/only [ > lpVersionInformation [struct! (OSVERSIONINFOEXA-def)] ;LPOSVERSIONINFO > return: [integer!] ;BOOL > ] kernel.dll "GetVersionExA" > > get-version: has [res] [ > res: GetVersionEx OSVERSIONINFOEXA > either 0 = res [none][OSVERSIONINFOEXA] > ] > > res: get-version > print [ > "Major:" res/dwMajorVersion newline > "Minor:" res/dwMinorVersion newline > "Build:" res/dwBuildNumber newline > "Version:" to-string copy/part at third OSVERSIONINFOEXA 21 128 > ] > > free kernel.dll > > -- > To unsubscribe from this list, just send an email to > [EMAIL PROTECTED] with unsubscribe as the subject. > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.515 / Virus Database: 313 - Release Date: 9/1/2003 -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
