惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Hugging Face - Blog
Hugging Face - Blog
Microsoft Azure Blog
Microsoft Azure Blog
月光博客
月光博客
S
Securelist
J
Java Code Geeks
Recorded Future
Recorded Future
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
M
MIT News - Artificial intelligence
S
Secure Thoughts
Y
Y Combinator Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
D
Docker
Martin Fowler
Martin Fowler
The Last Watchdog
The Last Watchdog
WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
Vercel News
Vercel News
O
OpenAI News
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园_首页
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
PCI Perspectives
PCI Perspectives
N
News and Events Feed by Topic
H
Heimdal Security Blog
SecWiki News
SecWiki News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
博客园 - 【当耐特】
T
Troy Hunt's Blog
L
LINUX DO - 最新话题
Hacker News: Ask HN
Hacker News: Ask HN
Hacker News - Newest:
Hacker News - Newest: "LLM"
N
Netflix TechBlog - Medium
A
Arctic Wolf
The Hacker News
The Hacker News
I
Intezer
S
Schneier on Security
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Apple Machine Learning Research
Apple Machine Learning Research
L
Lohrmann on Cybersecurity
宝玉的分享
宝玉的分享
P
Privacy & Cybersecurity Law Blog
Stack Overflow Blog
Stack Overflow Blog
T
Tor Project blog
小众软件
小众软件
Simon Willison's Weblog
Simon Willison's Weblog
The Cloudflare Blog
Jina AI
Jina AI

博客园 - 大坏蛋

struts 2.1配置 腾讯,你是怎么知道我机器上装了360的 程序.NET Framework版本升级,重签名,重链接,批量签名工具 .NET 平台优秀控件及源代码介绍(一) 灯神 终于轻松下来了 Friend Assemblies(.NET FrameWork 2.0新特性) .NET Remoting的新特性-IpcChannel(.NET Framework 2.0) 我的GMAIL开始使用 关于委派的返回值 .NET Remoting中的事件处理(.NET Framework 2.0) 关于MyIE2中博客园页面自动跳转的问题回答 Thread.Abort终止一个线程 今天统计了一下我们项目的代码 Friend Assembly 忘记交手机费,招商银行的自助缴费不错! 六一快到了,祝所有小朋友节日快乐 COM+连接池的问题 系统消息框居然是可以复制的
如何扮演另一个帐号(C#实现)
大坏蛋 · 2004-10-27 · via 博客园 - 大坏蛋

Using directives

namespace Impersonal
{
    
class Program
    
{
        
测试代码

        [DllImport(
"advapi32.dll", SetLastError = true)]
        
public extern static bool LogonUser(String lpszUsername, String lpszDomain,
            String lpszPassword, 
int dwLogonType,
            
int dwLogonProvider, ref IntPtr phToken);

        [DllImport(
"kernel32.dll", CharSet = CharSet.Auto)]
        
public extern static bool CloseHandle(IntPtr handle);

        [DllImport(
"advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]
        
public extern static bool DuplicateToken(IntPtr ExistingTokenHandle,
            
int SECURITY_IMPERSONATION_LEVEL, ref IntPtr DuplicateTokenHandle);

        
public delegate void ImpersonatedWork();
        
/// <summary>
        
/// 以指定用户的身份去做一件事情
        
/// </summary>
        
/// <param name="UserName"></param>
        
/// <param name="PWD"></param>
        
/// <param name="WhatToDo"></param>

        public static void ImpersonateAndDo(string UserName, string PWD, ImpersonatedWork WhatToDo)
        
{
            
扮演用户
            
以新用户身份调用
            
取消扮演
        }

    }

}

最近太忙,好久不来,贴段刚写的代码,希望大家还记得我.