This disables the Windows File System Redirector.
When a 32 bit program runs on a 64 bit operating system the paths to C:/Windows/System32 automatically get redirected to the 32 bit version (C:/Windows/SysWow64), if you really do need to access the contents of System32, you need to disable the file system redirector first.

import ctypes

class disable_file_system_redirection:
_disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirection
_revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirection
def __enter__(self):
self.old_value = ctypes.c_long()
self.success = self._disable(ctypes.byref(self.old_value))
def __exit__(self, type, value, traceback):
if self.success:
self._revert(self.old_value) #Example usage
import os path = 'C:\\Windows\\System32\\msg.exe' print os.path.exists(path)
with disable_file_system_redirection():
print os.path.exists(path)
print os.path.exists(path)

Disable File System Redirector For Windows x64 (Python recipe)(转)的更多相关文章

  1. [每天解决一问题系列 - 0009] File System Redirector

    问题描述: 在64位操作系统下,知道Wow64是干什么的,但一直不知道是怎么工作的 相关解释: https://msdn.microsoft.com/en-us/library/windows/des ...

  2. 小白日记46:kali渗透测试之Web渗透-SqlMap自动注入(四)-sqlmap参数详解- Enumeration,Brute force,UDF injection,File system,OS,Windows Registry,General,Miscellaneous

    sqlmap自动注入 Enumeration[数据枚举] --privileges -U username[CU 当前账号] -D dvwa -T users -C user --columns  [ ...

  3. Windows ->> Windows下一代文件系统 -- Resilient file system(ReFS)

    Comming soon!!! 参考文献: Building the next generation file system for Windows: ReFS ReFS: What you need ...

  4. Windows X64 Patch Guard

    先简单介绍下PatchGuard ,摘自百度百科 PatchGuard就是Windows Vista的内核保护系统,防止任何非授权软件试图“修改”Windows内核,也就是说,Vista内核的新型金钟 ...

  5. Common Internet File System

    CIFS (Common Internet File System) is a protocol that gained popularity around the year 2000, as ven ...

  6. How to Fix Missing TortoiseSVN File Status Icons in Windows

    For many Windows-based developers, Subversion and TortoiseSVN is a great source control solution. It ...

  7. Windows下Python读取GRIB数据

    之前写了一篇<基于Python的GRIB数据可视化>的文章,好多博友在评论里问我Windows系统下如何读取GRIB数据,在这里我做一下说明. 一.在Windows下Python为什么无法 ...

  8. 磁盘、分区及Linux文件系统 [Disk, Partition, Linux File System]

    1.磁盘基础知识 1.1 物理结构 硬盘的物理结构一般由磁头与碟片.电动机.主控芯片与排线等部件组成:当主电动机带动碟片旋转时,副电动机带动一组(磁头)到相对应的碟片上并确定读取正面还是反面的碟面,磁 ...

  9. Linux File System

    目录 . Linux文件系统简介 . 通用文件模型 . VFS相关数据结构 . 处理VFS对象 . 标准函数 1. Linux文件系统简介 Linux系统由数以万计的文件组成,其数据存储在硬盘或者其他 ...

随机推荐

  1. GO里的“指针”

    指针 *T即为类型T的指针 &t即为获取变量t的地址 *p即为获取指针变量所指向的内容 var p *int 指针的*在左边  类型在右边.这里的 *int就是一个指针类型. 跟int str ...

  2. python基础--random模块

    python使用random生成随机数 下面是主要函数random.random()用于生成一个0到1的随机符点数: 0 <= n < 1.0random.randint(a, b)生成的 ...

  3. No.4 selenium学习之路之iframe

    查看iframe: 1.top window ——可以直接进行定位

  4. P2184 【贪婪大陆】

    看到全是线段树或者树状数组写法,就来提供一发全网唯一cdq分治三维偏序解法吧 容易发现,这个题的查询就是对于每个区间l,r,查询有多少个修改区间li,ri与l,r有交集 转化为数学语言,就是查询满足l ...

  5. Effective STL 学习笔记: Item 22 ~ 24

    Effective STL 学习笔记: Item 22 ~ 24 */--> div.org-src-container { font-size: 85%; font-family: monos ...

  6. CVE-2010-3974 Microsoft Windows多个平台Fax Cover Page Editor内存破坏漏洞

    Microsoft Windows Fax Cover Pages用于个性化传真以及呈现更正式外观的传真传输.         Microsoft Windows XP SP2和SP3,Windows ...

  7. CTF中做Linux下漏洞利用的一些心得

    其实不是很爱搞Linux,但是因为CTF必须要接触一些,漏洞利用方面也是因为CTF基本都是linux的pwn题目. 基本的题目分类,我认为就下面这三种,这也是常见的类型. 下面就分类来说说 0x0.栈 ...

  8. 出现丢包解决方法(ping: sendmsg: Operation not permitted)

    故障排查: 早上突然收到nagios服务器check_icmp的报警,报警显示一台网站服务器的内网网络有问题.因为那台服务器挂载了内网的NFS,因此内网的网络就采用nagios的check_icmp来 ...

  9. Activity总结练习

    package com.example.wang.myapplication; import android.content.Intent; import android.os.Bundle; imp ...

  10. 微信小程序 跳一跳 外挂 C# winform源码

    昨天微信更新了,出现了一个小游戏“跳一跳”,玩了一下 赶紧还蛮有意思的 但纯粹是拼手感的,玩了好久,终于搞了个135分拿了个第一名,没想到过一会就被朋友刷下去了,最高的也就200来分把,于是就想着要是 ...