Initializing DX to Code Segment(CS) Memory Address...?!? 
Author Message
 Initializing DX to Code Segment(CS) Memory Address...?!?

;portion of source code from test.exe

find db 'test.exe',00h
.
.
.
mov ax,3d02h
mov dx,offset find
int 21h
xchg bx,ax
mov ah,40h
mov cx,20 ;20 bytes to be copied
mov dx,offset start_copy
int 21h
mov ah,3eh
int 21h
.
.
.
start_copy:  lea bx,start0
xor_loop1: mov ah,cs:[bx]
           xor ah,0ffh
           mov cs:[bx],ah
           inc bx
           cmp bx,offset start0+39
           jle xor_loop1
start0:

Here is my question! I am coding a program. Let's call this program "test.exe".
I created a target file. Let's call the target file "target.exe". Here is what
I am trying to do. I am trying to copy portion of source code from "test.exe"
to "target.exe" by using "mov ah,40h int 21"

I set CX to the numbers of bytes to be copied from "test.exe" to "target.exe".
So far so good!

I have to set DX so that it points to the address where "start_copy" starts,
and that address *should* point to Code Segment (CS) because that's where the
bytes, that I like to copy, are...

When I initialize DX to "start_copy" by using "mov dx,offset start_copy". DX
points to Data Segment (DS), which is not where the bytes, that I want to copy,
are  

What can I do so that DX points to memory address in Code Segment(CS)?

Any ideas?



Thu, 18 Mar 2004 23:25:31 GMT  
 Initializing DX to Code Segment(CS) Memory Address...?!?
Hello.

Right before <mov dx, OFFSET start_copy> do:
    push    ds    ; save old data segment on the stack
    push    cs
    pop     ds    ; set the data segment to the code segment
    mov    dx, OFFSET start_copy
    int    21h
    pop    ds    ; restore old data segment from the stack

Regards,
comrade


;portion of source code from test.exe

find db 'test.exe',00h
.
.
.
mov ax,3d02h
mov dx,offset find
int 21h
xchg bx,ax
mov ah,40h
mov cx,20 ;20 bytes to be copied
mov dx,offset start_copy
int 21h
mov ah,3eh
int 21h
.
.
.
start_copy:  lea bx,start0
xor_loop1: mov ah,cs:[bx]
   xor ah,0ffh
   mov cs:[bx],ah
   inc bx
   cmp bx,offset start0+39
   jle xor_loop1
start0:

Here is my question! I am coding a program. Let's call this program
"test.exe".
I created a target file. Let's call the target file "target.exe". Here is
what
I am trying to do. I am trying to copy portion of source code from
"test.exe"
to "target.exe" by using "mov ah,40h int 21"

I set CX to the numbers of bytes to be copied from "test.exe" to
"target.exe".
So far so good!

I have to set DX so that it points to the address where "start_copy" starts,
and that address *should* point to Code Segment (CS) because that's where
the
bytes, that I like to copy, are...

When I initialize DX to "start_copy" by using "mov dx,offset start_copy". DX
points to Data Segment (DS), which is not where the bytes, that I want to
copy,
are

What can I do so that DX points to memory address in Code Segment(CS)?

Any ideas?



Fri, 19 Mar 2004 01:22:08 GMT  
 Initializing DX to Code Segment(CS) Memory Address...?!?

Quote:

> Here is my question! I am coding a program. Let's call this program
"test.exe".
> I created a target file. Let's call the target file "target.exe". Here is
what
> I am trying to do. I am trying to copy portion of source code from
"test.exe"
> to "target.exe" by using "mov ah,40h int 21".

Here is my answer! You are coding a virus. Let's call this virus
"virus.exe". You have a target file to infect. Let's call the target file
"MSWord.exe". Here is what you are trying to do. You are trying to copy a
portion of your virus code from "virus.exe" to "MSWord.exe" by using "mov
ah,40h int 21h".

Quote:
> I set CX to the numbers of bytes to be copied from "test.exe" to

"target.exe".

[ snip description of problem that displays a largely empty understanding of
even basic assembly concepts ]

Quote:
> What can I do so that DX points to memory address in Code Segment(CS)?

On top of all this, the solution (as demonstrated in comrade's reply) is
entirely obvious...so, it seems you can't even be bothered to think or work
to create your virus...though I'm not surprised by such impatience, as it is
certainly characteristic of someone who's got "control issues" because, what
you don't seem to realise is, is that that lack of control entirely stems
from your lack of committment and determination to work to get such control
over your life and a massive over-dependence on other people to spoon-feed
you the solutions to everything...does Mommy still tie up your shoelaces for
you? ;)

Quote:
> Any ideas?

Yes; Learn at least the basics of assembly before you start getting any dumb
ideas about writing viruses in it...

Better yet, realise that this urge to write viruses is merely a
manifestation of a deep-rooted psychological issue about not feeling in
control of your life...coupled with the false notion you hold that exacting
a forced control over these {*filter*} forces in your life will earn you some
form of respect and authority (no doubt derived from the foolish and
incorrect images protrayed in films and TV that the destruction and theft of
people's data is "cool" and "maverik"...but, realise, that this is as much
the unreality of TV and films as the cowboy who kills people is "cool"...in
cold reality, just as that {*filter*} is, theft and vandalism are totally
unacceptable and can ruin other people's lives, possibly beyond
recovery)...which, btw, it won't...

When, in fact, it is simply _outright vandalism_ and _blatant theft_...the
medium used does NOT distinguish it legally, morally or, in any form,
acceptably from crimes such as common burglary and destruction of private
property...and it is certainly possible for such a crime to cause as much,
or more, damage and upset to people and companies than those more
traditional versions of the _same basic crimes_...and that this is not an
activity with an acceptable rebellious "underground" scene but one with a
distinctly _criminal_ underground, if you get too wrapped up in it...

But I won't over-preach this...if you insist, then go right ahead, find out
the hard way that I'm just trying to tell you how it really is...after all,
preaching to someone who's insisting on being "rebellious" is hardly the way
to get across a message that I believe is in everyone's interests, in the
long run...

Anyway, I'll put it this way...there is a simple requirement to being
clever: Using your brain! hehehe ;)

Beth :)



Sun, 21 Mar 2004 22:53:29 GMT  
 Initializing DX to Code Segment(CS) Memory Address...?!?
Whoa, that was a lot in one go. Guess he added the last drop to a full cup.

Fake


Quote:

> > Here is my question! I am coding a program. Let's call this program
> "test.exe".
> > I created a target file. Let's call the target file "target.exe". Here
is
> what
> > I am trying to do. I am trying to copy portion of source code from
> "test.exe"
> > to "target.exe" by using "mov ah,40h int 21".

> Here is my answer! You are coding a virus. Let's call this virus
> "virus.exe". You have a target file to infect. Let's call the target file
> "MSWord.exe". Here is what you are trying to do. You are trying to copy a
> portion of your virus code from "virus.exe" to "MSWord.exe" by using "mov
> ah,40h int 21h".

> > I set CX to the numbers of bytes to be copied from "test.exe" to
> "target.exe".

> [ snip description of problem that displays a largely empty understanding
of
> even basic assembly concepts ]

> > What can I do so that DX points to memory address in Code Segment(CS)?

> On top of all this, the solution (as demonstrated in comrade's reply) is
> entirely obvious...so, it seems you can't even be bothered to think or
work
> to create your virus...though I'm not surprised by such impatience, as it
is
> certainly characteristic of someone who's got "control issues" because,
what
> you don't seem to realise is, is that that lack of control entirely stems
> from your lack of committment and determination to work to get such
control
> over your life and a massive over-dependence on other people to spoon-feed
> you the solutions to everything...does Mommy still tie up your shoelaces
for
> you? ;)

> > Any ideas?

> Yes; Learn at least the basics of assembly before you start getting any
dumb
> ideas about writing viruses in it...

> Better yet, realise that this urge to write viruses is merely a
> manifestation of a deep-rooted psychological issue about not feeling in
> control of your life...coupled with the false notion you hold that
exacting
> a forced control over these {*filter*} forces in your life will earn you
some
> form of respect and authority (no doubt derived from the foolish and
> incorrect images protrayed in films and TV that the destruction and theft
of
> people's data is "cool" and "maverik"...but, realise, that this is as much
> the unreality of TV and films as the cowboy who kills people is
"cool"...in
> cold reality, just as that {*filter*} is, theft and vandalism are totally
> unacceptable and can ruin other people's lives, possibly beyond
> recovery)...which, btw, it won't...

> When, in fact, it is simply _outright vandalism_ and _blatant theft_...the
> medium used does NOT distinguish it legally, morally or, in any form,
> acceptably from crimes such as common burglary and destruction of private
> property...and it is certainly possible for such a crime to cause as much,
> or more, damage and upset to people and companies than those more
> traditional versions of the _same basic crimes_...and that this is not an
> activity with an acceptable rebellious "underground" scene but one with a
> distinctly _criminal_ underground, if you get too wrapped up in it...

> But I won't over-preach this...if you insist, then go right ahead, find
out
> the hard way that I'm just trying to tell you how it really is...after
all,
> preaching to someone who's insisting on being "rebellious" is hardly the
way
> to get across a message that I believe is in everyone's interests, in the
> long run...

> Anyway, I'll put it this way...there is a simple requirement to being
> clever: Using your brain! hehehe ;)

> Beth :)



Tue, 23 Mar 2004 04:12:01 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Initializing DX to Code Segment(CS) Memory Address…?!?

2. Code Segment Address

3. Effective address to 'segmented' address

4. data segment vs code segment

5. error in segment CS ?

6. Accessing absolute memory addresses in machine code

7. Initializing segment registers

8. Linking plain assembly and the /i (initialize all segments) option

9. initialize DS to data segment

10. Initialized data segment when using entries (CA-REALIA 5.x)

11. Locating the memory address range of a network card MAC address

12. assume cs:code,ds:code

 

 
Powered by phpBB® Forum Software