Jump to content
damian666

[Solved] Weird problem with filesize check...

Recommended Posts

Hi guys,

 

i have a script to change some icons in windows 10, because current icons are fugly :P

Func SizeCheck()
    FileCopy(@WindowsDir & "\system32\imageres.dll", @ScriptDir & "\check-imageres.dll", 1)
    sleep(2500)
    
    local $size1 = Round(FileGetSize(@ScriptDir & "\check-imageres.dll") / 1048576, 1)
    local $size2 = Number(IniRead(@ScriptDir & "\FileSize.ini", "Sizes", "ImageRes.dll", "0"))

    TrayTip("Icon Changer", "Current size is " & $size1, 0, $TIP_ICONASTERISK)
    sleep(2500)
    TrayTip("Icon Changer", "Patched file size is " & $size2, 0, $TIP_ICONASTERISK)
    sleep(2500)

    ;FileDelete(@ScriptDir & "\check-imageres.dll")

    if $size1 = $size2 Then
        Return True
    Else
        Return False
    EndIf
EndFunc

my problem is that the file reports 57.3mb in the destination, but when i copy it to the workdir, its 54.4mb

 

anyone knows what the hell is up with that?

 

Damian

Edited by damian666

Share this post


Link to post
Share on other sites

What are the exact properties for the 2 files when you look at their sizes via Windows Explorer?

Jos

Share this post


Link to post
Share on other sites

Do you have a x64 OS?

Your script likely runs in x86 mode so you need to check the C:\Windows\SysWOW64 directory version.

Jos

Share this post


Link to post
Share on other sites

On my WIn 8.1 x64 both imageres.dll versions are the same size (48.847.872 bytes) and your function seems to work properly.

I will test on my Win10 vm and will reply if I get the same result.


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

hmm... that one is indeed 54.4, BUT... i explicitly use @WindowsDir & "\system32\"

 

to get the right one, that should be the right one not?

​Well, it all depends how you Run/Compile your script either using the x86 or x64 versions.

Jos

Share this post


Link to post
Share on other sites

i compile it x86, always do :P

 

but even when ran from scite it does the same...

​Yea, that probably runs AutoIt3.exe, which is the x86 version.

Just play with this statement when you have the full SciTE4AutoIt3 installer:

#AutoIt3Wrapper_UseX64=y ; and try also n

Jos

Share this post


Link to post
Share on other sites

No problem on my WIn10 x86. File sizes are the same on both locations.

 

The strange thing is on your 2nd screenshot -> file size and size on disk are the same values!

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

what the hell... xd

 

that did it Jos, using X64 compile made it report the right size.

then my next question is... how the hell will i make it choose the right file if that doesnt work?

 

using x86 compile should default to system32 right? and x64 compile should look in syswow...

 

but now its backwards? O.o

 

Edited by damian666

Share this post


Link to post
Share on other sites

You could say the following:

The C:\Windows\SysWOW64 directory is the C:\Windows\System32 directory for X86 programs.

Jos

 

Share this post


Link to post
Share on other sites

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1)

that one line fixes most of my redirection issues


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
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

×
×
  • Create New...