Exetools  

Go Back   Exetools > General > General Discussion

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 03-28-2004, 07:03
amitophia
 
Posts: n/a
IDA IDC-script: cannot shift right properly

I have a little problem with idc-script
Here's an example:

Message("\n%X",0xC0665A84>>31);
Message("\n%X",0xC0665A84/0x80000000);

First resuls 0xFFFFFFFF, and second - 0;

What's a damn? The result must be 1 in both cases.

I have to implement ROR and ROL instructions in my IDC-script, but I can't 'cause the reason above.

Could someone tell me another way?

Thank you.
Reply With Quote
  #2  
Old 03-28-2004, 08:14
nino nino is offline
Friend
 
Join Date: Jan 2002
Posts: 58
Rept. Given: 0
Rept. Rcvd 2 Times in 1 Post
Thanks Given: 0
Thanks Rcvd at 1 Time in 1 Post
nino Reputation: 2
IDC uses signed arithmetic. Shift Right corresponds to SAR. Nevertheless you can still implement ROL and ROR keeping this in mind.
Reply With Quote
  #3  
Old 03-28-2004, 18:26
amitophia
 
Posts: n/a
2 ninio:
Thanks a lot.

If someone need:
#define ROL(x,n) x<<n|(~(0xFFFFFFFF<<n)&x>>32-n)
#define ROR(x,n) x<<32-n|(~(0x80000000>>n-1)&x>>n)
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
IDA can't properly deal with RUST strings WhoCares General Discussion 3 07-08-2021 10:46
Don't get Olly to work properly squareD General Discussion 3 06-12-2006 01:31
F9->Shift-F9 Exception passing in Olly bgrimm General Discussion 15 02-15-2005 05:06


All times are GMT +8. The time now is 17:32.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( 1998 - 2024 )