Jump to content

How to get CompanyName property from a file


cresch
 Share

Recommended Posts

I'm using AutoIt3 to launch programs with admin rights on locked down systems for some of our users. I would like to be able to create a script that would launch any executable from a particular list of companies. (Yeah, I know a programming could easily bypass this security method, but for our purposes it should suffice)

I'm looking for something like FileGetCompanyName (similar to FileGetVersion). However, since this does not currently existing within AI3, I think I'm going to have to resort to something like using DLLCall to call the appropriate function to get this info. Unfortunately, I'm pretty new at calling windows DLLs.

Near as I can tell, there is a FileVersionInfo.CompanyName property that gives me what I want, but it appears to be a .NET framework class library function (not sure if that matters for DLLCall or not). We do have the .NET framework installed on the systems on which I intend to run the scripts, so it's not really an issue as long as I can call it. I haven't any idea how to figure out the actual DLL the function resides in, though.

Can anyone point me towards some samples I might look at to accomplish this task?

Thanks

Chris

Link to comment
Share on other sites

Try the RunAsSet() Command.

Example:

RunAsSet("Administrator","DOMAIN","ThisIsMyPassword", 1)
 RunWait("regedit.exe")

Where the 1 is:

You could use 0 - Don't load the user, just stick to where I'm currently logged in

1 - Load the user account

2 - For net credentials only

F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent]
Link to comment
Share on other sites

Thanks, I already know how to run as a user.....what I'm trying to do is validate the file version info of the executable to be run (to determine if I should allow run as user or deny).

At any rate, I think I found a lead: http://www.jsware.net/jsware/scripts.php3#fvinfo

At the above link is a vbscript that has been enhanced to provide the extended file info (company name, copyright, etc.) that are typically seen in the Version tab when you right-click on an exe file and choose properties.

I'm working on writing the AI3 script, which will allow the user to browse out and select the file to launch (done), and then I'll somehow shell out (have to think about this one) and execute the script to get the extended version info I need, and then continue within AI3 and either launch with credentials or deny the launch.

Of course, the other goal is the compile and encrypt the entire package, so that it's not obvious what is being done or how things are being launched, thus the reason to start with AI3 instead of simply launching a VBscript.

Link to comment
Share on other sites

Just use _IsAdmin.

$admincheck = _IsAdmin

While 1

if $admincheck = 0 then

<--- Use "if processexists() then" here

<--- Use ProcessClose()

elseif $admincheck = 1 then

<---use RunAsSet here()

<--- Then RunWait()

wend

I think this should do it.

Edited by eynstyne
F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent]
Link to comment
Share on other sites

Just use _IsAdmin.

$admincheck = _IsAdmin

While 1

if $admincheck = 0 then

<--- Use "if processexists() then" here

<--- Use ProcessClose()

elseif $admincheck = 1 then

<---use RunAsSet here()

<--- Then RunWait()

wend

I think this should do it.

Sorry, but you're missing the whole point of what I'm trying to do. The users don't have admin rights on their own....for certain programs, I'm allowing them to launch with admin rights (via AI). I've got it just about figured out, based on the code posted in my previous message, though.

Link to comment
Share on other sites

This post at the MSDN blog site talks about this some using a tool from Microsoft, but it was no longer available when I searched for it. Examples in VBScript, if you could find the tool you'd have to make the port to AutoIt3.

Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Link to comment
Share on other sites

This post at the MSDN blog site talks about this some using a tool from Microsoft, but it was no longer available when I searched for it. Examples in VBScript, if you could find the tool you'd have to make the port to AutoIt3.

Thanks.....that does look like an interesting approach. The tool is available from the Microsoft site...just have to search on their site instead of clicking the link. Only drawback I see is that it requires the DLL to be installed on each system. Using just vbscript calls without the external DLL, I was able to retrieve the basic info I needed (not nearly as complete as what this DLL would return, but all the items you would see if you right-click Properties and look at the version info).

Thanks for the info!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...