Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / changing 2 bytes to 1 word and 4 bytes to 1 dword- not in dbp/dbc

Author
Message
Three Score
20
Years of Service
User Offline
Joined: 18th Jun 2004
Location: behind you
Posted: 26th Mar 2005 11:22
is there soem math eqaution or a dll of some sort to change 2 bytes into 1 word and 4bytes into 1 dword ect
i have tried to do it by myself but with failure

X-Patch x-patch.exe(gui):75% make.exe:5% x-patch.dll(runtime dll):0% developed on win xp home sp2
Mnemonix
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: Skaro
Posted: 26th Mar 2005 11:40
well, to change 2 bytes into one word, I think you just multiply them together.

Same for DWORD

Correct me if I am wrong.

The 3d chat is coming...
Rights For Traffic Cones!
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 26th Mar 2005 12:33 Edited at: 26th Mar 2005 12:34
You can use bit shifting to change between types if you want the binary to stay in tact and just line up next to the other.



[edit] Really need more info on how you are going to use this or more specifics on what you are trying to do. Try and give examples of what you want.

Three Score
20
Years of Service
User Offline
Joined: 18th Jun 2004
Location: behind you
Posted: 26th Mar 2005 14:00
ok well i am using c which of course does not have a write word to file function i can only write bytes so i need to be able to put them together to make a word and dword

X-Patch x-patch.exe(gui):75% make.exe:5% x-patch.dll(runtime dll):0% developed on win xp home sp2
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 26th Mar 2005 14:22 Edited at: 26th Mar 2005 14:25
I have never used C. And only a little C++. You can use my method though there may be a better way. You just do the opposite to turn them into bytes instead of turning bytes into them.



Or whatever the C equivalent would be.

Three Score
20
Years of Service
User Offline
Joined: 18th Jun 2004
Location: behind you
Posted: 26th Mar 2005 14:53
hmm easy enough i will tell u if it works out

X-Patch x-patch.exe(gui):75% make.exe:5% x-patch.dll(runtime dll):0% developed on win xp home sp2
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 26th Mar 2005 19:07
Which functions are you using to write the values out? If it's the standard C IO functions then:




This allows you to write multibyte values without having a conversion step.

I've typed this directly into the edit box, so you may need to tweak to get it to work.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins and source code http://www.matrix1.demon.co.uk
Three Score
20
Years of Service
User Offline
Joined: 18th Jun 2004
Location: behind you
Posted: 26th Mar 2005 20:36
so it should automatically take care of that when u read it IF valuein is a dword
God!! that is cool
i havnt compiled it but i know how i would do it now

X-Patch x-patch.exe(gui):75% make.exe:5% x-patch.dll(runtime dll):0% developed on win xp home sp2

Login to post a reply

Server time is: 2024-11-14 13:09:48
Your offset time is: 2024-11-14 13:09:48