News:

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

WritePrivateProfileString

Started by skywalker, April 13, 2006, 06:22:24 PM

Previous topic - Next topic

skywalker

I can't determine why this isn't working. EAX shows 000000 for the comparison.
Thanks.


.data
      sec     BYTE    "Wie Viel",0          ; [Section]
      key     BYTE    "Nummer",0          ; weights=5                         
      value   BYTE    0E9h,00h             ; Null term string  Alt 233,234 0E9h 0EAh                                   
      file    BYTE    "win1.ini",0
      valueOK BYTE    "Value is OK.",0 
      Sample  BYTE    "Box",0
.code

start:
             

fn WritePrivateProfileString, Offset sec, ADDR key, ADDR value, ADDR file
fn GetPrivateProfileInt,Offset sec,ADDR key,0,ADDR file

.if EAX==0E9h    ;Show a message if stored value is OK



P1

Go back and study the API reference please.

Here is your hint:
An application can use the GetProfileInt function to retrieve an integer value from the WIN.INI file.

Regards,  P1  :8)

skywalker

Quote from: P1 on April 13, 2006, 06:55:23 PM
Go back and study the API reference please.

Here is your hint:
An application can use the GetProfileInt function to retrieve an integer value from the WIN.INI file.

Regards,  P1  :8)

I am not writing to win.ini, but I'll go back and read it again.

ramguru

Your "value" isn't a correct decimal number represented in string...
I guess that would be correct
value BYTE 32h,33h,34h,35h,36h,37h,38h,39h,0
value BYTE "23456789",0
...
.if eax==23456789

P1

Hint #2:
QuoteReturn Value

If the function succeeds, the return value is the integer equivalent of the string following the specified key name in the specified initialization file. If the key is not found, the return value is the specified default value. If the value of the key is less than zero, the return value is zero.

Hint #3:
Quote[Wie Viel]
Nummer=é
What integer number is é or E9h as a string ?

Have you figured out why, you got the return value you got yet?

And your German needs a little help too.  Or should I ask "Wie Viel" of your German needs help?

Regards,  P1  :8)

skywalker

Quote from: P1 on April 13, 2006, 10:21:57 PM
Hint #2:
QuoteReturn Value

If the function succeeds, the return value is the integer equivalent of the string following the specified key name in the specified initialization file. If the key is not found, the return value is the specified default value. If the value of the key is less than zero, the return value is zero.

Hint #3:
Quote[Wie Viel]
Nummer=é
What integer number is é or E9h as a string ?

Have you figured out why, you got the return value you got yet?

And your German needs a little help too.  Or should I ask "Wie Viel" of your German needs help?

Regards,  P1  :8)

Points to the null-terminated string containing the key name whose value is to be retrieved.

String is different from integer.



skywalker

Quote from: ramguru on April 13, 2006, 10:19:54 PM
Your "value" isn't a correct decimal number represented in string...
I guess that would be correct
value BYTE 32h,33h,34h,35h,36h,37h,38h,39h,0
value BYTE "23456789",0
...
.if eax==23456789

See post I made to P1.

P1

Quote from: skywalker on April 14, 2006, 03:23:38 AMSee post I made to P1.
Just have just rejected the advise of two experienced Assembly programmers saying the same thing.  What makes you think you are right ???  Does your code work yet ???

You are rapidly running out of people who will help you, when you will not help yourself.  Even worst, reject the very help you need.

Hint #4:
We have already fixed your problem, but I will not give you the code, because you have not proven to have learned from being given code from other problems.

Hint #5:
You got a zero from your code, because it could not give you a number, so you got the default back. 

You have a serious problem with data types and I recommend a different language that will beep the expletives out for you when it wants to correct you.


Regards,  P1  :8)

P1

Hint #6:
They don't call it Machine Language for nothing.  You need to think like the Machine, otherwise just like a foriegn language to you.

Regards,  P1  :8)

skywalker

#9
Quote from: P1 on April 14, 2006, 02:16:27 PM
Quote from: skywalker on April 14, 2006, 03:23:38 AMSee post I made to P1.
Just have just rejected the advise of two experienced Assembly programmers saying the same thing.  What makes you think you are right ???  Does your code work yet ???

You are rapidly running out of people who will help you, when you will not help yourself.  Even worst, reject the very help you need.

Hint #4:
We have already fixed your problem, but I will not give you the code, because you have not proven to have learned from being given code from other problems.

Hint #5:
You got a zero from your code, because it could not give you a number, so you got the default back. 

You have a serious problem with data types and I recommend a different language that will beep the expletives out for you when it wants to correct you.


Regards,  P1  :8)
Quote from: P1
Go back and study the API reference please.

Here is your hint:
An application can use the GetProfileInt function to retrieve an integer value from the WIN.INI file.

Regards,  P1   :8)

Let's see the help you gave me above.

#1. My code clearly showed I wasn't writing to win.ini
#2. GetProfileInt would not work with my code

I have no problem studying and understanding the API reference.
I don't reject any help as long as it's done with respect.

P1

Quote from: P1 on April 14, 2006, 02:16:27 PMYou have a serious problem with data types ...
What part of this, do you not understand ?

As long as you do not understand data types, what we say or give you will be meaningless.  You have been unable to spot your error because of this.

When you fix the data type error in your code, that is when it will work.

I read the API reference of what you were using, I realized the mistake you made.  Made a test program to, test what I thought was your problem and confirmed it.  Then a second programmer gave you the code example to fix your problem and you dismissed him off as quickly you dismissed me.

Quote from: skywalker on April 14, 2006, 02:53:56 PMI have no problem studying and understanding the API reference.
Hint#7:
In the API reference, there is a data type conversion happening.  And you are missing it !!!

Regards,  P1  :8)

P1

Hint #8:
Look at Hint #3 and ask yourself, if that looks like your code output ???

Regards,  P1  :8)

P1

Quote from: skywalker on April 14, 2006, 02:53:56 PMI don't reject any help as long as it's done with respect.
Is this why, all these people helping you right now ???  Because of your respect of the help we are trying to give you ???

Most people on this board, already know the answer to your problem.  Help me out folks, read the whole post and some others maybe.  Is it Me or Him ???

Regards,  P1  :8)


P1

#13
Quote from: skywalker on April 14, 2006, 02:53:56 PM
#1. My code clearly showed I wasn't writing to win.ini
And who said I was talking about that?  DATA TYPES

Quote from: skywalker on April 14, 2006, 02:53:56 PM
#2. GetProfileInt would not work with my code
GIGO, DATA TYPES



I will not give you the code.  I will only give you pointers.

Now, if you really need help with Data Types, I reccommend that you go through Randy Hyde's The Art of Assembly Language Programming (AoA).

Seriously, consider hiring a assembly programmer for your software.  Or change to another language.

Regards,  P1  :8)

Mark Jones

I've made numerous posts about GetPrivateProfileString in the past and even wrote a multi-line version to fix a "bug" present in its inherent design. Doing a simple site search would have yielded my complete examples, plus 4 other threads on how this API is used. Did you search for GetPrivateProfileString??? :dazzled:

And I know you've read my posts asking other newcomers to read MASM32.HLP, HLHELP.HLP, MASMLIB.HLP, and ASMINTRO.HLP. Have you? Because they all contain KEY INFORMATION required to program in assembly language.

Quote from: Skywalker
I'll keep posting more. There are still plenty here who keep a positive learning attitude. :-)

Yeah, feign indifference... but truth is, nobody is going to keep handing you all the answers Andy, and worse they are starting to dislike you for pestering them, ignoring their hard-earned advice, and quoting every post! See this link for a word discribing these actions.

Please, either try to figure out the answers yourself first (by try I mean spend at least a week on it, then ask one question and be kind about any response you get!) or as P1 says, switch to another language. Assembler is NOT an easy language, and is not user-friendly at all. It very well might be more suited for you to learn something like VB or .NET. An employer is not going to hire you unless you have 20 years or more of assembly programming experience, and since you're interested in cryptography of hidden registry keys and posting links about PE hacking programs and whatnot, I think you're into this for the wrong reasons anyways.

Regards,
Mark
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08