小编noc*_*ura的帖子

Windows如何保护转换到内核模式?

Windows如何防止用户模式线程任意将CPU转换为内核模式?

我理解这些事情是真的:

  1. 当通过NTDLL进行系统调用时,用户模式线程实际上转换到内核模式.
  2. 向内核模式的转换是通过特定于处理器的指令完成的.

那么通过NTDLL对这些系统调用有什么特别之处呢?为什么用户模式线程不能伪造它并执行特定于处理器的指令转换到内核模式?我知道我在这里错过了一些关键的Windows架构......它是什么?

windows winapi kernel

13
推荐指数
3
解决办法
2749
查看次数

为什么"Namespace'http://www.w3.org/XML/1998/namespace'无法在此模式中引用."?

在Visual Studio 2010中查看来自http://xmpp.org/schemas/的stanzaerror.xsd时,我收到以下行的警告......

<xs:attribute ref='xml:lang' use='optional'/>
Run Code Online (Sandbox Code Playgroud)

警告:

命名空间" http://www.w3.org/XML/1998/namespace "无法在此架构中引用.

这似乎是一个非常基本的XML警告 - 任何想法?

<?xml version='1.0' encoding='UTF-8'?>    
<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='urn:ietf:params:xml:ns:xmpp-stanzas'
    xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'
    elementFormDefault='qualified'>

  <xs:element name='bad-request' type='empty'/>
  <xs:element name='conflict' type='empty'/>
  <xs:element name='feature-not-implemented' type='empty'/>
  <xs:element name='forbidden' type='empty'/>
  <xs:element name='gone' type='xs:string'/>
  <xs:element name='internal-server-error' type='empty'/>
  <xs:element name='item-not-found' type='empty'/>
  <xs:element name='jid-malformed' type='empty'/>
  <xs:element name='not-acceptable' type='empty'/>
  <xs:element name='not-allowed' type='empty'/>
  <xs:element name='not-authorized' type='empty'/>
  <xs:element name='payment-required' type='empty'/>
  <xs:element name='policy-violation' type='empty'/>
  <xs:element name='recipient-unavailable' type='empty'/>
  <xs:element name='redirect' type='xs:string'/>
  <xs:element name='registration-required' type='empty'/>
  <xs:element name='remote-server-not-found' type='empty'/>
  <xs:element name='remote-server-timeout' type='empty'/>
  <xs:element name='resource-constraint' type='empty'/> …
Run Code Online (Sandbox Code Playgroud)

xml xsd

13
推荐指数
1
解决办法
2万
查看次数

LeakDiag用于64位Windows?

有没有人成功使用LeakDiag来跟踪64位Windows上的内存分配?或者,你知道另一个免费的工具来取代64位的LeakDiag吗?

memory windows leakdiag

10
推荐指数
1
解决办法
6420
查看次数

如果断言失败,是否有错误?

我一直遵循逻辑:如果断言失败,那么就有一个错误.根本原因可能是:

  • 断言本身无效(bug)
  • 编程错误(bug)
  • (没有其他选择)

IE有没有其他可以得出的结论?是否存在断言失败并且没有错误的情况?

debugging assert

10
推荐指数
2
解决办法
261
查看次数

我需要这个字段是不稳定的吗?

我有一个旋转的线程,直到另一个线程更改的int是某个值.

int cur = this.m_cur;
while (cur > this.Max)
{
    // spin until cur is <= max
    cur = this.m_cur; 
}
Run Code Online (Sandbox Code Playgroud)

this.m_cur是否需要声明为volatile才能生效?由于编译器优化,它是否有可能永远旋转?

.net c# multithreading volatile

9
推荐指数
1
解决办法
385
查看次数

在.NET DateTime结构中解释UInt64 dateData?

在通过SOS.dll查看调试器中的DateTime结构时,我看到......

  0:096> !DumpVC 000007feed1ddff8  000000028036d890 
  Name:        System.DateTime
  MethodTable: 000007feed1ddff8
  EEClass:     000007feecbed6b0
  Size:        24(0x18) bytes
  File:          C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.  dll
  Fields:
                MT    Field   Offset                 Type VT     Attr            Value Name
  000007feed1e1158  40000d6        0        System.UInt64  1 instance 5246421159766325152 dateData
Run Code Online (Sandbox Code Playgroud)

如何将"5246421159766325152"解释为DateTime?有没有办法我可以从这个值创建一个DateTime来获得人类可读的版本?

.net datetime windbg sos

9
推荐指数
2
解决办法
1981
查看次数

什么是程序集绑定日志中的后策略引用?

试图理解这个程序集绑定失败 - 下面的日志中"后策略引用"的含义是什么?

LOG: This bind starts in default load context.
LOG: Using application configuration file: E:\approot\WorkerRole.dll.config
LOG: Using host configuration file: 
LOG: Using machine configuration file from D:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.WindowsAzure.Diagnostics, Version=2.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///E:/approot/Microsoft.WindowsAzure.Diagnostics.DLL.
LOG: Assembly download was successful. Attempting setup of file: E:\approot\Microsoft.WindowsAzure.Diagnostics.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: Microsoft.WindowsAzure.Diagnostics, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
WRN: Comparing the assembly name resulted in the mismatch: …
Run Code Online (Sandbox Code Playgroud)

.net .net-assembly fuslogvw

9
推荐指数
1
解决办法
2445
查看次数

我是否需要从Request.CreateResponse()处理HttpResponseException?

我在ApiController的请求处理方法中有这个代码:

if (uri != null)
{
    HttpResponseMessage r = Request.CreateResponse(HttpStatusCode.Redirect);
    r.Headers.Location = uri;
    throw new HttpResponseException(r);
}
Run Code Online (Sandbox Code Playgroud)

潜在的问题是"r"从未被处理过(至少在我的代码中).
我可以将它包装在一个使用中,但是在响应流式传输到客户端之前不会"r"处理掉?

处理这个问题的正确方法是什么?

c# asp.net dispose

8
推荐指数
1
解决办法
1842
查看次数

我可以释放传递给SysAllocString的内存吗?

通过堆上的wchar_t*分配带有SysAllocString的新BSTR时,我是否应该在堆上释放原始的wchar_t*?

这是正确的方法吗?

wchar_t *hs = new wchar_t[20];
// load some wchar's into hs...
BSTR bs = SysAllocString(hs);
delete[] hs;
Run Code Online (Sandbox Code Playgroud)

我应该在这里调用删除以释放内存吗?或者那个记忆是由BSTR做的?

c++ windows string memory-management bstr

7
推荐指数
2
解决办法
6124
查看次数

Linq查询:这个数组是否包含这个字符串?

有一个更好的方法吗?

    public bool IsServiceRunning(string serviceName)
    {
        string[] services =  client.AllServices();
        return (from s in services
                where s.Equals(serviceName, StringComparison.InvariantCultureIgnoreCase)
                select s).Count() > 0;
    }
Run Code Online (Sandbox Code Playgroud)

比较中的不区分大小写非常重要.

c# linq

6
推荐指数
2
解决办法
1万
查看次数