Convert DWORD to a unsigned long number


#1

Anyone know how to convert Dword LITTLE_ENDIAN to an unsigned long number or float value?


#2

Something along the following lines should get you going in the right direction. There should be plenty of Java examples out there but this is one possible way:

<cfscript>
ByteBuffer = createObject( "java", "java.nio.ByteBuffer" );
result = ByteBuffer.wrap( [DWORD_as_byte] ).order( ByteOrder.LITTLE_ENDIAN ).getInt();
// may need to bitAnd() with lower order bytes (0xffffffffL) to get unsigned int
writeDump( result );
</cfscript>

Potential further reading on using ByteBuffer in CF: https://www.bennadel.com/blog/3156-experimenting-with-bytebuffer-in-coldfusion-for-binary-manipulation.htm

HTH