Jump to content

Setting a Window classname else than "AutoIt v3 GUI"


 Share

Recommended Posts

i found a way to register a window class but still u cant use _WinAPI_CreateWindowEx with xskin

i tried to remove the guicreate and replace it with _WinAPI_CreateWindowEx but it destroyed the skin

i searched alot but found nothing if only there was a _WinAPI_SetClass

can anyone help?

thanks

Link to comment
Share on other sites

when you create a window with RegisterClassEx and CreateWindowEx it won't be an AutoIt-window. So all Autoit GUI(Ctrl)... functions won't work with it. You have to do it all on your own.

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

AutoIt is calling RegisterClassExW to register a window class. ClassName member of WNDCLASSEX structure needed for that function is pulled from .rdata section of @AutoItExe. So, part of AutoIt's source code goes like this (interpreted by me obviously):

#pragma section(".rdata", read)
window classname is "AutoIt v3 GUI"
...

Knowing this and depending on your skills or needs you can alter that information.

Link to comment
Share on other sites

Remember Matrix?

Spoon boy: Do not try and bend the spoon. That's impossible. Instead... only try to realize the truth. 
Neo: What truth? 
Spoon boy: There is no spoon. 
Neo: There is no spoon? 
Spoon boy: Then you'll see, that it is not the spoon that bends, it is only yourself.

Do not try to find .rdata, find "AutoIt v3 GUI"

$sCustomParameter = "yehia's class"
$sDefaultParameter = "AutoIt v3 GUI"

$AutoItBin = FileOpenDialog("Choose file", "", "Autoit compiled script (*.exe)|All files (*)")

ConsoleWrite(">Modifying default parameter." & @CRLF)

_CustomizeAutoIt3Parameter($AutoItBin, $sDefaultParameter, $sCustomParameter)

Switch @error
    Case 1
        ConsoleWrite("- Select different parameter to modify to. Skipping modification." & @CRLF)
    Case 3
        ConsoleWrite("- Default parameter couldn't be located. Skipping modification." & @CRLF)
    Case 2, 4
        ConsoleWrite("- Modifying default parameter cannot proceed. Skipping modification." & @CRLF)
    Case 5, 6
        ConsoleWrite("- Internal error. Skipping default parameter modification." & @CRLF)
    Case False
        ConsoleWrite('+>Default parameter successfully modified to: "' & $sCustomParameter & '"' & @CRLF)
EndSwitch



Func _CustomizeAutoIt3Parameter($AutoItBin, $sDefaultParameter, ByRef $sCustomParameter)

    If Not $sCustomParameter Or $sCustomParameter == $sDefaultParameter Then
        Return SetError(1, 0, "") ; $sCustomParameter must be specified and different than original
    EndIf

    ; Making sure that $sCustomParameter will be the same size as $sDefaultClass.
    ; If it's bigger it will be truncated, if smaller anti-truncated (don't know the word)
    ; Also, converting to UTF16 Little Endian.
    Local $tCustomParameter = DllStructCreate("byte[" & 2 * StringLen($sDefaultParameter) & "]")
    DllStructSetData($tCustomParameter, 1, StringToBinary($sCustomParameter, 2))
    Local $bCustomParameter = DllStructGetData($tCustomParameter, 1)
    $sCustomParameter = StringReplace(BinaryToString($bCustomParameter, 2), Chr(0), "") ; will use this to inform about the change after it's done
    ; Converting $sDefaultParameter to binary (UTF16 Little Endian)
    Local $bDefaultParameter = StringToBinary($sDefaultParameter, 2)

    ; reading $AutoItBin, binary mode
    Local $hBinHandle = FileOpen($AutoItBin, 16)
    If $hBinHandle = -1 Then
        Return SetError(2, 0, "") ; $AutoItBin culdn't be opened for reading
    EndIf
    Local $bBinary = FileRead($hBinHandle)
    FileClose($hBinHandle)

    If StringInStr(BinaryToString($bBinary), BinaryToString("0x497420697320612076696F6C6174696F" & _
            "6E206F6620746865204175746F497420" & _
            "45554C4120746F20617474656D707420" & _
            "746F207265766572736520656E67696E" & _
            "65657220746869732070726F6772616D"), 1) Then
        Exit ConsoleWrite("! Not allowed!!!" & @CRLF); don't be an ass
    EndIf

    ; Finding the offset in $AutoItBin where Parameter is written.
    ; Will use StringInStr() function to find offset after properly convert all binary data to coresponding strings.
    ; If there is no $sDefaultParameter inside $AutoItBin (no offset) return error.
    ; Real binary offset is this one minus 1; AutoIt takes offset 0 to be position 1.
    Local $iOffset = StringInStr(BinaryToString($bBinary), BinaryToString($bDefaultParameter), 1)
    If Not $iOffset Then
        Return SetError(3, 0, "") ; For some reason there is no $sDefaultParameter inside $AutoItBin
    EndIf

    ; One more checking needs to be done. That is to confirm that $sDefaultParameter is to be found at only one place inside $AutoItBin,
    ; to avoid possible wrong modification(s).
    ; Looking for the second occurence of $sDefaultParameter inside $AutoItBin and if found returning error.
    If StringInStr(BinaryToString($bBinary), BinaryToString($bDefaultParameter), 1, 2) Then
        Return SetError(4, 0, "") ; Exact unique location of $sDefaultParameter cannot be determined (multiple occurrences)
    EndIf

    ; Actual replacing can take place.
    ; Again using functions that handles strings since there is no binary versions of such.
    ; Binary data needs to be converted to coresponding strings before replacements.
    ; StringReplace() returns new string, so converting to new binary data is needed.
    Local $bBinaryNew = Binary(StringReplace(BinaryToString($bBinary), $iOffset, BinaryToString($bCustomParameter)))

    ; Will write new data to $AutoItBin now.
    $hBinHandle = FileOpen($AutoItBin, 18)
    If @error Then
        Return SetError(5, 0, "") ; $AutoItBin culdn't be opened for writing
    EndIf

    If Not FileWrite($hBinHandle, $bBinaryNew) Then
        FileClose($hBinHandle)
        Return SetError(6, 0, "") ; Problem writing. Highly unlikely to happen.
    EndIf

    FileClose($hBinHandle)

    Return SetError(0, 0, 1) ; All done! Return 1, set @error to 0.

EndFunc   ;==>_CustomizeAutoIt3Parameter

There are few things that you should consider. AutoIt EULA strictly forbid any modification of AutoIt3.exe and AutoIt3_x64.exe.

AutoIt EULA is also not completely clear about some things, but Jon and devs are lately very clear about compiled scripts not being their property nor responsibility. That would mean you can do what ever you want with them, they are yours if you compiled them.

Edited by trancexx
Link to comment
Share on other sites

XSkin (obviously) uses AutoIt GUI function calls.

You do the maths.

...

Do not try to find .rdata, find "AutoIt v3 GUI"

... I will edit this post with some code (after I chop it out of my modification of Jos's Wrapper)

Ditto!

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...