Jump to content

If @OSVersion = "WIN_VISTA" Then and helpdesk.exe


Recommended Posts

Hi folks...Hope someone can shed some light on this one...

First off, i have a DUAL BOOT laptop with XP and VISTA

I have compiled a helpdesk.exe with 7-zip that includes a setup.exe file (compiled with AutoIt) that gets executed at runtime via helpdesk.exe.

Inside the setup.exe file, i have a [if @OSVersion = "WIN_VISTA" Then] function.

Now, when i put the helpdesk.exe file in the "root" of drive C (This IS Vista's "root" by the way) and execute helpdesk.exe, the command in setup.exe (If @OSVersion = "WIN_VISTA" Then) doesn't recognize that its Vista...BUT, when i put helpdesk.exe in a FOLDER ( same drive ie C), the (If @OSVersion = "WIN_VISTA" Then)-command recognize its Vista...Is this some bug, or am i missing something? ^_^

PS: sorry if this is not a AutoIt question, as i must admit...if i extract the embedded setup.exe and put it in the root, it DOES function propperly...

Edited by Robin
Link to comment
Share on other sites

I'm sure it has to do with the path. Are you using the full path or just the name to run it? If you are using just the name, you are doing it wrong.

mmm...just the name...but you got me thinking there...

thx to both you guys ^_^

Edited by Robin
Link to comment
Share on other sites

Can you post a script that replicates your problem?

What OS are you running it on? What version AutoIt?

Bare in mind this ONLY happens if running from 7-zip's helpdesk.exe...If i click on this file directly, no prob...the file still gets executed...

Problem here, is it even executes the XP coding...weired, eh?

Script Start

=======

Case $MSG = $SafeMode

If @OSVersion = "WIN_VISTA" Then

MsgBox(0, "", "hello")

FileCopy(@ScriptDir & "\main.exe", @HomeDrive & "\main.exe", 1)

Sleep(50)

FileCopy(@ScriptDir & "\helpdesk.txt", @HomeDrive & "\helpdesk.txt_", 1)

Sleep(50)

FileCopy(@ScriptDir & "\VistaRunSafe.exe", @HomeDrive & "\VistaRunSafe.exe", 1)

EndIf

If @OSVersion = "WIN_XP" Then

FileCopy(@ScriptDir & "\main.exe", @HomeDrive & "\main.exe", 1)

Sleep(50)

FileCopy(@ScriptDir & "\run.bat", @HomeDrive & "\run.bat", 1)

Sleep(50)

FileCopy(@ScriptDir & "\helpdesk.txt", @HomeDrive & "\helpdesk.txt_", 1)

Sleep(50)

$Attrib1 = FileSetAttrib(@HomeDrive & "\boot.ini", "-R+A-S-H")

If FileExists(@HomeDrive & "\bootback\boot.ini") Then

MsgBox(0x40, "Attention!", "Re-Preparing for Safe-Mode Restart")

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", "Runbat", "REG_SZ", @HomeDrive & "\run.bat")

Else

If @OSVersion = "WIN_XP" Then

$file2 = DirCreate(@HomeDrive & "\bootback")

FileCopy($file1, @HomeDrive & "\bootback\")

MsgBox(0, "Backup!", "File backed up Successfully..Now applying Changes...")

RunWait(@ScriptDir & '\bootcfg /raw "/safeboot:network" /id 1', @SystemDir & "\dllcache", @SW_HIDE)

RunWait("runhelper.exe", @ScriptDir & "\", @SW_HIDE)

EndIf

EndIf

EndIf

Script End

======

Edited by Robin
Link to comment
Share on other sites

Ok, this doesn't make sense.

If @OSVersion = "WIN_VISTA" Then
    ;...
EndIf

If @OSVersion = "WIN_XP" Then ;<<<<<<<<<<<<<<<<<<<<
    ;...
    If FileExists(@HomeDrive & "\bootback\boot.ini") Then
        ;...
    Else
        If @OSVersion = "WIN_XP" Then ;<<<<<<<<<<<<<<<<<<
        ;...
        EndIf
    EndIf
EndIf

Where I added arrows. You are already in an XP block, why are you checking it again?

Link to comment
Share on other sites

@Richard

Probably because he couldn't get it to work and was troubleshooting

@Robin

I have experienced similar issues using macros, try throwing the macro in a variable and asking the variable what the OS is, the following code snip-it fails on Windows Vista/7 in my testing.

CODE-Removed I couldn't reproduce the bug, so I edited the code out...

But throwing @IPAddress4 into a variable first, seems to work fine... Also, you may want to consider the different permissions for different directories. Is your program using #RequireAdmin, if not that is a known cause of issues in Vista machines.

Just my 2cents... ^_^

Edited by BinaryBrother

SIGNATURE_0X800007D NOT FOUND

Link to comment
Share on other sites

Skip the rest. Try the following script.

Tell us what OS you run this on.

Switch @OSVersion
    Case "WIN_XP"
        $sMessage = "Windows XP"
    Case "WIN_VISTA"
        $sMessage = "Windows Vista"
EndSwitch
$msg = "Location = " & @ScriptFullPath & @CRLF & "OS = " & $sMessage

ClipPut ($msg)

MsgBox (0, "Following has been copied to clipboard", $msg)

Please paste the output (done automatically) into this thread, telling us what OS you ran it on (XP or Vista). I'd say the most likely thing is a logic problem on your behalf... ^_^

Cheers,

Brett

Link to comment
Share on other sites

Skip the rest. Try the following script.

Tell us what OS you run this on.

Switch @OSVersion
    Case "WIN_XP"
        $sMessage = "Windows XP"
    Case "WIN_VISTA"
        $sMessage = "Windows Vista"
EndSwitch
$msg = "Location = " & @ScriptFullPath & @CRLF & "OS = " & $sMessage

ClipPut ($msg)

MsgBox (0, "Following has been copied to clipboard", $msg)

Please paste the output (done automatically) into this thread, telling us what OS you ran it on (XP or Vista). I'd say the most likely thing is a logic problem on your behalf... ^_^

Cheers,

Brett

This was done on a VISTA ULTIMATE SP 2

Thanks for the help guys..Far as I believe, its NOT a bug...like the previous poster said...some fault on my side..will recheck my code..lol

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...