CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Installing SQL Server 2008
  • Writing UDFs for Firebird Embedded SQL Server
  • [Updated] Shutdown Manager
  • Building Windows Azure Cloud Service Applications with Azure Storage and the Azure SDK

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Other Programming > Assembly
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Assembly Questions and Answers for Assembly here!

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old December 13th, 2004, 07:22 AM
    Elden Elden is offline
    Junior Member
     
    Join Date: Dec 2004
    Posts: 7
    Elden is an unknown quantity at this point (<10)
    Question Change the value of a register?

    Hello,

    is there a way to change the register value of a running program?

    example: (from a debugger)

    7C912927 84E4 TEST AL,AL


    AL=0 and i want to change it to 1 and freeze the value so it always stay to 1. It's possible to do it with a debugger but i would like to learn how to code that in c++

    Any advices, links?

    Thx
    Reply With Quote
      #2    
    Old December 14th, 2004, 12:06 AM
    kahlinor kahlinor is offline
    Member
     
    Join Date: Nov 2004
    Posts: 34
    kahlinor is an unknown quantity at this point (<10)
    Re: Change the value of a register?

    I don't understand what you mean. Registers can't be 'frozen' to a specific value, especially one that is used for return values (al).

    The easiest way to preserve a register value is to constantly push and pop the register before and after any code that changes it. Alternatevely, you can store it into a variable and recover it later.
    Reply With Quote
      #3    
    Old December 15th, 2004, 01:53 PM
    NoHero's Avatar
    NoHero NoHero is offline
    Moderator
     
    Join Date: Mar 2004
    Location: (Upper-) Austria
    Posts: 2,899
    NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)
    Re: Change the value of a register?

    Quote:
    Originally Posted by kahlinor
    I don't understand what you mean. Registers can't be 'frozen' to a specific value, especially one that is used for return values (al).

    The easiest way to preserve a register value is to constantly push and pop the register before and after any code that changes it. Alternatevely, you can store it into a variable and recover it later.
    Correct. And changing registry values during runtime may cause damage because you may delete a value that is needed. So don't mess up with changing registry values. (Believe this: on an x86 there is no way to freeze and/or lock registrys and/or its value).
    __________________
    I am not offering technical guidiance via email or IM
    Come on share your photo with us! CG members photo album!
    Use the Code Tags!
    Reply With Quote
      #4    
    Old December 18th, 2004, 05:48 PM
    Maven Maven is offline
    Junior Member
     
    Join Date: Feb 2003
    Location: Greeneville, TN
    Posts: 17
    Maven is an unknown quantity at this point (<10)
    Re: Change the value of a register?

    Quote:
    Originally Posted by Elden
    Hello,

    is there a way to change the register value of a running program?

    example: (from a debugger)

    7C912927 84E4 TEST AL,AL


    AL=0 and i want to change it to 1 and freeze the value so it always stay to 1. It's possible to do it with a debugger but i would like to learn how to code that in c++

    Any advices, links?

    Thx
    Trying to get rid of cd protection eh? LOL

    psss you hex it from the exe file.
    __________________
    I never travel without my diary. One should always have something sensational to read.
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Other Programming > Assembly


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    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 On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 08:17 PM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
    Copyright WebMediaBrands Inc. 2002-2009