#192923 - 2009-03-16 06:35 PM
shell regedit on 64 bit OS
|
jeff_eisenberg
Fresh Scripter
Registered: 2009-02-26
Posts: 45
Loc: CA
|
Question. On 64 bit operating systems:
I need to get an entry under HKLM\Software\Product\etc
However, when you run the following command SHELL "regedit /s update.reg", the registry setting gets redirected to HKLM\Software\Wow6432Node\Product\etc.
This particular software needs the registry entry under HKLM\Software\Product\etc. But what's strange is that when you double click on the *.reg file directly, it goes to the place specified in the reg file. Is there some swtic or something in Kixtart to make it go to the specified place?
Thanks,
Jeff
|
|
Top
|
|
|
|
#192928 - 2009-03-16 08:43 PM
Re: shell regedit on 64 bit OS
[Re: Glenn Barnas]
|
jeff_eisenberg
Fresh Scripter
Registered: 2009-02-26
Posts: 45
Loc: CA
|
Got it.
So it looks like the command:
SETOPTION("Wow64FileRedirection","off")
Has a conflict with the EnumProcess fuction below. When you add the SETOPTION to turn off Wow64FileRedirection the EnumProcess function produces the following popup error.
Windows - Unable To Locate Component: Exception Processing message c0000135 Parameters 7c7df5f8
Any ideas?
--------------------------- FUNCTION EnumProcess($exe, optional $terminate, optional $Computer) Dim $winmgmts, $ExecQuery, $Process, $id, $getobject, $ if not $computer $computer=@wksta endif $winmgmts="winmgmts:{impersonationLevel=impersonate}!//$COMPUTER" select case val($exe)>0 $ExecQuery="select * from Win32_Process where ProcessId='$exe'" $GetObject=GetObject($winmgmts).ExecQuery($ExecQuery) For each $Process in $GetObject if $terminate $=$Process.Terminate endif $EnumProcess = $Process.name next $GetObject='' case vartype($exe)=8 $ExecQuery="select * from Win32_Process where Name='$exe'" $GetObject=GetObject($winmgmts).ExecQuery($ExecQuery) For each $Process in $GetObject if $terminate $=$Process.Terminate endif $id=$Process.ProcessId $EnumProcess = "$Id" + "|" + "$EnumProcess" Next $EnumProcess=left($EnumProcess,len($EnumProcess)-1) $GetObject='' case 1 exit 1 endselect ENDFUNCTION
|
|
Top
|
|
|
|
#192967 - 2009-03-18 07:18 AM
Re: shell regedit on 64 bit OS
[Re: Lonkero]
|
jeff_eisenberg
Fresh Scripter
Registered: 2009-02-26
Posts: 45
Loc: CA
|
I'm really sorry about not following the proper etiquette. I'm new to this. What do you mean by code tags? Do you mean tabs. I tried to put in tabs for clarity, but when you submit the message the tab spaces disappear.
Here is the script I am running along with how I call the UDF. I tested it with only the code below and it give the same error so I know it's something below and not any of the other code in my script.
---------------------------- SETOPTION("Wow64FileRedirection","off") CALL "ENUMPROCESS.kix" $STICK=EnumProcess("stick.exe") IF $STICK = 0 RUN "C:\Program Files\Stick\Stick.exe" ENDIF
Here is the function ---------------------------------- FUNCTION EnumProcess($exe, optional $terminate, optional $Computer) Dim $winmgmts, $ExecQuery, $Process, $id, $getobject, $ if not $computer $computer=@wksta endif $winmgmts="winmgmts:{impersonationLevel=impersonate}!//$COMPUTER" select case val($exe)>0 $ExecQuery="select * from Win32_Process where ProcessId='$exe'" $GetObject=GetObject($winmgmts).ExecQuery($ExecQuery) For each $Process in $GetObject if $terminate $=$Process.Terminate endif $EnumProcess = $Process.name next $GetObject='' case vartype($exe)=8 $ExecQuery="select * from Win32_Process where Name='$exe'" $GetObject=GetObject($winmgmts).ExecQuery($ExecQuery) For each $Process in $GetObject if $terminate $=$Process.Terminate endif $id=$Process.ProcessId $EnumProcess = "$Id" + "|" + "$EnumProcess" Next $EnumProcess=left($EnumProcess,len($EnumProcess)-1) $GetObject='' case 1 exit 1 endselect ENDFUNCTION
|
|
Top
|
|
|
|
#192969 - 2009-03-18 09:37 AM
Re: shell regedit on 64 bit OS
[Re: Gargoyle]
|
jeff_eisenberg
Fresh Scripter
Registered: 2009-02-26
Posts: 45
Loc: CA
|
Why thank you very much: It seems that the error occurs during the "select * from Win32_Process" part of the function. This is running on a 64 bit OS.
------------------------------- script:
SETOPTION("Wow64FileRedirection","off")
CALL "ENUMPROCESS.kix"
$STICK=EnumProcess("stick.exe")
IF $STICK = 0
RUN "C:\Program Files\Stick\Stick.exe"
ENDIF
------------------------------- Function:
FUNCTION EnumProcess($exe, optional $terminate, optional $Computer)
Dim $winmgmts, $ExecQuery, $Process, $id, $getobject, $
if not $computer $computer=@wksta endif
$winmgmts="winmgmts:{impersonationLevel=impersonate}!//$COMPUTER"
select
case val($exe)>0
$ExecQuery="select * from Win32_Process where ProcessId='$exe'"
$GetObject=GetObject($winmgmts).ExecQuery($ExecQuery)
For each $Process in $GetObject
if $terminate $=$Process.Terminate endif
$EnumProcess = $Process.name
next
$GetObject=''
case vartype($exe)=8
$ExecQuery="select * from Win32_Process where Name='$exe'"
$GetObject=GetObject($winmgmts).ExecQuery($ExecQuery)
For each $Process in $GetObject
if $terminate $=$Process.Terminate endif
$id=$Process.ProcessId
$EnumProcess = "$Id" + "|" + "$EnumProcess"
Next
$EnumProcess=left($EnumProcess,len($EnumProcess)-1)
$GetObject=''
case 1
exit 1
endselect
ENDFUNCTION
|
|
Top
|
|
|
|
#192972 - 2009-03-18 03:38 PM
Re: shell regedit on 64 bit OS
[Re: Allen]
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4562
Loc: USA
|
I think this may be a bug. Can someone verify my findings?
Using the following code;
? @kix
? iif(@onwow64,"64","32") + "bit"
? "Wow64FileRedirection=" + SETOPTION("Wow64FileRedirection")
;$rc=SETOPTION("Wow64FileRedirection","off")
$PID=EnumProcess("calc.exe")
? "PID=" + $Pid
Results:
4.61 Beta 1
64bit
Wow64FileRedirection=OFF
PID=3952
Works as expected. However, just uncommenting the Wow64FileRedirection line, which should be doing nothing, as it is already OFF, breaks Enumprocess resulting in the following:
4.61 Beta 1
64bit
Wow64FileRedirection=OFFselect * from Win32_Process where Name='calc.exe'
PID=
Tested with 4.53, 4.60, and 4.61b1 with the same results.
|
|
Top
|
|
|
|
#192979 - 2009-03-18 04:42 PM
Re: shell regedit on 64 bit OS
[Re: Allen]
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4562
Loc: USA
|
Interesting reading/investigation. I think I found something of some use.
A brief history. In 64-bit (x64) Windows operating system, including Windows Vista, Microsoft implements a feature called File System Redirector on WOW64 (Windows-32-on-Windows-64 that runs 32-bit programs without modifications) subsystem layer for 32-bit programs or DLL (dynamic link libraries) which provides a WOW64 sandbox for registry calls and some file system calls. The filesystem redirection forces 32-bit application attempts to be installed into or accessed from %windir%\System32, been intercepted and get redirected or re-pointed to %windir%\SysWOW64 instead.
The reason for the Filesystem Redirector is that in x64 edition of Windows OS, %windir%\System32 directory is reserved for 64-bit applications. However, most DLL implements Windows API has the same file names and paths that were not changed when porting to 64-bit. As there cannot be two 32-bit and 64-bit DLLs with same name and same path exist on the same system at the same time, so File System Redirector automatically isolates and makes 32-bit applications or non-64-bit aware programs use a different directory as their System32 directory, which is %windir%\SysWOW64 folder. It’s also as a way to avoid incompatibility issue to prevent a 32-bit binary from accidentally accessing data from a 64-bit binary.
Starting with Vista x64 Microsoft introduced a virtual directory for 32 bit apps to access the "REAL" system32 directory. Its called SYSNATIVE. You can't see it from explorer, but 32 bit apps (kixtart) can use it. Interestingly, you can make a directory called SYSNATIVE in the Windows directory, and then you can see the magic of the Virtual/Redirect at work within 32 bit apps, 64bit apps just see it as an empty directory.
I think the value of this with Kixtart is, you can use it without having to turn on or off file redirection globally.
|
|
Top
|
|
|
|
#192982 - 2009-03-18 04:47 PM
Re: shell regedit on 64 bit OS
[Re: Allen]
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4562
Loc: USA
|
@Glenn
If on is default... setoption is returning the wrong value either way.
$RC=SETOPTION("Wow64FileRedirection","on")
? $RC
OFF
|
|
Top
|
|
|
|
#192991 - 2009-03-19 12:04 AM
Re: shell regedit on 64 bit OS
[Re: Glenn Barnas]
|
jeff_eisenberg
Fresh Scripter
Registered: 2009-02-26
Posts: 45
Loc: CA
|
Thanks guys. This is an XP 64 bit OS I'm having the problem on.
jeff.
|
|
Top
|
|
|
|
#192993 - 2009-03-19 03:07 AM
Re: shell regedit on 64 bit OS
[Re: Allen]
|
jeff_eisenberg
Fresh Scripter
Registered: 2009-02-26
Posts: 45
Loc: CA
|
Yes. On seems to be the default.
When the FileRedirects is on (or not defined), the reg file I run via the script, puts the registry entry in to the "Wow6432Node" of the registry which is not the setting in the reg file.
When the FileRedirects is on (or not defined), the EnumProcess function I use works fine.
When the FileRedirects is off, the reg file I run puts the registry entry in the correct portion of the registry so the "redirect" seems to be off and working how I would like it to... But I get the error with the EnumProcess funcion pop up window:
Windows Unable to Locate Component Exception Processing Message: C0000135 Parameters 7c7df5f8 7c7df5f8 7c7df5f8 7c7df5f8
Also in the kixtart window you see: Select * from win_32process where name = 'XXXX.exe"
Jeff
|
|
Top
|
|
|
|
#192994 - 2009-03-19 03:29 AM
Re: shell regedit on 64 bit OS
[Re: jeff_eisenberg]
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4562
Loc: USA
|
Well the good news is, you can turn it on and off as needed. The bad news is you will have to keep up with it.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1003 anonymous users online.
|
|
|