操作说明:调试启用权限的应用程序How-to: debug a rights-enabled application

下面的主题演示如何调试应用程序和使用 Windows 事件日志。The following topic shows how to debug your application and use the Windows Event Log.

调试应用程序Debugging your application

Rights Management Services SDK 2.1 中禁用了运行时的开发人员版本的反调试检查。In Rights Management Services SDK 2.1, the anti-debugging checks in the developer version of our runtime are disabled.

你可以使用以下注册表项启用调试跟踪。You can turn on debug tracing by using the following registry key. (若要关闭调试跟踪,请将值更改为0。)在此版本中进行调试时,无需执行任何其他操作。(To turn debug tracing off, change the value to 0.) Nothing else is required for debugging in this release.

HKEY_LOCAL_MACHINE
   SOFTWARE
      Microsoft
         MSIPC
            "Trace" = 00000001
            Data type
            dword

使用 Windows 事件日志的应用程序日志记录Application logging by using the Windows Event Log

事件日志的名称为“Microsoft-RMS-MSIPC/Debug”。The name of the event log is "Microsoft-RMS-MSIPC/Debug". 这意味着,在 Windows 事件查看器中,你的日志会显示为“Application and Services Logs\Microsoft\RMS\MSIPC\Debug”。This means that in the Windows Event Viewer, your log appears as "Application and Services Logs\Microsoft\RMS\MSIPC\Debug".

请注意  默认情况下,此日志处于启用状态,其详细程度级别设置为 3。Note  The log is enabled by default and set to verbosity level 3.

 

若要更改日志记录功能的设置,可以使用 Windows 事件查看器的 UI或者 Wevtutil(一种Windows 中内置的命令行工具)。To change the settings of the logging feature, you can use either the UI for the Windows Event Viewer or Wevtutil, a command line tool built into Windows.

通过 Wevtutil 接口可以控制日志的详细程度。Through the Wevtutil interface, you can control the level of verbosity of your log.

目前,我们支持 3 种级别的日志记录:At this time, we support 3 levels of logging:

  • 级别 2- 错误Level 2—Error
  • 级别 3 - 警告Level 3—Warning
  • 级别 4 - 信息Level 4—Information

例如,下面的命令将启用 MSIPC 事件日志并将详细程度级别设置为信息。For example, the following command will enable the MSIPC event log and set the level of verbosity to information.

wevtutil sl Microsoft-RMS-MSIPC/Debug /e:true /l:4wevtutil sl Microsoft-RMS-MSIPC/Debug /e:true /l:4

请注意:在 Windows 事件查看器的“视图”菜单中,选择“显示分析和调试日志”可使 MSIPC 调试日志可见  。Note  In the Windows Event Viewer on the View menu, select Show Analytic and Debug Logs to make the MSIPC Debug log visible.