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,就搜了一下,总结了一下答案. ...
随机推荐
- How to center body on a page?
[提问] I'm trying to center the body element on my HTML page. Basically, in the CSS I set the body e ...
- 配置Oracle访问SQL地理数据库
Oracle访问空间数据 ArcSDE是ArcGIS的空间数据引擎,它是在关系数据库管理系统(RDBMS)中存储和管理多用户空间数据库的通路.以前连接方式有两种,服务连接与直接连接(简称"直 ...
- OCIEnvCreate 失败,返回代码为 -1的解决方法
错误描述 连接Oracle始终报这个错误: {System.Exception: OCIEnvCreate 失败,返回代码为 -1,但错误消息文本不可用 本机环境是oracle10g客户端,以前也连过 ...
- WampServer在win10系统下安装的坑
WampServer之前一直是好好的,最近换了Win10的系统,安装的不太顺利. 1.问题一 出现的第一个问题,就是安装时会报错.怎么解决的,具体的我已经忘记了,好像是要下载vc运行时包. 2.问题二 ...
- LNMP一键安装包-CentOS/Ubuntu/Debian自动安装Nginx,MySQL,PHP
适用环境: 系统支持:CentOS.Ubuntu.Debian 内存要求:≥128M 安装了什么: 1.Nginx-1.2.1 2.MySQL 5.5.25 3.PHP 5.2.17或PHP 5.3. ...
- 解决Maven报Plugin execution not covered by lifecycle configuration
来自:http://blog.csdn.net/xxd851116/article/details/25197373 环境 eclipse 4.3.0 maven 3.0.4 ...
- Node,Sockets,Cores,Threads
http://fishcried.com/2015-01-09/cpu_topology/ http://kodango.com/cpu-topology http://www.udpwork.com ...
- vim 窗口操作:多tab|窗口拆分
转 我是一个vimer,还在用着这个上古时代的编辑器,但我并不是守旧派,因为即使是 现在,vim也在不断的创新.我用vim也有一两年的光景了,但是我还是不敢我自己 精通vim,当然我使用vim基本是两 ...
- \G 用法:查询结果按列打印
\G 用法:查询结果按列打印 \G 放到sql语句后,可以使每个字段打印到单独的行, 如: mysql \G; mysql> select * from t \G;*************** ...
- notepad++插件实现json、xml格式化
notepad++比较出色的免费的数据编辑.格式化工具... 现在json.xml文件很流行.格式化也是必须的,方便查看关键信息! 01.下载notepad++及相关插件 npp_7.5.5-x86: ...