_Hex function (VO28Run)
Posted: Wed May 17, 2023 10:29 am
Hi all,
it seems that the VO28Run function _Hex isn't implemented yet. Does anyone have a suggestion how to write this part of my code (I've posted the whole entity for better understanding of what I want do do) VO code properly in X#:
LOCAL ptrLanguage AS WORD PTR
LOCAL DIM aName[256] AS BYTE
LOCAL DIM aHex[8] AS BYTE
LOCAL ptrValue AS PTR
dwSize := GetFileVersionInfoSize( pszFile, @dwZero )
IF dwSize > 0
ptrInfo := MemAlloc( dwSize )
IF MemCheckPtr( ptrInfo, dwSize )
dwLangSize := 4 * _SIZEOF(WORD)
ptrLanguage := MemAlloc( dwLangSize )
IF MemCheckPtr( ptrLanguage, dwLangSize )
IF GetFileVersionInfo( pszFile, 0, dwSize, ptrInfo )
IF !VerQueryValue( ptrInfo, String2Psz( ;
"VarFileInfoTranslation" ),;
@ptrLanguage, @dwLangSize )
dwLangSize := 0
ENDIF
MemCopy( @aName[1], PTR( _CAST, "StringFileInfo" ), 18 )
IF dwLangSize >= 2
_Hex( ptrLanguage[1], @aHex[1] )
MemCopy( @aName[19], @aHex[5], 4 )
_Hex( ptrLanguage[2], @aHex[1] )
MemCopy( @aName[23], @aHex[5], 4 )
ELSE
// As default: Lang = US English, CharSet= Windows Multilingual
MemCopy( @aName[19], PTR( _CAST, "040904E4" ), 8 )
ENDIF
MemCopy( @aName[27], PTR( _CAST, "" ), 2 )
MemCopy( @aName[29], PTR( _CAST, pszValueName ), PszLen( pszValueName ))
ptrValue := MemAlloc( dwValueLength )
IF MemCheckPtr( ptrValue, dwValueLength )
IF VerQueryValue( ptrInfo, PSZ( _CAST, @aName[1] ), @ptrValue, @dwValueLength )
MemCopy( ptrValueBuffer, ptrValue, dwValueLength )
lSucceed := TRUE
ENDIF
MemFree( ptrValue )
ENDIF
ENDIF
MemFree( ptrLanguage )
ENDIF
MemFree( ptrInfo )
ENDIF
ENDIF
RETURN lSucceed
it seems that the VO28Run function _Hex isn't implemented yet. Does anyone have a suggestion how to write this part of my code (I've posted the whole entity for better understanding of what I want do do) VO code properly in X#:
LOCAL ptrLanguage AS WORD PTR
LOCAL DIM aName[256] AS BYTE
LOCAL DIM aHex[8] AS BYTE
LOCAL ptrValue AS PTR
dwSize := GetFileVersionInfoSize( pszFile, @dwZero )
IF dwSize > 0
ptrInfo := MemAlloc( dwSize )
IF MemCheckPtr( ptrInfo, dwSize )
dwLangSize := 4 * _SIZEOF(WORD)
ptrLanguage := MemAlloc( dwLangSize )
IF MemCheckPtr( ptrLanguage, dwLangSize )
IF GetFileVersionInfo( pszFile, 0, dwSize, ptrInfo )
IF !VerQueryValue( ptrInfo, String2Psz( ;
"VarFileInfoTranslation" ),;
@ptrLanguage, @dwLangSize )
dwLangSize := 0
ENDIF
MemCopy( @aName[1], PTR( _CAST, "StringFileInfo" ), 18 )
IF dwLangSize >= 2
_Hex( ptrLanguage[1], @aHex[1] )
MemCopy( @aName[19], @aHex[5], 4 )
_Hex( ptrLanguage[2], @aHex[1] )
MemCopy( @aName[23], @aHex[5], 4 )
ELSE
// As default: Lang = US English, CharSet= Windows Multilingual
MemCopy( @aName[19], PTR( _CAST, "040904E4" ), 8 )
ENDIF
MemCopy( @aName[27], PTR( _CAST, "" ), 2 )
MemCopy( @aName[29], PTR( _CAST, pszValueName ), PszLen( pszValueName ))
ptrValue := MemAlloc( dwValueLength )
IF MemCheckPtr( ptrValue, dwValueLength )
IF VerQueryValue( ptrInfo, PSZ( _CAST, @aName[1] ), @ptrValue, @dwValueLength )
MemCopy( ptrValueBuffer, ptrValue, dwValueLength )
lSucceed := TRUE
ENDIF
MemFree( ptrValue )
ENDIF
ENDIF
MemFree( ptrLanguage )
ENDIF
MemFree( ptrInfo )
ENDIF
ENDIF
RETURN lSucceed