Sign in to follow this  
Followers 0
Frank Schnell

Execute script using CPAU fails

6 posts in this topic

Hi,

we are using CPAU.exe (http://www.joeware.net/win/free/tools/cpau.htm) to create installation packages which run with administration rights. This way restricted users can install certain software.

I tried now to do the same with a compiled AutoIt script. Unfortunately it fails when executing with an error message "(193) Unknown error".

As we never had an issue with CPAU in the past two years of usage I expect the error to berelated to AutoIt. We just started to use it.

How to reproduce:

1) create a simple AutoIt script foo.au3 with this contents

; Script Start - Add your code below here

MsgBox(0,"TITLE","User name: " & @username)

2) compile it to become foo.exe

3) Encode using CPAU using this command line

cpau -enc -u <administrator UID> -file install.cpau -ex foo.exe

4) Run wrapped executable

cpau -dec -profile -file install.cpau

Instead of executing and displaying username an error is being generated

Attempting to use job file C:\Documents and Settings\fsc\Desktop\install.cpau

Successfully Processed Job File

Error: Couldn't create Process: (193) Unknown Error

The command did not complete successfully.

Did anyone ever successfully use AutiIt compiled scripts with CPAU ?

Tx for any help

FRank

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Not sure about CPAU but you can do the same thing using AutoIts RunAsSet() function. No need for CPAU. The way I do this is set a command line parameter that when not present tells the autoIt script to RunAsSet() with the proper command line and exit. The new new instance then has the credentials.

Edited to add sample code.

If $CmdLine <> "/c"
    RunAsSet("Administrator", @Computername, "adminpassword")
Run(@ScriptFullPath & "/c")
Exit
;~ Your code to run run under new credentials here
;~ Note that Run() and RunWait do not need the script iself to be run under new credentials. (See Help)
Edited by John

Share this post


Link to post
Share on other sites

First off: Does your foo.exe run when it has not been "tampered" with by CPAU?

Then: Try to compile it without compression. My gut felling tells me it is a conflict between CPAU and UPX. But I have not tested it. :whistle:

Share this post


Link to post
Share on other sites

@Uten,

Yes, without CPAU it does run without a problem. How do I compile without compression?

@John,

I have to use CPAU as it does not disclose the password!

Share this post


Link to post
Share on other sites

If you use scite4autoit3 you can use the compiler diretives (scite calls AutoIt3Wrapper.exe witch use the directives).

#Region Compiler directives section
#compiler_compression = 0
#compiler_OutFile_Type=exe         ;a3x
#compiler_run_after=move %out%  c:\temp\ ;TODO: Put it somewhere
;#compiler_run_after=del /F %out%   ;TODO: Or delete it?
#endregion

If you use aut2exe I think there is a setting in the dialog.

Share this post


Link to post
Share on other sites

Uten,

I am using AutoIt v3 and provided that I understood things

correctly I added this code

#Region Compiler directives section

#compiler_compression = 0

#endregion

at the top of my little script and compiled it. It is now

100+ bytes larger. Is that all what compression would be

capable of?

Unfortunately it still generates that error message.

I get the impression AutoIt and CPAU do not work together.

Thanks for helping

Frank

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  
Followers 0