Jump to content

Recommended Posts

Posted

Hi all,

I want to check if a file exists under the System32 folder: C:\Windows\System32\inetsrv\rewrite.dll

The following code always worked for me:

$string = @SystemDir & "\inetsrv\rewrite.dll"
ConsoleWrite(FileExists($string))

But yesterday I updated my Windows 10 with the last "big" update and now my @SystemDir returns the following string:

C:\Windows\SysWOW64

And before it was:

C:\Windows\System32

So I thought I change my code to:

$string = @WindowsDir & "\System32\inetsrv\rewrite.dll"
ConsoleWrite(FileExists($string))

But this code also does not work. I tried to run it as administrator but this also didn't work.

What am I doing wrong?

Regards,

lrstndm

Posted

Why does that matter?

So for a 32-bit machine I need to compile a 32 bit version. And for a 64-bit machine I need to compile a 64 bit version?

What changed in the meantime? Because this always worked for me?

 

Posted (edited)

on my system windows 8.1 64 bit with the last version of autoit

run script x86  @systemDir   =  C:\Windows\SysWOW64

run script x64  @SystemDir   = C:\Windows\system32

the same if i compile the script

 

Edited by HAL9000
i was wrong
Posted

Is it possible to disable (or something else) this. So that it always checks this good.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Compile_Both=y
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
$string = @WindowsDir & "\System32\inetsrv\rewrite.dll"
ConsoleWrite(FileExists($string))

I currently changed the code with the above code. The UseX64 has to be on 'y' because else it returns 0 (file not exists).

But when I check the string variable is says the exact same value. I just cannot imagine how this could be wrong.

Is it possible someone explains this?

  • Developers
Posted

It seems you do not understand yet how windows handles the mixed x64 and x86 processes on an x64 Windows version.
Maybe you need to do a little more reading on that. :)

Either way, a couple of questions before being able to give you the right answer:

  • Do the computers, that run this script, all have an X64 OS installed?
  • What exactly is it you want to test for: the existence of rewrite.dll in the X86 or x64 world?
  • What action should this lead to based on the found information?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

The problem is that the same code works on a Windows Server 2008 R2 (64-bit system) both the 32-bit and 64-bit compiled code. But on a WIndows 10 (64-bit system) only the 64 bit compiled code works. I don't know how this is possible.

Posted

Have a look at the _WinAPI_Wow64EnableWow64FsRedirection function :

#include <WinAPIFiles.au3>

MsgBox (0, "", FileExists(@WindowsDir & "\System32\inetsrv\test") )

_WinAPI_Wow64EnableWow64FsRedirection ( False )
MsgBox (0, "", FileExists(@WindowsDir & "\System32\inetsrv\test") )

 

Posted (edited)

Thank you jguinch. That fixed the problem!

Do you know why this came just up today with me jguinch?

Is this because of the update from Windows 10?

Edited by lrstndm

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
×
×
  • Create New...