小编Kir*_*gde的帖子

使用Ez文件锁定器锁定文件时RmGetList()API失败,但与另一个文件锁定实用程序一起使用

我遇到了一个与Restart Manager API有关的奇怪问题:RmGetlist().为了模拟文件锁定方案,我正在使用以下第三方文件锁定实用程序:

Ez文件柜 - http://www.xoslab.com/efl.html -

文件柜 http://www.jensscheffler.de/filelocker

这里的奇怪问题是,这两个实用程序都锁定了某个文件,但是,RMGetList()失败,带有第一个文件锁定实用程序(Ez文件锁定)的Access拒绝错误(5),而它与第二个文件锁定实用程序一起使用.

这可能有什么问题?为什么RmGetList()会因一个文件锁定实用程序失败而与另一个一起工作?

以下是正在使用的代码:

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Security;
using System.IO;
using System.Windows.Forms;

namespace RMSession
{
    class Program
    {


        public static void GetProcessesUsingFiles(string[] filePaths)
        {
            uint sessionHandle;
            int error = NativeMethods.RmStartSession(out sessionHandle, 0, Guid.NewGuid().ToString("N"));
            if (error == 0)
            {
                try
                {
                    error = NativeMethods.RmRegisterResources(sessionHandle, (uint)filePaths.Length, filePaths, 0, null, 0, null);
                    if (error == 0)
                    {
                        RM_PROCESS_INFO[] processInfo = null;
                        uint pnProcInfoNeeded = 0, pnProcInfo = 0, …
Run Code Online (Sandbox Code Playgroud)

winapi restartmanager

3
推荐指数
1
解决办法
465
查看次数

标签 统计

restartmanager ×1

winapi ×1