Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Get language name then CE start

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
GH*master
Expert Cheater
Reputation: 8

Joined: 10 Jan 2008
Posts: 159

PostPosted: Wed Apr 11, 2012 11:42 am    Post subject: Get language name then CE start Reply with quote

I have some problem.

This analog code from C++
Code:

TCHAR wlocale[255];
GetSystemDefaultLocaleName(wlocale, 255); // result wlocale = "ru-RU"


Debug code:
Code:
   TCHAR wlocale[255];
   GetSystemDefaultLocaleName(wlocale, 255);
0114322C  mov         esi,esp 
0114322E  push        0FFh 
01143233  lea         eax,[wlocale] 
01143239  push        eax 
0114323A  call        dword ptr [__imp__GetSystemDefaultLocaleName@8 (1145048h)] 
01143240  cmp         esi,esp 
01143242  call        _RTC_CheckEsp (1143710h)



GetSystemDefaultLocaleName is kernel32.GetSystemDefaultLocaleName


I rewrite code from CE Lua:

Code:
local aaCode = [[

alloc(bufferMem,1024)
alloc(codeMem,1024)

label(strLanguageNameOS)
registersymbol(strLanguageNameOS)

codeMem:
mov eax, [esp]
mov [lastPoint],eax

push 0FFh
lea  eax,[bufferMem]
push eax
call kernel32.GetSystemDefaultLocaleName

mov eax,[lastPoint]
push eax
ret

lastPoint:
dd 0

bufferMem:
   strLanguageNameOS:
   dd 0

createthread(codeMem)
]]

autoAssemble(aaCode, true)

local valLang = readStringLocal("strLanguageNameOS")

print(valLang)


But no any result that I needed (CE 6.2 Beta 5, Win7 64)
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Wed Apr 11, 2012 12:52 pm    Post subject: Reply with quote

Readstringlocal might not know that strLanguageNameOS is (there are 2 symbol tables, and I guess getAddress looks it up in the target process symbollist, bug)

See if you can find another method.
00400500 tends to be free. Don't forget to add FullAccess(00400500,1) to your aa script

Also, add in a check to see if the thread is done or not

And perhaps lua also has a method of getting the language
If it's regarding translations, 6.2 has a ini file where you can specify the language to use regardless of the os language

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8516
Location: 127.0.0.1

PostPosted: Wed Apr 11, 2012 1:18 pm    Post subject: This post has 1 review(s) Reply with quote

This works from the auto-assembler window:

Code:

globalalloc(threadMem,1024);
globalalloc(bufferMem,1024);
label(localeName)
registersymbol(localeName)
createThread(threadMem);

bufferMem:
    localeName:
    dd 00

threadMem:
    push 0FF
    lea eax, [bufferMem]
    push eax
    call kernel32.GetSystemDefaultLocaleName
    ret


You can call it from Lua like this but there is no way to easily read a unicode string as of now:

Code:


local script = [[
    globalalloc(threadMem,1024);
    globalalloc(bufferMem,1024);
    label(localeName)
    registersymbol(localeName)
    createThread(threadMem);

    bufferMem:
        localeName:
        dd 00

    threadMem:
        push 0FF
        lea eax, [bufferMem]
        push eax
        call kernel32.GetSystemDefaultLocaleName
        ret
]];

-- Reinitialize the symbol handler..
reinitializeSymbolhandler();

-- Compile the script and run it..
local compiled = autoAssemble( script, true );
print( "Script compile status: " .. tostring( compiled ) );

-- Attempt to read the string..
local locale = readString( getAddress( "localeName" ) );
print( locale );


_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites