News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Help Convert

Started by Emperor, March 28, 2006, 12:27:54 PM

Previous topic - Next topic

Emperor

Hi, I need some help rewriting some code. How would I write this C statement in asm.


(DWORD)(LPVOID)&theVar

hutch--

Its not a statement, its a part of one.

Looks like a DWORD sized pointer to data.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Shantanu Gadgil

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?
To ret is human, to jmp divine!

zcoder

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....
Back in 1979, My computer ran so fine.
And there was no such thing,
As a Microsoft Crashed Machine.
http://zcoder.110mb.com
http://www.dietzel.com/partner/idevaffiliate.php?id=345_6  Free Domain Names

P1

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)


Emperor

@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

zcoder

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....
Back in 1979, My computer ran so fine.
And there was no such thing,
As a Microsoft Crashed Machine.
http://zcoder.110mb.com
http://www.dietzel.com/partner/idevaffiliate.php?id=345_6  Free Domain Names

P1

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)

zcoder

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....


Back in 1979, My computer ran so fine.
And there was no such thing,
As a Microsoft Crashed Machine.
http://zcoder.110mb.com
http://www.dietzel.com/partner/idevaffiliate.php?id=345_6  Free Domain Names

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

MichaelW

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.

eschew obfuscation

zcoder

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....



Back in 1979, My computer ran so fine.
And there was no such thing,
As a Microsoft Crashed Machine.
http://zcoder.110mb.com
http://www.dietzel.com/partner/idevaffiliate.php?id=345_6  Free Domain Names

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Emperor

How on earth did my little problem turn into this argument ::)

hutch--

Its not an argument, its an additional discussion on licencing. Absolutely do not lose any sleep over it.  :bg
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php