Jump to content
Sign in to follow this  
VitAl2013

64bit Xeon

Recommended Posts

VitAl2013

1) AutoIt3Wrapper is 2.0.1.24

2) AutoIt is 3.3.6.1

3) WinAPIEx.au3 is 2.2

4) Code:

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

Local $way = "C:\temp"
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)
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

According CFF.png I have this resource inside. But I have @error=1 - as result it don't write to the disk. Why? What I should do?

res_file.zip

post-49718-12725326154102_thumb.png

Edited by VitAl2013

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.