Jump to content
Sign in to follow this  
VitAl2013

Different compilation

Recommended Posts

VitAl2013

For some reasons, I can't fine my theme that I made before. That's why I want make new one and retell more

I have just simple 32bit Processor (I don't remember name) on first machine and 64bit Xeon in second. I take one au3, this:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Version=beta
#AutoIt3Wrapper_Res_File_Add=c:\Temp\res_file.bla, RT_RCDATA, res_f
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#Include <WinAPIEx.au3>

Local $way = "Z:\HOME\"
Local $a = "RES"
Local $b = "file"
Local $where = $way&StringLower($a)&"_"&StringLower(StringLeft($b, 1))&".bla"
Local $what = StringUpper($a)&"_"&StringUpper(StringLeft($b, 1))

MsgBox (64, "$where/what", "$where = "&$where&@CRLF&"$what = "&$what)

_ResSaveToFile($where, $what)
; _ResSaveToFile("Z:\HOME\res_f.bla", "RES_F")
If @error <> 0 Then
   MsgBox (64, "error", "@error = "& @error)
EndIf

Func _ResSaveToFile($sFile, $iRes)

    Local $hFile, $hInst, $hInfo, $hData, $pData, $tData, $iSize, $iByte

    $hInst = _WinAPI_GetModuleHandle('')
    $hInfo = _WinAPI_FindResource($hInst, $iRes, $RT_RCDATA)
    $hData = _WinAPI_LoadResource($hInst, $hInfo)
    $iSize = _WinAPI_SizeofResource($hInst, $hInfo)
    $pData = _WinAPI_LockResource($hData)
    If @error Then
        Return SetError(1, 0, 0)
    EndIf
    $tData = DllStructCreate('byte[' & $iSize & ']', $pData)
    $hFile = _WinAPI_CreateFile($sFile, 1)
    If Not $hFile Then
        Return SetError(2, 0, 0)
    EndIf
    _WinAPI_WriteFile($hFile, DllStructGetPtr($tData), $iSize, $iByte)
    _WinAPI_CloseHandle($hFile)
    If $iByte <> $iSize Then
        Return SetError(3, 0, 0)
    EndIf
    Return 1
EndFunc   ;==>_ResSaveToFile

On first machine I get ResSave_work.zip and it's work ok

On second - ResSave_broken.zip and it's bring error 1

Is it error? Is it error of AutoIT or is is my error? What I should do?

Edited by VitAl2013

Share this post


Link to post
Share on other sites
99ojo

Hi,

did you compile your script with 64 Bit?

;-))

Stefan

P.S: There's no need to upload a 'suspicous' exe file. Everyone can compile your autoit script by himself.

Share this post


Link to post
Share on other sites
VitAl2013

Everyone can compile your autoit script by himself.

I want show that it's different files. They have different size and I assume that different structure. Also I give them for specialists that can say exactly what happened.

did you compile your script with 64 Bit?

Yes I did. I try did it with 64bit (#AutoIt3Wrapper_UseX64) and without. With UPX (#AutoIt3Wrapper_UseUpx) and without. Edited by VitAl2013

Share this post


Link to post
Share on other sites
VitAl2013

I think it's because processor for servers. It's not just simple 64bit processor.

Share this post


Link to post
Share on other sites
KaFu

I have Win7-64bit installed at home. Will test the script later, a reason might also be that the WinAPIEx functions you use are not truely 64bit compatible (see help file about 64bit usage).

Share this post


Link to post
Share on other sites
KaFu

This works for me compiled to x86 and to x64 too...

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_File_Add=C:\test\res_file_in.jpg, RT_RCDATA, res_f
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <WinAPIEx.au3>

Local $where = @ScriptDir & "\" & "res_file_out.jpg"
Local $what = "res_f"

MsgBox(64, "$where/what", "$where = " & $where & @CRLF & "$what = " & $what)

_ResSaveToFile($where, $what)

If @error <> 0 Then
    MsgBox(64, "error", "@error = " & @error)
EndIf

Func _ResSaveToFile($sFile, $iRes)

    Local $hFile, $hInst, $hInfo, $hData, $pData, $tData, $iSize, $iByte

    $hInst = _WinAPI_GetModuleHandle('')
    $hInfo = _WinAPI_FindResource($hInst, $iRes, $RT_RCDATA)
    $hData = _WinAPI_LoadResource($hInst, $hInfo)
    $iSize = _WinAPI_SizeofResource($hInst, $hInfo)
    $pData = _WinAPI_LockResource($hData)
    If @error Then
        Return SetError(1, 0, 0)
    EndIf
    $tData = DllStructCreate('byte[' & $iSize & ']', $pData)
    $hFile = _WinAPI_CreateFile($sFile, 1)
    If Not $hFile Then
        Return SetError(2, 0, 0)
    EndIf
    _WinAPI_WriteFile($hFile, DllStructGetPtr($tData), $iSize, $iByte)
    _WinAPI_CloseHandle($hFile)
    If $iByte <> $iSize Then
        Return SetError(3, 0, 0)
    EndIf
    Return 1
EndFunc   ;==>_ResSaveToFile

Share this post


Link to post
Share on other sites
VitAl2013

KaFu

Do you have server's processor (Xeon) ? Or just 64bit processor?

see help file about 64bit usage

Where is it?

Share this post


Link to post
Share on other sites
KaFu

Standard 64bit, no Xeon. Help-File => AutoIt => Using AutoIt => Running under Windows 64-bit Edition (last section). But as it runs on my CPU I guess it's not related to x64 in general.

Share this post


Link to post
Share on other sites
DW1

Perhaps a server OS issue? Maybe not arch at all?

Share this post


Link to post
Share on other sites
VitAl2013

I have WinXP64bit OS (not server version). Any ideas more?

Normally my computer it's "DELL PRECISION T7500" with downgrade to XP64bit. Processor is "Dual Core Intel® Xeon® Processor E5503, 2.0GHz,4M L3, 4.8GT/s"

Edited by VitAl2013

Share this post


Link to post
Share on other sites
VitAl2013

I install VitrualBOX and emulate 32bit processor - nothing. Not completely, plus 1 more variant - not open files at all.

I download 3300 and 3320 versions. The same mistakes, but each version have different sizes of exe files.

We have theoretical tool for compile 64bit exe in 32bit processor, but maybe... Do we have instrument for compile 32bit exe on 64bit processor?

Share this post


Link to post
Share on other sites
KaFu

The "Compile" dialog in the SciTE AutoIt Editor lets you choose if you want to compile to x86 or x64 on a 64bit OS. If I've got a program which depents on the OSArch, I compile it twice and use a wrapper to choose the right version per OS...

Global $sFilename, $iPID, $timer

If Not FileExists(@ScriptDir & "\SSD") Then DirCreate(@ScriptDir & "\SSD")
Global $sConfig_Path = @ScriptDir & "\SSD"

If @OSArch = "X86" Then
    $sFilename = $sConfig_Path & "\SSD_32bit.exe"
    FileInstall("SSD_32bit.exe", $sFilename)
Else
    $sFilename = $sConfig_Path & "\SSD_64bit.exe"
    FileInstall("SSD_64bit.exe", $sFilename)
EndIf

If Not FileExists($sFilename) Then _Exit("Could not extract OSArch file to" & @CRLF & @CRLF & $sFilename)

Run(FileGetShortName($sFilename) & " " & $CmdLineRaw, $sConfig_Path)

Func _Exit($sMsg = "")
    If $sMsg Then MsgBox(16 + 262144, "SSD Install Error", $sMsg)
    Exit
EndFunc   ;==>_Exit

Share this post


Link to post
Share on other sites
VitAl2013

This program just make install files by FileInstall. I not help with compilation. Also it not add selective resources. I mean After that I can't select what I want save. Or maybe I don't understand your idea.

Here I see just that opened (or saved) resource depends on OS bits. My resources not depend, the just not compiled right.

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
Sign in to follow this  

×