ActiveX IE保护模式下的低权限操作路径及Windows操作系统特殊路径
参考理解IE保护模式:https://blog.csdn.net/xt_xiaotian/article/details/5336809
文件帮助类:
public class FileHelp
{
public enum GetDirectoryType
{
ByAppDomain,
ByAssembly
}
public static string GetCurrentDirectory(GetDirectoryType type = GetDirectoryType.ByAppDomain)
{
switch (type)
{
case GetDirectoryType.ByAppDomain:
return AppDomain.CurrentDomain.BaseDirectory;
case GetDirectoryType.ByAssembly: return Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
default:
return AppDomain.CurrentDomain.BaseDirectory;
}
}
public static string GetCurrentDirectoryByAssembly()
{
return GetCurrentDirectory(GetDirectoryType.ByAssembly);
} /// <summary>
///程序数据路径- C:\ProgramData
/// </summary>
/// <returns></returns>
public static string GetCommonApplicationData()
{
return Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
} /// <summary>
/// 用户数据路径
/// </summary>
/// <returns></returns>
public static string GetApplicationData()
{
return Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
} /// <summary>
/// 用户数据本地路径
/// </summary>
/// <returns></returns>
public static string GetLocalApplicationData()
{
return Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
} /// <summary>
/// 用户路径
/// </summary>
/// <returns></returns>
public static string GetUserProfile()
{
return Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
} /// <summary>
/// 用户的图片路径
/// </summary>
/// <returns></returns>
public static string GetMyPictures()
{
return Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
} /// <summary>
/// 用户的视频路径
/// </summary>
/// <returns></returns>
public static string GetMyVideos()
{
return Environment.GetFolderPath(Environment.SpecialFolder.MyVideos);
} /// <summary>
/// 用户的文档路径
/// </summary>
/// <returns></returns>
public static string GetMyDocuments()
{
return Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
} /// <summary>
/// IE保护模式下的低权限操作路径(Temporary Internet Files/Low)
/// 参考:https://blog.csdn.net/xt_xiaotian/article/details/5336809
/// </summary>
/// <returns></returns>
public static string GetTemporaryInternetFiles()
{
return GetLocalApplicationData()+ "\\Microsoft\\Windows\\Temporary Internet Files\\Low";
} /// <summary>
/// IE保护模式下的低权限操作路径(%userprofile%/AppData/LocalLow)
/// 参考:https://blog.csdn.net/xt_xiaotian/article/details/5336809
/// </summary>
/// <returns></returns>
public static string GetAppDataLocalLow()
{
return GetUserProfile() + "\\AppData\\LocalLow";
} /// <summary>
/// 获取系统字体文件路径
/// </summary>
/// <returns></returns>
public static string GetFonts()
{
return Environment.GetFolderPath(Environment.SpecialFolder.Fonts);
} /// <summary>
/// 二进制文件读取
/// </summary>
/// <param name="FileUrl">文件路径</param>
/// <returns></returns>
public static byte[] BinaryRead(string FileUrl)
{
List<byte> lst = new List<byte>();
try
{
//文件路径
String filename = FileUrl;
//打开文件
FileStream FStream;
if (File.Exists(filename))
{
FStream = new FileStream(filename, FileMode.Open);
}
else
{
return null;
}
int BufferSize = 1048576; //每次读取的字节数 每次读取1MB
byte[] Buffer = new byte[BufferSize];
long FileLength = FStream.Length;//文件流的长度
int ReadCount = (int)(FileLength / BufferSize) + 1; //需要对文件读取的次数
//数据读取
BinaryReader BWrite = new BinaryReader(FStream);
//br.BaseStream.Seek(0, SeekOrigin.Begin);
//while (br.BaseStream.Position < br.BaseStream.Length){}
for (int a = 0; a < ReadCount; a++)
{
Buffer = BWrite.ReadBytes(BufferSize);
lst.AddRange(Buffer);
}
BWrite.Close();
BWrite.Close();
return lst.ToArray();
}
catch (System.Exception ex)
{
Log.WriteLog4Ex("FileHelp.BinaryRead", ex);
return null;
}
} /// <summary>
/// 二进制文件写入
/// </summary>
/// <param name="Bts"></param>
/// <param name="DirectoryUrl">文件目录路径</param>
/// <param name="FileName">文件名称</param>
/// <returns></returns>
public static bool BinaryWrite(byte[] Bts, string DirectoryUrl, string FileName)
{
try
{
//文件路径
string Filepath = DirectoryUrl + "\\" + FileName;
//目录创建
if (!Directory.Exists(DirectoryUrl))
Directory.CreateDirectory(DirectoryUrl);
//文件创建
FileStream FStream;
if (File.Exists(Filepath))
{
FStream = new FileStream(Filepath, FileMode.Append);
}
else
{
FStream = new FileStream(Filepath, FileMode.Create);
}
//数据写入
BinaryWriter BWrite = new BinaryWriter(FStream);
BWrite.Write(Bts);
BWrite.Close();
FStream.Close();
return true;
}
catch (System.Exception ex)
{
Log.WriteLog4Ex("FileHelp.BinaryWrite", ex);
return false;
}
} /// <summary>
/// 二进制文件删除
/// </summary>
/// <param name="FileUrl">文件路径</param>
public static void FileDelete(string FileUrl)
{
try
{
//文件路径
String filename = FileUrl;
//删除文件
if (File.Exists(filename))
{
File.Delete(filename);
}
}
catch (System.Exception ex)
{
Log.WriteLog4Ex("FileHelp.FileDelete", ex);
}
}
}
IE保护模式下的允许访问低权限路径:
/// <summary>
/// IE保护模式下的低权限操作路径(Temporary Internet Files/Low)
/// 参考:https://blog.csdn.net/xt_xiaotian/article/details/5336809
/// </summary>
/// <returns></returns>
public static string GetTemporaryInternetFiles()
{
return GetLocalApplicationData()+ "\\Microsoft\\Windows\\Temporary Internet Files\\Low";
} /// <summary>
/// IE保护模式下的低权限操作路径(%userprofile%/AppData/LocalLow)
/// 参考:https://blog.csdn.net/xt_xiaotian/article/details/5336809
/// </summary>
/// <returns></returns>
public static string GetAppDataLocalLow()
{
return GetUserProfile() + "\\AppData\\LocalLow";
}
ActiveX IE保护模式下的低权限操作路径及Windows操作系统特殊路径的更多相关文章
- IE保护模式下ActiveX控件打不开共享内存的解决方案
原文:http://www.cppblog.com/Streamlet/archive/2012/10/25/193831.html 感谢溪流漫话的投递 IE保护模式下,ActiveX控件会打不开别的 ...
- 软件调试——IA-32 保护模式下寄存器一览
最近在看张银奎先生的<调试软件>一书,想将关键的技术记录下来,以便日后查阅,也分享给想看之人吧. 1 通用寄存器 EAX,EBX,ECX,EDX:用于运算的通用寄存器,可以使用AX,BX等 ...
- ASM:《X86汇编语言-从实模式到保护模式》第14章:保护模式下的特权保护和任务概述
★PART1:32位保护模式下任务的隔离和特权级保护 这一章是全书的重点之一,这一张必须要理解特权级(包括CPL,RPL和DPL的含义)是什么,调用门的使用,还有LDT和TSS的工作原理(15章着重 ...
- ASM:《X86汇编语言-从实模式到保护模式》第13章:保护模式下内核的加载,程序的动态加载和执行
★PART1:32位保护模式下内核简易模型 1. 内核的结构,功能和加载 每个内核的主引导程序都会有所不同,因为内核都会有不同的结构.有时候主引导程序的一些段和内核段是可以共用的(事实上加载完内核以后 ...
- ASM:《X86汇编语言-从实模式到保护模式》第17章:保护模式下中断和异常的处理与抢占式多任务
★PART1:中断和异常概述 1. 中断(Interrupt) 中断包括硬件中断和软中断.硬件中断是由外围设备发出的中断信号引发的,以请求处理器提供服务.当I/O接口发出中断请求的时候,会被像8259 ...
- 保护模式下pmtest1.asm的理解
整个代码对应内存线性地址分为四段,[gdt] [code32] [video32] [code16] 代码先在实模式[code16]下运行,code16中的cs就是系统分配的该程序物理地址的基址. 编 ...
- x86架构:保护模式下利用中断实现抢占式多任务运行
站在用户角度考虑,一个合格的操作系统即使在单核下也能 "同时" 执行多个任务,这就要求CPU以非常快的频率在不同任务之间切换,让普通人根本感觉不到任务的切换.windwo ...
- x86架构:保护模式下加载并运行用户程序
本章的代码分3个模块: MBR 引导:加载内核core程序 core:包含内核代码段(从磁盘加载用户程序并重定位).内核数据段(存放api名称.临时缓冲.字符串等).API段(供用户程序调用) 用户程 ...
- 为什么在保护模式下IA-32处理器最高可访问4GB的内存
在保护模式下,IA-32处理器可访问最高达4GB的内存,这是32位无符号二进制整数地址能够寻址的上限. 今天看汇编的时候发现书里带过一句,不太明白为什么内存上限是4GB,就搜了一下,总结了一下答案. ...
随机推荐
- CHtmlEditCtrl (2): Add a Source Text Editor to Your HTML Editor
In a previous article, I described how to create an HTML editor using the MFC CHtmlEditCtrl class in ...
- LeetCode Anagrams My solution
Anagrams Given an array of strings, return all groups of strings that are anagrams. Note: All inputs ...
- Android基础(五) Service全解析----看不见的Activity
一.服务的介绍: 作为Android四大组件之中的一个,Service(服务)也常常运用于我们的日常使用中,它与Activity的差别在于:Service一直在后台执行.没实用户界面.所以绝不会到前台 ...
- DexHunter脱壳神器分析
0x00 这篇文章我们分析Android脱壳神器DexHunter的源码. DexHunter作者也写了一篇介绍它的文章从Android执行时出发.打造我们的脱壳神器.DexHunter源码位于htt ...
- 面试小结之Elasticsearch篇
https://www.cnblogs.com/luckcs/articles/7052932.html
- format ZKFC失败
at org.apache.hadoop.ha.ActiveStandbyElector$WatcherWithClientRef.waitForZKConnectionEvent(ActiveSta ...
- Lanczos Algorithm and it's Parallelization Stragegy
由于写了降维的一个系列算法分析,本来以为对这个Lanczos算法会理解一点,但是还是不知道讲了什么,最多的就是会如何调用,然后出结果,所以就翻译官网的相关内容.本篇翻译来自Dimensional Re ...
- CentOS7中zip压缩和unzip解压缩命令详解
安装zip.unzip应用 yum install zip unzip 以下命令均在/home目录下操作cd /home #进入/home目录1.把/home目录下面的mydata目录压缩为mydat ...
- 在唯一密钥属性“name”设置为“ExtensionlessUrlHandler-Integrated-4.0”时,无法添加类型为“add”的重复集合项
以管理员运行下面的命令注册: 32位机器: C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i 64位机器: C:\W ...
- java 读取clob
java 读取clob CreationTime--2018年7月1日09点41分 Author:Marydon 1.说明 jdbc 数据类型为Clob,与java的String类型相对应. 2. ...