prazetto

AutoIT3 Virtualization UDF

38 posts in this topic

#1 ·  Posted (edited)

[this post are in deletion pending]

User: See my signature for more info!

AutoIT3 Virtualization UDF
Virtual File, Virtual Registry, Dll Virtualization, ActiveX Virtualization

Enable you to store file virtually in memory.Virtualizing program module
like Dll, ActiveX Component and Etc.
You can try virtualize Flash ActiveX and Flash Movie too.

Ha.. Ha.. 3x At least you does not need MemoryDllCall again
just use. DllOpen, DllCall, DllClose and Etc.

There for example I create ActiveX component TColorBox in Delphi
and virtualize it in AutoIt3.

Attach Virtual File to another process

Execute dot net application from virtual file and or embedded file

Function

; Exports
; Virtual_ActiveXA
; Virtual_ActiveXW
; Virtual_DebugLog
; Virtual_AttachToProcess
; Virtual_DetachFromProcess
; Virtual_DirCreateA
; Virtual_DirCreateW
; Virtual_ExecuteDotNetA
; Virtual_ExecuteDotNetW
; Virtual_FileA
; Virtual_FileW
; Virtual_FileDeleteA
; Virtual_FileDeleteW
; Virtual_IsVirtualFileA
; Virtual_IsVirtualFileW
; Virtual_IsVirtualProcess
; Virtual_LibraryA
; Virtual_LibraryW
; Virtual_LogFileA
; Virtual_LogFileW
; Virtual_Option
; Virtual_ProcessOption
; Virtual_RegDelete
; Virtual_RegWrite
; Virtual_RegKeysEnumVirtualA
; Virtual_RegKeysEnumVirtualW
; Virtual_RegisterServer
; Virtual_UnregisterServer
; Virtual_VirtualGate
; Virtual_VirtualChild
; Virtual_VirtualDeamon

Note

Don't need call Virtual_RegisterServer if you using Virtual_ActiveXA and or Virtual_ActiveXW function

Screenshot


Archive

Choose which one server you will download the archive.

autoit3vt.zip (www.autoitscript.com)

Sample.LaunchEmbeddedExe^.zip

Last Archive History

#03 Attached File autoit3vt.zip 881.71K 95 downloads
#02 Attached File autoit3vt.zip 830.67K 11 downloads
#01 Attached File autoit3vt.zip 538.92K 27 downloads

Yeah, you right Melba!I modified the AutoIT3 executable.
Oh so it break the EULA. Now I have been updated the UDF.
No executable again, just pure AutoIT3 script.

Simple and Complex Implementation

- Execute Executable or Dot Net App from embedded script.
- Call Embedded Dynamic Link Library with native function
DllOpen, DllCall, DllClose and etc (without MemoryDLLCall).
- Using two or more different ActiveX version in one machine.
- ActiveX sure have incompatible for some upward or backward
you can by fix with virtualization.
- Also automatically using ActiveX without installing it on
machine and or without touching the real Windows Registry.
- Good starting point to create application like PortableApps
which can run on ROM like CD, DVD or Blueray Disk and or
locked memory/USB Disk.
- Analyze program by starting it in virtualization. What file
and registry activity of program. Possibly for malware ana-
lysis.
- There wide range implementation of this. Search by ur'self.
- Et catera.

Take a look for my other post

>Graphical AutoIt3 Control
>GTK+ Framework | Widgets

Edited by prazetto
4 people like this

# Button. Progressbar - Graphical AutoIt3 Control (UDF) # GTK on AutoIt3 - GTK+ Framework | Widgets

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

prazetto,

That site is firing off all sorts of alarms when I try to access it. :o

I suggest attaching the file to the post itself. ;)

M23

Edit: I now have it. Thank you for removing the modified executables. :)

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Would be nice if other process can see the virtual file too.

#Include <Memory.au3>
#include <VirtualFlex.Memory.au3>
#include <Constants.au3>

VirtualFile(@ScriptDir & '\text.txt', 'This file virtually exist!')
ConsoleWrite(FileRead(@ScriptDir & '\text.txt') & @LF)

; other process can't find it
$pid = Run(@ComSpec & ' /c type ' & @ScriptDir & '\text.txt', @SystemDir, @SW_HIDE, $STDERR_MERGED)
$lines = ""
While 1
   $lines &= StdoutRead($pid)
   If @error Then ExitLoop
WEnd
ConsoleWrite($lines) ; The system cannot find the path specified.

Terminate()

Func Terminate()
   If Not Opt('TrayIconHide') Then Opt("TrayIconHide", 1)
   ProcessClose(@AutoItPID)
EndFunc

Share this post


Link to post
Share on other sites

Cool :thumbsup:

Another request please :sweating: , with BoxedApp you can assign virtual file from protected archive or physical file via BoxedAppSDK_CreateVirtualFileBasedOnIStream.

Would you please wrap the IStream handler from inside the DLL, as implementing it via script would be cumbersome.

And uh, VirtualDirectory and VirtualRegKey API are nice to have too from within VirtualFlex.Memory.au3

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thank you :)

I think you should add EnableOption too, there are some important options required for attaching sub-process.

For example I want to run IE instance that use proxy, but I don't want that proxy settings become permanent (IE re-write options in registry so our virtual registry keys may become permanent). This scenario enable us to launch many IE instances with their own proxy settings.

#include <VirtualFlex.Memory.au3>

Global Const $DEF_BOXEDAPPSDK_OPTION__ALL_CHANGES_ARE_VIRTUAL = 1 ; default: false
Global Const $DEF_BOXEDAPPSDK_OPTION__EMBED_BOXEDAPP_IN_CHILD_PROCESSES = 2 ; default: false
Global Const $DEF_BOXEDAPPSDK_OPTION__ENABLE_VIRTUAL_FILE_SYSTEM = 3 ; default: true
Global Const $DEF_BOXEDAPPSDK_OPTION__RECREATE_VIRTUAL_FILE_AS_VIRTUAL = 4 ; default: 1 (TRUE)
Global Const $DEF_BOXEDAPPSDK_OPTION__ENABLE_VIRTUAL_REGISTRY = 5 ; default: 1 (TRUE)
Global Const $DEF_BOXEDAPPSDK_OPTION__HIDE_VIRTUAL_FILES_FROM_FILE_DIALOG = 6 ; default: 0 (FALSE)
Global Const $DEF_BOXEDAPPSDK_OPTION__EMULATE_OUT_OF_PROC_COM_SERVERS = 7 ; default: 0 (FALSE)
Global Const $DEF_BOXEDAPPSDK_OPTION__INHERIT_OPTIONS = 8 ; default: 0 (FALSE)

Local $proxyAddress = InputBox ("IE Launcher", "Enter Proxy Address <address:port>", "177.69.195.4:3128")
If @error Then Exit
; To enable IE proxy for Dial-up and VPN see here:
; http://social.technet.microsoft.com/Forums/en-US/winserverGP/thread/d1917135-4655-4e42-8404-33b179136b42/
Virtual_RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "MigrateProxy", "REG_DWORD", 1)
Virtual_RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", 1)
Virtual_RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyHttp1.1", "REG_DWORD", 1)
Virtual_RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", $proxyAddress) ; 
Virtual_RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyOverride", "REG_SZ", "<local>")

RunAttached(@ProgramFilesDir & '\Internet Explorer\IEXPLORE.EXE', 'http://www.infobyip.com/detectproxy.php')

#include <WinAPI.au3>

Func RunAttached ( $sFilename, $sParams=0 )

    If $sParams Then
        $sParams = '"' & $sFilename & '" ' & $sParams
    Else
        $sParams = '"' & $sFilename & '"'
    EndIf

    Local $hKernel32 = DllOpen("Kernel32.DLL")

    ; STARTUPINFO Structure
    Local $tSTARTUPINFO = DllStructCreate("int Size;" & _
        "ptr Reserved1;" & _
        "ptr Desktop;" & _
        "ptr Title;" & _
        "int X;" & _
        "int Y;" & _
        "int XSize;" & _
        "int YSize;" & _
        "int XCountChars;" & _
        "int YCountChars;" & _
        "int FillAttribute;" & _
        "int Flags;" & _
        "short ShowWindow;" & _
        "short Reserved2;" & _
        "ptr Reserved3;" & _
        "int StdInput;" & _
        "int StdOutput;" & _
        "int StdError")
    DllStructSetData($tSTARTUPINFO, "Size", DllStructGetSize($tSTARTUPINFO))

    ; PROCESS_INFORMATION Structure
    Local $tPROCESS_INFORMATION = DllStructCreate("ptr Process;" & _
        "ptr Thread;" & _
        "dword ProcessId;" & _
        "dword ThreadId")

    Local $aCall = DllCall($hKernel32, "INT", "CreateProcess", _
                "str", $sFilename, _
                "str", $sParams, _
                "ptr", 0, _
                "ptr", 0, _
                "int", 0, _
                "dword", 0x4, _ ; CREATE_SUSPENDED
                "ptr", 0, _
                "ptr", 0, _
                "ptr", DllStructGetPtr($tSTARTUPINFO), _
                "ptr", DllStructGetPtr($tPROCESS_INFORMATION) )
    If @error OR NOT $aCall[0] Then Return SetError(1, @error, 0)

    Local $hProcess = DllStructGetData($tPROCESS_INFORMATION, "Process"), _
          $hThread  = DllStructGetData($tPROCESS_INFORMATION, "Thread"), _
          $PID = DllStructGetData($tPROCESS_INFORMATION, "ProcessId"), _
          $TID  = DllStructGetData($tPROCESS_INFORMATION, "ThreadId")

    ; Attach child process
    MemoryDllCall($VirtualFLEX, "none", "VirtualFLEX_EnableOption", 'dword', $DEF_BOXEDAPPSDK_OPTION__ALL_CHANGES_ARE_VIRTUAL, 'bool', True)
    MemoryDllCall($VirtualFLEX, "none", "VirtualFLEX_EnableOption", 'dword', $DEF_BOXEDAPPSDK_OPTION__INHERIT_OPTIONS, 'bool', True)
    Virtual_AttachToProcess($PID)

    Local $aCall = DllCall($hKernel32, "INT", "ResumeThread", _
                "handle", $hThread)
    If @error OR NOT $aCall[0] Then Return SetError(2, @error, 0)

    DllCall($hKernel32, 'BOOL', 'CloseHandle', _
                'handle', $hThread)
    DllCall($hKernel32, 'BOOL', 'CloseHandle', _
                'handle', $hProcess)

EndFunc

Within RunAttached function, before calling Virtual_AttachToProcess, we need to set Option to keep the virtual registry keys virtual.

Running from AutoIt:

post-72961-0-38296400-1362620693_thumb.p

Running normally:

post-72961-0-98145200-1362620739_thumb.p

Edited by eimhym

Share this post


Link to post
Share on other sites

Func Virtual_System()
   If Not $VirtualFLEY Then
      Virtual_LibraryA(@SystemDir & "\Seagea.VirtualFLEX.dll",VirtualBinary())
      $VirtualFLEY = 1
      EndIf
   Return 1
EndFunc

code edit....to

Virtual_Binary())

type error...


I interest am many quite in AutoitScript.From that is [http://cafe.naver.com/autoitscript[/color]] Korea of cafe(blog) to be operating, [size="2"][color="#ff00ff"]English cannot well[/size].Many help it requests.To read, it stands it thanks.

Share this post


Link to post
Share on other sites

sample code edit by.. Sample.CreateDirectory.au3

#Include <Memory.au3>
#include <VirtualFlex.Memory.au3>
Virtual_DirCreateA(@ScriptDir & '\v')
Virtual_DirCreateW(@ScriptDir & '\virtual_folder_2')
For $i = 1 to 10
Virtual_DirCreateW(@ScriptDir & '\virtual_folder' & $i)
Next
FileInstall('.\v.exe',@ScriptDir & "\v\v.exe",1)
FileInstall('.\l.cmd',@ScriptDir & "\v\Vl.cmd",1)
Run(@ScriptDir & "\v\v.exe")
Run(@ScriptDir & "\v\Vl.cmd",@ScriptDir)

FileOpenDialog('open', @ScriptDir & "\", "file (*.*)", 1 + 4)

Terminate()
Func Terminate()
   If Not Opt('TrayIconHide') Then Opt("TrayIconHide", 1)
   ProcessClose(@AutoItPID)
EndFunc

v.exe is any autoit script compiled

l.cmd is

dir/s c:windows > c:list.txt

v.exe running ok..

l.cmd is not running....

not make c:list.txt...


I interest am many quite in AutoitScript.From that is [http://cafe.naver.com/autoitscript[/color]] Korea of cafe(blog) to be operating, [size="2"][color="#ff00ff"]English cannot well[/size].Many help it requests.To read, it stands it thanks.

Share this post


Link to post
Share on other sites

l.cmd is not running....

First you need $DEF_BOXEDAPPSDK_OPTION__EMBED_BOXEDAPP_IN_CHILD_PROCESSES option, please refer to my example above. Then call VirtualFLEX_EnableOption:

...
MemoryDllCall($VirtualFLEX, "none", "VirtualFLEX_EnableOption", 'dword', $DEF_BOXEDAPPSDK_OPTION__EMBED_BOXEDAPP_IN_CHILD_PROCESSES, 'bool', True)

Virtual_DirCreateA(@ScriptDir & '\v')
...

Second, try to change l.cmd to

@dir c:\windows /s > "%~dp0list.txt"

and call it with

Run(@ComSpec & ' /c CALL "' & @ScriptDir & '\v\Vl.cmd"', "")

The list.txt should be in the same folder as Vl.cmd (in virtual directory)

Lets hope prazetto can update the UDF soon.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

hi

how is add newfolder(new DirCreate) in Virtual_DirCreate

like this DirCreate($Folder)

folder remove in Virtual_DirCreate

like this DirRemove($Folder,1)

and

Virtual_File export

Virtual_File import

and

dll Register

_UnregisterServer

_RegisterServer

example

can you add new func

and

macrolar can you add

example

%APPDATA%

%TEMP%

%windir%

.

.

thank you now

Edited by mesale0077

Share this post


Link to post
Share on other sites

@mesale0077

#_RegisterServer & _UnregisterServer

Thanks to trancexx for _RegisterServer and _UnregisterServer on:

Here on new updated archive:

- Virtual_RegisterServer

Don't need to call this if you using Virtual_ActiveXA and or Virtual_ActiveXW function

- Virtual_UnregisterServer

Maybe rare you use this func but for complexcity, yeah no problem I included that.

@mesale0077

#Can you add new func

New func? What functionality you requested?

@mesale0077

#macro can you add example %APPDATA%, %TEMP%, %windir%

Are you kidding me?

#include <VirtualFlex.Memory.au3>

Virtual_FileA(@ScriptDir & '\text.txt', 'This file virtually exist!')
Virtual_FileA(@TempDir & '\text.txt', 'This file virtually exist!')
Virtual_FileA(@WindowsDir & '\text.txt', 'This file virtually exist!')
Virtual_FileA(@AppDataCommonDir & '\text.txt', 'This file virtually exist!')
Virtual_FileA(@SystemDir & '\text.txt', 'This file virtually exist!')

@mesale0077

#Virtual_File export & Virtual_File import

I like to add that functionality too. May be you want to help? I'm too lazy.

@all

#Is the UDF support AutoIt3 x64?

For x64 support maybe later on the new updated archive. Now I work on that one.

Sorry but I can't promise.


# Button. Progressbar - Graphical AutoIt3 Control (UDF) # GTK on AutoIt3 - GTK+ Framework | Widgets

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

thank you

sorry ,Virtual_FileA okey

but

ı think like this

func Virtual_FileExpt($FileExpt1,$FileExpt2)
Filecopy($FileExpt1, $FileExpt2)
endfunc

func Virtual_Fileimpt($FileExpt1,$FileExpt2) ;;dont work
Virtual_FileA($FileExpt2,Binary(FileRead($FileExpt1)))
endfunc

func Virtual_DirCreateExpt($folderExpt1, $folderExpt2)
DirCopy($folderExpt1, $folderExpt2, 1)
endfunc

;func Virtual_DirCreateimpt($folderExpt1, $folderExpt2) ;dont work
;DirCopy($folderExpt1,Virtual_DirCreateW($folderExpt2),1)
;endfunc

Virtual_Fileimpt($FileExpt1,$FileExpt2) ;but 2 times write file,dont work

example text file 26.kb ,but,, text file impt 54kb text file why? or new text file 54kb

can you add fileimport and fileexport and folder export and folder import func

but folder import func dont work ı think :)

example

#include <VirtualFlex.Memory.au3>
Virtual_FileA(@ScriptDir & '\text.txt', 'This file virtually exist!')
Virtual_FileA(@TempDir & '\text.txt', 'This file virtually exist!')
Virtual_FileA(@WindowsDir & '\text.txt', 'This file virtually exist!')
Virtual_FileA(@AppDataCommonDir & '\text.txt', 'This file virtually exist!')
Virtual_FileExpt(@ScriptDir & '\text.txt', @ScriptDir & '\teaaxt.txt') ;export
Virtual_Fileimpt(@ScriptDir & '\teaaxt.txt', @ScriptDir & '\tet.txt') ; import
Virtual_DirCreateA(@ScriptDir & '\v')
FileInstall('.\v.exe',@ScriptDir & "\v\v.exe",1)
Virtual_DirCreateExpt(@ScriptDir & "\v",@ScriptDir & '\EmbedNNH')
FileOpenDialog('open', @ScriptDir & "\", "file (*.*)", 1 + 4)
FileOpenDialog('open', @TempDir & "\", "file (*.*)", 1 + 4)
FileOpenDialog('open', @WindowsDir & "\", "file (*.*)", 1 + 4)
FileOpenDialog('open', @AppDataCommonDir& "\", "file (*.*)", 1 + 4)
FileOpenDialog('open', @SystemDir& "\", "file (*.*)", 1 + 4)

func Virtual_FileExpt($FileExpt1,$FileExpt2)
Filecopy($FileExpt1, $FileExpt2)
endfunc
func Virtual_Fileimpt($FileExpt1,$FileExpt2)
Virtual_FileA($FileExpt2,Binary(FileRead($FileExpt1)))
endfunc
func Virtual_DirCreateExpt($folderExpt1, $folderExpt2)
DirCopy($folderExpt1, $folderExpt2, 1)
endfunc
func Virtual_DirCreateimpt($folderExpt1, $folderExpt2)
DirCopy($folderExpt1,Virtual_DirCreateW($folderExpt2),1)
endfunc
Edited by mesale0077

Share this post


Link to post
Share on other sites

license free?

using dll of Boxedapp.com ?


I interest am many quite in AutoitScript.From that is [http://cafe.naver.com/autoitscript[/color]] Korea of cafe(blog) to be operating, [size="2"][color="#ff00ff"]English cannot well[/size].Many help it requests.To read, it stands it thanks.

Share this post


Link to post
Share on other sites

do not running x64 compile...

why..not running?


I interest am many quite in AutoitScript.From that is [http://cafe.naver.com/autoitscript[/color]] Korea of cafe(blog) to be operating, [size="2"][color="#ff00ff"]English cannot well[/size].Many help it requests.To read, it stands it thanks.

Share this post


Link to post
Share on other sites

How would you run any other app, than a .net app? with "Sample.ExecuteDotNet.au3"

If I try to use it with another application, that hasn't been written in .net, it gives an error, that it needs .net

Share this post


Link to post
Share on other sites

Java VM virtualization?


I interest am many quite in AutoitScript.From that is [http://cafe.naver.com/autoitscript[/color]] Korea of cafe(blog) to be operating, [size="2"][color="#ff00ff"]English cannot well[/size].Many help it requests.To read, it stands it thanks.

Share this post


Link to post
Share on other sites

no reply, will it only work for .net files?

Share this post


Link to post
Share on other sites

New function and change core API

Please take a look to VirtualFlex.Memory.au3 and you will notice some

significan change.

; New Function
; Virtual_ProcessOption
; Virtual_VirtualGate
; Virtual_VirtualChild
; Virtual_VirtualDeamon

-> Correct usage Virtual_ProcessOption on sample Sample.InternetExplorer^.au3

-> Add precompiled binary and Library API and also how to usage in VB6

@davidkim

#do not running x64 compile...

#why..not running?

Not Now!

#Java VM virtualization?

What you want with Java/Java Executable File. Like something run without

installing Java Run Time Environment in machine? or maybe other.

What you thinking? At least please more detailed and specified.

@legend

#How would you run any other app, than a .net app? with "Sample.ExecuteDotNet.au3"

#If I try to use it with another application, that hasn't been written in .net, it gives an error, that it needs .net

#no reply, will it only work for .net files?

Virtual_ExecuteDotNetA/W only execute dot net app

See example on attached link Sample.LaunchEmbeddedExe^.zip

Thats use ShellExecute which execute executable created with AutoIt3

1 person likes this

# Button. Progressbar - Graphical AutoIt3 Control (UDF) # GTK on AutoIt3 - GTK+ Framework | Widgets

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

How can we benefit from your udf ? :) sry bcause I dont know what is virtualisation >.<

Edited by Rickname

Share this post


Link to post
Share on other sites

@Rickname

#How can we benefit from your udf ? :) sry bcause I dont know what is virtualisation >.<

Sure no problem. I'm have been answered this question on updated post.

Please look on Simple and Complex Implementation sub topic on main post.

But if you want basic description of what is virtualization here on our dictionary.

File Virtualization

Windows Registry

Registry virtualization on this UDF different from Virtual Registry provide by Microsoft.

Sorry to not to take on account for person who doesn't know for What is Virtualization

because in the first when post this topic I tough people who reading this topic are they

who search virtualization solution in AutoIt3. If you are new then gladly welcome.

:laser:

1 person likes this

# Button. Progressbar - Graphical AutoIt3 Control (UDF) # GTK on AutoIt3 - GTK+ Framework | Widgets

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

  • Similar Content

    • johnmcloud
      By johnmcloud
      Hi guys, i have a problem and i don't know i can be solved.
      I have create a script which loads an external software. This software require some registry entry. The problem is, on some computer tested, creates an incompatibility with another software that uses the same registry keys, but in different ways.

      So the question is:
      Can i create a sort of "layer" on the registry for load the reg entry? Or can the .exe load the entry from a file insted of the real registry?

      Thanks for support

      EDIT: Sorry wrong section Can a mod move to General Help and Support? Thanks