gVim can't view file created with Notepad in System32 folder - windows

When I create a file called hello.txt in C:\Windows\System32 with the text "hello" in it, gVim for some reason will not find this file. Can someone explain why this happens?
Here you can see I created the file in Notepad.
Now I'm trying to find the same file in gVim using :E. hello.txt is nowhere to be found. :e hello.txt opens up a new file. I feel like I'm getting trolled by my computer.

If you're using a 32-bit Vim (both Bram's installer and the "Vim without Cream" installer often recommended are 32-bit) on a 64-bit Windows, then you've fallen victim to the WOW64 redirection in Windows. Since 32-bit applications are not compatible with 64-bit libraries, C:\Windows\System32 when accessed from a 32-bit application actually gives you the content of C:\Windows\SysWOW64.
But don't despair, you can actually access the C:\Windows\System32 on most 64-bit systems from within Vim, you just need to use the special path C:\Windows\Sysnative (which only seems accessible by 32-bit applications and maps to the 64-bit C:\Windows\System32 directory).

Related

which file can install a program on windows 7?

Which of these files( in setup folder), if execute can install a program on windows 7 ?
1- setup.com
2-setup.ini
3-setup.inf
COM files are executable in Windows. You should be able to run setup.com from the CMD prompt by cding to the directory setup.com is in, and running setup or setup.com.
Keep in mind, COM files cannot be executed on 64-bit versions of Windows, since these editions lack NTVDM, the MS-DOS-emulating subsystem that handles COM file execution. You would instead need to emulate the 32-bit environment using an emulator like DOSBox.
setup.inf can be used to file copy and installation. I cannot remember setup.com installers for Windows programs.
msdn inf description

cmd not showing some files

Here is something odd. When I run:
Set oShell = CreateObject("WScript.Shell")
oShell.run("C:\Windows\System32\PnPutil.exe")
I get a 80070002 cannot find specified file. I know that file is there. So I ran:
oShell.run("cmd /K C:\Windows\System32\PnPutil.exe")
I get a command shell and browse to C:\Windows\System32. PnPutil.exe is not there. I can browse to the folder in explorer, it is there. What gives? Am I in an alternate cmd universe?
Probably you're running 32-bit cmd.exe on 64-bit Windows. %SystemRoot%\System32 gets redirected to %SystemRoot%\SysWow64 for 32-bit apps, which is where the 32-bit DLLs and EXEs reside (MSDN: File System Redirector). But there's no 32-bit version of PnPutil.exe. Try C:\Windows\Sysnative\PnPutil.exe. The Sysnative virtual directory lets 32-bit apps access the real System32 directory.

VB6 Legacy Code can't "Call Shell"

I am working on some legacy VB6 code and I am having my program break with this message:
and it then highlights this code:
I know that the specified locations exist per these screenshots:
I am running this Visual Studio 6.0 on a 64-bit Windows 7 machine. How can I make the program see shell?
command.com does not exist on 64 bit windows.
Try using C:\Windows\SysWOW64\cmd.exe instead. C:\Windows\SysWOW64 is a folder giving you backwards compatibility stuff for 32 bit.
But see the comment below (taken from Euro Micelli).
Really you should use %SYSTEMROOT\System32\cmd.exe instead. First, Windows is not always installed in C:\Windows; you should let the system figure that out. Second, using System32 is always correct for a 32-bit application: when running on Win32, it is the correct folder; when running on Win64, Windows will map %SYSTEMROOT%\System32 to %SYSTEMROOT%\SysWOW64
I use vb6 and windows 7.
I've done the same thing as you but I put the dos command in a bat file.
Login.bat
NET USE W: \\10.48.10.8\e$
Then in the code
Shell ("c:\login.bat")
The vb command is not correct for the OS that you are running. You need to check that that drive is not already mapped, and remove the command.com /c from the command that you are trying to execute.

gvim does not recognize certain directories or files (Windows 7 64-bit)

I'm having a weird issue with gvim on Windows 7 64-bit. I am using gvim 7.2, and the "c:\windows\gvim.bat" is the executable that is first on my path if I just type "gvim" on the powershell command line. Note that I've tried both the gvim.bat file and calling gvim.exe directly.
For some reason, there is a certain directory on my file system which vim does not seem to see or recognize. I can navigate to this directory in cmd, powershell, windows explorer, etc., and I can see the files in the directory. I can also edit the files in notepad or another text editor, but if I try to open any of the files in gvim, it does not open the file, but rather reports "[New DIRECTORY]". If I try to open the folder itself in gvim, it does not open it in the vim directory browser as I would expect, but instead it reports "[New FILE]".
If I open gvim, and do File->Open... and navigate to where the folder should be, it is not visible in the open file dialog.
What would cause a directory (or files) to not be visible or recognized by gvim?
Note that the directory I'm having problems with is the PowerShellCommunityExtensions module. I currently have this installed here: "c:\windows\system32\WindowsPowerShell\v1.0\Modules\Pscx\". The Pscx folder is the one that gvim will not recognize. I have other modules in this Modules folder which gvim can open successfully.
Apparently GVIM.exe is a 32-bit app that appears to Windows 7 as a legacy app which causes Windows Vista/7 to virtualize access to the file system and registry. Access to C:\Windows\System32 is redirected to C:\Windows\SysWOW4. Writes to C:\Program Files are redirected to C:\ProgramData or C:\Users\\AppData\Local\VirtualStore. And access to the registry node HKLM:\Software is redirected to HKLM:\Software\Wow6432Node. The following MS Support URL explains it a bit further.

Launching 64-bit executable from 32-bit Windows app

What is the "correct" way for a 32-bit application to find the "Program Files" folder on 64-bit Windows? For example, I am running a 32-bit application with a VBScript engine, and want to launch 64-bit Excel (using ShellExec, or similar). In the 32-bit world, I would check the environment variable "ProgramFiles" to get the base folder. My understanding is that as a 32-bit app on a 64-bit Windows, that environment variable will point to the 32-bit program files folder - eg: C:\Program Files(x86). But my 64-bit Excel will be under C:\Program Files.
I want to avoid hard-coding a reference to "c:\program files".
You can check the environment variable "ProgramW6432". It should exist and point to Program Files, without the x86, when running a 32bit application on a 64bit Windows.
Documentation: MSDN
Depending on the version of windows, you should be using the known folders apis.
http://msdn.microsoft.com/en-us/library/bb776911%28v=VS.85%29.aspx
Specifically you can use FOLDERID_ProgramFilesX64 in conjunction with SHGetKnownFolderPath.

Resources