Registry and binary
-
im trying to write 40 01 00 20 (hex) to the registry as a binary number it is writing but it come out as 32 00 00 00 can someone show me the right way DWORD value = 40,01,00,20; DWORD dwvalue = sizeof(DWORD); RegSetValueEx( hKey, "Attributes", 0, REG_BINARY, (LPBYTE) &value, dwvalue ); "Attributes"=hex:50,01,00,20 ok i found that if i do it as value = 0x20000150; it will put it in the registry as 50 01 00 20 why does it turn it around?
-
im trying to write 40 01 00 20 (hex) to the registry as a binary number it is writing but it come out as 32 00 00 00 can someone show me the right way DWORD value = 40,01,00,20; DWORD dwvalue = sizeof(DWORD); RegSetValueEx( hKey, "Attributes", 0, REG_BINARY, (LPBYTE) &value, dwvalue ); "Attributes"=hex:50,01,00,20 ok i found that if i do it as value = 0x20000150; it will put it in the registry as 50 01 00 20 why does it turn it around?
locoone wrote:
DWORD value = 40,01,00,20;
How did you get that line through the compiler?? Try this: DWORD value = 0x40 << 24 | 0x1 << 16 | 0x0 << 8 | 0x20; Regarding: "Attributes"=hex:50,01,00,20 ok i found that if i do it as value = 0x20000150; it will put it in the registry as 50 01 00 20 why does it turn it around? It's beacuse Intel CPU's uses little endian, which stores numerical values in a "byte swapped" order. Other CPU's may use big endian.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
-
im trying to write 40 01 00 20 (hex) to the registry as a binary number it is writing but it come out as 32 00 00 00 can someone show me the right way DWORD value = 40,01,00,20; DWORD dwvalue = sizeof(DWORD); RegSetValueEx( hKey, "Attributes", 0, REG_BINARY, (LPBYTE) &value, dwvalue ); "Attributes"=hex:50,01,00,20 ok i found that if i do it as value = 0x20000150; it will put it in the registry as 50 01 00 20 why does it turn it around?
locoone wrote:
why does it turn it around?
Should not bother you, as you should read it back correctly.
Prasad Notifier using ATL | Operator new[],delete[][^]