低权限IE和高权限进程通过管道通信时的权限问题
2016-04-28 23:22
204 查看
BOOL CreatePipeSecurity(PSECURITY_ATTRIBUTES *ppSa)
{
BOOL bSuccess = TRUE;
DWORD dwError = ERROR_SUCCESS;
PSECURITY_DESCRIPTOR pSd = NULL;
PSECURITY_ATTRIBUTES pSa = NULL;
PCWSTR szDDL = L"S:(ML;;NW;;;LW)D:(A;;0x12019f;;;WD)";
if (!ConvertStringSecurityDescriptorToSecurityDescriptor(szDDL, SDDL_REVISION_1, &pSd, NULL))
{
return FALSE;
}
pSa = (PSECURITY_ATTRIBUTES)LocalAlloc(LPTR, sizeof(*pSa));
if (pSa == NULL)
{
LocalFree(pSd);
return FALSE;
}
pSa->nLength = sizeof(*pSa);
pSa->lpSecurityDescriptor = pSd;
pSa->bInheritHandle = FALSE;
*ppSa = pSa;
return bSuccess;
}
void FreePipeSecurity(PSECURITY_ATTRIBUTES pSa)
{
if (pSa)
{
if (pSa->lpSecurityDescriptor)
{
LocalFree(pSa->lpSecurityDescriptor);
}
LocalFree(pSa);
}
}
unsigned int __stdcall WorkThread( void *lpParam )
{
SECURITY_ATTRIBUTES* lpPipeSecurity;
CreatePipeSecurity(&lpPipeSecurity);
lpKeyBoardMonitor->m_hLastPipe = CreateNamedPipe( _T( PIPE_NAME ),
PIPE_ACCESS_DUPLEX,
PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT,
PIPE_UNLIMITED_INSTANCES,
MAXBYTE,
MAXBYTE,
NULL,
lpPipeSecurity );
......
......
//不需要Pipe的时候,释放
FreePipeSecurity(lpPipeSecurity);
}
参考文章:
How to create an anonymous pipe that gives access to everyone
Named Pipes Not Working When Logged In As
a Standard User in Vista
CreateLowIntegrityProcessCreateLowIntegrityProcess
{
BOOL bSuccess = TRUE;
DWORD dwError = ERROR_SUCCESS;
PSECURITY_DESCRIPTOR pSd = NULL;
PSECURITY_ATTRIBUTES pSa = NULL;
PCWSTR szDDL = L"S:(ML;;NW;;;LW)D:(A;;0x12019f;;;WD)";
if (!ConvertStringSecurityDescriptorToSecurityDescriptor(szDDL, SDDL_REVISION_1, &pSd, NULL))
{
return FALSE;
}
pSa = (PSECURITY_ATTRIBUTES)LocalAlloc(LPTR, sizeof(*pSa));
if (pSa == NULL)
{
LocalFree(pSd);
return FALSE;
}
pSa->nLength = sizeof(*pSa);
pSa->lpSecurityDescriptor = pSd;
pSa->bInheritHandle = FALSE;
*ppSa = pSa;
return bSuccess;
}
void FreePipeSecurity(PSECURITY_ATTRIBUTES pSa)
{
if (pSa)
{
if (pSa->lpSecurityDescriptor)
{
LocalFree(pSa->lpSecurityDescriptor);
}
LocalFree(pSa);
}
}
unsigned int __stdcall WorkThread( void *lpParam )
{
SECURITY_ATTRIBUTES* lpPipeSecurity;
CreatePipeSecurity(&lpPipeSecurity);
lpKeyBoardMonitor->m_hLastPipe = CreateNamedPipe( _T( PIPE_NAME ),
PIPE_ACCESS_DUPLEX,
PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT,
PIPE_UNLIMITED_INSTANCES,
MAXBYTE,
MAXBYTE,
NULL,
lpPipeSecurity );
......
......
//不需要Pipe的时候,释放
FreePipeSecurity(lpPipeSecurity);
}
参考文章:
How to create an anonymous pipe that gives access to everyone
Named Pipes Not Working When Logged In As
a Standard User in Vista
CreateLowIntegrityProcessCreateLowIntegrityProcess
相关文章推荐
- 不同方式下文件读取和存储的比较(OpenCV 中FileStorage与C++中文件流ofstream/ifsteam比较)
- Android夜间模式初探
- Android Studio打包:“APP_NAME" IS NOT TRANSLATED IN ZH, ZH_CN……..解决办法
- JEECG&Dubbo Demo
- 前端图片预览,上传前预览,兼容IE7、8、9、10、11,Firefox,Chrome
- JEECG&Dubbo Demo
- java--静态变量
- 构建高效安全的Nginx Web服务器
- 微服务架构只是个 “技术的浪潮 、流行” ?
- sysdig案例分析 - 哪些文件正在被进程访问
- java--IO
- 不同人员对性能的关注点与web前端性能测试概念
- RCNN & SPP-net & Fast-RCNN & Faster-RCNN
- Android中Parcelable接口用法
- 42. Trapping Rain Water
- 四大组件的工作过程探索(一)
- 求解x=a^b(mod m)
- 共用数据保护(const 常量)
- Redis的Sentinel
- Android Matrix的使用与自定义动画