The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Emperor on March 28, 2006, 12:27:54 PM

Title: Help Convert
Post by: Emperor on March 28, 2006, 12:27:54 PM
Hi, I need some help rewriting some code. How would I write this C statement in asm.


(DWORD)(LPVOID)&theVar
Title: Re: Help Convert
Post by: hutch-- on March 28, 2006, 12:40:09 PM
Its not a statement, its a part of one.

Looks like a DWORD sized pointer to data.
Title: Re: Help Convert
Post by: Shantanu Gadgil on March 28, 2006, 12:52:00 PM
Quote(DWORD)(LPVOID)&theVar
As hutch said, it does seem to part of something, assignment perhaps?  :8)

mov ebx, addr theVar (can also use offset instead of addr if theVar is not LOCAL)

All the DWORD and LPVOID is checking enforced by the C compiler, after all an address is an address is an address, isn't it?
Title: Re: Help Convert
Post by: zcoder on March 28, 2006, 01:45:48 PM
Yeah that is part of one it's not all there.

(DWORD)(LPVOID)&theVar

that is takeing a pointer to theVar and making it into a DWORD but 'where' is missing.
value = (DWORD)(LPVOID)&theVar and value has to be a DWORD.

if so then translated is:

    lea edi,theVar
   mov [value],edi

or if you can point to theVar

    mov edi,offset theVar
   mov [value],edi


Zcoder....
Title: Re: Help Convert
Post by: P1 on March 28, 2006, 02:19:51 PM
At www.stanford.edu they use &TheVar as a standard notation in C homework.

Maybe not homework, Who has the original copyright, on this software you are converting?

Regards,  P1  :8)

Title: Re: Help Convert
Post by: Emperor on March 29, 2006, 02:48:54 AM
@hutch--
Thanks for correcting me, true it is not a valid statement but a part of one.

@shantanu_gadgil, zcoder
After looking at your examples I realised that what I am trying to do may not be possible because I know I tryed what you both suggested before I posted here.

@P1
No this isn't any form of homework, I am just trying to convert some code I wrote myself. I only used theVar for my example of my problem.

Edit: And by the way I figured out what was wrong, it wasn't a problem with how I got the address is was how I used it :red
Title: Re: Help Convert
Post by: zcoder on March 29, 2006, 09:17:18 PM
Who has the original copyright, on this software you are converting?

I dont really think he is going o sell his program.
and if he got the source for free then he can learn from it
even convert it to another program to use in a free program.

I am sick of people worried about copyrights.
unless you are going to make something for sale
the average hobbiest does not have to worry about
modifying some dam free source code.

Zcoder....
Title: Re: Help Convert
Post by: P1 on March 29, 2006, 10:03:01 PM
Quote from: zcoder on March 29, 2006, 09:17:18 PMI am sick of people worried about copyrights.
unless you are going to make something for sale the average hobbiest does not have to worry about modifying some dam free source code.
I'll bet the Blackberry company is not saying that.  If there was any money to be had, Linux would be in more trouble than it is now. 

No one is afraid of a snake, who has never been near one or been bitten by one.

Inside the US, one needs to worry about lawyers.  Outside the US, you worry about the rights lawyers should protect.

I am going to guess, you have never been name as a party to a law suit before, have you?

Knowingly help someone to commit a Felony, is to be guilty of a Felony as well.  That means you were an accomplice or culpable ( liable for damages ) at the very minimum.  OJ Simpson had enough lawyers to be proven not guilty, but not enough to be proven not culpable.

Regards,  P1  :8)
Title: Re: Help Convert
Post by: zcoder on March 30, 2006, 12:59:05 AM
Lookup the word PUBLIC DOMAIN.

I have already been to court about such things
once something has been released to the public
it becomes public domain you have lost all your rights to it.

Some case's very on this. and it is clear that Emperor is not making
a program to sell on the market. he is most likely a private person
who has a hobby. and any source he has was give to him freely.

Anyway I think you accused him just by the fact of asking that question.


Zcoder....


Title: Re: Help Convert
Post by: hutch-- on March 30, 2006, 01:15:17 AM
There are a number of viable distinctions in relation to the licence for published source code, public domain is the most loose but it can be copyrighted by someone else. Copyright freeware retains the copyright but allows anyone to use it under certain conditions. Commercial software is what you pay for including its conditions of licence and GPL is copyright software that allows free use of the software but requires that you publish any modifications that are distributed.

Modifiers to all of these are existing capacities in operating systems such as disk IO, memory allocation and the like and it becomes difficult for anyone to copyright something that at best is just another way to do something that many others have already done.

My own choice for most of the stuff I distribute is copyright freeware that anyone can freely use without giving credits for it which includes writing commercial software with it but the copyright protects the software from being taken over or sold as source code. This ensures that it can always reach its target without anyone trying to charge for it.

The solution for anyone who does not want others to use thier code is to simply not publish it. Commercial software is full of this type of code.
Title: Re: Help Convert
Post by: MichaelW on March 30, 2006, 02:54:38 AM
Quote from: zcoder on March 30, 2006, 12:59:05 AM
Lookup the word PUBLIC DOMAIN.

I have already been to court about such things
once something has been released to the public
it becomes public domain you have lost all your rights to it.

In the USA, and I think probably in most countries, releasing a work to the public does not automatically place it in the public domain. In recent times there has been an enormous amount of copyrighted work released to the public that is not in the public domain.

Title: Re: Help Convert
Post by: zcoder on March 30, 2006, 04:22:16 AM
MichaelW ,
Your right, but copyrighted is different, you are protected then.

If someone place's a notice on the work saying it's copyrighted, that does not make it so, no court will uphold that, becouse you
did not apply for a copyright and you just can't by yourself say you are the only one who has done such a thing, or know
if someone else has applyed for such a copyright or not.

Imagine the chaos there would be if there was no real form of keeping the patends and copyrights on records.

GNU suffers from this and the debates go on till this very day.
also you will not find any thing on record about anyone
getting into trouble becouse they used something in the GNU
type software in a comercial app.

if you have heard of such a case can you find it on records or was it not a fact?
and it would not be in the states as we do not up hold such un organized crap.

Zcoder....



Title: Re: Help Convert
Post by: hutch-- on March 30, 2006, 07:09:24 AM
Z,

You are mixing up copyright and patent. The author has copyright on what they write if it is their work where a patent is a registered design which is a different thing. A patent must prove that it is unique and does not voilate an existing patent.

The difference is this, if you created Z_APP and made it copyright Z, then if someone copies it without your permission, they have violated your copyright where if someone wrote their own version of your Z_APP, your copyright does not apply to their work.

With a patent, someone else who write the same app as yours if they have used your patent has violated your patent which is illegal and they then become liable to any legal action you may wish to take against them.

The GNU organisation has in fact taken successful legal action against people who have used their code in a non-published piece of software but iot is usually the case that the offender agrees to publish the work that the code is contained in.
Title: Re: Help Convert
Post by: Emperor on March 30, 2006, 12:11:16 PM
How on earth did my little problem turn into this argument ::)
Title: Re: Help Convert
Post by: hutch-- on March 30, 2006, 12:44:28 PM
Its not an argument, its an additional discussion on licencing. Absolutely do not lose any sleep over it.  :bg
Title: Re: Help Convert
Post by: zcoder on March 30, 2006, 07:47:28 PM
Emperor,
I would not worry, and lose sleep over this.
it it just a discusion about others who worry about copyrights.
I my self don't think that the code given freely on this forum
is for comercial use, nore do I see anyone publish any comercial
source on this forum, and I don't think members have been
trying to make comercial software, I see them all here to learn
as this is all really just a hobby.

Now this does not mean that people from software company's
dont come here, I bet some do, but yet I have never lost
sleep over anyone taking even a small section of source I wrote
and putting it into a app for sale.

Infact what I release is public domain the day I post it. and I am
not going to worry about what others do, thats their business.

and most of all I am not going to accuse someone of copyright
miss use, unless I know all the facts.

And thats what got the topic off topic. LOL

Zcoder..