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 


Lua Script (Win API) Not Work After Windows Upadate

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sun Jan 15, 2023 9:56 pm    Post subject: Lua Script (Win API) Not Work After Windows Upadate Reply with quote

1. According to MS I knew DWM has suspended since Windows 8.
Anyhow, before my Windows update to Windows 10 64 Bit, I tried using DWM function and work just fine. Now, on CE 7.4 64 bit, on my Windows 10 64 bir, I got this error :

Code:
Error:Failure determining what dwmapi.DwmEnableComposition means


How this happen and how to fix it?.


2. I tried using undocumented function 'SetWindowCompositionAttribute' to make form blur like like on Windows 7, since the function DWM API Blur behind window, can not use.

Code:
if f then f.destroy() end
f = createForm()
f.Position = poScreenCenter
f.BorderStyle = bsNone
f.setSize(600, 400)
f.Color = 0xEDA200
f.OnMouseDown = function() f.dragNow() end

function SetWindowCompositionAttribute(hwnd, data)
 return executeCodeLocalEx("user32.SetWindowCompositionAttribute", hwnd, data)
end

--WindowsCompostionAttributeData = {Attribute = 0, Pdata = 0, SizeOfData = 0}

ACCENT_DISABLED = 0
ACCENT_ENABLE_GRADIENT = 1
ACCENT_ENABLE_TRANSPARENTGRADIENT = 2
ACCENT_ENABLE_BLURBEHIND = 3
ACCENT_INVALID_STATE = 4
WCA_ACCENT_POLICY = 19

accent = createMemoryStream()
accent.writeDword(ACCENT_ENABLE_BLURBEHIND)

dt = [[
data = WindowsCompostionAttributeData
data.Attribute = WCA_ACCENT_POLICY
data.SizeOfData = accent.Size
data.Pdata = readPointer(accent.Memory)
]]

data = createMemoryStream()
data.writeDword(19)
data.writeDword(accent.Size)  -- Marshal Size Of accent
data.writeDword(readPointerLocal(accent))  -- VarPtr(accent)

SetWindowCompositionAttribute(f.Handle, data.Memory)

f.Show()


But unlucky the script doesn't work.
How to write the script correctly in CE Lua?. In case this function SetWindowCompositionAttribute jut work fine when I am use C++ or Delphi. Any solutions?

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
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: Mon Jan 16, 2023 2:34 am    Post subject: Reply with quote

maybe it has been renamed and microsoft just added a compatibility rename

check enumerate dll's and symbols and see if you can find it.
or see where it goes to when debugging in c++ or Delphi

_________________
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
.lua
Expert Cheater
Reputation: 1

Joined: 13 Sep 2018
Posts: 189

PostPosted: Wed Jan 18, 2023 11:15 am    Post subject: Reply with quote

The alias has not been modified and still exists


GIF.gif
 Description:
 Filesize:  324.51 KB
 Viewed:  1576 Time(s)

GIF.gif


Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Thu Jan 19, 2023 1:55 am    Post subject: Reply with quote

Yes, I know that dwmapi.dll still there on system32 or SysWOW64.
Anyhow, when using CE 7.4 Bit on Windows 10 64 bit, when try to load a function i.e : "DwmExtendFrameItoClientAre" or others functions won by dwmapi.dll, CE 7.4 return error "Error:Failure determining what....function name".

That just work find when I try on my other machine, Windows 7 Ultimate 64 bit + CE 7.4 64 bit.
The screenshot arttach using Windows 10 64 Bit, shown the dwmapi function still there.

P.S : and CE 7.4 doen't have function "createLib", except add a plug-in and I don;t have that plug-in.



Capture.PNG
 Description:
 Filesize:  68.81 KB
 Viewed:  1539 Time(s)

Capture.PNG



_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
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: Thu Jan 19, 2023 3:56 am    Post subject: Reply with quote

load the dll into cheat engine explicitly and then do a reinitializeSelfSymbolhandler()
_________________
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
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Thu Jan 19, 2023 7:03 am    Post subject: Reply with quote

Like this?. If yes then thanks DB.

Code:
dwmExtend = assert( package.loadlib( "C:\\Windows\\system32\\dwmapi.dll", "DwmExtendFrameIntoClientArea" ) )
reinitializeSelfSymbolhandler(dwmExtend)
-- result : Loaded


Another test :

Test 1 :

Code:
sm = assert( package.loadlib( "C:\\Windows\\system32\\user32.dll", "MessageBoxA" ) )
reinitializeSelfSymbolhandler(sm)

MB_OK = 0
MB_ICONERROR = 16
sm(0, "An error has occurred!", "Title!", MB_OK)()

-- result : ERROR. Acces Violation


Test 2 :

Code:
function mbox(hWnd, lpText, lpCaption, uType)
 return executeCodeLocalEx("user32.MessageBoxA", hWnd, lpText, lpCaption, uType)
end

mbox(0, "An error has occurred!", "Title!", MB_ICONERROR or MB_OK)

-- Result as attached image



Capture.PNG
 Description:
 Filesize:  14.01 KB
 Viewed:  1483 Time(s)

Capture.PNG



_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
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